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

@ -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,