Use St.Group where appropriate

There are some places in the code where we use both fixed positioning
and CSS. Currently we use either a combination of ClutterGroup and StBin,
or we uses StBoxLayout with fixed positioning. Replace those with the new
StGroup container.

https://bugzilla.gnome.org/show_bug.cgi?id=613907
This commit is contained in:
Florian Müllner 2010-03-22 01:39:49 +01:00
parent f0645d468c
commit 03a0809e39
3 changed files with 20 additions and 21 deletions

View File

@ -403,19 +403,19 @@ function MessageTray() {
MessageTray.prototype = { MessageTray.prototype = {
_init: function() { _init: function() {
this.actor = new St.BoxLayout({ name: 'message-tray', this.actor = new St.Group({ name: 'message-tray',
reactive: true, reactive: true,
track_hover: true }); track_hover: true });
this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged)); this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
this._notificationBin = new St.Bin(); this._notificationBin = new St.Bin();
this.actor.add(this._notificationBin); this.actor.add_actor(this._notificationBin);
this._notificationBin.hide(); this._notificationBin.hide();
this._notificationQueue = []; this._notificationQueue = [];
this._notification = null; this._notification = null;
this._summaryBin = new St.Bin({ anchor_gravity: Clutter.Gravity.NORTH_EAST }); this._summaryBin = new St.Bin({ anchor_gravity: Clutter.Gravity.NORTH_EAST });
this.actor.add(this._summaryBin); this.actor.add_actor(this._summaryBin);
this._summary = new St.BoxLayout({ name: 'summary-mode', this._summary = new St.BoxLayout({ name: 'summary-mode',
reactive: true, reactive: true,
track_hover: true }); track_hover: true });
@ -427,7 +427,7 @@ MessageTray.prototype = {
anchor_gravity: Clutter.Gravity.NORTH_EAST, anchor_gravity: Clutter.Gravity.NORTH_EAST,
reactive: true, reactive: true,
track_hover: true }); track_hover: true });
this.actor.add(this._summaryNotificationBin); this.actor.add_actor(this._summaryNotificationBin);
this._summaryNotificationBin.lower_bottom(); this._summaryNotificationBin.lower_bottom();
this._summaryNotificationBin.hide(); this._summaryNotificationBin.hide();
this._summaryNotificationBin.connect('notify::hover', Lang.bind(this, this._onSummaryNotificationHoverChanged)); this._summaryNotificationBin.connect('notify::hover', Lang.bind(this, this._onSummaryNotificationHoverChanged));

View File

@ -174,7 +174,7 @@ function Overview() {
Overview.prototype = { Overview.prototype = {
_init : function() { _init : function() {
this._group = new St.BoxLayout({ style_class: 'overview' }); this._group = new St.Group({ style_class: 'overview' });
this._group._delegate = this; this._group._delegate = this;
this.infoBar = new InfoBar(); this.infoBar = new InfoBar();
@ -268,6 +268,7 @@ Overview.prototype = {
this._recalculateGridSizes(); this._recalculateGridSizes();
this._group.set_position(primary.x, primary.y); this._group.set_position(primary.x, primary.y);
this._group.set_size(primary.width, primary.height);
let contentY = Panel.PANEL_HEIGHT; let contentY = Panel.PANEL_HEIGHT;
let contentHeight = primary.height - contentY; let contentHeight = primary.height - contentY;

View File

@ -43,12 +43,10 @@ function GenericWorkspacesView(width, height, x, y, workspaces) {
GenericWorkspacesView.prototype = { GenericWorkspacesView.prototype = {
_init: function(width, height, x, y, workspaces) { _init: function(width, height, x, y, workspaces) {
this.actor = new St.Bin({ style_class: 'workspaces' }); this.actor = new St.Group({ style_class: 'workspaces' });
this._actor = new Clutter.Group();
this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.add_actor(this._actor);
this.actor.connect('style-changed', Lang.bind(this, this.actor.connect('style-changed', Lang.bind(this,
function() { function() {
let node = this.actor.get_theme_node(); let node = this.actor.get_theme_node();
@ -74,7 +72,7 @@ GenericWorkspacesView.prototype = {
// Add workspace actors // Add workspace actors
for (let w = 0; w < global.screen.n_workspaces; w++) for (let w = 0; w < global.screen.n_workspaces; w++)
this._workspaces[w].actor.reparent(this._actor); this._workspaces[w].actor.reparent(this.actor);
this._workspaces[activeWorkspaceIndex].actor.raise_top(); this._workspaces[activeWorkspaceIndex].actor.raise_top();
// Position/scale the desktop windows and their children after the // Position/scale the desktop windows and their children after the
@ -297,7 +295,7 @@ MosaicView.prototype = {
GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces); GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces);
this.actor.add_style_class_name('mosaic'); this.actor.add_style_class_name('mosaic');
this._actor.set_clip(x - Workspace.FRAME_SIZE, this.actor.set_clip(x - Workspace.FRAME_SIZE,
y - Workspace.FRAME_SIZE, y - Workspace.FRAME_SIZE,
width + 2 * Workspace.FRAME_SIZE, width + 2 * Workspace.FRAME_SIZE,
height + 2 * Workspace.FRAME_SIZE); height + 2 * Workspace.FRAME_SIZE);
@ -411,7 +409,7 @@ MosaicView.prototype = {
// Add actors // Add actors
if (newNumWorkspaces > oldNumWorkspaces) if (newNumWorkspaces > oldNumWorkspaces)
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++)
this._actor.add_actor(this._workspaces[w].actor); this.actor.add_actor(this._workspaces[w].actor);
// Figure out the new layout // Figure out the new layout
this._computeWorkspacePositions(); this._computeWorkspacePositions();
@ -648,12 +646,12 @@ SingleView.prototype = {
Lang.bind(this, this._onWindowDragEnd)); Lang.bind(this, this._onWindowDragEnd));
} }
this._actor.add_actor(this._newWorkspaceArea.actor); this.actor.add_actor(this._newWorkspaceArea.actor);
this._actor.add_actor(this._leftShadow); this.actor.add_actor(this._leftShadow);
this._actor.add_actor(this._rightShadow); this.actor.add_actor(this._rightShadow);
this.actor.add_style_class_name('single'); this.actor.add_style_class_name('single');
this._actor.set_clip(x, y, width, height); this.actor.set_clip(x, y, width, height);
this._activeWorkspaceX = 0; // x offset of active ws while dragging this._activeWorkspaceX = 0; // x offset of active ws while dragging
this._activeWorkspaceY = 0; // y offset of active ws while dragging this._activeWorkspaceY = 0; // y offset of active ws while dragging
this._scroll = null; this._scroll = null;
@ -1085,7 +1083,7 @@ SingleView.prototype = {
if (newNumWorkspaces > oldNumWorkspaces) { if (newNumWorkspaces > oldNumWorkspaces) {
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) { for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
this._actor.add_actor(this._workspaces[w].actor); this.actor.add_actor(this._workspaces[w].actor);
this._workspaces[w]._windowDragBeginId = this._workspaces[w].connect('window-drag-begin', this._workspaces[w]._windowDragBeginId = this._workspaces[w].connect('window-drag-begin',
Lang.bind(this, this._onWindowDragBegin)); Lang.bind(this, this._onWindowDragBegin));
this._workspaces[w]._windowDragEndId = this._workspaces[w].connect('window-drag-end', this._workspaces[w]._windowDragEndId = this._workspaces[w].connect('window-drag-end',