From 2f39bd8ba4c666b14ff883152f2ae6c0ad156aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 17 Oct 2019 23:27:27 +0200 Subject: [PATCH 1/4] st/bin: Use child's align properties By now, all containers and layout managers except StBin (and its subclasses) use the generic ClutterActor expand/align properties to control how their children are laid out. This is particularly confusing as two or the properties StBin uses for layout - x-align and y-align - shadow the generic ClutterActor ones, but work very differently: They use a different enum and determine how the bin lays out its child, instead of how the bin is laid out by its parent. Address this by deprecating the StBin properties and using the same generic ClutterActor properties as everyone else. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803 --- src/st/st-bin.c | 62 +++++++++++++++++++++++++++++----------------- src/st/st-button.c | 2 ++ 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/st/st-bin.c b/src/st/st-bin.c index 6d6d056d2e..49d66ce4b4 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -97,6 +97,27 @@ clutter_container_iface_init (ClutterContainerIface *iface) iface->remove = st_bin_remove; } +static double +get_align_factor (ClutterActorAlign align) +{ + switch (align) + { + case CLUTTER_ACTOR_ALIGN_CENTER: + return 0.5; + + case CLUTTER_ACTOR_ALIGN_START: + return 0.0; + + case CLUTTER_ACTOR_ALIGN_END: + return 1.0; + + case CLUTTER_ACTOR_ALIGN_FILL: + break; + } + + return 0.0; +} + static void st_bin_allocate (ClutterActor *self, const ClutterActorBox *box, @@ -109,15 +130,16 @@ st_bin_allocate (ClutterActor *self, if (priv->child && clutter_actor_is_visible (priv->child)) { StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self)); + ClutterActorAlign x_align = clutter_actor_get_x_align (priv->child); + ClutterActorAlign y_align = clutter_actor_get_y_align (priv->child); ClutterActorBox childbox; - gdouble x_align_f, y_align_f; st_theme_node_get_content_box (theme_node, box, &childbox); - st_get_align_factors (priv->x_align, priv->y_align, - &x_align_f, &y_align_f); clutter_actor_allocate_align_fill (priv->child, &childbox, - x_align_f, y_align_f, - priv->x_fill, priv->y_fill, + get_align_factor (x_align), + get_align_factor (y_align), + x_align == CLUTTER_ACTOR_ALIGN_FILL, + y_align == CLUTTER_ACTOR_ALIGN_FILL, flags); } } @@ -143,7 +165,10 @@ st_bin_get_preferred_width (ClutterActor *self, } else { - _st_actor_get_preferred_width (priv->child, for_height, priv->y_fill, + ClutterActorAlign y_align = clutter_actor_get_y_align (priv->child); + + _st_actor_get_preferred_width (priv->child, for_height, + y_align == CLUTTER_ACTOR_ALIGN_FILL, min_width_p, natural_width_p); } @@ -172,7 +197,10 @@ st_bin_get_preferred_height (ClutterActor *self, } else { - _st_actor_get_preferred_height (priv->child, for_width, priv->x_fill, + ClutterActorAlign x_align = clutter_actor_get_y_align (priv->child); + + _st_actor_get_preferred_height (priv->child, for_width, + x_align == CLUTTER_ACTOR_ALIGN_FILL, min_height_p, natural_height_p); } @@ -350,7 +378,7 @@ st_bin_class_init (StBinClass *klass) "The horizontal alignment", ST_TYPE_ALIGN, ST_ALIGN_MIDDLE, - ST_PARAM_READWRITE); + ST_PARAM_READWRITE | G_PARAM_DEPRECATED); /** * StBin:y-align: @@ -363,7 +391,7 @@ st_bin_class_init (StBinClass *klass) "The vertical alignment", ST_TYPE_ALIGN, ST_ALIGN_MIDDLE, - ST_PARAM_READWRITE); + ST_PARAM_READWRITE | G_PARAM_DEPRECATED); /** * StBin:x-fill: @@ -376,7 +404,7 @@ st_bin_class_init (StBinClass *klass) "Whether the child should fill the " "horizontal allocation", FALSE, - ST_PARAM_READWRITE); + ST_PARAM_READWRITE | G_PARAM_DEPRECATED); /** * StBin:y-fill: @@ -389,7 +417,7 @@ st_bin_class_init (StBinClass *klass) "Whether the child should fill the " "vertical allocation", FALSE, - ST_PARAM_READWRITE); + ST_PARAM_READWRITE | G_PARAM_DEPRECATED); g_object_class_install_properties (gobject_class, N_PROPS, props); } @@ -486,7 +514,6 @@ st_bin_set_alignment (StBin *bin, StAlign y_align) { StBinPrivate *priv; - gboolean changed = FALSE; g_return_if_fail (ST_IS_BIN (bin)); @@ -498,19 +525,14 @@ st_bin_set_alignment (StBin *bin, { priv->x_align = x_align; g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_X_ALIGN]); - changed = TRUE; } if (priv->y_align != y_align) { priv->y_align = y_align; g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_Y_ALIGN]); - changed = TRUE; } - if (changed) - clutter_actor_queue_relayout (CLUTTER_ACTOR (bin)); - g_object_thaw_notify (G_OBJECT (bin)); } @@ -556,7 +578,6 @@ st_bin_set_fill (StBin *bin, gboolean y_fill) { StBinPrivate *priv; - gboolean changed = FALSE; g_return_if_fail (ST_IS_BIN (bin)); @@ -567,7 +588,6 @@ st_bin_set_fill (StBin *bin, if (priv->x_fill != x_fill) { priv->x_fill = x_fill; - changed = TRUE; g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_X_FILL]); } @@ -575,14 +595,10 @@ st_bin_set_fill (StBin *bin, if (priv->y_fill != y_fill) { priv->y_fill = y_fill; - changed = TRUE; g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_Y_FILL]); } - if (changed) - clutter_actor_queue_relayout (CLUTTER_ACTOR (bin)); - g_object_thaw_notify (G_OBJECT (bin)); } diff --git a/src/st/st-button.c b/src/st/st-button.c index 16984f2b33..c1ea7b9915 100644 --- a/src/st/st-button.c +++ b/src/st/st-button.c @@ -628,6 +628,8 @@ st_button_set_label (StButton *button, "line-alignment", PANGO_ALIGN_CENTER, "ellipsize", PANGO_ELLIPSIZE_END, "use-markup", TRUE, + "x-align", CLUTTER_ACTOR_ALIGN_CENTER, + "y-align", CLUTTER_ACTOR_ALIGN_CENTER, NULL); st_bin_set_child (ST_BIN (button), label); } -- GitLab From 72af64d9646e89f5c6b60e86bb36c917b39562c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 17 Oct 2019 23:29:06 +0200 Subject: [PATCH 2/4] st: Remove st_get_align_factor() utility method It is now unused. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803 --- src/st/st-widget.c | 60 ---------------------------------------------- src/st/st-widget.h | 6 ----- 2 files changed, 66 deletions(-) diff --git a/src/st/st-widget.c b/src/st/st-widget.c index f7e3084947..586954b468 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -3112,63 +3112,3 @@ st_widget_get_focus_chain (StWidget *widget) { return ST_WIDGET_GET_CLASS (widget)->get_focus_chain (widget); } - -/** - * st_get_align_factors: - * @x_align: an #StAlign - * @y_align: an #StAlign - * @x_align_out: (out) (optional): @x_align as a #gdouble - * @y_align_out: (out) (optional): @y_align as a #gdouble - * - * Converts @x_align and @y_align to #gdouble values. - */ -void -st_get_align_factors (StAlign x_align, - StAlign y_align, - gdouble *x_align_out, - gdouble *y_align_out) -{ - if (x_align_out) - { - switch (x_align) - { - case ST_ALIGN_START: - *x_align_out = 0.0; - break; - - case ST_ALIGN_MIDDLE: - *x_align_out = 0.5; - break; - - case ST_ALIGN_END: - *x_align_out = 1.0; - break; - - default: - g_warn_if_reached (); - break; - } - } - - if (y_align_out) - { - switch (y_align) - { - case ST_ALIGN_START: - *y_align_out = 0.0; - break; - - case ST_ALIGN_MIDDLE: - *y_align_out = 0.5; - break; - - case ST_ALIGN_END: - *y_align_out = 1.0; - break; - - default: - g_warn_if_reached (); - break; - } - } -} diff --git a/src/st/st-widget.h b/src/st/st-widget.h index d6e3ca2bf2..2f593e3d34 100644 --- a/src/st/st-widget.h +++ b/src/st/st-widget.h @@ -157,12 +157,6 @@ void st_widget_set_accessible_name (StWidget *widget, const gchar * st_widget_get_accessible_name (StWidget *widget); void st_widget_set_accessible (StWidget *widget, AtkObject *accessible); -/* utility methods */ -void st_get_align_factors (StAlign x_align, - StAlign y_align, - gdouble *x_align_out, - gdouble *y_align_out); - G_END_DECLS #endif /* __ST_WIDGET_H__ */ -- GitLab From f2bd39b20c89c1896c124f1dccdd587aa544e45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 17 Oct 2019 23:40:24 +0200 Subject: [PATCH 3/4] js: Use generic actor properties to align StBin children StBin's fill/align properties are now no-ops; get back the intended child allocation by setting the corresponding x/y-align on the child. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803 --- js/gdm/authPrompt.js | 3 +-- js/gdm/loginDialog.js | 28 ++++++++++++++---------- js/ui/altTab.js | 13 ++++++----- js/ui/appDisplay.js | 35 +++++++++++++++--------------- js/ui/calendar.js | 6 ++--- js/ui/checkBox.js | 7 +++--- js/ui/components/autorunManager.js | 15 ++++++++----- js/ui/dash.js | 9 +++++--- js/ui/dateMenu.js | 14 +++++++----- js/ui/iconGrid.js | 13 ++++++----- js/ui/keyboard.js | 5 +---- js/ui/lookingGlass.js | 14 +++++++----- js/ui/magnifier.js | 2 +- js/ui/messageList.js | 14 ++++++------ js/ui/messageTray.js | 3 +-- js/ui/modalDialog.js | 9 +++++--- js/ui/overview.js | 2 +- js/ui/padOsd.js | 14 ++++++------ js/ui/panelMenu.js | 10 +++++---- js/ui/popupMenu.js | 20 ++++++++--------- js/ui/screenShield.js | 13 +++++------ js/ui/search.js | 23 +++++++++++++------- js/ui/shellMountOperation.js | 12 +++++----- js/ui/unlockDialog.js | 4 +--- js/ui/viewSelector.js | 7 ++---- 25 files changed, 155 insertions(+), 140 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 8a93123496..c5d93c946e 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -88,8 +88,6 @@ var AuthPrompt = GObject.registerClass({ this.connect('destroy', this._onDestroy.bind(this)); this._userWell = new St.Bin({ - x_fill: true, - x_align: St.Align.START, x_expand: true, y_expand: true, }); @@ -447,6 +445,7 @@ var AuthPrompt = GObject.registerClass({ if (user) { let userWidget = new UserWidget.UserWidget(user); + userWidget.x_align = Clutter.ActorAlign.START; this._userWell.set_child(userWidget); } } diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 5b40405d7a..96d8453b70 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -42,7 +42,10 @@ var UserListItem = GObject.registerClass({ Signals: { 'activate': {} } }, class UserListItem extends St.Button { _init(user) { - let layout = new St.BoxLayout({ vertical: true }); + let layout = new St.BoxLayout({ + vertical: true, + x_align: Clutter.ActorAlign.START, + }); super._init({ style_class: 'login-dialog-user-list-item', button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, @@ -50,8 +53,6 @@ var UserListItem = GObject.registerClass({ x_expand: true, child: layout, reactive: true, - x_align: St.Align.START, - x_fill: true }); this.user = user; @@ -456,15 +457,18 @@ var LoginDialog = GObject.registerClass({ // translators: this message is shown below the user list on the // login screen. It can be activated to reveal an entry for // manually entering the username. - let notListedLabel = new St.Label({ text: _("Not listed?"), - style_class: 'login-dialog-not-listed-label' }); - this._notListedButton = new St.Button({ style_class: 'login-dialog-not-listed-button', - button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, - can_focus: true, - child: notListedLabel, - reactive: true, - x_align: St.Align.START, - x_fill: true }); + let notListedLabel = new St.Label({ + text: _("Not listed?"), + style_class: 'login-dialog-not-listed-label', + x_align: Clutter.ActorAlign.START, + }); + this._notListedButton = new St.Button({ + style_class: 'login-dialog-not-listed-button', + button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, + can_focus: true, + child: notListedLabel, + reactive: true, + }); this._notListedButton.connect('clicked', this._hideUserListAskForUsernameAndBeginVerification.bind(this)); diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 3ec807c494..1c4a239984 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -655,7 +655,7 @@ class AppIcon extends St.BoxLayout { this.app = app; this.icon = null; - this._iconBin = new St.Bin({ x_fill: true, y_fill: true }); + this._iconBin = new St.Bin(); this.add_child(this._iconBin); this.label = new St.Label({ @@ -894,12 +894,13 @@ class ThumbnailList extends SwitcherPopup.SwitcherList { let title = windows[i].get_title(); if (title) { - let name = new St.Label({ text: title }); - // St.Label doesn't support text-align so use a Bin - let bin = new St.Bin({ x_align: St.Align.MIDDLE }); + let name = new St.Label({ + text: title, + // St.Label doesn't support text-align + x_align: Clutter.ActorAlign.CENTER, + }); this._labels.push(bin); - bin.add_actor(name); - box.add_actor(bin); + box.add_actor(name); this.addItem(box, name); } else { diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index ee0beabe97..43b1860f80 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -305,10 +305,7 @@ var AllView = GObject.registerClass({ this._scrollView = new St.ScrollView({ style_class: 'all-apps', x_expand: true, y_expand: true, - x_fill: true, - y_fill: false, - reactive: true, - y_align: St.Align.START }); + reactive: true, }); this.add_actor(this._scrollView); this._grid._delegate = this; @@ -327,7 +324,10 @@ var AllView = GObject.registerClass({ this.folderIcons = []; this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); - let box = new St.BoxLayout({ vertical: true }); + let box = new St.BoxLayout({ + vertical: true, + y_align: Clutter.ActorAlign.START, + }); this._grid.currentPage = 0; this._stack.add_actor(this._grid); @@ -1046,8 +1046,11 @@ class AppDisplay extends St.BoxLayout { this._viewStackLayout.connect('allocated-size-changed', this._onAllocatedSizeChanged.bind(this)); this.add_actor(this._viewStack); let layout = new ControlsBoxLayout({ homogeneous: true }); - this._controls = new St.Widget({ style_class: 'app-view-controls', - layout_manager: layout }); + this._controls = new St.Widget({ + style_class: 'app-view-controls', + layout_manager: layout, + x_align: Clutter.ActorAlign.CENTER, + }); this._controls.connect('notify::mapped', () => { // controls are faded either with their parent or // explicitly in animate(); we can't know how they'll be @@ -1266,15 +1269,18 @@ class FolderView extends BaseAppView { this._scrollView = new St.ScrollView({ overlay_scrollbars: true, - x_fill: true, - y_fill: true, x_expand: true, y_expand: true }); this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); this.add_actor(this._scrollView); - let scrollableContainer = new St.BoxLayout({ vertical: true, reactive: true }); + let scrollableContainer = new St.BoxLayout({ + vertical: true, + reactive: true, + x_expand: true, + y_expand: true, + }); scrollableContainer.add_actor(this._grid); this._scrollView.add_actor(scrollableContainer); @@ -1462,8 +1468,6 @@ var FolderIcon = GObject.registerClass({ button_mask: St.ButtonMask.ONE, toggle_mode: true, can_focus: true, - x_fill: true, - y_fill: true }); this.id = id; this.name = ''; @@ -1902,10 +1906,7 @@ var AppFolderPopup = GObject.registerClass({ this._boxPointer = new BoxPointer.BoxPointer(this._arrowSide, { style_class: 'app-folder-popup-bin', - x_fill: true, - y_fill: true, - x_expand: true, - x_align: St.Align.START }); + x_expand: true, }); this._boxPointer.style_class = 'app-folder-popup'; this.add_actor(this._boxPointer); @@ -2057,8 +2058,6 @@ var AppIcon = GObject.registerClass({ reactive: true, button_mask: St.ButtonMask.ONE | St.ButtonMask.TWO, can_focus: true, - x_fill: true, - y_fill: true }); this.app = app; diff --git a/js/ui/calendar.js b/js/ui/calendar.js index c187e96d37..81bfc1fd11 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -790,8 +790,8 @@ class EventsSection extends MessageList.MessageListSection { this._title = new St.Button({ style_class: 'events-section-title', label: '', - x_align: St.Align.START, can_focus: true }); + this._title.child.x_align = Clutter.ActorAlign.START; this.insert_child_below(this._title, null); this._title.connect('clicked', this._onTitleClicked.bind(this)); @@ -1078,8 +1078,7 @@ class CalendarMessageList extends St.Widget { this._scrollView = new St.ScrollView({ style_class: 'vfade', overlay_scrollbars: true, - x_expand: true, y_expand: true, - x_fill: true, y_fill: true }); + x_expand: true, y_expand: true, }); this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); box.add_actor(this._scrollView); @@ -1098,6 +1097,7 @@ class CalendarMessageList extends St.Widget { this._sectionList = new St.BoxLayout({ style_class: 'message-list-sections', vertical: true, + x_expand: true, y_expand: true, y_align: Clutter.ActorAlign.START }); this._sectionList.connect('actor-added', this._sync.bind(this)); diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js index c4683e0e54..a58e6dbd4b 100644 --- a/js/ui/checkBox.js +++ b/js/ui/checkBox.js @@ -11,11 +11,12 @@ class CheckBox extends St.Button { button_mask: St.ButtonMask.ONE, toggle_mode: true, can_focus: true, - x_fill: true, - y_fill: true }); - this._box = new St.Bin(); + this._box = new St.Bin({ + x_expand: true, + y_expand: true, + }); this._box.set_y_align(Clutter.ActorAlign.START); container.add_actor(this._box); diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js index 41e316330f..82f8b9ecb0 100644 --- a/js/ui/components/autorunManager.js +++ b/js/ui/components/autorunManager.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported Component */ -const { Gio, GObject, St } = imports.gi; +const { Clutter, Gio, GObject, St } = imports.gi; const GnomeSession = imports.misc.gnomeSession; const Main = imports.ui.main; @@ -320,20 +320,23 @@ class AutorunNotification extends MessageTray.Notification { } _buttonForApp(app) { - let box = new St.BoxLayout(); + let box = new St.BoxLayout({ + x_expand: true, + x_align: Clutter.ActorAlign.START, + }); let icon = new St.Icon({ gicon: app.get_icon(), style_class: 'hotplug-notification-item-icon' }); box.add(icon); let label = new St.Bin({ - y_align: St.Align.MIDDLE, - child: new St.Label({ text: _("Open with %s").format(app.get_name()) }), + child: new St.Label({ + text: _("Open with %s").format(app.get_name()), + y_align: Clutter.ActorAlign.CENTER, + }), }); box.add(label); let button = new St.Button({ child: box, - x_fill: true, - x_align: St.Align.START, x_expand: true, button_mask: St.ButtonMask.ONE, style_class: 'hotplug-notification-item button' }); diff --git a/js/ui/dash.js b/js/ui/dash.js index e22cbfbb3d..b033eb2ac7 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -285,9 +285,12 @@ var DashActor = GObject.registerClass( class DashActor extends St.Widget { _init() { let layout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.VERTICAL }); - super._init({ name: 'dash', - layout_manager: layout, - clip_to_allocation: true }); + super._init({ + name: 'dash', + layout_manager: layout, + clip_to_allocation: true, + y_align: Clutter.ActorAlign.CENTER, + }); } vfunc_allocate(box, flags) { diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 665fa433e2..960c5f4bdd 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -37,7 +37,6 @@ class TodayButton extends St.Button { // until the selected date changes. super._init({ style_class: 'datemenu-today-button', - x_align: St.Align.START, x_expand: true, can_focus: true, reactive: false @@ -90,7 +89,6 @@ class WorldClocksSection extends St.Button { _init() { super._init({ style_class: 'world-clocks-button', - x_fill: true, can_focus: true, x_expand: true, }); @@ -101,6 +99,7 @@ class WorldClocksSection extends St.Button { let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL }); this._grid = new St.Widget({ style_class: 'world-clocks-grid', + x_expand: true, layout_manager: layout }); layout.hookup_style(this._grid); @@ -253,15 +252,17 @@ class WeatherSection extends St.Button { _init() { super._init({ style_class: 'weather-button', - x_fill: true, can_focus: true, x_expand: true, }); this._weatherClient = new Weather.WeatherClient(); - let box = new St.BoxLayout({ style_class: 'weather-box', - vertical: true }); + let box = new St.BoxLayout({ + style_class: 'weather-box', + vertical: true, + x_expand: true, + }); this.child = box; @@ -582,12 +583,13 @@ class DateMenuButton extends PanelMenu.Button { vbox.add_actor(this._calendar); this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade', - x_expand: true, x_fill: true, + x_expand: true, overlay_scrollbars: true }); this._displaysSection.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); vbox.add_actor(this._displaysSection); let displaysBox = new St.BoxLayout({ vertical: true, + x_expand: true, style_class: 'datemenu-displays-box' }); this._displaysSection.add_actor(displaysBox); diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 782756947b..74aac7ad33 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -39,18 +39,19 @@ class BaseIcon extends St.Bin { if (params.showLabel) styleClass += ' overview-icon-with-label'; - super._init({ style_class: styleClass, - x_fill: true, - y_fill: true }); + super._init({ style_class: styleClass }); this.connect('destroy', this._onDestroy.bind(this)); - this._box = new St.BoxLayout({ vertical: true }); + this._box = new St.BoxLayout({ + vertical: true, + x_expand: true, + y_expand: true, + }); this.set_child(this._box); this.iconSize = ICON_SIZE; - this._iconBin = new St.Bin({ x_align: St.Align.MIDDLE, - y_align: St.Align.MIDDLE }); + this._iconBin = new St.Bin(); this._box.add_actor(this._iconBin); diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 7cdb60d945..e12d83a968 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -292,10 +292,7 @@ var Key = GObject.registerClass({ if (this._extended_keys.length == 0) return; - this._boxPointer = new BoxPointer.BoxPointer(St.Side.BOTTOM, - { x_fill: true, - y_fill: true, - x_align: St.Align.START }); + this._boxPointer = new BoxPointer.BoxPointer(St.Side.BOTTOM); this._boxPointer.hide(); Main.layoutManager.addTopChrome(this._boxPointer); this._boxPointer.setPosition(this.keyButton, 0.5); diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 9238cb82e9..922ed988eb 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -264,7 +264,7 @@ class ObjLink extends St.Button { reactive: true, track_hover: true, style_class: 'shell-link', - label: text + label: text, }); this.set_x_align(Clutter.ActorAlign.START); this.get_child().single_line_mode = true; @@ -359,8 +359,6 @@ class ObjInspector extends St.ScrollView { _init(lookingGlass) { super._init({ pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), - x_fill: true, - y_fill: true }); this._obj = null; @@ -369,9 +367,13 @@ class ObjInspector extends St.ScrollView { this._parentList = []; this.get_hscroll_bar().hide(); - this._container = new St.BoxLayout({ name: 'LookingGlassPropertyInspector', - style_class: 'lg-dialog', - vertical: true }); + this._container = new St.BoxLayout({ + name: 'LookingGlassPropertyInspector', + style_class: 'lg-dialog', + vertical: true, + x_expand: true, + y_expand: true, + }); this.add_actor(this._container); this._lookingGlass = lookingGlass; diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 316abc6bf0..191784c209 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -1278,7 +1278,7 @@ var ZoomRegion = class ZoomRegion { _createActors() { // The root actor for the zoom region - this._magView = new St.Bin({ style_class: 'magnifier-zoom-region', x_fill: true, y_fill: true }); + this._magView = new St.Bin({ style_class: 'magnifier-zoom-region' }); global.stage.add_actor(this._magView); // hide the magnified region from CLUTTER_PICK_ALL diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 5cac1de75c..06fa11e212 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -307,13 +307,16 @@ var Message = GObject.registerClass({ accessible_role: Atk.Role.NOTIFICATION, can_focus: true, x_expand: true, - x_fill: true + y_expand: true, }); this.expanded = false; this._useBodyMarkup = false; - let vbox = new St.BoxLayout({ vertical: true }); + let vbox = new St.BoxLayout({ + vertical: true, + x_expand: true, + }); this.set_child(vbox); let hbox = new St.BoxLayout(); @@ -325,7 +328,7 @@ var Message = GObject.registerClass({ this._iconBin = new St.Bin({ style_class: 'message-icon-bin', y_expand: true, - y_align: St.Align.START, + y_align: Clutter.ActorAlign.START, visible: false }); hbox.add_actor(this._iconBin); @@ -344,8 +347,7 @@ var Message = GObject.registerClass({ titleBox.add_actor(this.titleLabel); this._secondaryBin = new St.Bin({ style_class: 'message-secondary-bin', - x_expand: true, y_expand: true, - x_fill: true, y_fill: true }); + x_expand: true, y_expand: true, }); titleBox.add_actor(this._secondaryBin); let closeIcon = new St.Icon({ icon_name: 'window-close-symbolic', @@ -605,8 +607,6 @@ var MessageListSection = GObject.registerClass({ let listItem = new St.Bin({ child: message, - x_fill: true, - y_fill: true, layout_manager: new ScaleLayout(), pivot_point: new Graphene.Point({ x: .5, y: .5 }), }); diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 2ec8a14f42..0c738fd55b 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -632,8 +632,7 @@ class SourceActor extends St.Widget { this._actorDestroyed = false; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; - this._iconBin = new St.Bin({ x_fill: true, - x_expand: true, + this._iconBin = new St.Bin({ x_expand: true, height: size * scaleFactor, width: size * scaleFactor }); diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index 1f7c481e1c..f357744075 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -57,9 +57,12 @@ var ModalDialog = GObject.registerClass({ coordinate: Clutter.BindCoordinate.ALL }); this.add_constraint(constraint); - this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); - this._backgroundBin = new St.Bin({ child: this.backgroundStack, - x_fill: true, y_fill: true }); + this.backgroundStack = new St.Widget({ + layout_manager: new Clutter.BinLayout(), + x_expand: true, + y_expand: true, + }); + this._backgroundBin = new St.Bin({ child: this.backgroundStack }); this._monitorConstraint = new Layout.MonitorConstraint(); this._backgroundBin.add_constraint(this._monitorConstraint); this.add_actor(this._backgroundBin); diff --git a/js/ui/overview.js b/js/ui/overview.js index 6798ee3645..e09f523be5 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -111,7 +111,7 @@ class OverviewActor extends St.BoxLayout { this._searchEntry.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); let searchEntryBin = new St.Bin({ child: this._searchEntry, - x_align: St.Align.MIDDLE + x_align: Clutter.ActorAlign.CENTER, }); this.add_actor(searchEntryBin); diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index c16e93d017..88dd61a687 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -29,17 +29,17 @@ var PadChooser = GObject.registerClass({ super._init({ style_class: 'pad-chooser-button', toggle_mode: true, - x_fill: false, - y_fill: false, - x_align: St.Align.MIDDLE, - y_align: St.Align.MIDDLE }); this.currentDevice = device; this._padChooserMenu = null; - let arrow = new St.Icon({ style_class: 'popup-menu-arrow', - icon_name: 'pan-down-symbolic', - accessible_role: Atk.Role.ARROW }); + let arrow = new St.Icon({ + style_class: 'popup-menu-arrow', + icon_name: 'pan-down-symbolic', + accessible_role: Atk.Role.ARROW, + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER, + }); this.set_child(arrow); this._ensureMenu(groupDevices); diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index 8c4c26423f..cbb10e5385 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -10,15 +10,17 @@ const PopupMenu = imports.ui.popupMenu; var ButtonBox = GObject.registerClass( class ButtonBox extends St.Widget { _init(params) { - params = Params.parse(params, { style_class: 'panel-button' }, true); + params = Params.parse(params, { + style_class: 'panel-button', + x_expand: true, + y_expand: true, + }, true); super._init(params); this._delegate = this; - this.container = new St.Bin({ y_fill: true, - x_fill: true, - child: this }); + this.container = new St.Bin({ child: this }); this.connect('style-changed', this._onStyleChanged.bind(this)); this.connect('destroy', this._onDestroy.bind(this)); diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index e96aea8c67..fc7db59256 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -340,7 +340,6 @@ var PopupSwitchMenuItem = GObject.registerClass({ this.add_child(this.label); this._statusBin = new St.Bin({ - x_align: St.Align.END, x_expand: true, }); this._statusBin.set_x_align(Clutter.ActorAlign.END); @@ -442,12 +441,14 @@ var PopupMenuBase = class { this.focusActor = sourceActor; this._parent = null; - if (styleClass !== undefined) { - this.box = new St.BoxLayout({ style_class: styleClass, - vertical: true }); - } else { - this.box = new St.BoxLayout({ vertical: true }); - } + this.box = new St.BoxLayout({ + vertical: true, + x_expand: true, + y_expand: true, + }); + + if (styleClass !== undefined) + this.box.style_class = styleClass; this.length = 0; this.isOpen = false; @@ -797,10 +798,7 @@ var PopupMenu = class extends PopupMenuBase { this._arrowAlignment = arrowAlignment; this._arrowSide = arrowSide; - this._boxPointer = new BoxPointer.BoxPointer(arrowSide, - { x_fill: true, - y_fill: true, - x_align: St.Align.START }); + this._boxPointer = new BoxPointer.BoxPointer(arrowSide); this.actor = this._boxPointer; this.actor._delegate = this; this.actor.style_class = 'popup-menu-boxpointer'; diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 088fceb4c8..3712c198a4 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -98,8 +98,7 @@ var NotificationsBox = GObject.registerClass({ style_class: 'screen-shield-notifications-container' }); - this._scrollView = new St.ScrollView({ x_fill: false, x_align: St.Align.START, - hscrollbar_policy: St.PolicyType.NEVER }); + this._scrollView = new St.ScrollView({ hscrollbar_policy: St.PolicyType.NEVER }); this._notificationBox = new St.BoxLayout({ vertical: true, style_class: 'screen-shield-notifications-container' }); this._scrollView.add_actor(this._notificationBox); @@ -165,9 +164,7 @@ var NotificationsBox = GObject.registerClass({ _makeNotificationDetailedSource(source, box) { let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE); - let sourceBin = new St.Bin({ y_align: St.Align.START, - x_align: St.Align.START, - child: sourceActor }); + let sourceBin = new St.Bin({ child: sourceActor }); box.add(sourceBin); let textBox = new St.BoxLayout({ vertical: true }); @@ -355,9 +352,11 @@ var Arrow = GObject.registerClass( class ScreenShieldArrow extends St.Bin { _init(params) { super._init(params); - this.x_fill = this.y_fill = true; - this._drawingArea = new St.DrawingArea(); + this._drawingArea = new St.DrawingArea({ + x_expand: true, + y_expand: true, + }); this._drawingArea.connect('repaint', this._drawArrow.bind(this)); this.child = this._drawingArea; diff --git a/js/ui/search.js b/js/ui/search.js index 2b0af27cb1..3b4dbc25c8 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -43,8 +43,6 @@ class SearchResult extends St.Button { reactive: true, can_focus: true, track_hover: true, - x_align: St.Align.START, - y_fill: true }); } @@ -68,12 +66,13 @@ class ListSearchResult extends SearchResult { super._init(provider, metaInfo, resultsView); this.style_class = 'list-search-result'; - this.x_fill = true; let content = new St.BoxLayout({ style_class: 'list-search-result-content', vertical: false, + x_align: Clutter.ActorAlign.START, x_expand: true, + y_expand: true, }); this.set_child(content); @@ -142,7 +141,12 @@ class GridSearchResult extends SearchResult { this.icon = new IconGrid.BaseIcon(this.metaInfo['name'], { createIcon: this.metaInfo['createIcon'] }); - let content = new St.Bin({ child: this.icon }); + let content = new St.Bin({ + child: this.icon, + x_align: Clutter.ActorAlign.START, + x_expand: true, + y_expand: true, + }); this.set_child(content); this.label_actor = this.icon.label; } @@ -166,7 +170,7 @@ var SearchResultsBase = GObject.registerClass({ this._terms = []; this._focusChild = null; - this._resultDisplayBin = new St.Bin({ x_fill: true }); + this._resultDisplayBin = new St.Bin(); this.add_child(this._resultDisplayBin); let separator = new St.Widget({ style_class: 'search-section-separator' }); @@ -353,7 +357,7 @@ class GridSearchResults extends SearchResultsBase { this._grid = new IconGrid.IconGrid({ rowLimit: MAX_GRID_SEARCH_RESULTS_ROWS, xAlign: St.Align.START }); - this._bin = new St.Bin({ x_align: St.Align.MIDDLE }); + this._bin = new St.Bin({ x_align: Clutter.ActorAlign.CENTER }); this._bin.set_child(this._grid); this._resultDisplayBin.set_child(this._bin); @@ -427,8 +431,11 @@ var SearchResultsView = GObject.registerClass({ _init() { super._init({ name: 'searchResults', vertical: true }); - this._content = new MaxWidthBox({ name: 'searchResultsContent', - vertical: true }); + this._content = new MaxWidthBox({ + name: 'searchResultsContent', + vertical: true, + x_expand: true, + }); this._scrollView = new St.ScrollView({ overlay_scrollbars: true, diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index a5dff2636f..968205a458 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -53,8 +53,6 @@ var ListItem = GObject.registerClass({ can_focus: true, child: layout, reactive: true, - x_align: St.Align.START, - x_fill: true }); this._app = app; @@ -65,10 +63,12 @@ var ListItem = GObject.registerClass({ child: this._icon }); layout.add(iconBin); - this._nameLabel = new St.Label({ text: this._app.get_name(), - style_class: 'mount-dialog-app-list-item-name' }); - let labelBin = new St.Bin({ y_align: St.Align.MIDDLE, - child: this._nameLabel }); + this._nameLabel = new St.Label({ + text: this._app.get_name(), + style_class: 'mount-dialog-app-list-item-name', + y_align: Clutter.ActorAlign.CENTER, + }); + let labelBin = new St.Bin({ child: this._nameLabel }); layout.add(labelBin); } diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index a584dce6df..077ab1fbe2 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -55,9 +55,7 @@ var UnlockDialog = GObject.registerClass({ this._otherUserButton = new St.Button({ style_class: 'login-dialog-not-listed-button', can_focus: true, child: otherUserLabel, - reactive: true, - x_align: St.Align.START, - x_fill: false }); + reactive: true }); this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this)); this._promptBox.add_child(this._otherUserButton); } else { diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 40396ab9c7..6b10ec600c 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -309,11 +309,8 @@ var ViewSelector = GObject.registerClass({ _addPage(actor, name, a11yIcon, params) { params = Params.parse(params, { a11yFocus: null }); - let page = new St.Bin({ child: actor, - x_align: St.Align.START, - y_align: St.Align.START, - x_fill: true, - y_fill: true }); + let page = new St.Bin({ child: actor }); + if (params.a11yFocus) Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon); else -- GitLab From 2c62e45168035a973823ff16aa044cfc4db1707b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 17 Oct 2019 23:27:27 +0200 Subject: [PATCH 4/4] st: Remove StBin's align properties They are now completely unused, so remove them and stop the confusing shadowing of ClutterActor's own x/y-align properties. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803 --- js/gdm/authPrompt.js | 8 +-- js/misc/util.js | 20 +++---- js/ui/calendar.js | 10 ++-- js/ui/checkBox.js | 2 +- js/ui/endSessionDialog.js | 2 +- js/ui/lookingGlass.js | 2 +- js/ui/padOsd.js | 10 ++-- js/ui/popupMenu.js | 2 +- js/ui/search.js | 14 +++-- js/ui/status/system.js | 19 +++--- src/st/st-bin.c | 119 -------------------------------------- src/st/st-bin.h | 6 -- 12 files changed, 45 insertions(+), 169 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index c5d93c946e..62a65725e7 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -162,9 +162,9 @@ var AuthPrompt = GObject.registerClass({ can_focus: true, label: _("Cancel"), x_expand: true, + x_align: Clutter.ActorAlign.START, + y_align: Clutter.ActorAlign.END, }); - this.cancelButton.set_x_align(Clutter.ActorAlign.START); - this.cancelButton.set_y_align(Clutter.ActorAlign.END); this.cancelButton.connect('clicked', () => this.cancel()); this._buttonBox.add_child(this.cancelButton); @@ -175,9 +175,9 @@ var AuthPrompt = GObject.registerClass({ reactive: true, can_focus: true, label: _("Next"), + x_align: Clutter.ActorAlign.END, + y_align: Clutter.ActorAlign.END, }); - this.nextButton.set_x_align(Clutter.ActorAlign.END); - this.nextButton.set_y_align(Clutter.ActorAlign.END); this.nextButton.connect('clicked', () => this.emit('next')); this.nextButton.add_style_pseudo_class('default'); this._buttonBox.add_child(this.nextButton); diff --git a/js/misc/util.js b/js/misc/util.js index 541f1876bd..bdffffc529 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -346,19 +346,13 @@ function insertSorted(array, val, cmp) { var CloseButton = GObject.registerClass( class CloseButton extends St.Button { _init(boxpointer) { - super._init({ style_class: 'notification-close' }); - - // This is a bit tricky. St.Bin has its own x-align/y-align properties - // that compete with Clutter's properties. This should be fixed for - // Clutter 2.0. Since St.Bin doesn't define its own setters, the - // setters are a workaround to get Clutter's version. - this.set_x_align(Clutter.ActorAlign.END); - this.set_y_align(Clutter.ActorAlign.START); - - // XXX Clutter 2.0 workaround: ClutterBinLayout needs expand - // to respect the alignments. - this.set_x_expand(true); - this.set_y_expand(true); + super._init({ + style_class: 'notification-close', + x_expand: true, + y_expand: true, + x_align: Clutter.ActorAlign.END, + y_align: Clutter.ActorAlign.START, + }); this._boxPointer = boxpointer; if (boxpointer) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 81bfc1fd11..ef13289c7b 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -1082,10 +1082,12 @@ class CalendarMessageList extends St.Widget { this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); box.add_actor(this._scrollView); - this._clearButton = new St.Button({ style_class: 'message-list-clear-button button', - label: _("Clear"), - can_focus: true }); - this._clearButton.set_x_align(Clutter.ActorAlign.END); + this._clearButton = new St.Button({ + style_class: 'message-list-clear-button button', + label: _('Clear'), + can_focus: true, + x_align: Clutter.ActorAlign.END, + }); this._clearButton.connect('clicked', () => { this._sectionList.get_children().forEach(s => s.clear()); }); diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js index a58e6dbd4b..e122fda41e 100644 --- a/js/ui/checkBox.js +++ b/js/ui/checkBox.js @@ -16,8 +16,8 @@ class CheckBox extends St.Button { this._box = new St.Bin({ x_expand: true, y_expand: true, + y_align: Clutter.ActorAlign.START, }); - this._box.set_y_align(Clutter.ActorAlign.START); container.add_actor(this._box); this._label = new St.Label(); diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js index 11c5696dd9..fc5440eb72 100644 --- a/js/ui/endSessionDialog.js +++ b/js/ui/endSessionDialog.js @@ -272,8 +272,8 @@ class EndSessionDialog extends ModalDialog.ModalDialog { this._iconBin = new St.Bin({ x_expand: true, + x_align: Clutter.ActorAlign.END, }); - this._iconBin.set_x_align(Clutter.ActorAlign.END); mainContentLayout.add_child(this._iconBin); let messageLayout = new St.BoxLayout({ vertical: true, diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 922ed988eb..87f2aa04cd 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -265,8 +265,8 @@ class ObjLink extends St.Button { track_hover: true, style_class: 'shell-link', label: text, + x_align: Clutter.ActorAlign.START, }); - this.set_x_align(Clutter.ActorAlign.START); this.get_child().single_line_mode = true; this._obj = o; diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index 88dd61a687..854e0f61ed 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -735,10 +735,12 @@ var PadOsd = GObject.registerClass({ x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER }); this.add_actor(buttonBox); - this._editButton = new St.Button({ label: _("Edit…"), - style_class: 'button', - can_focus: true }); - this._editButton.set_x_align(Clutter.ActorAlign.CENTER); + this._editButton = new St.Button({ + label: _('Edit…'), + style_class: 'button', + can_focus: true, + x_align: Clutter.ActorAlign.CENTER, + }); this._editButton.connect('clicked', () => { this.setEditionMode(true); }); diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index fc7db59256..74c228f56e 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -340,9 +340,9 @@ var PopupSwitchMenuItem = GObject.registerClass({ this.add_child(this.label); this._statusBin = new St.Bin({ + x_align: Clutter.ActorAlign.END, x_expand: true, }); - this._statusBin.set_x_align(Clutter.ActorAlign.END); this.add_child(this._statusBin); this._statusLabel = new St.Label({ diff --git a/js/ui/search.js b/js/ui/search.js index 3b4dbc25c8..2f3f47d93d 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -770,13 +770,15 @@ var ProviderInfo = GObject.registerClass( class ProviderInfo extends St.Button { _init(provider) { this.provider = provider; - super._init({ style_class: 'search-provider-icon', - reactive: true, - can_focus: true, - accessible_name: provider.appInfo.get_name(), - track_hover: true }); + super._init({ + style_class: 'search-provider-icon', + reactive: true, + can_focus: true, + accessible_name: provider.appInfo.get_name(), + track_hover: true, + y_align: Clutter.ActorAlign.START, + }); - this.set_y_align(Clutter.ActorAlign.START); this._content = new St.BoxLayout({ vertical: false, style_class: 'list-search-provider-content' }); this.set_child(this._content); diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 8c7b3d1dd9..8b9a746528 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -175,15 +175,16 @@ class Indicator extends PanelMenu.SystemIndicator { } _createActionButton(iconName, accessibleName) { - let icon = new St.Button({ reactive: true, - can_focus: true, - track_hover: true, - accessible_name: accessibleName, - x_expand: true, - style_class: 'system-menu-action' }); - icon.set_x_align(Clutter.ActorAlign.CENTER); - icon.child = new St.Icon({ icon_name: iconName }); - return icon; + return new St.Button({ + child: new St.Icon({ icon_name: iconName }), + reactive: true, + can_focus: true, + track_hover: true, + accessible_name: accessibleName, + x_expand: true, + x_align: Clutter.ActorAlign.CENTER, + style_class: 'system-menu-action', + }); } _createSubMenu() { diff --git a/src/st/st-bin.c b/src/st/st-bin.c index 49d66ce4b4..b9c17e59c7 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -43,9 +43,6 @@ struct _StBinPrivate { ClutterActor *child; - StAlign x_align; - StAlign y_align; - guint x_fill : 1; guint y_fill : 1; }; @@ -55,8 +52,6 @@ enum PROP_0, PROP_CHILD, - PROP_X_ALIGN, - PROP_Y_ALIGN, PROP_X_FILL, PROP_Y_FILL, @@ -273,18 +268,6 @@ st_bin_set_property (GObject *gobject, st_bin_set_child (bin, g_value_get_object (value)); break; - case PROP_X_ALIGN: - st_bin_set_alignment (bin, - g_value_get_enum (value), - priv->y_align); - break; - - case PROP_Y_ALIGN: - st_bin_set_alignment (bin, - priv->x_align, - g_value_get_enum (value)); - break; - case PROP_X_FILL: st_bin_set_fill (bin, g_value_get_boolean (value), @@ -324,14 +307,6 @@ st_bin_get_property (GObject *gobject, g_value_set_boolean (value, priv->y_fill); break; - case PROP_X_ALIGN: - g_value_set_enum (value, priv->x_align); - break; - - case PROP_Y_ALIGN: - g_value_set_enum (value, priv->y_align); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); } @@ -367,32 +342,6 @@ st_bin_class_init (StBinClass *klass) CLUTTER_TYPE_ACTOR, ST_PARAM_READWRITE); - /** - * StBin:x-align: - * - * The horizontal alignment of the #StBin child. - */ - props[PROP_X_ALIGN] = - g_param_spec_enum ("x-align", - "X Align", - "The horizontal alignment", - ST_TYPE_ALIGN, - ST_ALIGN_MIDDLE, - ST_PARAM_READWRITE | G_PARAM_DEPRECATED); - - /** - * StBin:y-align: - * - * The vertical alignment of the #StBin child. - */ - props[PROP_Y_ALIGN] = - g_param_spec_enum ("y-align", - "Y Align", - "The vertical alignment", - ST_TYPE_ALIGN, - ST_ALIGN_MIDDLE, - ST_PARAM_READWRITE | G_PARAM_DEPRECATED); - /** * StBin:x-fill: * @@ -425,10 +374,6 @@ st_bin_class_init (StBinClass *klass) static void st_bin_init (StBin *bin) { - StBinPrivate *priv = st_bin_get_instance_private (bin); - - priv->x_align = ST_ALIGN_MIDDLE; - priv->y_align = ST_ALIGN_MIDDLE; } /** @@ -499,70 +444,6 @@ st_bin_get_child (StBin *bin) return ((StBinPrivate *)st_bin_get_instance_private (bin))->child; } -/** - * st_bin_set_alignment: - * @bin: a #StBin - * @x_align: horizontal alignment - * @y_align: vertical alignment - * - * Sets the horizontal and vertical alignment of the child - * inside a #StBin. - */ -void -st_bin_set_alignment (StBin *bin, - StAlign x_align, - StAlign y_align) -{ - StBinPrivate *priv; - - g_return_if_fail (ST_IS_BIN (bin)); - - priv = st_bin_get_instance_private (bin); - - g_object_freeze_notify (G_OBJECT (bin)); - - if (priv->x_align != x_align) - { - priv->x_align = x_align; - g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_X_ALIGN]); - } - - if (priv->y_align != y_align) - { - priv->y_align = y_align; - g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_Y_ALIGN]); - } - - g_object_thaw_notify (G_OBJECT (bin)); -} - -/** - * st_bin_get_alignment: - * @bin: a #StBin - * @x_align: return location for the horizontal alignment, or %NULL - * @y_align: return location for the vertical alignment, or %NULL - * - * Retrieves the horizontal and vertical alignment of the child - * inside a #StBin, as set by st_bin_set_alignment(). - */ -void -st_bin_get_alignment (StBin *bin, - StAlign *x_align, - StAlign *y_align) -{ - StBinPrivate *priv; - - g_return_if_fail (ST_IS_BIN (bin)); - - priv = st_bin_get_instance_private (bin); - - if (x_align) - *x_align = priv->x_align; - - if (y_align) - *y_align = priv->y_align; -} - /** * st_bin_set_fill: * @bin: a #StBin diff --git a/src/st/st-bin.h b/src/st/st-bin.h index 0a22ca0cd1..d4d9fa509a 100644 --- a/src/st/st-bin.h +++ b/src/st/st-bin.h @@ -47,12 +47,6 @@ StWidget * st_bin_new (void); void st_bin_set_child (StBin *bin, ClutterActor *child); ClutterActor *st_bin_get_child (StBin *bin); -void st_bin_set_alignment (StBin *bin, - StAlign x_align, - StAlign y_align); -void st_bin_get_alignment (StBin *bin, - StAlign *x_align, - StAlign *y_align); void st_bin_set_fill (StBin *bin, gboolean x_fill, gboolean y_fill); -- GitLab