Port to Clutter-0.9

tools/build/gnome-shell.modules: Point  at master branch of Clutter (0.9)
  and make gobject-introspection a dep of Clutter.
configure.ac src/Makefile.am: Use Clutter-0.9
js/ui/button.js js/ui/genericDisplay.js js/ui/overlay.js js/ui/panel.js
js/ui/runDialog.js js/ui/workspaces.js src/shell-status-menu.c:
  Use ClutterText instead of ClutterLabel and ClutterEntry
js/ui/workspaces.js js/ui/genericDisplay.js: Use ClutterClone instead
  of ClutterCloneTexture
src/shell-global.[ch]: Add Shell.get_event_key_symbol() to workaround
  unaccessibility of clutter_key_event_symbol() to use.
js/runDialog.js js/overlay.js: Use Shell.get_event_key_symbol() as
  appropriate.
This commit is contained in:
Owen W. Taylor 2009-02-23 14:42:00 -05:00
parent 6719c00f8a
commit 0f7abf96a7
12 changed files with 106 additions and 100 deletions

View File

@ -19,8 +19,8 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The prefix for our gettext translation domains.])
PKG_CHECK_MODULES(MUTTER_PLUGIN, gtk+-2.0 dbus-glib-1 metacity-plugins gjs-gi-1.0)
PKG_CHECK_MODULES(TIDY, clutter-0.8)
PKG_CHECK_MODULES(BIG, clutter-cairo-0.8 gtk+-2.0 librsvg-2.0)
PKG_CHECK_MODULES(TIDY, clutter-0.9)
PKG_CHECK_MODULES(BIG, clutter-0.9 gtk+-2.0 librsvg-2.0)
PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-2.0)
PKG_CHECK_MODULES(TRAY, gtk+-2.0)
PKG_CHECK_MODULES(TASKPANEL, libwnck-1.0 dbus-glib-1)

View File

@ -46,8 +46,8 @@ Button.prototype = {
y_align: Big.BoxAlignment.CENTER
});
if (typeof widgetOrText == 'string') {
this._widget = new Clutter.Label({ font_name: "Sans Bold 16px",
text: widgetOrText });
this._widget = new Clutter.Text({ font_name: "Sans Bold 16px",
text: widgetOrText });
} else {
this._widget = widgetOrText;
}

View File

@ -65,7 +65,7 @@ GenericDisplayItem.prototype = {
//// Draggable interface ////
getDragActor: function(stageX, stageY) {
// FIXME: assumes this._icon is a Clutter.Texture
let icon = new Clutter.CloneTexture({ parent_texture: this._icon });
let icon = new Clutter.Clone({ source: this._icon });
[icon.width, icon.height] = this._icon.get_transformed_size();
// If the user dragged from the icon itself, then position
@ -137,21 +137,21 @@ GenericDisplayItem.prototype = {
this.actor.add_actor(this._icon);
let text_width = this._availableWidth - (ITEM_DISPLAY_ICON_SIZE + 4);
this._name = new Clutter.Label({ color: ITEM_DISPLAY_NAME_COLOR,
font_name: "Sans 14px",
width: text_width,
ellipsize: Pango.EllipsizeMode.END,
text: nameText,
x: ITEM_DISPLAY_ICON_SIZE + 4,
y: ITEM_DISPLAY_PADDING });
this._name = new Clutter.Text({ color: ITEM_DISPLAY_NAME_COLOR,
font_name: "Sans 14px",
width: text_width,
ellipsize: Pango.EllipsizeMode.END,
text: nameText,
x: ITEM_DISPLAY_ICON_SIZE + 4,
y: ITEM_DISPLAY_PADDING });
this.actor.add_actor(this._name);
this._description = new Clutter.Label({ color: ITEM_DISPLAY_DESCRIPTION_COLOR,
font_name: "Sans 12px",
width: text_width,
ellipsize: Pango.EllipsizeMode.END,
text: descriptionText,
x: this._name.x,
y: this._name.height + 4 });
this._description = new Clutter.Text({ color: ITEM_DISPLAY_DESCRIPTION_COLOR,
font_name: "Sans 12px",
width: text_width,
ellipsize: Pango.EllipsizeMode.END,
text: descriptionText,
x: this._name.x,
y: this._name.height + 4 });
this.actor.add_actor(this._description);
}
};

View File

@ -110,14 +110,16 @@ Sideshow.prototype = {
// We need to initialize the text for the entry to have the cursor displayed
// in it. See http://bugzilla.openedhand.com/show_bug.cgi?id=1365
this._searchEntry = new Clutter.Entry({
font_name: "Sans 14px",
x: searchIconTexture.x
+ searchIconTexture.width + 4,
y: searchIconTexture.y,
width: this._searchBox.width - (searchIconTexture.x),
height: searchIconTexture.height,
text: ""});
this._searchEntry = new Clutter.Text({ font_name: "Sans 14px",
x: searchIconTexture.x
+ searchIconTexture.width + 4,
y: searchIconTexture.y,
width: this._searchBox.width - (searchIconTexture.x),
height: searchIconTexture.height,
editable: true,
activatable: true,
singleLineMode: true,
text: ""});
this.actor.add_actor(this._searchEntry);
this._searchQueued = false;
this._searchEntry.connect('notify::text', function (se, prop) {
@ -141,15 +143,15 @@ Sideshow.prototype = {
return true;
});
this._searchEntry.connect('key-press-event', function (se, e) {
let code = e.get_code();
if (code == 9) {
let symbol = Shell.get_event_key_symbol(e);
if (symbol == Clutter.Escape) {
// A single escape clears the entry, two of them hides the overlay
if (me._searchEntry.text == '')
me.emit('activated');
else
me._searchEntry.text = '';
return true;
} else if (code == 111) {
} else if (symbol == Clutter.Up) {
// selectUp and selectDown wrap around in their respective displays
// too, but there doesn't seem to be any flickering if we first select
// something in one display, but then unset the selection, and move
@ -162,7 +164,7 @@ Sideshow.prototype = {
me._appDisplay.selectLastItem();
}
return true;
} else if (code == 116) {
} else if (symbol == Clutter.Down) {
if (me._appDisplay.hasSelected() && !me._appDisplay.selectDown() && me._docDisplay.hasItems()) {
me._appDisplay.unsetSelected();
me._docDisplay.selectFirstItem();
@ -180,10 +182,10 @@ Sideshow.prototype = {
padding_top: SIDESHOW_SECTION_PADDING_TOP,
spacing: SIDESHOW_SECTION_SPACING});
this._appsText = new Clutter.Label({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "Applications",
height: LABEL_HEIGHT});
this._appsText = new Clutter.Text({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "Applications",
height: LABEL_HEIGHT});
this._appsSection.append(this._appsText, Big.BoxPackFlags.EXPAND);
@ -195,11 +197,11 @@ Sideshow.prototype = {
this._appsSection.append(this._appDisplay.actor, Big.BoxPackFlags.EXPAND);
let moreAppsBox = new Big.Box({x_align: Big.BoxAlignment.END});
this._moreAppsText = new Clutter.Label({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "More...",
height: LABEL_HEIGHT,
reactive: true});
this._moreAppsText = new Clutter.Text({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "More...",
height: LABEL_HEIGHT,
reactive: true});
moreAppsBox.append(this._moreAppsText, Big.BoxPackFlags.EXPAND);
this._appsSection.append(moreAppsBox, Big.BoxPackFlags.EXPAND);
@ -212,21 +214,21 @@ Sideshow.prototype = {
padding_top: SIDESHOW_SECTION_PADDING_TOP,
spacing: SIDESHOW_SECTION_SPACING});
this._docsText = new Clutter.Label({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "Recent Documents",
height: LABEL_HEIGHT});
this._docsText = new Clutter.Text({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "Recent Documents",
height: LABEL_HEIGHT});
this._docsSection.append(this._docsText, Big.BoxPackFlags.EXPAND);
this._docDisplay = new DocDisplay.DocDisplay(this._width, this._itemDisplayHeight - this._appDisplay.actor.height, SIDESHOW_COLUMNS, SIDESHOW_PAD);
this._docsSection.append(this._docDisplay.actor, Big.BoxPackFlags.EXPAND);
let moreDocsBox = new Big.Box({x_align: Big.BoxAlignment.END});
this._moreDocsText = new Clutter.Label({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "More...",
height: LABEL_HEIGHT,
reactive: true});
this._moreDocsText = new Clutter.Text({ color: SIDESHOW_TEXT_COLOR,
font_name: "Sans Bold 14px",
text: "More...",
height: LABEL_HEIGHT,
reactive: true});
moreDocsBox.append(this._moreDocsText, Big.BoxPackFlags.EXPAND);
this._docsSection.append(moreDocsBox, Big.BoxPackFlags.EXPAND);

View File

@ -58,8 +58,8 @@ Panel.prototype = {
statusbutton.release();
});
this._clock = new Clutter.Label({ font_name: "Sans Bold 16px",
text: "" });
this._clock = new Clutter.Text({ font_name: "Sans Bold 16px",
text: "" });
let pad = (PANEL_HEIGHT - this._clock.height) / 2;
let clockbox = new Big.Box({ padding_top: pad,
padding_bottom: pad,

View File

@ -50,19 +50,20 @@ RunDialog.prototype = {
border_width: 0 });
boxGroup.add_actor(box);
let label = new Clutter.Label({ color: BOX_TEXT_COLOR,
font_name: '18px Sans',
text: 'Please enter a command:' });
let label = new Clutter.Text({ color: BOX_TEXT_COLOR,
font_name: '18px Sans',
text: 'Please enter a command:' });
label.set_position(6, 6);
boxGroup.add_actor(label);
this._entry = new Clutter.Entry({ color: BOX_TEXT_COLOR,
font_name: '20px Sans Bold',
reactive: true,
text: '',
entry_padding: 0,
width: BOX_WIDTH - 12,
height: BOX_HEIGHT - 12 });
this._entry = new Clutter.Text({ color: BOX_TEXT_COLOR,
font_name: '20px Sans Bold',
editable: true,
activatable: true,
singleLineMode: true,
text: '',
width: BOX_WIDTH - 12,
height: BOX_HEIGHT - 12 });
// TODO: Implement relative positioning using Tidy.
this._entry.set_position(6, 30);
boxGroup.add_actor(this._entry);
@ -106,7 +107,7 @@ RunDialog.prototype = {
this._group.show_all();
this._entry.connect('key-press-event', function(o, e) {
if (e.get_code() == 9) {
if (Shell.get_event_key_symbol(e) == Clutter.Escape) {
me.hide();
me.emit('cancel');
return true;

View File

@ -57,10 +57,10 @@ function WindowClone(realWindow) {
WindowClone.prototype = {
_init : function(realWindow) {
this.actor = new Clutter.CloneTexture({ parent_texture: realWindow.get_texture(),
reactive: true,
x: realWindow.x,
y: realWindow.y });
this.actor = new Clutter.Clone({ source: realWindow.get_texture(),
reactive: true,
x: realWindow.x,
y: realWindow.y });
this.actor._delegate = this;
this.realWindow = realWindow;
this.metaWindow = realWindow.meta_window;
@ -166,11 +166,11 @@ WindowClone.prototype = {
Shell.clutter_texture_set_from_pixbuf(iconTexture, icon);
box.append(iconTexture, Big.BoxPackFlags.NONE);
let title = new Clutter.Label({ color: WINDOWCLONE_TITLE_COLOR,
font_name: "Sans 12",
text: this.metaWindow.title,
ellipsize: Pango.EllipsizeMode.END
});
let title = new Clutter.Text({ color: WINDOWCLONE_TITLE_COLOR,
font_name: "Sans 12",
text: this.metaWindow.title,
ellipsize: Pango.EllipsizeMode.END
});
box.append(title, Big.BoxPackFlags.EXPAND);
// Get and cache the expected width (just the icon), with spacing, plus title
box.fullWidth = box.width;
@ -237,8 +237,8 @@ function DesktopClone(window) {
DesktopClone.prototype = {
_init : function(window) {
if (window) {
this.actor = new Clutter.CloneTexture({ parent_texture: window.get_texture(),
reactive: true });
this.actor = new Clutter.Clone({ source: window.get_texture(),
reactive: true });
} else {
let global = Shell.Global.get();
this.actor = new Clutter.Rectangle({ color: global.stage.color,

View File

@ -92,8 +92,8 @@ Shell-0.1.gir: $(metacity) $(G_IR_SCANNER) Big-1.0.gir libgnome-shell.la Makefil
$(G_IR_SCANNER) \
--namespace=Shell \
--nsversion=0.1 \
--add-include-path=$(libdir)/metacity/ \
--include=Clutter-0.8 \
--add-include-path=$(libdir)/metacity/ \
--include=Clutter-0.9 \
--include=Meta-2.25 \
--add-include-path=$(builddir) \
--include=Big-1.0 \
@ -106,7 +106,7 @@ CLEANFILES += Shell-1.0.gir
# The dependency on libgnome-shell.la here is because g-ir-compiler opens it
# (not the fake library, since we've already done the rewriting)
Shell-0.1.typelib: libgnome-shell.la Shell-0.1.gir
Shell-0.1.typelib: libgnome-shell.la Shell-0.1.gir Big-1.0.gir
LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. g-ir-compiler --includedir=$(builddir) --includedir=$(libdir)/metacity/ Shell-0.1.gir -o $@
CLEANFILES += Shell-1.0.typelib
@ -114,7 +114,7 @@ Tidy-1.0.gir: $(metacity) $(G_IR_SCANNER) libgnome-shell.la libtidy-1.0.la Makef
$(G_IR_SCANNER) \
--namespace=Tidy \
--nsversion=1.0 \
--include=Clutter-0.8 \
--include=Clutter-0.9 \
--program=metacity \
--program-arg=--mutter-plugins=$$(pwd)/libgnome-shell.la \
$(tidy_source_h) \
@ -132,7 +132,8 @@ Big-1.0.gir: $(metacity) $(G_IR_SCANNER) libgnome-shell.la libbig-1.0.la Makefil
$(G_IR_SCANNER) \
--namespace=Big \
--nsversion=1.0 \
--include=ClutterCairo-0.8 \
--include=Clutter-0.9 \
--include=GdkPixbuf-2.0 \
--program=metacity \
--program-arg=--mutter-plugins=$$(pwd)/libgnome-shell.la \
$(big_source_h) \

View File

@ -421,6 +421,15 @@ shell_get_categories_for_desktop_file(const char *desktop_file_name)
return categories_list;
}
guint16
shell_get_event_key_symbol(ClutterEvent *event)
{
g_return_val_if_fail(event->type == CLUTTER_KEY_PRESS ||
event->type == CLUTTER_KEY_RELEASE, 0);
return event->key.keyval;
}
/**
* shell_global_get:
*

View File

@ -38,6 +38,8 @@ GdkPixbuf *shell_get_thumbnail_for_recent_info(GtkRecentInfo *recent_info);
GSList *shell_get_categories_for_desktop_file(const char *desktop_file_name);
guint16 shell_get_event_key_symbol(ClutterEvent *event);
ShellGlobal *shell_global_get (void);
void shell_global_grab_dbus_service (ShellGlobal *global);

View File

@ -50,7 +50,7 @@ struct _ShellStatusMenuPrivate {
ClutterTexture *user_icon;
BigBox *name_box;
ClutterLabel *name;
ClutterText *name;
GtkWidget *menu;
GtkWidget *account_item;
@ -110,15 +110,14 @@ reset_icon (ShellStatusMenu *status)
}
static void
update_label (ShellStatusMenu *status)
update_name_text (ShellStatusMenu *status)
{
ShellStatusMenuPrivate *priv = status->priv;
char *markup;
markup = g_strdup_printf ("<b>%s</b>",
gdm_user_get_real_name (GDM_USER (priv->user)));
clutter_label_set_use_markup (priv->name, TRUE);
clutter_label_set_text (priv->name, markup);
markup = g_markup_printf_escaped("<b>%s</b>",
gdm_user_get_real_name (GDM_USER (priv->user)));
clutter_text_set_markup (priv->name, markup);
g_free (markup);
}
@ -135,7 +134,7 @@ user_notify_display_name_cb (GObject *object,
GParamSpec *pspec,
ShellStatusMenu *status)
{
update_label (status);
update_name_text (status);
}
static void
@ -155,7 +154,7 @@ setup_current_user (ShellStatusMenu *status)
name = _("Unknown");
}
update_label (status);
update_name_text (status);
if (priv->user != NULL)
{
@ -541,7 +540,7 @@ shell_status_menu_init (ShellStatusMenu *status)
priv->name_box = BIG_BOX (big_box_new (BIG_BOX_ORIENTATION_VERTICAL));
g_object_set (G_OBJECT (priv->name_box), "y-align", BIG_BOX_ALIGNMENT_CENTER, NULL);
big_box_append (BIG_BOX (status), CLUTTER_ACTOR (priv->name_box), BIG_BOX_PACK_EXPAND);
priv->name = CLUTTER_LABEL (clutter_label_new ());
priv->name = CLUTTER_TEXT (clutter_text_new ());
big_box_append (BIG_BOX (priv->name_box), CLUTTER_ACTOR (priv->name), BIG_BOX_PACK_EXPAND);
priv->manager = gdm_user_manager_ref_default ();

View File

@ -3,11 +3,6 @@
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<!-- vim:set ts=2 expandtab: -->
<moduleset>
<repository type="svn" name="svn.gnome.org" default="yes"
href="http://svn.gnome.org/svn/">
<mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
<mirror type="git" href="git://git-mirror.gnome.org/git/" />
</repository>
<repository type="git" name="fishsoup.net"
href="git://git.fishsoup.net/"/>
<repository type="git" name="git.clutter-project.org"
@ -23,8 +18,6 @@
<branch repo="git.gnome.org" module="gir-repository"/>
<dependencies>
<dep package="gobject-introspection"/>
<dep package="clutter"/>
<dep package="clutter-cairo"/>
</dependencies>
</autotools>
@ -39,11 +32,10 @@
</autotools>
<autotools id="clutter">
<branch repo="git.clutter-project.org" module="clutter" revision="clutter-0-8"/>
</autotools>
<autotools id="clutter-cairo">
<branch repo="git.clutter-project.org" module="clutter-cairo" revision="clutter-cairo-0-8"/>
<branch repo="git.clutter-project.org" module="clutter"/>
<dependencies>
<dep package="gobject-introspection"/>
</dependencies>
</autotools>
<autotools id="metacity-clutter" autogenargs="--with-clutter">