From 46b398a43ed9e233e00e80d59d43928a3e7df626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 21 Sep 2021 16:35:32 +0200 Subject: [PATCH 1/5] Always assume GLSL is supported The support for GLSL has been advertised as unconditionally supported by mutter for a while, and has now lost the 'GLSL' feature completely. Lets remove the checks. --- js/ui/lightbox.js | 2 +- src/shell-glsl-effect.c | 26 -------------------------- src/shell-invert-lightness-effect.c | 29 ----------------------------- src/st/st-scroll-view-fade.c | 9 --------- 4 files changed, 1 insertion(+), 65 deletions(-) diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index 8348abada0..cf68ea828c 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -129,7 +129,7 @@ var Lightbox = GObject.registerClass({ this._container = container; this._children = container.get_children(); this._fadeFactor = params.fadeFactor; - this._radialEffect = Clutter.feature_available(Clutter.FeatureFlags.SHADERS_GLSL) && params.radialEffect; + this._radialEffect = params.radialEffect; if (this._radialEffect) this.add_effect(new RadialShaderEffect({ name: 'radial' })); diff --git a/src/shell-glsl-effect.c b/src/shell-glsl-effect.c index b7d39bd7b4..ee6f5eefe2 100644 --- a/src/shell-glsl-effect.c +++ b/src/shell-glsl-effect.c @@ -22,29 +22,6 @@ struct _ShellGLSLEffectPrivate G_DEFINE_TYPE_WITH_PRIVATE (ShellGLSLEffect, shell_glsl_effect, CLUTTER_TYPE_OFFSCREEN_EFFECT); -static gboolean -shell_glsl_effect_pre_paint (ClutterEffect *effect, - ClutterPaintNode *node, - ClutterPaintContext *paint_context) -{ - ClutterEffectClass *parent_class; - - if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL)) - { - /* if we don't have support for GLSL shaders then we - * forcibly disable the ActorMeta - */ - g_warning ("Unable to use the ShaderEffect: the graphics hardware " - "or the current GL driver does not implement support " - "for the GLSL shading language."); - clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE); - return FALSE; - } - - parent_class = CLUTTER_EFFECT_CLASS (shell_glsl_effect_parent_class); - return parent_class->pre_paint (effect, node, paint_context); -} - static CoglPipeline * shell_glsl_effect_create_pipeline (ClutterOffscreenEffect *effect, CoglTexture *texture) @@ -156,15 +133,12 @@ shell_glsl_effect_constructed (GObject *object) static void shell_glsl_effect_class_init (ShellGLSLEffectClass *klass) { - ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterOffscreenEffectClass *offscreen_class; offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); offscreen_class->create_pipeline = shell_glsl_effect_create_pipeline; - effect_class->pre_paint = shell_glsl_effect_pre_paint; - gobject_class->constructed = shell_glsl_effect_constructed; gobject_class->dispose = shell_glsl_effect_dispose; } diff --git a/src/shell-invert-lightness-effect.c b/src/shell-invert-lightness-effect.c index c9521ea495..f856ede612 100644 --- a/src/shell-invert-lightness-effect.c +++ b/src/shell-invert-lightness-effect.c @@ -72,32 +72,6 @@ G_DEFINE_TYPE (ShellInvertLightnessEffect, shell_invert_lightness_effect, CLUTTER_TYPE_OFFSCREEN_EFFECT); -static gboolean -shell_invert_lightness_effect_pre_paint (ClutterEffect *effect, - ClutterPaintNode *node, - ClutterPaintContext *paint_context) -{ - ShellInvertLightnessEffect *self = SHELL_INVERT_LIGHTNESS_EFFECT (effect); - ClutterEffectClass *parent_class; - - if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL)) - { - /* if we don't have support for GLSL shaders then we - * forcibly disable the ActorMeta - */ - g_warning ("Unable to use the ShellInvertLightnessEffect: the " - "graphics hardware or the current GL driver does not " - "implement support for the GLSL shading language."); - clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (self), FALSE); - return FALSE; - } - - parent_class = - CLUTTER_EFFECT_CLASS (shell_invert_lightness_effect_parent_class); - - return parent_class->pre_paint (effect, node, paint_context); -} - static CoglPipeline * shell_glsl_effect_create_pipeline (ClutterOffscreenEffect *effect, CoglTexture *texture) @@ -126,15 +100,12 @@ shell_invert_lightness_effect_dispose (GObject *gobject) static void shell_invert_lightness_effect_class_init (ShellInvertLightnessEffectClass *klass) { - ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ClutterOffscreenEffectClass *offscreen_class; offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass); offscreen_class->create_pipeline = shell_glsl_effect_create_pipeline; - effect_class->pre_paint = shell_invert_lightness_effect_pre_paint; - gobject_class->dispose = shell_invert_lightness_effect_dispose; } diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c index 6c0176f5d9..7dba2df42e 100644 --- a/src/st/st-scroll-view-fade.c +++ b/src/st/st-scroll-view-fade.c @@ -214,15 +214,6 @@ st_scroll_view_fade_set_actor (ClutterActorMeta *meta, g_return_if_fail (actor == NULL || ST_IS_SCROLL_VIEW (actor)); - if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL)) - { - /* if we don't have support for GLSL shaders then we - * forcibly disable the ActorMeta - */ - clutter_actor_meta_set_enabled (meta, FALSE); - return; - } - if (self->vadjustment) { g_signal_handlers_disconnect_by_func (self->vadjustment, -- GitLab From 840f3c83dfbbf0a425338133c139c8f3e8054fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 21 Sep 2021 16:34:09 +0200 Subject: [PATCH 2/5] Adapt to explicit ClutterContext passing This makes sure (tries to at liest) that every Clutter actor constructed by the shell has a 'context' parameter passed to it. This is due to the change in Mutter's Clutter where an explicit context pointer is required to be passed at construction. --- js/gdm/authPrompt.js | 12 +- js/gdm/loginDialog.js | 80 +++++--- js/gdm/util.js | 7 +- js/misc/util.js | 5 +- js/ui/accessDialog.js | 1 + js/ui/altTab.js | 102 +++++++--- js/ui/animation.js | 1 + js/ui/appDisplay.js | 39 +++- js/ui/audioDeviceSelection.js | 33 ++- js/ui/background.js | 4 +- js/ui/barLevel.js | 1 + js/ui/boxpointer.js | 14 +- js/ui/calendar.js | 114 ++++++++--- js/ui/checkBox.js | 12 +- js/ui/components/autorunManager.js | 21 +- js/ui/components/keyring.js | 13 +- js/ui/components/networkAgent.js | 2 + js/ui/components/polkitAgent.js | 16 +- js/ui/components/telepathyClient.js | 33 ++- js/ui/ctrlAltTab.js | 16 +- js/ui/dash.js | 47 +++-- js/ui/dateMenu.js | 127 +++++++++--- js/ui/dialog.js | 44 +++- js/ui/dnd.js | 6 +- js/ui/endSessionDialog.js | 1 + js/ui/ibusCandidatePopup.js | 63 ++++-- js/ui/iconGrid.js | 23 ++- js/ui/inhibitShortcutsDialog.js | 1 + js/ui/keyboard.js | 55 ++++- js/ui/layout.js | 77 ++++--- js/ui/lightbox.js | 1 + js/ui/lookingGlass.js | 298 ++++++++++++++++++++++------ js/ui/magnifier.js | 48 ++++- js/ui/main.js | 1 + js/ui/messageList.js | 82 ++++++-- js/ui/messageTray.js | 65 ++++-- js/ui/modalDialog.js | 22 +- js/ui/mpris.js | 5 +- js/ui/notificationDaemon.js | 7 +- js/ui/osdMonitorLabeler.js | 20 +- js/ui/osdWindow.js | 17 +- js/ui/overview.js | 20 +- js/ui/overviewControls.js | 3 + js/ui/padOsd.js | 102 +++++++--- js/ui/pageIndicators.js | 15 +- js/ui/panel.js | 57 ++++-- js/ui/panelMenu.js | 12 +- js/ui/pointerA11yTimeout.js | 1 + js/ui/popupMenu.js | 94 ++++++--- js/ui/remoteSearch.js | 5 +- js/ui/ripples.js | 39 ++-- js/ui/runDialog.js | 2 + js/ui/screenShield.js | 2 + js/ui/screenshot.js | 9 +- js/ui/search.js | 90 +++++++-- js/ui/searchController.js | 10 + js/ui/shellEntry.js | 5 +- js/ui/shellMountOperation.js | 14 +- js/ui/status/accessibility.js | 1 + js/ui/status/brightness.js | 7 +- js/ui/status/dwellClick.js | 7 +- js/ui/status/keyboard.js | 32 ++- js/ui/status/location.js | 2 + js/ui/status/network.js | 131 ++++++++---- js/ui/status/power.js | 1 + js/ui/status/system.js | 4 +- js/ui/status/volume.js | 5 +- js/ui/switchMonitor.js | 15 +- js/ui/switcherPopup.js | 53 +++-- js/ui/unlockDialog.js | 57 +++++- js/ui/userWidget.js | 23 ++- js/ui/welcomeDialog.js | 5 +- js/ui/windowManager.js | 25 ++- js/ui/windowMenu.js | 5 +- js/ui/windowPreview.js | 9 +- js/ui/workspace.js | 5 + js/ui/workspaceAnimation.js | 14 +- js/ui/workspaceSwitcherPopup.js | 44 +++- js/ui/workspaceThumbnail.js | 31 ++- js/ui/workspacesView.js | 3 + js/ui/xdndHandler.js | 14 +- src/main.c | 5 + src/shell-app.c | 2 +- src/shell-window-preview-layout.c | 3 +- src/st/meson.build | 2 + src/st/st-bin.c | 7 +- src/st/st-bin.h | 2 +- src/st/st-box-layout.c | 7 +- src/st/st-box-layout.h | 2 +- src/st/st-button.c | 21 +- src/st/st-button.h | 5 +- src/st/st-context.c | 34 ++++ src/st/st-context.h | 34 ++++ src/st/st-entry.c | 129 +++++++----- src/st/st-entry.h | 3 +- src/st/st-icon.c | 7 +- src/st/st-icon.h | 2 +- src/st/st-label.c | 61 ++++-- src/st/st-label.h | 3 +- src/st/st-password-entry.c | 7 +- src/st/st-password-entry.h | 2 +- src/st/st-scroll-bar.c | 100 +++++++--- src/st/st-scroll-bar.h | 3 +- src/st/st-scroll-view.c | 74 ++++--- src/st/st-scroll-view.h | 2 +- src/st/st-texture-cache.c | 6 +- src/st/test-theme.c | 3 +- 107 files changed, 2289 insertions(+), 746 deletions(-) create mode 100644 src/st/st-context.c create mode 100644 src/st/st-context.h diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 4844b9ee0c..9ce21f2e4c 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -50,6 +50,7 @@ var AuthPrompt = GObject.registerClass({ }, class AuthPrompt extends St.BoxLayout { _init(gdmClient, mode) { super._init({ + context: St.get_clutter_context(), style_class: 'login-dialog-prompt-layout', vertical: true, x_expand: true, @@ -83,6 +84,7 @@ var AuthPrompt = GObject.registerClass({ this.connect('destroy', this._onDestroy.bind(this)); this._userWell = new St.Bin({ + context: St.get_clutter_context(), x_expand: true, y_expand: true, }); @@ -92,7 +94,9 @@ var AuthPrompt = GObject.registerClass({ this._initEntryRow(); - let capsLockPlaceholder = new St.Label(); + let capsLockPlaceholder = new St.Label({ + context: St.get_clutter_context(), + }); this.add_child(capsLockPlaceholder); this._capsLockWarningLabel = new ShellEntry.CapsLockWarning({ @@ -106,6 +110,7 @@ var AuthPrompt = GObject.registerClass({ GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.INVERT_BOOLEAN); this._message = new St.Label({ + context: St.get_clutter_context(), opacity: 0, styleClass: 'login-dialog-message', y_expand: true, @@ -131,12 +136,14 @@ var AuthPrompt = GObject.registerClass({ _initEntryRow() { this._mainBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'login-dialog-button-box', vertical: false, }); this.add_child(this._mainBox); this.cancelButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'modal-dialog-button button cancel-button', accessible_name: _('Cancel'), button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, @@ -153,6 +160,7 @@ var AuthPrompt = GObject.registerClass({ this._mainBox.add_child(this.cancelButton); let entryParams = { + context: St.get_clutter_context(), style_class: 'login-dialog-prompt-entry', can_focus: true, x_expand: true, @@ -171,6 +179,7 @@ var AuthPrompt = GObject.registerClass({ this._entry.grab_key_focus(); this._timedLoginIndicator = new St.Bin({ + context: St.get_clutter_context(), style_class: 'login-dialog-timed-login-indicator', scale_x: 0, }); @@ -191,6 +200,7 @@ var AuthPrompt = GObject.registerClass({ }); this._defaultButtonWell = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.CENTER, diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index d2a82b43d1..01ef615fab 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -41,9 +41,11 @@ var UserListItem = GObject.registerClass({ }, class UserListItem extends St.Button { _init(user) { let layout = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, }); super._init({ + context: St.get_clutter_context(), style_class: 'login-dialog-user-list-item', button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, can_focus: true, @@ -67,9 +69,12 @@ var UserListItem = GObject.registerClass({ this._userWidget.bind_property('label-actor', this, 'label-actor', GObject.BindingFlags.SYNC_CREATE); - this._timedLoginIndicator = new St.Bin({ style_class: 'login-dialog-timed-login-indicator', - scale_x: 0, - visible: false }); + this._timedLoginIndicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'login-dialog-timed-login-indicator', + scale_x: 0, + visible: false + }); layout.add(this._timedLoginIndicator); this._onUserChanged(); @@ -160,6 +165,7 @@ var UserList = GObject.registerClass({ }, class UserList extends St.ScrollView { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'login-dialog-user-list-view', x_expand: true, y_expand: true, @@ -167,9 +173,12 @@ var UserList = GObject.registerClass({ this.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); - this._box = new St.BoxLayout({ vertical: true, - style_class: 'login-dialog-user-list', - pseudo_class: 'expanded' }); + this._box = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + style_class: 'login-dialog-user-list', + pseudo_class: 'expanded' + }); this.add_actor(this._box); this._items = {}; @@ -308,8 +317,12 @@ var SessionMenuButton = GObject.registerClass({ Signals: { 'session-activated': { param_types: [GObject.TYPE_STRING] } }, }, class SessionMenuButton extends St.Bin { _init() { - let gearIcon = new St.Icon({ icon_name: 'emblem-system-symbolic' }); + let gearIcon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'emblem-system-symbolic' + }); let button = new St.Button({ + context: St.get_clutter_context(), style_class: 'modal-dialog-button button login-dialog-session-list-button', reactive: true, track_hover: true, @@ -321,7 +334,10 @@ var SessionMenuButton = GObject.registerClass({ child: gearIcon, }); - super._init({ child: button }); + super._init({ + context: St.get_clutter_context(), + child: button + }); this._button = button; this._menu = new PopupMenu.PopupMenu(this._button, 0, St.Side.BOTTOM); @@ -407,7 +423,11 @@ var LoginDialog = GObject.registerClass({ }, }, class LoginDialog extends St.Widget { _init(parentActor) { - super._init({ style_class: 'login-dialog', visible: false }); + super._init({ + context: St.get_clutter_context(), + style_class: 'login-dialog', + visible: false + }); this.get_accessible().set_role(Atk.Role.WINDOW); @@ -433,11 +453,14 @@ var LoginDialog = GObject.registerClass({ this._updateLogoTextureId = this._textureCache.connect('texture-file-changed', this._updateLogoTexture.bind(this)); - this._userSelectionBox = new St.BoxLayout({ style_class: 'login-dialog-user-selection-box', - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER, - vertical: true, - visible: false }); + this._userSelectionBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'login-dialog-user-selection-box', + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER, + vertical: true, + visible: false + }); this.add_child(this._userSelectionBox); this._userList = new UserList(); @@ -453,10 +476,12 @@ var LoginDialog = GObject.registerClass({ // login screen. It can be activated to reveal an entry for // manually entering the username. let notListedLabel = new St.Label({ + context: St.get_clutter_context(), text: _("Not listed?"), style_class: 'login-dialog-not-listed-label', }); this._notListedButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'login-dialog-not-listed-button', button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, can_focus: true, @@ -472,17 +497,23 @@ var LoginDialog = GObject.registerClass({ this._userSelectionBox.add_child(this._notListedButton); - this._bannerView = new St.ScrollView({ style_class: 'login-dialog-banner-view', - opacity: 0, - vscrollbar_policy: St.PolicyType.AUTOMATIC, - hscrollbar_policy: St.PolicyType.NEVER }); + this._bannerView = new St.ScrollView({ + context: St.get_clutter_context(), + style_class: 'login-dialog-banner-view', + opacity: 0, + vscrollbar_policy: St.PolicyType.AUTOMATIC, + hscrollbar_policy: St.PolicyType.NEVER + }); this.add_child(this._bannerView); let bannerBox = new St.BoxLayout({ vertical: true }); this._bannerView.add_actor(bannerBox); - this._bannerLabel = new St.Label({ style_class: 'login-dialog-banner', - text: '' }); + this._bannerLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'login-dialog-banner', + text: '' + }); this._bannerLabel.clutter_text.line_wrap = true; this._bannerLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; bannerBox.add_child(this._bannerLabel); @@ -497,9 +528,12 @@ var LoginDialog = GObject.registerClass({ this._sessionMenuButton.show(); this.add_child(this._sessionMenuButton); - this._logoBin = new St.Widget({ style_class: 'login-dialog-logo-bin', - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.END }); + this._logoBin = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'login-dialog-logo-bin', + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.END + }); this._logoBin.connect('resource-scale-changed', () => { this._updateLogoTexture(this._textureCache, this._logoFile); }); diff --git a/js/gdm/util.js b/js/gdm/util.js index 72561daab2..e422e130f1 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -115,8 +115,11 @@ function cloneAndFadeOutActor(actor) { // and reveals its sibling. actor.hide(); - let clone = new Clutter.Clone({ source: actor, - reactive: false }); + let clone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: actor, + reactive: false + }); Main.uiGroup.add_child(clone); diff --git a/js/misc/util.js b/js/misc/util.js index bd57184728..ea46c5ea04 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -305,7 +305,10 @@ function createTimeLabel(date, params) { if (_desktopSettings == null) _desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' }); - let label = new St.Label({ text: formatTime(date, params) }); + let label = new St.Label({ + context: St.get_clutter_context(), + text: formatTime(date, params) + }); let id = _desktopSettings.connect('changed::clock-format', () => { label.text = formatTime(date, params); }); diff --git a/js/ui/accessDialog.js b/js/ui/accessDialog.js index 057cd5b1bb..26eca7bfed 100644 --- a/js/ui/accessDialog.js +++ b/js/ui/accessDialog.js @@ -59,6 +59,7 @@ class AccessDialog extends ModalDialog.ModalDialog { } let bodyLabel = new St.Label({ + context: St.get_clutter_context(), text: body, x_align: Clutter.ActorAlign.CENTER, }); diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 6af9380edc..25014191f1 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -28,14 +28,17 @@ var AppIconMode = { function _createWindowClone(window, size) { let [width, height] = window.get_size(); let scale = Math.min(1.0, size / width, size / height); - return new Clutter.Clone({ source: window, - width: width * scale, - height: height * scale, - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER, - // usual hack for the usual bug in ClutterBinLayout... - x_expand: true, - y_expand: true }); + return new Clutter.Clone({ + context: St.get_clutter_context(), + source: window, + width: width * scale, + height: height * scale, + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER, + // usual hack for the usual bug in ClutterBinLayout... + x_expand: true, + y_expand: true + }); } function getWindows(workspace) { @@ -400,14 +403,22 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { var CyclerHighlight = GObject.registerClass( class CyclerHighlight extends St.Widget { _init() { - super._init({ layout_manager: new Clutter.BinLayout() }); + super._init({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout(), + }); this._window = null; this._sizeChangedId = 0; - this._clone = new Clutter.Clone(); + this._clone = new Clutter.Clone({ + context: St.get_clutter_context(), + }); this.add_actor(this._clone); - this._highlight = new St.Widget({ style_class: 'cycler-highlight' }); + this._highlight = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'cycler-highlight' + }); this.add_actor(this._highlight); let coordinate = Clutter.BindCoordinate.ALL; @@ -471,6 +482,12 @@ var CyclerList = GObject.registerClass({ 'item-removed': { param_types: [GObject.TYPE_INT] }, 'item-highlighted': { param_types: [GObject.TYPE_INT] } }, }, class CyclerList extends St.Widget { + _init() { + super._init({ + context: St.get_clutter_context(), + }); + } + highlight(index, _justOutline) { this.emit('item-highlighted', index); } @@ -480,7 +497,9 @@ var CyclerPopup = GObject.registerClass({ GTypeFlags: GObject.TypeFlags.ABSTRACT, }, class CyclerPopup extends SwitcherPopup.SwitcherPopup { _init() { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); this._items = this._getWindows(); @@ -657,15 +676,21 @@ class WindowCyclerPopup extends CyclerPopup { var AppIcon = GObject.registerClass( class AppIcon extends St.BoxLayout { _init(app) { - super._init({ style_class: 'alt-tab-app', - vertical: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'alt-tab-app', + vertical: true + }); this.app = app; this.icon = null; - this._iconBin = new St.Bin(); + this._iconBin = new St.Bin({ + context: St.get_clutter_context(), + }); this.add_child(this._iconBin); this.label = new St.Label({ + context: St.get_clutter_context(), text: this.app.get_name(), x_align: Clutter.ActorAlign.CENTER, }); @@ -858,7 +883,10 @@ class AppSwitcher extends SwitcherPopup.SwitcherList { this._removeIcon(app); }); - let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' }); + let arrow = new St.DrawingArea({ + context: St.get_clutter_context(), + style_class: 'switcher-arrow' + }); arrow.connect('repaint', () => SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM)); this.add_actor(arrow); this._arrows.push(arrow); @@ -895,10 +923,16 @@ class ThumbnailSwitcher extends SwitcherPopup.SwitcherList { this._windows = windows; for (let i = 0; i < windows.length; i++) { - let box = new St.BoxLayout({ style_class: 'thumbnail-box', - vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'thumbnail-box', + vertical: true + }); - let bin = new St.Bin({ style_class: 'thumbnail' }); + let bin = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'thumbnail' + }); box.add_actor(bin); this._thumbnailBins.push(bin); @@ -906,6 +940,7 @@ class ThumbnailSwitcher extends SwitcherPopup.SwitcherList { let title = windows[i].get_title(); if (title) { let name = new St.Label({ + context: St.get_clutter_context(), text: title, // St.Label doesn't support text-align x_align: Clutter.ActorAlign.CENTER, @@ -982,15 +1017,24 @@ class ThumbnailSwitcher extends SwitcherPopup.SwitcherList { var WindowIcon = GObject.registerClass( class WindowIcon extends St.BoxLayout { _init(window, mode) { - super._init({ style_class: 'alt-tab-app', - vertical: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'alt-tab-app', + vertical: true + }); this.window = window; - this._icon = new St.Widget({ layout_manager: new Clutter.BinLayout() }); + this._icon = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout() + }); this.add_child(this._icon); - this.label = new St.Label({ text: window.get_title() }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text: window.get_title() + }); let tracker = Shell.WindowTracker.get_default(); this.app = tracker.get_window_app(window); @@ -1029,7 +1073,10 @@ class WindowIcon extends St.BoxLayout { _createAppIcon(app, size) { let appIcon = app ? app.create_icon_texture(size) - : new St.Icon({ icon_name: 'icon-missing', icon_size: size }); + : new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'icon-missing', icon_size: size + }); appIcon.x_expand = appIcon.y_expand = true; appIcon.x_align = appIcon.y_align = Clutter.ActorAlign.END; @@ -1042,8 +1089,11 @@ class WindowSwitcher extends SwitcherPopup.SwitcherList { _init(windows, mode) { super._init(true); - this._label = new St.Label({ x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER }); + this._label = new St.Label({ + context: St.get_clutter_context(), + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER + }); this.add_actor(this._label); this.windows = windows; diff --git a/js/ui/animation.js b/js/ui/animation.js index 5cb3a83c13..f1b3b9a504 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -15,6 +15,7 @@ class Animation extends St.Bin { const themeContext = St.ThemeContext.get_for_stage(global.stage); super._init({ + context: St.get_clutter_context(), style: `width: ${width}px; height: ${height}px;`, }); diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index d7dc25ee59..fa55602003 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -140,6 +140,7 @@ var BaseAppView = GObject.registerClass({ }, }, class BaseAppView extends St.Widget { _init(params = {}) { + params['context'] = St.get_clutter_context(); super._init(params); this._grid = this._createGrid(); @@ -154,6 +155,7 @@ var BaseAppView = GObject.registerClass({ // Scroll View this._scrollView = new St.ScrollView({ + context: St.get_clutter_context(), style_class: 'apps-scroll-view', clip_to_allocation: true, x_expand: true, @@ -211,6 +213,7 @@ var BaseAppView = GObject.registerClass({ // Navigation indicators this._nextPageIndicator = new St.Widget({ + context: St.get_clutter_context(), style_class: 'page-navigation-hint next', opacity: 0, visible: false, @@ -222,6 +225,7 @@ var BaseAppView = GObject.registerClass({ }); this._prevPageIndicator = new St.Widget({ + context: St.get_clutter_context(), style_class: 'page-navigation-hint previous', opacity: 0, visible: false, @@ -235,6 +239,7 @@ var BaseAppView = GObject.registerClass({ // Next/prev page arrows const rtl = this.get_text_direction() === Clutter.TextDirection.RTL; this._nextPageArrow = new St.Icon({ + context: St.get_clutter_context(), style_class: 'page-navigation-arrow', icon_name: rtl ? 'carousel-arrow-back-24-symbolic' @@ -246,6 +251,7 @@ var BaseAppView = GObject.registerClass({ x_align: Clutter.ActorAlign.END, }); this._prevPageArrow = new St.Icon({ + context: St.get_clutter_context(), style_class: 'page-navigation-arrow', icon_name: rtl ? 'carousel-arrow-next-24-symbolic' @@ -258,6 +264,7 @@ var BaseAppView = GObject.registerClass({ }); this._hintContainer = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), x_expand: true, y_expand: true, @@ -266,6 +273,7 @@ var BaseAppView = GObject.registerClass({ this._hintContainer.add_child(this._nextPageIndicator); const scrollContainer = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), clip_to_allocation: true, y_expand: true, @@ -276,6 +284,7 @@ var BaseAppView = GObject.registerClass({ scrollContainer.add_child(this._prevPageArrow); this._box = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, x_expand: true, y_expand: true, @@ -1423,6 +1432,7 @@ class AppDisplay extends BaseAppView { this._pageManager.connect('layout-changed', () => this._redisplay()); this._stack = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), x_expand: true, y_expand: true, @@ -1890,6 +1900,7 @@ var AppSearchProvider = class AppSearchProvider { let iconName = this._systemActions.getIconName(id); const createIcon = size => new St.Icon({ + context: St.get_clutter_context(), icon_name: iconName, width: size * scaleFactor, height: size * scaleFactor, @@ -1958,6 +1969,7 @@ var AppViewItem = GObject.registerClass( class AppViewItem extends St.Button { _init(params = {}, isDraggable = true, expandTitleOnHover = true) { super._init({ + context: St.get_clutter_context(), pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), reactive: true, button_mask: St.ButtonMask.ONE | St.ButtonMask.TWO, @@ -2288,6 +2300,7 @@ class FolderView extends BaseAppView { column_homogeneous: true, }); let icon = new St.Widget({ + context: St.get_clutter_context(), layout_manager: layout, x_align: Clutter.ActorAlign.CENTER, style: 'width: %dpx; height: %dpx;'.format(size, size), @@ -2299,7 +2312,10 @@ class FolderView extends BaseAppView { let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL; for (let i = 0; i < 4; i++) { const style = 'width: %dpx; height: %dpx;'.format(subSize, subSize); - let bin = new St.Bin({ style }); + let bin = new St.Bin({ + context: St.get_clutter_context(), + style + }); if (i < numItems) bin.child = this._orderedItems[i].app.create_icon_texture(subSize); layout.attach(bin, rtl ? (i + 1) % 2 : i % 2, Math.floor(i / 2), 1, 1); @@ -2599,6 +2615,7 @@ var AppFolderDialog = GObject.registerClass({ }, class AppFolderDialog extends St.Bin { _init(source, folder, appDisplay) { super._init({ + context: St.get_clutter_context(), visible: false, x_expand: true, y_expand: true, @@ -2627,6 +2644,7 @@ var AppFolderDialog = GObject.registerClass({ this._isOpen = false; this._viewBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'app-folder-dialog', x_expand: true, y_expand: true, @@ -2636,6 +2654,7 @@ var AppFolderDialog = GObject.registerClass({ }); this.child = new St.Bin({ + context: St.get_clutter_context(), style_class: 'app-folder-dialog-container', child: this._viewBox, x_align: Clutter.ActorAlign.CENTER, @@ -2663,12 +2682,15 @@ var AppFolderDialog = GObject.registerClass({ _addFolderNameEntry() { this._entryBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'folder-name-container', }); this._viewBox.add_child(this._entryBox); // Empty actor to center the title - let ghostButton = new Clutter.Actor(); + let ghostButton = new Clutter.Actor({ + context: St.get_clutter_context(), + }); this._entryBox.add_child(ghostButton); let stack = new Shell.Stack({ @@ -2679,6 +2701,7 @@ var AppFolderDialog = GObject.registerClass({ // Folder name label this._folderNameLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'folder-name-label', x_expand: true, y_expand: true, @@ -2690,6 +2713,7 @@ var AppFolderDialog = GObject.registerClass({ // Folder name entry this._entry = new St.Entry({ + context: St.get_clutter_context(), style_class: 'folder-name-entry', opacity: 0, reactive: false, @@ -2707,6 +2731,7 @@ var AppFolderDialog = GObject.registerClass({ // Edit button this._editButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'edit-folder-button', button_mask: St.ButtonMask.ONE, toggle_mode: true, @@ -2715,6 +2740,7 @@ var AppFolderDialog = GObject.registerClass({ x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.CENTER, child: new St.Icon({ + context: St.get_clutter_context(), icon_name: 'document-edit-symbolic', icon_size: 16, }), @@ -3101,8 +3127,12 @@ var AppIcon = GObject.registerClass({ this._id = app.get_id(); this._name = app.get_name(); - this._iconContainer = new St.Widget({ layout_manager: new Clutter.BinLayout(), - x_expand: true, y_expand: true }); + this._iconContainer = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout(), + x_expand: true, + y_expand: true + }); this.set_child(this._iconContainer); @@ -3114,6 +3144,7 @@ var AppIcon = GObject.registerClass({ this._iconContainer.add_child(this.icon); this._dot = new St.Widget({ + context: St.get_clutter_context(), style_class: 'app-well-app-running-dot', layout_manager: new Clutter.BinLayout(), x_expand: true, diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js index 8660663f92..985725d4c9 100644 --- a/js/ui/audioDeviceSelection.js +++ b/js/ui/audioDeviceSelection.js @@ -42,6 +42,7 @@ var AudioDeviceSelectionDialog = GObject.registerClass({ }); this._selectionBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'audio-selection-box', x_align: Clutter.ActorAlign.CENTER, x_expand: true, @@ -90,8 +91,11 @@ var AudioDeviceSelectionDialog = GObject.registerClass({ } _addDevice(device) { - let box = new St.BoxLayout({ style_class: 'audio-selection-device-box', - vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'audio-selection-device-box', + vertical: true + }); box.connect('notify::height', () => { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { box.width = box.height; @@ -99,18 +103,27 @@ var AudioDeviceSelectionDialog = GObject.registerClass({ }); }); - let icon = new St.Icon({ style_class: 'audio-selection-device-icon', - icon_name: this._getDeviceIcon(device) }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'audio-selection-device-icon', + icon_name: this._getDeviceIcon(device) + }); box.add(icon); - let label = new St.Label({ style_class: 'audio-selection-device-label', - text: this._getDeviceLabel(device), - x_align: Clutter.ActorAlign.CENTER }); + let label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'audio-selection-device-label', + text: this._getDeviceLabel(device), + x_align: Clutter.ActorAlign.CENTER + }); box.add(label); - let button = new St.Button({ style_class: 'audio-selection-device', - can_focus: true, - child: box }); + let button = new St.Button({ + context: St.get_clutter_context(), + style_class: 'audio-selection-device', + can_focus: true, + child: box + }); this._selectionBox.add(button); button.connect('clicked', () => { diff --git a/js/ui/background.js b/js/ui/background.js index 1f7c5e5720..f3d1e20078 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -94,7 +94,7 @@ // MetaBackgroundImage MetaBackgroundImage // MetaBackgroundImage MetaBackgroundImage -const { Clutter, GDesktopEnums, Gio, GLib, GObject, GnomeDesktop, Meta } = imports.gi; +const { Clutter, GDesktopEnums, Gio, GLib, GObject, GnomeDesktop, Meta, St } = imports.gi; const Signals = imports.signals; const LoginManager = imports.misc.loginManager; @@ -521,6 +521,7 @@ var SystemBackground = GObject.registerClass({ } super._init({ + context: St.get_clutter_context(), meta_display: global.display, monitor: 0, }); @@ -756,6 +757,7 @@ var BackgroundManager = class BackgroundManager { _createBackgroundActor() { let background = this._backgroundSource.getBackground(this._monitorIndex); let backgroundActor = new Meta.BackgroundActor({ + context: St.get_clutter_context(), meta_display: global.display, monitor: this._monitorIndex, request_mode: this._useContentSize diff --git a/js/ui/barLevel.js b/js/ui/barLevel.js index 25d4835280..179dc31c1c 100644 --- a/js/ui/barLevel.js +++ b/js/ui/barLevel.js @@ -26,6 +26,7 @@ var BarLevel = GObject.registerClass({ this._barLevelWidth = 0; let defaultParams = { + context: St.get_clutter_context(), style_class: 'barlevel', accessible_role: Atk.Role.LEVEL_BAR, }; diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index be9c57ce03..2909a5fd75 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -31,7 +31,9 @@ var BoxPointer = GObject.registerClass({ Signals: { 'arrow-side-changed': {} }, }, class BoxPointer extends St.Widget { _init(arrowSide, binProperties) { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); @@ -39,9 +41,15 @@ var BoxPointer = GObject.registerClass({ this._userArrowSide = arrowSide; this._arrowOrigin = 0; this._arrowActor = null; - this.bin = new St.Bin(binProperties); + const defaultBinProperties = { + context: St.get_clutter_context(), + }; + this.bin = new St.Bin(Object.assign( + defaultBinProperties, binProperties)); this.add_actor(this.bin); - this._border = new St.DrawingArea(); + this._border = new St.DrawingArea({ + context: St.get_clutter_context(), + }); this._border.connect('repaint', this._drawBorder.bind(this)); this.add_actor(this._border); this.set_child_above_sibling(this.bin, this._border); diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 8ccc73d709..a3ce935f90 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -407,6 +407,7 @@ var Calendar = GObject.registerClass({ this._shouldDateGrabFocus = false; super._init({ + context: St.get_clutter_context(), style_class: 'calendar', layout_manager: new Clutter.GridLayout(), reactive: true, @@ -454,17 +455,26 @@ var Calendar = GObject.registerClass({ this.destroy_all_children(); // Top line of the calendar '<| September 2009 |>' - this._topBox = new St.BoxLayout(); + this._topBox = new St.BoxLayout({ + context: St.get_clutter_context(), + }); layout.attach(this._topBox, 0, 0, offsetCols + 7, 1); - this._backButton = new St.Button({ style_class: 'calendar-change-month-back pager-button', - accessible_name: _("Previous month"), - can_focus: true }); - this._backButton.add_actor(new St.Icon({ icon_name: 'pan-start-symbolic' })); + this._backButton = new St.Button({ + context: St.get_clutter_context(), + style_class: 'calendar-change-month-back pager-button', + accessible_name: _("Previous month"), + can_focus: true + }); + this._backButton.add_actor(new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'pan-start-symbolic' + })); this._topBox.add(this._backButton); this._backButton.connect('clicked', this._onPrevMonthButtonClicked.bind(this)); this._monthLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'calendar-month-label', can_focus: true, x_align: Clutter.ActorAlign.CENTER, @@ -472,10 +482,16 @@ var Calendar = GObject.registerClass({ }); this._topBox.add_child(this._monthLabel); - this._forwardButton = new St.Button({ style_class: 'calendar-change-month-forward pager-button', - accessible_name: _("Next month"), - can_focus: true }); - this._forwardButton.add_actor(new St.Icon({ icon_name: 'pan-end-symbolic' })); + this._forwardButton = new St.Button({ + context: St.get_clutter_context(), + style_class: 'calendar-change-month-forward pager-button', + accessible_name: _("Next month"), + can_focus: true + }); + this._forwardButton.add_actor(new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'pan-end-symbolic' + })); this._topBox.add(this._forwardButton); this._forwardButton.connect('clicked', this._onNextMonthButtonClicked.bind(this)); @@ -491,9 +507,12 @@ var Calendar = GObject.registerClass({ // Could use iter.toLocaleFormat('%a') but that normally gives three characters // and we want, ideally, a single character for e.g. S M T W T F S let customDayAbbrev = _getCalendarDayAbbreviation(iter.getDay()); - let label = new St.Label({ style_class: 'calendar-day-base calendar-day-heading', - text: customDayAbbrev, - can_focus: true }); + let label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'calendar-day-base calendar-day-heading', + text: customDayAbbrev, + can_focus: true + }); label.accessible_name = iter.toLocaleFormat('%A'); let col; if (this.get_text_direction() == Clutter.TextDirection.RTL) @@ -623,8 +642,11 @@ var Calendar = GObject.registerClass({ let nRows = 8; while (row < nRows) { // xgettext:no-javascript-format - let button = new St.Button({ label: iter.toLocaleFormat(C_("date day number format", "%d")), - can_focus: true }); + let button = new St.Button({ + context: St.get_clutter_context(), + label: iter.toLocaleFormat(C_("date day number format", "%d")), + can_focus: true + }); let rtl = button.get_text_direction() == Clutter.TextDirection.RTL; if (this._eventSource instanceof EmptyEventSource) @@ -676,9 +698,12 @@ var Calendar = GObject.registerClass({ this._buttons.push(button); if (this._useWeekdate && iter.getDay() == 4) { - let label = new St.Label({ text: iter.toLocaleFormat('%V'), - style_class: 'calendar-day-base calendar-week-number', - can_focus: true }); + let label = new St.Label({ + context: St.get_clutter_context(), + text: iter.toLocaleFormat('%V'), + style_class: 'calendar-day-base calendar-week-number', + can_focus: true + }); let weekFormat = Shell.util_translate_time_string(N_("Week %V")); label.clutter_text.y_align = Clutter.ActorAlign.CENTER; label.accessible_name = iter.toLocaleFormat(weekFormat); @@ -746,8 +771,11 @@ class NotificationMessage extends MessageList.Message { _getIcon() { if (this.notification.gicon) { - return new St.Icon({ gicon: this.notification.gicon, - icon_size: MESSAGE_ICON_SIZE }); + return new St.Icon({ + context: St.get_clutter_context(), + gicon: this.notification.gicon, + icon_size: MESSAGE_ICON_SIZE + }); } else { return this.notification.source.createIcon(MESSAGE_ICON_SIZE); } @@ -788,6 +816,7 @@ var TimeLabel = GObject.registerClass( class NotificationTimeLabel extends St.Label { _init(datetime) { super._init({ + context: St.get_clutter_context(), style_class: 'event-time', x_align: Clutter.ActorAlign.START, y_align: Clutter.ActorAlign.END, @@ -885,15 +914,25 @@ class NotificationSection extends MessageList.MessageListSection { var Placeholder = GObject.registerClass( class Placeholder extends St.BoxLayout { _init() { - super._init({ style_class: 'message-list-placeholder', vertical: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'message-list-placeholder', + vertical: true + }); this._date = new Date(); const file = Gio.File.new_for_uri( 'resource:///org/gnome/shell/theme/no-notifications.svg'); - this._icon = new St.Icon({ gicon: new Gio.FileIcon({ file }) }); + this._icon = new St.Icon({ + context: St.get_clutter_context(), + gicon: new Gio.FileIcon({ file }) + }); this.add_actor(this._icon); - this._label = new St.Label({ text: _('No Notifications') }); + this._label = new St.Label({ + context: St.get_clutter_context(), + text: _('No Notifications') + }); this.add_actor(this._label); } }); @@ -922,6 +961,7 @@ var CalendarMessageList = GObject.registerClass( class CalendarMessageList extends St.Widget { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'message-list', layout_manager: new Clutter.BinLayout(), x_expand: true, @@ -931,11 +971,16 @@ class CalendarMessageList extends St.Widget { this._placeholder = new Placeholder(); this.add_actor(this._placeholder); - let box = new St.BoxLayout({ vertical: true, - x_expand: true, y_expand: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + x_expand: true, + y_expand: true + }); this.add_actor(box); this._scrollView = new St.ScrollView({ + context: St.get_clutter_context(), style_class: 'vfade', overlay_scrollbars: true, x_expand: true, y_expand: true, @@ -943,10 +988,14 @@ class CalendarMessageList extends St.Widget { this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); box.add_actor(this._scrollView); - let hbox = new St.BoxLayout({ style_class: 'message-list-controls' }); + let hbox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'message-list-controls' + }); box.add_child(hbox); const dndLabel = new St.Label({ + context: St.get_clutter_context(), text: _('Do Not Disturb'), y_align: Clutter.ActorAlign.CENTER, }); @@ -954,6 +1003,7 @@ class CalendarMessageList extends St.Widget { this._dndSwitch = new DoNotDisturbSwitch(); this._dndButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'dnd-button', can_focus: true, toggle_mode: true, @@ -967,6 +1017,7 @@ class CalendarMessageList extends St.Widget { hbox.add_child(this._dndButton); this._clearButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'message-list-clear-button button', label: _('Clear'), can_focus: true, @@ -982,11 +1033,14 @@ class CalendarMessageList extends St.Widget { this._clearButton, 'visible', GObject.BindingFlags.INVERT_BOOLEAN); - 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 = new St.BoxLayout({ + context: St.get_clutter_context(), + 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)); this._sectionList.connect('actor-removed', this._sync.bind(this)); this._scrollView.add_actor(this._sectionList); diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js index d64bd0d6c2..0489ea6626 100644 --- a/js/ui/checkBox.js +++ b/js/ui/checkBox.js @@ -5,10 +5,12 @@ var CheckBox = GObject.registerClass( class CheckBox extends St.Button { _init(label) { let container = new St.BoxLayout({ + context: St.get_clutter_context(), x_expand: true, y_expand: true, }); super._init({ + context: St.get_clutter_context(), style_class: 'check-box', child: container, button_mask: St.ButtonMask.ONE, @@ -17,10 +19,16 @@ class CheckBox extends St.Button { }); this.set_accessible_role(Atk.Role.CHECK_BOX); - this._box = new St.Bin({ y_align: Clutter.ActorAlign.START }); + this._box = new St.Bin({ + context: St.get_clutter_context(), + y_align: Clutter.ActorAlign.START + }); container.add_actor(this._box); - this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); + this._label = new St.Label({ + context: St.get_clutter_context(), + y_align: Clutter.ActorAlign.CENTER + }); this._label.clutter_text.set_line_wrap(true); this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); this.set_label_actor(this._label); diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js index cc7b41274f..cac6e88a07 100644 --- a/js/ui/components/autorunManager.js +++ b/js/ui/components/autorunManager.js @@ -320,25 +320,34 @@ class AutorunNotification extends MessageTray.Notification { _buttonForApp(app) { let box = new St.BoxLayout({ + context: St.get_clutter_context(), x_expand: true, x_align: Clutter.ActorAlign.START, }); - let icon = new St.Icon({ gicon: app.get_icon(), - style_class: 'hotplug-notification-item-icon' }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + gicon: app.get_icon(), + style_class: 'hotplug-notification-item-icon' + }); box.add(icon); let label = new St.Bin({ + context: St.get_clutter_context(), child: new St.Label({ + context: St.get_clutter_context(), text: _("Open with %s").format(app.get_name()), y_align: Clutter.ActorAlign.CENTER, }), }); box.add(label); - let button = new St.Button({ child: box, - x_expand: true, - button_mask: St.ButtonMask.ONE, - style_class: 'hotplug-notification-item button' }); + let button = new St.Button({ + context: St.get_clutter_context(), + child: box, + x_expand: true, + button_mask: St.ButtonMask.ONE, + style_class: 'hotplug-notification-item button' + }); button.connect('clicked', () => { startAppForMount(app, this._mount); diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js index 8623f2fdd4..b56b015ca3 100644 --- a/js/ui/components/keyring.js +++ b/js/ui/components/keyring.js @@ -27,11 +27,13 @@ class KeyringDialog extends ModalDialog.ModalDialog { content, 'description', GObject.BindingFlags.SYNC_CREATE); let passwordBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-layout', vertical: true, }); this._passwordEntry = new St.PasswordEntry({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-entry', can_focus: true, x_align: Clutter.ActorAlign.CENTER, @@ -43,6 +45,7 @@ class KeyringDialog extends ModalDialog.ModalDialog { passwordBox.add_child(this._passwordEntry); this._confirmEntry = new St.PasswordEntry({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-entry', can_focus: true, x_align: Clutter.ActorAlign.CENTER, @@ -56,7 +59,10 @@ class KeyringDialog extends ModalDialog.ModalDialog { this.prompt.set_password_actor(this._passwordEntry.clutter_text); this.prompt.set_confirm_actor(this._confirmEntry.clutter_text); - let warningBox = new St.BoxLayout({ vertical: true }); + let warningBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); let capsLockWarning = new ShellEntry.CapsLockWarning(); let syncCapsLockWarningVisibility = () => { @@ -67,7 +73,10 @@ class KeyringDialog extends ModalDialog.ModalDialog { this.prompt.connect('notify::confirm-visible', syncCapsLockWarningVisibility); warningBox.add_child(capsLockWarning); - let warning = new St.Label({ style_class: 'prompt-dialog-error-label' }); + let warning = new St.Label({ + context: St.get_clutter_context(), + style_class: 'prompt-dialog-error-label' + }); warning.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; warning.clutter_text.line_wrap = true; this.prompt.bind_property('warning', diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index 92e499302a..15b5917822 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -43,6 +43,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog { let reactive = secret.key != null; let entryParams = { + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-entry', hint_text: secret.label, text: secret.value, @@ -89,6 +90,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog { if (flags & NM.SecretAgentGetSecretsFlags.WPS_PBC_ACTIVE) { let descriptionLabel = new St.Label({ + context: St.get_clutter_context(), text: _('Alternatively you can connect by pushing the “WPS” button on your router.'), style_class: 'message-dialog-description', }); diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index 5127ab924d..2812ee2652 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -58,6 +58,7 @@ var AuthenticationDialog = GObject.registerClass({ this._user = AccountsService.UserManager.get_default().get_user(userName); let userBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'polkit-dialog-user-layout', vertical: true, }); @@ -70,6 +71,7 @@ var AuthenticationDialog = GObject.registerClass({ userBox.add_child(this._userAvatar); this._userLabel = new St.Label({ + context: St.get_clutter_context(), style_class: userName === 'root' ? 'polkit-dialog-user-root-label' : 'polkit-dialog-user-label', @@ -81,11 +83,13 @@ var AuthenticationDialog = GObject.registerClass({ userBox.add_child(this._userLabel); let passwordBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-layout', vertical: true, }); this._passwordEntry = new St.PasswordEntry({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-entry', text: "", can_focus: true, @@ -99,7 +103,10 @@ var AuthenticationDialog = GObject.registerClass({ GObject.BindingFlags.SYNC_CREATE); passwordBox.add_child(this._passwordEntry); - let warningBox = new St.BoxLayout({ vertical: true }); + let warningBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); let capsLockWarning = new ShellEntry.CapsLockWarning(); this._passwordEntry.bind_property('visible', @@ -108,6 +115,7 @@ var AuthenticationDialog = GObject.registerClass({ warningBox.add_child(capsLockWarning); this._errorMessageLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-error-label', visible: false, }); @@ -116,6 +124,7 @@ var AuthenticationDialog = GObject.registerClass({ warningBox.add_child(this._errorMessageLabel); this._infoMessageLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-info-label', visible: false, }); @@ -127,7 +136,10 @@ var AuthenticationDialog = GObject.registerClass({ * infoMessage and errorMessageLabel - but it is still invisible because * gnome-shell.css sets the color to be transparent */ - this._nullMessageLabel = new St.Label({ style_class: 'prompt-dialog-null-label' }); + this._nullMessageLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'prompt-dialog-null-label' + }); this._nullMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this._nullMessageLabel.clutter_text.line_wrap = true; warningBox.add_child(this._nullMessageLabel); diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index 103688259c..3b0da9f5e8 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -831,6 +831,12 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({ var ChatLineBox = GObject.registerClass( class ChatLineBox extends St.BoxLayout { + _init() { + super._init({ + context: St.get_clutter_context(), + }); + } + vfunc_get_preferred_height(forWidth) { let [, natHeight] = super.vfunc_get_preferred_height(forWidth); return [natHeight, natHeight]; @@ -842,9 +848,12 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner { _init(notification) { super._init(notification); - this._responseEntry = new St.Entry({ style_class: 'chat-response', - x_expand: true, - can_focus: true }); + this._responseEntry = new St.Entry({ + context: St.get_clutter_context(), + style_class: 'chat-response', + x_expand: true, + can_focus: true + }); this._responseEntry.clutter_text.connect('activate', this._onEntryActivated.bind(this)); this._responseEntry.clutter_text.connect('text-changed', this._onEntryChanged.bind(this)); this.setActionArea(this._responseEntry); @@ -857,12 +866,18 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner { this.emit('unfocused'); }); - this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade', - vscrollbar_policy: St.PolicyType.AUTOMATIC, - hscrollbar_policy: St.PolicyType.NEVER, - visible: this.expanded }); - this._contentArea = new St.BoxLayout({ style_class: 'chat-body', - vertical: true }); + this._scrollArea = new St.ScrollView({ + context: St.get_clutter_context(), + style_class: 'chat-scrollview vfade', + vscrollbar_policy: St.PolicyType.AUTOMATIC, + hscrollbar_policy: St.PolicyType.NEVER, + visible: this.expanded + }); + this._contentArea = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'chat-body', + vertical: true + }); this._scrollArea.add_actor(this._contentArea); this.setExpandedBody(this._scrollArea); diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js index fbc7a0f5fc..87226939dd 100644 --- a/js/ui/ctrlAltTab.js +++ b/js/ui/ctrlAltTab.js @@ -94,6 +94,7 @@ var CtrlAltTabManager = class CtrlAltTabManager { icon = app.create_icon_texture(POPUP_APPICON_SIZE); } else { icon = new St.Icon({ + context: St.get_clutter_context(), gicon: textureCache.bind_cairo_surface_property(windows[i], 'icon'), icon_size: POPUP_APPICON_SIZE, }); @@ -171,17 +172,24 @@ class CtrlAltTabSwitcher extends SwitcherPopup.SwitcherList { } _addIcon(item) { - let box = new St.BoxLayout({ style_class: 'alt-tab-app', - vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'alt-tab-app', + vertical: true + }); let icon = item.iconActor; if (!icon) { - icon = new St.Icon({ icon_name: item.iconName, - icon_size: POPUP_APPICON_SIZE }); + icon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: item.iconName, + icon_size: POPUP_APPICON_SIZE + }); } box.add_child(icon); let text = new St.Label({ + context: St.get_clutter_context(), text: item.name, x_align: Clutter.ActorAlign.CENTER, }); diff --git a/js/ui/dash.js b/js/ui/dash.js index 08902c436a..e98c287a3b 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -58,6 +58,7 @@ var DashItemContainer = GObject.registerClass( class DashItemContainer extends St.Widget { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'dash-item-container', pivot_point: new Graphene.Point({ x: .5, y: .5 }), layout_manager: new Clutter.BinLayout(), @@ -69,7 +70,10 @@ class DashItemContainer extends St.Widget { }); this._labelText = ""; - this.label = new St.Label({ style_class: 'dash-label' }); + this.label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'dash-label' + }); this.label.hide(); Main.layoutManager.addChrome(this.label); this.label_actor = this.label; @@ -196,10 +200,13 @@ class ShowAppsIcon extends DashItemContainer { _init() { super._init(); - this.toggleButton = new St.Button({ style_class: 'show-apps', - track_hover: true, - can_focus: true, - toggle_mode: true }); + this.toggleButton = new St.Button({ + context: St.get_clutter_context(), + style_class: 'show-apps', + track_hover: true, + can_focus: true, + toggle_mode: true + }); this._iconActor = null; this.icon = new IconGrid.BaseIcon(_("Show Applications"), { setSizeManually: true, @@ -215,10 +222,13 @@ class ShowAppsIcon extends DashItemContainer { } _createIcon(size) { - this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic', - icon_size: size, - style_class: 'show-apps-icon', - track_hover: true }); + this._iconActor = new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'view-app-grid-symbolic', + icon_size: size, + style_class: 'show-apps-icon', + track_hover: true + }); return this._iconActor; } @@ -274,7 +284,10 @@ var DragPlaceholderItem = GObject.registerClass( class DragPlaceholderItem extends DashItemContainer { _init() { super._init(); - this.setChild(new St.Bin({ style_class: 'placeholder' })); + this.setChild(new St.Bin({ + context: St.get_clutter_context(), + style_class: 'placeholder' + })); } }); @@ -282,7 +295,10 @@ var EmptyDropTargetItem = GObject.registerClass( class EmptyDropTargetItem extends DashItemContainer { _init() { super._init(); - this.setChild(new St.Bin({ style_class: 'empty-dash-drop-target' })); + this.setChild(new St.Bin({ + context: St.get_clutter_context(), + style_class: 'empty-dash-drop-target' + })); } }); @@ -320,17 +336,20 @@ var Dash = GObject.registerClass({ this._labelShowing = false; super._init({ + context: St.get_clutter_context(), name: 'dash', offscreen_redirect: Clutter.OffscreenRedirect.ALWAYS, layout_manager: new Clutter.BinLayout(), }); this._dashContainer = new St.BoxLayout({ + context: St.get_clutter_context(), x_align: Clutter.ActorAlign.CENTER, y_expand: true, }); this._box = new St.Widget({ + context: St.get_clutter_context(), clip_to_allocation: true, layout_manager: new DashIconsLayout(), y_expand: true, @@ -348,10 +367,13 @@ var Dash = GObject.registerClass({ this.showAppsButton = this._showAppsIcon.toggleButton; this._background = new St.Widget({ + context: St.get_clutter_context(), style_class: 'dash-background', }); - const sizerBox = new Clutter.Actor(); + const sizerBox = new Clutter.Actor({ + context: St.get_clutter_context(), + }); sizerBox.add_constraint(new Clutter.BindConstraint({ source: this._showAppsIcon.icon, coordinate: Clutter.BindCoordinate.HEIGHT, @@ -801,6 +823,7 @@ var Dash = GObject.registerClass({ if (nFavorites > 0 && nFavorites < nIcons) { if (!this._separator) { this._separator = new St.Widget({ + context: St.get_clutter_context(), style_class: 'dash-separator', y_align: Clutter.ActorAlign.CENTER, height: this.iconSize, diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 33c054c12f..cfc3feef41 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -40,20 +40,30 @@ class TodayButton extends St.Button { // on the current date can be confusing. So don't make the button reactive // until the selected date changes. super._init({ + context: St.get_clutter_context(), style_class: 'datemenu-today-button', x_expand: true, can_focus: true, reactive: false, }); - let hbox = new St.BoxLayout({ vertical: true }); + let hbox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); this.add_actor(hbox); - this._dayLabel = new St.Label({ style_class: 'day-label', - x_align: Clutter.ActorAlign.START }); + this._dayLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'day-label', + x_align: Clutter.ActorAlign.START + }); hbox.add_actor(this._dayLabel); - this._dateLabel = new St.Label({ style_class: 'date-label' }); + this._dateLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'date-label' + }); hbox.add_actor(this._dateLabel); this._calendar = calendar; @@ -92,10 +102,12 @@ var EventsSection = GObject.registerClass( class EventsSection extends St.Button { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'events-button', can_focus: true, x_expand: true, child: new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'events-box', vertical: true, x_expand: true, @@ -109,11 +121,13 @@ class EventsSection extends St.Button { this._calendarApp = null; this._title = new St.Label({ + context: St.get_clutter_context(), style_class: 'events-title', }); this.child.add_child(this._title); this._eventsList = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'events-list', vertical: true, x_expand: true, @@ -212,14 +226,17 @@ class EventsSection extends St.Button { for (let event of events) { const box = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'event-box', vertical: true, }); box.add(new St.Label({ + context: St.get_clutter_context(), text: event.summary, style_class: 'event-summary', })); box.add(new St.Label({ + context: St.get_clutter_context(), text: this._formatEventTime(event), style_class: 'event-time', })); @@ -228,6 +245,7 @@ class EventsSection extends St.Button { if (this._eventsList.get_n_children() === 0) { const placeholder = new St.Label({ + context: St.get_clutter_context(), text: _('No Events'), style_class: 'event-placeholder', }); @@ -274,6 +292,7 @@ var WorldClocksSection = GObject.registerClass( class WorldClocksSection extends St.Button { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'world-clocks-button', can_focus: true, x_expand: true, @@ -285,9 +304,12 @@ class WorldClocksSection extends St.Button { this._locations = []; 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 }); + this._grid = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'world-clocks-grid', + x_expand: true, + layout_manager: layout + }); layout.hookup_style(this._grid); this.child = this._grid; @@ -347,9 +369,12 @@ class WorldClocksSection extends St.Button { let title = this._locations.length == 0 ? _("Add world clocks…") : _("World Clocks"); - let header = new St.Label({ style_class: 'world-clocks-header', - x_align: Clutter.ActorAlign.START, - text: title }); + let header = new St.Label({ + context: St.get_clutter_context(), + style_class: 'world-clocks-header', + x_align: Clutter.ActorAlign.START, + text: title + }); layout.attach(header, 0, 0, 2, 1); this.label_actor = header; @@ -357,15 +382,19 @@ class WorldClocksSection extends St.Button { let l = this._locations[i].location; let name = l.get_city_name() || l.get_name(); - let label = new St.Label({ style_class: 'world-clocks-city', - text: name, - x_align: Clutter.ActorAlign.START, - y_align: Clutter.ActorAlign.CENTER, - x_expand: true }); + let label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'world-clocks-city', + text: name, + x_align: Clutter.ActorAlign.START, + y_align: Clutter.ActorAlign.CENTER, + x_expand: true + }); let time = new St.Label({ style_class: 'world-clocks-time' }); const tz = new St.Label({ + context: St.get_clutter_context(), style_class: 'world-clocks-timezone', x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.CENTER, @@ -470,6 +499,7 @@ var WeatherSection = GObject.registerClass( class WeatherSection extends St.Button { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'weather-button', can_focus: true, x_expand: true, @@ -478,6 +508,7 @@ class WeatherSection extends St.Button { this._weatherClient = new Weather.WeatherClient(); let box = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'weather-box', vertical: true, x_expand: true, @@ -485,8 +516,12 @@ class WeatherSection extends St.Button { this.child = box; - let titleBox = new St.BoxLayout({ style_class: 'weather-header-box' }); + let titleBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'weather-header-box' + }); this._titleLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'weather-header', x_align: Clutter.ActorAlign.START, x_expand: true, @@ -496,6 +531,7 @@ class WeatherSection extends St.Button { box.add_child(titleBox); this._titleLocation = new St.Label({ + context: St.get_clutter_context(), style_class: 'weather-header location', x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.END, @@ -504,6 +540,7 @@ class WeatherSection extends St.Button { let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL }); this._forecastGrid = new St.Widget({ + context: St.get_clutter_context(), style_class: 'weather-grid', layout_manager: layout, }); @@ -570,17 +607,20 @@ class WeatherSection extends St.Button { const tempPrefix = Math.round(tempValue) >= 0 ? ' ' : ''; let time = new St.Label({ + context: St.get_clutter_context(), style_class: 'weather-forecast-time', text: timeStr, x_align: Clutter.ActorAlign.CENTER, }); let icon = new St.Icon({ + context: St.get_clutter_context(), style_class: 'weather-forecast-icon', icon_name: fc.get_symbolic_icon_name(), x_align: Clutter.ActorAlign.CENTER, x_expand: true, }); let temp = new St.Label({ + context: St.get_clutter_context(), style_class: 'weather-forecast-temp', text: '%s%d°'.format(tempPrefix, Math.round(tempValue)), x_align: Clutter.ActorAlign.CENTER, @@ -598,7 +638,10 @@ class WeatherSection extends St.Button { _setStatusLabel(text) { let layout = this._forecastGrid.layout_manager; - let label = new St.Label({ text }); + let label = new St.Label({ + context: St.get_clutter_context(), + text: text + }); layout.attach(label, 0, 0, 1, 1); } @@ -663,6 +706,7 @@ var MessagesIndicator = GObject.registerClass( class MessagesIndicator extends St.Icon { _init() { super._init({ + context: St.get_clutter_context(), icon_size: 16, visible: false, y_expand: true, @@ -787,13 +831,18 @@ class DateMenuButton extends PanelMenu.Button { super._init(0.5); - this._clockDisplay = new St.Label({ style_class: 'clock' }); + this._clockDisplay = new St.Label({ + context: St.get_clutter_context(), + style_class: 'clock' + }); this._clockDisplay.clutter_text.y_align = Clutter.ActorAlign.CENTER; this._clockDisplay.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this._indicator = new MessagesIndicator(); - const indicatorPad = new St.Widget(); + const indicatorPad = new St.Widget({ + context: St.get_clutter_context(), + }); this._indicator.bind_property('visible', indicatorPad, 'visible', GObject.BindingFlags.SYNC_CREATE); @@ -802,7 +851,10 @@ class DateMenuButton extends PanelMenu.Button { coordinate: Clutter.BindCoordinate.SIZE, })); - let box = new St.BoxLayout({ style_class: 'clock-display-box' }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'clock-display-box' + }); box.add_actor(indicatorPad); box.add_actor(this._clockDisplay); box.add_actor(this._indicator); @@ -812,12 +864,18 @@ class DateMenuButton extends PanelMenu.Button { this.add_style_class_name('clock-display'); let layout = new FreezableBinLayout(); - let bin = new St.Widget({ layout_manager: layout }); + let bin = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: layout + }); // For some minimal compatibility with PopupMenuItem bin._delegate = this; this.menu.box.add_child(bin); - hbox = new St.BoxLayout({ name: 'calendarArea' }); + hbox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'calendarArea' + }); bin.add_actor(hbox); this._calendar = new Calendar.Calendar(); @@ -844,23 +902,32 @@ class DateMenuButton extends PanelMenu.Button { // Fill up the second column const boxLayout = new CalendarColumnLayout([this._calendar, this._date]); - vbox = new St.Widget({ style_class: 'datemenu-calendar-column', - layout_manager: boxLayout }); + vbox = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'datemenu-calendar-column', + layout_manager: boxLayout + }); boxLayout.hookup_style(vbox); hbox.add(vbox); vbox.add_actor(this._date); vbox.add_actor(this._calendar); - this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade', - x_expand: true, - overlay_scrollbars: true }); + this._displaysSection = new St.ScrollView({ + context: St.get_clutter_context(), + style_class: 'datemenu-displays-section vfade', + x_expand: true, + overlay_scrollbars: true + }); this._displaysSection.set_policy(St.PolicyType.NEVER, St.PolicyType.EXTERNAL); vbox.add_actor(this._displaysSection); - let displaysBox = new St.BoxLayout({ vertical: true, - x_expand: true, - style_class: 'datemenu-displays-box' }); + let displaysBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + x_expand: true, + style_class: 'datemenu-displays-box' + }); this._displaysSection.add_actor(displaysBox); this._eventsItem = new EventsSection(); diff --git a/js/ui/dialog.js b/js/ui/dialog.js index 9513a8151a..bad2bbf651 100644 --- a/js/ui/dialog.js +++ b/js/ui/dialog.js @@ -13,7 +13,10 @@ function _setLabel(label, value) { var Dialog = GObject.registerClass( class Dialog extends St.Widget { _init(parentActor, styleClass) { - super._init({ layout_manager: new Clutter.BinLayout() }); + super._init({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout() + }); this.connect('destroy', this._onDestroy.bind(this)); this._initialKeyFocus = null; @@ -33,6 +36,7 @@ class Dialog extends St.Widget { _createDialog() { this._dialog = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'modal-dialog', x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, @@ -46,6 +50,7 @@ class Dialog extends St.Widget { this._dialog.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); this.contentLayout = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, style_class: 'modal-dialog-content-box', y_expand: true, @@ -53,6 +58,7 @@ class Dialog extends St.Widget { this._dialog.add_child(this.contentLayout); this.buttonLayout = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BoxLayout({ homogeneous: true }), }); this._dialog.add_child(this.buttonLayout); @@ -125,6 +131,7 @@ class Dialog extends St.Widget { keys = []; let button = new St.Button({ + context: St.get_clutter_context(), style_class: 'modal-dialog-linked-button', button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, reactive: true, @@ -172,13 +179,20 @@ var MessageDialogContent = GObject.registerClass({ }, }, class MessageDialogContent extends St.BoxLayout { _init(params) { - this._title = new St.Label({ style_class: 'message-dialog-title' }); - this._description = new St.Label({ style_class: 'message-dialog-description' }); + this._title = new St.Label({ + context: St.get_clutter_context(), + style_class: 'message-dialog-title' + }); + this._description = new St.Label({ + context: St.get_clutter_context(), + style_class: 'message-dialog-description' + }); this._description.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this._description.clutter_text.line_wrap = true; let defaultParams = { + context: St.get_clutter_context(), style_class: 'message-dialog-content', x_expand: true, vertical: true, @@ -257,20 +271,26 @@ var ListSection = GObject.registerClass({ }, }, class ListSection extends St.BoxLayout { _init(params) { - this._title = new St.Label({ style_class: 'dialog-list-title' }); + this._title = new St.Label({ + context: St.get_clutter_context(), + style_class: 'dialog-list-title' + }); this._listScrollView = new St.ScrollView({ + context: St.get_clutter_context(), style_class: 'dialog-list-scrollview', hscrollbar_policy: St.PolicyType.NEVER, }); this.list = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'dialog-list-box', vertical: true, }); this._listScrollView.add_actor(this.list); let defaultParams = { + context: St.get_clutter_context(), style_class: 'dialog-list', x_expand: true, vertical: true, @@ -311,24 +331,34 @@ var ListSectionItem = GObject.registerClass({ }, }, class ListSectionItem extends St.BoxLayout { _init(params) { - this._iconActorBin = new St.Bin(); + this._iconActorBin = new St.Bin({ + context: St.get_clutter_context(), + }); let textLayout = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, y_expand: true, y_align: Clutter.ActorAlign.CENTER, }); - this._title = new St.Label({ style_class: 'dialog-list-item-title' }); + this._title = new St.Label({ + context: St.get_clutter_context(), + style_class: 'dialog-list-item-title' + }); this._description = new St.Label({ + context: St.get_clutter_context(), style_class: 'dialog-list-item-title-description', }); textLayout.add_child(this._title); textLayout.add_child(this._description); - let defaultParams = { style_class: 'dialog-list-item' }; + let defaultParams = { + context: St.get_clutter_context(), + style_class: 'dialog-list-item' + }; super._init(Object.assign(defaultParams, params)); this.label_actor = this._title; diff --git a/js/ui/dnd.js b/js/ui/dnd.js index cefde6f603..a58ff5b871 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -45,7 +45,11 @@ let currentDraggable = null; function _getEventHandlerActor() { if (!eventHandlerActor) { - eventHandlerActor = new Clutter.Actor({ width: 0, height: 0 }); + eventHandlerActor = new Clutter.Actor({ + context: St.get_clutter_context(), + width: 0, + height: 0 + }); Main.uiGroup.add_actor(eventHandlerActor); // We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen // when you've grabbed the pointer. diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js index 1fdbd11b93..e088ccdac8 100644 --- a/js/ui/endSessionDialog.js +++ b/js/ui/endSessionDialog.js @@ -280,6 +280,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog { this._messageDialogContent.add_child(this._checkBox); this._batteryWarning = new St.Label({ + context: St.get_clutter_context(), style_class: 'end-session-dialog-battery-warning', text: _('Low battery power: please plug in before installing updates.'), }); diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index 5a9fe77928..ec439b30f4 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -24,17 +24,27 @@ var CandidateArea = GObject.registerClass({ }, class CandidateArea extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), vertical: true, reactive: true, visible: false, }); this._candidateBoxes = []; for (let i = 0; i < MAX_CANDIDATES_PER_PAGE; ++i) { - let box = new St.BoxLayout({ style_class: 'candidate-box', - reactive: true, - track_hover: true }); - box._indexLabel = new St.Label({ style_class: 'candidate-index' }); - box._candidateLabel = new St.Label({ style_class: 'candidate-label' }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'candidate-box', + reactive: true, + track_hover: true + }); + box._indexLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'candidate-index' + }); + box._candidateLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'candidate-label' + }); box.add_child(box._indexLabel); box.add_child(box._candidateLabel); this._candidateBoxes.push(box); @@ -47,20 +57,31 @@ var CandidateArea = GObject.registerClass({ }); } - this._buttonBox = new St.BoxLayout({ style_class: 'candidate-page-button-box' }); + this._buttonBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'candidate-page-button-box' + }); this._previousButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'candidate-page-button candidate-page-button-previous button', x_expand: true, }); - this._previousButton.child = new St.Icon({ style_class: 'candidate-page-button-icon' }); + this._previousButton.child = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'candidate-page-button-icon' + }); this._buttonBox.add_child(this._previousButton); this._nextButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'candidate-page-button candidate-page-button-next button', x_expand: true, }); - this._nextButton.child = new St.Icon({ style_class: 'candidate-page-button-icon' }); + this._nextButton.child = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'candidate-page-button-icon' + }); this._buttonBox.add_child(this._nextButton); this.add(this._buttonBox); @@ -146,21 +167,33 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer { this.visible = false; this.style_class = 'candidate-popup-boxpointer'; - this._dummyCursor = new Clutter.Actor({ opacity: 0 }); + this._dummyCursor = new Clutter.Actor({ + context: St.get_clutter_context(), + opacity: 0 + }); Main.layoutManager.uiGroup.add_actor(this._dummyCursor); Main.layoutManager.addChrome(this); - let box = new St.BoxLayout({ style_class: 'candidate-popup-content', - vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'candidate-popup-content', + vertical: true + }); this.bin.set_child(box); - this._preeditText = new St.Label({ style_class: 'candidate-popup-text', - visible: false }); + this._preeditText = new St.Label({ + context: St.get_clutter_context(), + style_class: 'candidate-popup-text', + visible: false + }); box.add(this._preeditText); - this._auxText = new St.Label({ style_class: 'candidate-popup-text', - visible: false }); + this._auxText = new St.Label({ + context: St.get_clutter_context(), + style_class: 'candidate-popup-text', + visible: false + }); box.add(this._auxText); this._candidateArea = new CandidateArea(); diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 65b130ce74..4153f0989b 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -76,11 +76,15 @@ class BaseIcon extends Shell.SquareBin { if (params.showLabel) styleClass += ' overview-icon-with-label'; - super._init({ style_class: styleClass }); + super._init({ + context: St.get_clutter_context(), + style_class: styleClass + }); this.connect('destroy', this._onDestroy.bind(this)); this._box = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, x_expand: true, y_expand: true, @@ -88,12 +92,18 @@ class BaseIcon extends Shell.SquareBin { this.set_child(this._box); this.iconSize = ICON_SIZE; - this._iconBin = new St.Bin({ x_align: Clutter.ActorAlign.CENTER }); + this._iconBin = new St.Bin({ + context: St.get_clutter_context(), + x_align: Clutter.ActorAlign.CENTER + }); this._box.add_actor(this._iconBin); if (params.showLabel) { - this.label = new St.Label({ text: label }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text: label + }); this.label.clutter_text.set({ x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, @@ -198,6 +208,7 @@ function zoomOutActorAtPos(actor, x, y) { return; const actorClone = new Clutter.Clone({ + context: St.get_clutter_context(), source: actor, reactive: false, }); @@ -1179,6 +1190,7 @@ var IconGrid = GObject.registerClass({ () => this.emit('pages-changed')); super._init({ + context: St.get_clutter_context(), style_class: 'icon-grid', layoutManager, x_expand: true, @@ -1510,7 +1522,10 @@ var IconGrid = GObject.registerClass({ let normalization = maxDist - minDist; actors.forEach(actor => { - let clone = new Clutter.Clone({ source: actor }); + let clone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: actor + }); this._clonesAnimating.push(clone); Main.uiGroup.add_actor(clone); }); diff --git a/js/ui/inhibitShortcutsDialog.js b/js/ui/inhibitShortcutsDialog.js index c59544eaf9..e2b9b5216b 100644 --- a/js/ui/inhibitShortcutsDialog.js +++ b/js/ui/inhibitShortcutsDialog.js @@ -86,6 +86,7 @@ var InhibitShortcutsDialog = GObject.registerClass({ let restoreAccel = this._getRestoreAccel(); if (restoreAccel) { let restoreLabel = new St.Label({ + context: St.get_clutter_context(), /* Translators: %s is a keyboard shortcut like "Super+x" */ text: _('You can restore shortcuts by pressing %s.').format(restoreAccel), style_class: 'message-dialog-description', diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 639a742737..c4d659c02b 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -53,7 +53,10 @@ const defaultKeysPost = [ var AspectContainer = GObject.registerClass( class AspectContainer extends St.Widget { _init(params) { - super._init(params); + const defaultParams = { + context: St.get_clutter_context(), + }; + super._init(Object.assign(defaultParams, params)); this._ratio = 1; } @@ -109,6 +112,7 @@ class KeyContainer extends St.Widget { column_homogeneous: true, row_homogeneous: true }); super._init({ + context: St.get_clutter_context(), layout_manager: gridLayout, x_expand: true, y_expand: true, @@ -187,6 +191,7 @@ var Suggestions = GObject.registerClass( class Suggestions extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'word-suggestions', vertical: false, x_align: Clutter.ActorAlign.CENTER, @@ -195,7 +200,10 @@ class Suggestions extends St.BoxLayout { } add(word, callback) { - let button = new St.Button({ label: word }); + let button = new St.Button({ + context: St.get_clutter_context(), + label: word + }); button.connect('clicked', callback); this.add_child(button); } @@ -277,7 +285,10 @@ var Key = GObject.registerClass({ }, }, class Key extends St.BoxLayout { _init(key, extendedKeys, icon = null) { - super._init({ style_class: 'key-container' }); + super._init({ + context: St.get_clutter_context(), + style_class: 'key-container' + }); this.key = key || ""; this.keyButton = this._makeKey(this.key, icon); @@ -422,12 +433,16 @@ var Key = GObject.registerClass({ _makeKey(key, icon) { let button = new St.Button({ + context: St.get_clutter_context(), style_class: 'keyboard-key', x_expand: true, }); if (icon) { - let child = new St.Icon({ icon_name: icon }); + let child = new St.Icon({ + context: St.get_clutter_context(), + icon_name: icon + }); button.set_child(child); this._icon = child; } else { @@ -477,6 +492,7 @@ var Key = GObject.registerClass({ _getExtendedKeys() { this._extendedKeyboard = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'key-container', vertical: false, }); @@ -679,6 +695,7 @@ var EmojiPager = GObject.registerClass({ }, class EmojiPager extends St.Widget { _init(sections, nCols, nRows) { super._init({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), reactive: true, clip_to_allocation: true, @@ -860,15 +877,20 @@ var EmojiPager = GObject.registerClass({ let gridLayout = new Clutter.GridLayout({ orientation: Clutter.Orientation.HORIZONTAL, column_homogeneous: true, row_homogeneous: true }); - let panel = new St.Widget({ layout_manager: gridLayout, - style_class: 'emoji-page', - x_expand: true, - y_expand: true }); + let panel = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: gridLayout, + style_class: 'emoji-page', + x_expand: true, + y_expand: true + }); /* Set an expander actor so all proportions are right despite the panel * not having all rows/cols filled in. */ - let expander = new Clutter.Actor(); + let expander = new Clutter.Actor({ + context: St.get_clutter_context(), + }); gridLayout.attach(expander, 0, 0, this._nCols, this._nRows); let page = this._pages[nPage]; @@ -960,6 +982,7 @@ var EmojiSelection = GObject.registerClass({ }, class EmojiSelection extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'emoji-panel', x_expand: true, y_expand: true, @@ -1139,7 +1162,12 @@ var Keypad = GObject.registerClass({ let gridLayout = new Clutter.GridLayout({ orientation: Clutter.Orientation.HORIZONTAL, column_homogeneous: true, row_homogeneous: true }); - this._box = new St.Widget({ layout_manager: gridLayout, x_expand: true, y_expand: true }); + this._box = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: gridLayout, + x_expand: true, + y_expand: true + }); this.add_child(this._box); for (let i = 0; i < keys.length; i++) { @@ -1274,7 +1302,12 @@ var Keyboard = GObject.registerClass({ }, }, class Keyboard extends St.BoxLayout { _init() { - super._init({ name: 'keyboard', reactive: true, vertical: true }); + super._init({ + context: St.get_clutter_context(), + name: 'keyboard', + reactive: true, + vertical: true + }); this._focusInExtendedKeys = false; this._emojiActive = false; diff --git a/js/ui/layout.js b/js/ui/layout.js index e3c5f49755..40f4f5e279 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -211,7 +211,10 @@ var LayoutManager = GObject.registerClass({ this._pendingLoadBackground = false; // Set up stage hierarchy to group all UI actors under one container. - this.uiGroup = new UiActor({ name: 'uiGroup' }); + this.uiGroup = new UiActor({ + context: St.get_clutter_context(), + name: 'uiGroup' + }); this.uiGroup.set_flags(Clutter.ActorFlags.NO_LAYOUT); global.stage.add_child(this.uiGroup); @@ -226,12 +229,16 @@ var LayoutManager = GObject.registerClass({ global.stage.remove_actor(global.top_window_group); this.uiGroup.add_actor(global.top_window_group); - this.overviewGroup = new St.Widget({ name: 'overviewGroup', - visible: false, - reactive: true }); + this.overviewGroup = new St.Widget({ + context: St.get_clutter_context(), + name: 'overviewGroup', + visible: false, + reactive: true + }); this.addChrome(this.overviewGroup); this.screenShieldGroup = new St.Widget({ + context: St.get_clutter_context(), name: 'screenShieldGroup', visible: false, clip_to_allocation: true, @@ -239,33 +246,49 @@ var LayoutManager = GObject.registerClass({ }); this.addChrome(this.screenShieldGroup); - this.panelBox = new St.BoxLayout({ name: 'panelBox', - vertical: true }); + this.panelBox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'panelBox', + vertical: true + }); this.addChrome(this.panelBox, { affectsStruts: true, trackFullscreen: true }); this.panelBox.connect('notify::allocation', this._panelBoxChanged.bind(this)); - this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup', - layout_manager: new Clutter.BinLayout() }); + this.modalDialogGroup = new St.Widget({ + context: St.get_clutter_context(), + name: 'modalDialogGroup', + layout_manager: new Clutter.BinLayout() + }); this.uiGroup.add_actor(this.modalDialogGroup); - this.keyboardBox = new St.BoxLayout({ name: 'keyboardBox', - reactive: true, - track_hover: true }); + this.keyboardBox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'keyboardBox', + reactive: true, + track_hover: true + }); this.addTopChrome(this.keyboardBox); this._keyboardHeightNotifyId = 0; // A dummy actor that tracks the mouse or text cursor, based on the // position and size set in setDummyCursorGeometry. - this.dummyCursor = new St.Widget({ width: 0, height: 0, opacity: 0 }); + this.dummyCursor = new St.Widget({ + context: St.get_clutter_context(), + width: 0, + height: 0, + opacity: 0 + }); this.uiGroup.add_actor(this.dummyCursor); let feedbackGroup = Meta.get_feedback_group_for_display(global.display); global.stage.remove_actor(feedbackGroup); this.uiGroup.add_actor(feedbackGroup); - this._backgroundGroup = new Meta.BackgroundGroup(); + this._backgroundGroup = new Meta.BackgroundGroup({ + context: St.get_clutter_context(), + }); global.window_group.add_child(this._backgroundGroup); global.window_group.set_child_below_sibling(this._backgroundGroup, null); this._bgManagers = []; @@ -643,10 +666,13 @@ var LayoutManager = GObject.registerClass({ async _prepareStartupAnimation() { // During the initial transition, add a simple actor to block all events, // so they don't get delivered to X11 windows that have been transformed. - this._coverPane = new Clutter.Actor({ opacity: 0, - width: global.screen_width, - height: global.screen_height, - reactive: true }); + this._coverPane = new Clutter.Actor({ + context: St.get_clutter_context(), + opacity: 0, + width: global.screen_width, + height: global.screen_height, + reactive: true + }); this.addChrome(this._coverPane); if (Meta.is_restart()) { @@ -1073,7 +1099,9 @@ var LayoutManager = GObject.registerClass({ var HotCorner = GObject.registerClass( class HotCorner extends Clutter.Actor { _init(layoutManager, monitor, x, y) { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); // We use this flag to mark the case where the user has entered the // hot corner and has not left both the hot corner and a surrounding @@ -1153,11 +1181,14 @@ class HotCorner extends Clutter.Actor { reactive: true, }); - this._corner = new Clutter.Actor({ name: 'hot-corner', - width: 1, - height: 1, - opacity: 0, - reactive: true }); + this._corner = new Clutter.Actor({ + context: St.get_clutter_context(), + name: 'hot-corner', + width: 1, + height: 1, + opacity: 0, + reactive: true, + }); this._corner._delegate = this; this.add_child(this._corner); diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index cf68ea828c..6e28c260af 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -119,6 +119,7 @@ var Lightbox = GObject.registerClass({ }); super._init({ + context: St.get_clutter_context(), reactive: params.inhibitEvents, width: params.width, height: params.height, diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index cc5a7e5e47..addc6c945d 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -114,21 +114,31 @@ var Notebook = GObject.registerClass({ }, class Notebook extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), vertical: true, y_expand: true, }); - this.tabControls = new St.BoxLayout({ style_class: 'labels' }); + this.tabControls = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'labels' + }); this._selectedIndex = -1; this._tabs = []; } appendPage(name, child) { - let labelBox = new St.BoxLayout({ style_class: 'notebook-tab', - reactive: true, - track_hover: true }); - let label = new St.Button({ label: name }); + let labelBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'notebook-tab', + reactive: true, + track_hover: true + }); + let label = new St.Button({ + context: St.get_clutter_context(), + label: name + }); label.connect('clicked', () => { this.selectChild(child); return true; @@ -136,7 +146,10 @@ var Notebook = GObject.registerClass({ labelBox.add_child(label); this.tabControls.add(labelBox); - let scrollview = new St.ScrollView({ y_expand: true }); + let scrollview = new St.ScrollView({ + context: St.get_clutter_context(), + y_expand: true + }); scrollview.get_hscroll_bar().hide(); scrollview.add_actor(child); @@ -263,6 +276,7 @@ class ObjLink extends St.Button { text = GLib.markup_escape_text(text, -1); super._init({ + context: St.get_clutter_context(), reactive: true, track_hover: true, style_class: 'shell-link', @@ -283,19 +297,30 @@ class ObjLink extends St.Button { var Result = GObject.registerClass( class Result extends St.BoxLayout { _init(lookingGlass, command, o, index) { - super._init({ vertical: true }); + super._init({ + context: St.get_clutter_context(), + vertical: true + }); this.index = index; this.o = o; this._lookingGlass = lookingGlass; - let cmdTxt = new St.Label({ text: command }); + let cmdTxt = new St.Label({ + context: St.get_clutter_context(), + text: command + }); cmdTxt.clutter_text.ellipsize = Pango.EllipsizeMode.END; this.add(cmdTxt); - let box = new St.BoxLayout({}); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + }); this.add(box); - let resultTxt = new St.Label({ text: 'r(%d) = '.format(index) }); + let resultTxt = new St.Label({ + context: St.get_clutter_context(), + text: 'r(%d) = '.format(index) + }); resultTxt.clutter_text.ellipsize = Pango.EllipsizeMode.END; box.add(resultTxt); let objLink = new ObjLink(this._lookingGlass, o); @@ -306,7 +331,12 @@ class Result extends St.BoxLayout { var WindowList = GObject.registerClass({ }, class WindowList extends St.BoxLayout { _init(lookingGlass) { - super._init({ name: 'Windows', vertical: true, style: 'spacing: 8px' }); + super._init({ + context: St.get_clutter_context(), + name: 'Windows', + vertical: true, + style: 'spacing: 8px' + }); let tracker = Shell.WindowTracker.get_default(); this._updateId = Main.initializeDeferredWork(this, this._updateWindowList.bind(this)); global.display.connect('window-created', this._updateWindowList.bind(this)); @@ -329,24 +359,43 @@ var WindowList = GObject.registerClass({ metaWindow.connect('unmanaged', this._updateWindowList.bind(this)); metaWindow._lookingGlassManaged = true; } - let box = new St.BoxLayout({ vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); this.add(box); let windowLink = new ObjLink(this._lookingGlass, metaWindow, metaWindow.title); box.add_child(windowLink); - let propsBox = new St.BoxLayout({ vertical: true, style: 'padding-left: 6px;' }); + let propsBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + style: 'padding-left: 6px;' + }); box.add(propsBox); - propsBox.add(new St.Label({ text: 'wmclass: %s'.format(metaWindow.get_wm_class()) })); + propsBox.add(new St.Label({ + context: St.get_clutter_context(), + text: 'wmclass: %s'.format(metaWindow.get_wm_class()) + })); let app = tracker.get_window_app(metaWindow); if (app != null && !app.is_window_backed()) { let icon = app.create_icon_texture(22); - let propBox = new St.BoxLayout({ style: 'spacing: 6px; ' }); + let propBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style: 'spacing: 6px; ' + }); propsBox.add(propBox); - propBox.add_child(new St.Label({ text: 'app: ' })); + propBox.add_child(new St.Label({ + context: St.get_clutter_context(), + text: 'app: ' + })); let appLink = new ObjLink(this._lookingGlass, app, app.get_id()); propBox.add_child(appLink); propBox.add_child(icon); } else { - propsBox.add(new St.Label({ text: '' })); + propsBox.add(new St.Label({ + context: St.get_clutter_context(), + text: '' + })); } } } @@ -360,6 +409,7 @@ var ObjInspector = GObject.registerClass( class ObjInspector extends St.ScrollView { _init(lookingGlass) { super._init({ + context: St.get_clutter_context(), pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), }); @@ -370,6 +420,7 @@ class ObjInspector extends St.ScrollView { this.get_hscroll_bar().hide(); this._container = new St.BoxLayout({ + context: St.get_clutter_context(), name: 'LookingGlassPropertyInspector', style_class: 'lg-dialog', vertical: true, @@ -390,26 +441,44 @@ class ObjInspector extends St.ScrollView { this._container.destroy_all_children(); - let hbox = new St.BoxLayout({ style_class: 'lg-obj-inspector-title' }); + let hbox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'lg-obj-inspector-title' + }); this._container.add_actor(hbox); let label = new St.Label({ + context: St.get_clutter_context(), text: 'Inspecting: %s: %s'.format(typeof obj, objectToString(obj)), x_expand: true, }); label.single_line_mode = true; hbox.add_child(label); - let button = new St.Button({ label: 'Insert', style_class: 'lg-obj-inspector-button' }); + let button = new St.Button({ + context: St.get_clutter_context(), + label: 'Insert', + style_class: 'lg-obj-inspector-button' + }); button.connect('clicked', this._onInsert.bind(this)); hbox.add(button); if (this._previousObj != null) { - button = new St.Button({ label: 'Back', style_class: 'lg-obj-inspector-button' }); + button = new St.Button({ + context: St.get_clutter_context(), + label: 'Back', + style_class: 'lg-obj-inspector-button' + }); button.connect('clicked', this._onBack.bind(this)); hbox.add(button); } - button = new St.Button({ style_class: 'window-close' }); - button.add_actor(new St.Icon({ icon_name: 'window-close-symbolic' })); + button = new St.Button({ + context: St.get_clutter_context(), + style_class: 'window-close' + }); + button.add_actor(new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'window-close-symbolic' + })); button.connect('clicked', this.close.bind(this)); hbox.add(button); if (typeof obj == typeof {}) { @@ -425,10 +494,18 @@ class ObjInspector extends St.ScrollView { let prop = obj[propName]; link = new ObjLink(this._lookingGlass, prop); } catch (e) { - link = new St.Label({ text: '' }); + link = new St.Label({ + context: St.get_clutter_context(), + text: '' + }); } - let box = new St.BoxLayout(); - box.add(new St.Label({ text: '%s: '.format(propName) })); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + }); + box.add(new St.Label({ + context: St.get_clutter_context(), + text: '%s: '.format(propName) + })); box.add(link); this._container.add_actor(box); } @@ -531,16 +608,26 @@ var Inspector = GObject.registerClass({ 'target': { param_types: [Clutter.Actor.$gtype, GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] } }, }, class Inspector extends Clutter.Actor { _init(lookingGlass) { - super._init({ width: 0, height: 0 }); + super._init({ + context: St.get_clutter_context(), + width: 0, + height: 0 + }); Main.uiGroup.add_actor(this); - let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog', - vertical: false, - reactive: true }); + let eventHandler = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'LookingGlassDialog', + vertical: false, + reactive: true + }); this._eventHandler = eventHandler; this.add_actor(eventHandler); - this._displayText = new St.Label({ x_expand: true }); + this._displayText = new St.Label({ + context: St.get_clutter_context(), + x_expand: true + }); eventHandler.add_child(this._displayText); eventHandler.connect('key-press-event', this._onKeyPressEvent.bind(this)); @@ -669,14 +756,24 @@ var Inspector = GObject.registerClass({ var Extensions = GObject.registerClass({ }, class Extensions extends St.BoxLayout { _init(lookingGlass) { - super._init({ vertical: true, name: 'lookingGlassExtensions' }); + super._init({ + context: St.get_clutter_context(), + vertical: true, + name: 'lookingGlassExtensions' + }); this._lookingGlass = lookingGlass; - this._noExtensions = new St.Label({ style_class: 'lg-extensions-none', - text: _("No extensions installed") }); + this._noExtensions = new St.Label({ + context: St.get_clutter_context(), + style_class: 'lg-extensions-none', + text: _("No extensions installed") + }); this._numExtensions = 0; - this._extensionsList = new St.BoxLayout({ vertical: true, - style_class: 'lg-extensions-list' }); + this._extensionsList = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + style_class: 'lg-extensions-list' + }); this._extensionsList.add(this._noExtensions); this.add(this._extensionsList); @@ -725,14 +822,23 @@ var Extensions = GObject.registerClass({ if (shouldShow) { let errors = extension.errors; - let errorDisplay = new St.BoxLayout({ vertical: true }); + let errorDisplay = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); if (errors && errors.length) { for (let i = 0; i < errors.length; i++) - errorDisplay.add(new St.Label({ text: errors[i] })); + errorDisplay.add(new St.Label({ + context: St.get_clutter_context(), + text: errors[i] + })); } else { /* Translators: argument is an extension UUID. */ let message = _("%s has not emitted any errors.").format(extension.uuid); - errorDisplay.add(new St.Label({ text: message })); + errorDisplay.add(new St.Label({ + context: St.get_clutter_context(), + text: message + })); } actor._errorDisplay = errorDisplay; @@ -765,49 +871,70 @@ var Extensions = GObject.registerClass({ } _createExtensionDisplay(extension) { - let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'lg-extension', + vertical: true + }); box._extension = extension; let name = new St.Label({ + context: St.get_clutter_context(), style_class: 'lg-extension-name', text: extension.metadata.name, x_expand: true, }); box.add_child(name); let description = new St.Label({ + context: St.get_clutter_context(), style_class: 'lg-extension-description', text: extension.metadata.description || 'No description', x_expand: true, }); box.add_child(description); - let metaBox = new St.BoxLayout({ style_class: 'lg-extension-meta' }); + let metaBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'lg-extension-meta' + }); box.add(metaBox); - let state = new St.Label({ style_class: 'lg-extension-state', - text: this._stateToString(extension.state) }); + let state = new St.Label({ + context: St.get_clutter_context(), + style_class: 'lg-extension-state', + text: this._stateToString(extension.state) + }); metaBox.add(state); - let viewsource = new St.Button({ reactive: true, - track_hover: true, - style_class: 'shell-link', - label: _("View Source") }); + let viewsource = new St.Button({ + context: St.get_clutter_context(), + reactive: true, + track_hover: true, + style_class: 'shell-link', + label: _("View Source") + }); viewsource._extension = extension; viewsource.connect('clicked', this._onViewSource.bind(this)); metaBox.add(viewsource); if (extension.metadata.url) { - let webpage = new St.Button({ reactive: true, - track_hover: true, - style_class: 'shell-link', - label: _("Web Page") }); + let webpage = new St.Button({ + context: St.get_clutter_context(), + reactive: true, + track_hover: true, + style_class: 'shell-link', + label: _("Web Page") + }); webpage._extension = extension; webpage.connect('clicked', this._onWebPage.bind(this)); metaBox.add(webpage); } - let viewerrors = new St.Button({ reactive: true, - track_hover: true, - style_class: 'shell-link', - label: _("Show Errors") }); + let viewerrors = new St.Button({ + context: St.get_clutter_context(), + reactive: true, + track_hover: true, + style_class: 'shell-link', + label: _("Show Errors") + }); viewerrors._extension = extension; viewerrors._parentBox = box; viewerrors._isShowing = false; @@ -826,6 +953,7 @@ var ActorLink = GObject.registerClass({ }, class ActorLink extends St.Button { _init(actor) { this._arrow = new St.Icon({ + context: St.get_clutter_context(), icon_name: 'pan-end-symbolic', icon_size: 8, x_align: Clutter.ActorAlign.CENTER, @@ -834,12 +962,15 @@ var ActorLink = GObject.registerClass({ }); const label = new St.Label({ + context: St.get_clutter_context(), text: actor.toString(), x_align: Clutter.ActorAlign.START, }); const inspectButton = new St.Button({ + context: St.get_clutter_context(), child: new St.Icon({ + context: St.get_clutter_context(), icon_name: 'insert-object-symbolic', icon_size: 12, y_align: Clutter.ActorAlign.CENTER, @@ -851,12 +982,15 @@ var ActorLink = GObject.registerClass({ }); inspectButton.connect('clicked', () => this.emit('inspect-actor')); - const box = new St.BoxLayout(); + const box = new St.BoxLayout({ + context: St.get_clutter_context(), + }); box.add_child(this._arrow); box.add_child(label); box.add_child(inspectButton); super._init({ + context: St.get_clutter_context(), reactive: true, track_hover: true, toggle_mode: true, @@ -879,7 +1013,9 @@ var ActorLink = GObject.registerClass({ var ActorTreeViewer = GObject.registerClass( class ActorTreeViewer extends St.BoxLayout { _init(lookingGlass) { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); this._lookingGlass = lookingGlass; this._actorData = new Map(); @@ -941,8 +1077,12 @@ class ActorTreeViewer extends St.BoxLayout { this._lookingGlass.inspectObject(actor, button); }); - const mainContainer = new St.BoxLayout({ vertical: true }); + const mainContainer = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); const childrenContainer = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, style: 'padding: 0 0 0 18px', }); @@ -1007,6 +1147,7 @@ var LookingGlass = GObject.registerClass( class LookingGlass extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), name: 'LookingGlassDialog', style_class: 'lg-dialog', vertical: true, @@ -1043,10 +1184,16 @@ class LookingGlass extends St.BoxLayout { Main.uiGroup.add_actor(this._objInspector); this._objInspector.hide(); - let toolbar = new St.BoxLayout({ name: 'Toolbar' }); + let toolbar = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'Toolbar' + }); this.add_actor(toolbar); - let inspectIcon = new St.Icon({ icon_name: 'find-location-symbolic', - icon_size: 24 }); + let inspectIcon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'find-location-symbolic', + icon_size: 24 + }); toolbar.add_actor(inspectIcon); inspectIcon.reactive = true; inspectIcon.connect('button-press-event', () => { @@ -1062,8 +1209,11 @@ class LookingGlass extends St.BoxLayout { return Clutter.EVENT_STOP; }); - let gcIcon = new St.Icon({ icon_name: 'user-trash-full-symbolic', - icon_size: 24 }); + let gcIcon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'user-trash-full-symbolic', + icon_size: 24 + }); toolbar.add_actor(gcIcon); gcIcon.reactive = true; gcIcon.connect('button-press-event', () => { @@ -1085,14 +1235,21 @@ class LookingGlass extends St.BoxLayout { this._notebook = notebook; this.add_child(notebook); - let emptyBox = new St.Bin({ x_expand: true }); + let emptyBox = new St.Bin({ + context: St.get_clutter_context(), + x_expand: true + }); toolbar.add_child(emptyBox); toolbar.add_actor(notebook.tabControls); - this._evalBox = new St.BoxLayout({ name: 'EvalBox', vertical: true }); + this._evalBox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'EvalBox', vertical: true + }); notebook.appendPage('Evaluator', this._evalBox); this._resultsArea = new St.BoxLayout({ + context: St.get_clutter_context(), name: 'ResultsArea', vertical: true, y_expand: true, @@ -1100,15 +1257,20 @@ class LookingGlass extends St.BoxLayout { this._evalBox.add_child(this._resultsArea); this._entryArea = new St.BoxLayout({ + context: St.get_clutter_context(), name: 'EntryArea', y_align: Clutter.ActorAlign.END, }); this._evalBox.add_actor(this._entryArea); - let label = new St.Label({ text: CHEVRON }); + let label = new St.Label({ + context: St.get_clutter_context(), + text: CHEVRON + }); this._entryArea.add(label); this._entry = new St.Entry({ + context: St.get_clutter_context(), can_focus: true, x_expand: true, }); @@ -1191,7 +1353,11 @@ class LookingGlass extends St.BoxLayout { _showCompletions(completions) { if (!this._completionActor) { - this._completionActor = new St.Label({ name: 'LookingGlassAutoCompletionText', style_class: 'lg-completions-text' }); + this._completionActor = new St.Label({ + context: St.get_clutter_context(), + name: 'LookingGlassAutoCompletionText', + style_class: 'lg-completions-text' + }); this._completionActor.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; this._completionActor.clutter_text.line_wrap = true; this._evalBox.insert_child_below(this._completionActor, this._entryArea); diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 180df25460..f462558e87 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -96,7 +96,10 @@ var Magnifier = class Magnifier { let cursorTracker = Meta.CursorTracker.get_for_display(global.display); this._cursorTracker = cursorTracker; - this._mouseSprite = new Clutter.Actor({ request_mode: Clutter.RequestMode.CONTENT_SIZE }); + this._mouseSprite = new Clutter.Actor({ + context: St.get_clutter_context(), + request_mode: Clutter.RequestMode.CONTENT_SIZE + }); this._mouseSprite.content = new MouseSpriteContent(); // Create the first ZoomRegion and initialize it according to the @@ -1324,14 +1327,19 @@ var ZoomRegion = class ZoomRegion { _createActors() { // The root actor for the zoom region - this._magView = new St.Bin({ style_class: 'magnifier-zoom-region' }); + this._magView = new St.Bin({ + style_class: 'magnifier-zoom-region' + }); global.stage.add_actor(this._magView); // hide the magnified region from CLUTTER_PICK_ALL Shell.util_set_hidden_from_pick(this._magView, true); // Add a group to clip the contents of the magnified view. - let mainGroup = new Clutter.Actor({ clip_to_allocation: true }); + let mainGroup = new Clutter.Actor({ + context: St.get_clutter_context(), + clip_to_allocation: true + }); this._magView.set_child(mainGroup); // Add a background for when the magnified uiGroup is scrolled @@ -1341,14 +1349,20 @@ var ZoomRegion = class ZoomRegion { // Clone the group that contains all of UI on the screen. This is the // chrome, the windows, etc. - this._uiGroupClone = new Clutter.Clone({ source: Main.uiGroup, - clip_to_allocation: true }); + this._uiGroupClone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: Main.uiGroup, + clip_to_allocation: true + }); mainGroup.add_actor(this._uiGroupClone); // Add either the given mouseSourceActor to the ZoomRegion, or a clone of // it. if (this._mouseSourceActor.get_parent() != null) - this._mouseActor = new Clutter.Clone({ source: this._mouseSourceActor }); + this._mouseActor = new Clutter.Clone({ + context: St.get_clutter_context(), + source: this._mouseSourceActor + }); else this._mouseActor = this._mouseSourceActor; mainGroup.add_actor(this._mouseActor); @@ -1671,14 +1685,23 @@ class Crosshairs extends Clutter.Actor { let groupHeight = global.screen_height * 3; super._init({ + context: St.get_clutter_context(), clip_to_allocation: false, width: groupWidth, height: groupHeight, }); - this._horizLeftHair = new Clutter.Actor(); - this._horizRightHair = new Clutter.Actor(); - this._vertTopHair = new Clutter.Actor(); - this._vertBottomHair = new Clutter.Actor(); + this._horizLeftHair = new Clutter.Actor({ + context: St.get_clutter_context(), + }); + this._horizRightHair = new Clutter.Actor({ + context: St.get_clutter_context(), + }); + this._vertTopHair = new Clutter.Actor({ + context: St.get_clutter_context(), + }); + this._vertBottomHair = new Clutter.Actor({ + context: St.get_clutter_context(), + }); this.add_actor(this._horizLeftHair); this.add_actor(this._horizRightHair); this.add_actor(this._vertTopHair); @@ -1724,7 +1747,10 @@ class Crosshairs extends Clutter.Actor { if (container) { crosshairsActor = this; if (this.get_parent() != null) { - crosshairsActor = new Clutter.Clone({ source: this }); + crosshairsActor = new Clutter.Clone({ + context: St.get_clutter_context(), + source: this + }); this._clones.push(crosshairsActor); // Clones don't share visibility. diff --git a/js/ui/main.js b/js/ui/main.js index c7bac11f25..1a2a47e02c 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -810,6 +810,7 @@ class RestartMessage extends ModalDialog.ModalDialog { destroyOnClose: true }); let label = new St.Label({ + context: St.get_clutter_context(), text: message, x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 8ffdaebc13..f757135a81 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -35,6 +35,7 @@ var URLHighlighter = GObject.registerClass( class URLHighlighter extends St.Label { _init(text = '', lineWrap, allowMarkup) { super._init({ + context: St.get_clutter_context(), reactive: true, style_class: 'url-highlighter', x_expand: true, @@ -304,6 +305,7 @@ var Message = GObject.registerClass({ }, class Message extends St.Button { _init(title, body) { super._init({ + context: St.get_clutter_context(), style_class: 'message', accessible_role: Atk.Role.NOTIFICATION, can_focus: true, @@ -315,53 +317,81 @@ var Message = GObject.registerClass({ this._useBodyMarkup = false; let vbox = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, x_expand: true, }); this.set_child(vbox); - let hbox = new St.BoxLayout(); + let hbox = new St.BoxLayout({ + context: St.get_clutter_context(), + }); vbox.add_actor(hbox); - this._actionBin = new St.Widget({ layout_manager: new ScaleLayout(), - visible: false }); + this._actionBin = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: new ScaleLayout(), + visible: false + }); vbox.add_actor(this._actionBin); - this._iconBin = new St.Bin({ style_class: 'message-icon-bin', - y_expand: true, - y_align: Clutter.ActorAlign.START, - visible: false }); + this._iconBin = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'message-icon-bin', + y_expand: true, + y_align: Clutter.ActorAlign.START, + visible: false + }); hbox.add_actor(this._iconBin); - let contentBox = new St.BoxLayout({ style_class: 'message-content', - vertical: true, x_expand: true }); + let contentBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'message-content', + vertical: true, + x_expand: true + }); hbox.add_actor(contentBox); - this._mediaControls = new St.BoxLayout(); + this._mediaControls = new St.BoxLayout({ + context: St.get_clutter_context(), + }); hbox.add_actor(this._mediaControls); - let titleBox = new St.BoxLayout(); + let titleBox = new St.BoxLayout({ + context: St.get_clutter_context(), + }); contentBox.add_actor(titleBox); - this.titleLabel = new St.Label({ style_class: 'message-title' }); + this.titleLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'message-title' + }); this.setTitle(title); titleBox.add_actor(this.titleLabel); this._secondaryBin = new St.Bin({ + context: St.get_clutter_context(), style_class: 'message-secondary-bin', x_expand: true, y_expand: true, }); titleBox.add_actor(this._secondaryBin); - let closeIcon = new St.Icon({ icon_name: 'window-close-symbolic', - icon_size: 16 }); + let closeIcon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'window-close-symbolic', + icon_size: 16 + }); this._closeButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'message-close-button', child: closeIcon, opacity: 0, }); titleBox.add_actor(this._closeButton); - this._bodyStack = new St.Widget({ x_expand: true }); + this._bodyStack = new St.Widget({ + context: St.get_clutter_context(), + x_expand: true + }); this._bodyStack.layout_manager = new LabelExpanderLayout(); contentBox.add_actor(this._bodyStack); @@ -426,9 +456,16 @@ var Message = GObject.registerClass({ } addMediaControl(iconName, callback) { - let icon = new St.Icon({ icon_name: iconName, icon_size: 16 }); - let button = new St.Button({ style_class: 'message-media-control', - child: icon }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: iconName, + icon_size: 16 + }); + let button = new St.Button({ + context: St.get_clutter_context(), + style_class: 'message-media-control', + child: icon + }); button.connect('clicked', callback); this._mediaControls.add_actor(button); return button; @@ -551,14 +588,18 @@ var MessageListSection = GObject.registerClass({ }, class MessageListSection extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'message-list-section', clip_to_allocation: true, vertical: true, x_expand: true, }); - this._list = new St.BoxLayout({ style_class: 'message-list-section-list', - vertical: true }); + this._list = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'message-list-section-list', + vertical: true + }); this.add_actor(this._list); this._list.connect('actor-added', this._sync.bind(this)); @@ -604,6 +645,7 @@ var MessageListSection = GObject.registerClass({ throw new Error('Message was already added previously'); let listItem = new St.Bin({ + context: St.get_clutter_context(), child: message, 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 8a5c262a99..c888e298c6 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -561,16 +561,22 @@ var NotificationBanner = GObject.registerClass({ _addSecondaryIcon() { if (this.notification.secondaryGIcon) { - let icon = new St.Icon({ gicon: this.notification.secondaryGIcon, - x_align: Clutter.ActorAlign.END }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + gicon: this.notification.secondaryGIcon, + x_align: Clutter.ActorAlign.END + }); this.setSecondaryActor(icon); } } addButton(button, callback) { if (!this._buttonBox) { - this._buttonBox = new St.BoxLayout({ style_class: 'notification-actions', - x_expand: true }); + this._buttonBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'notification-actions', + x_expand: true + }); this.setActionArea(this._buttonBox); global.focus_manager.add_group(this._buttonBox); } @@ -596,10 +602,13 @@ var NotificationBanner = GObject.registerClass({ } addAction(label, callback) { - let button = new St.Button({ style_class: 'notification-button', - label, - x_expand: true, - can_focus: true }); + let button = new St.Button({ + context: St.get_clutter_context(), + style_class: 'notification-button', + label, + x_expand: true, + can_focus: true + }); return this.addButton(button, callback); } @@ -608,7 +617,9 @@ var NotificationBanner = GObject.registerClass({ var SourceActor = GObject.registerClass( class SourceActor extends St.Widget { _init(source, size) { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); this._source = source; this._size = size; @@ -620,9 +631,12 @@ 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_expand: true, - height: size * scaleFactor, - width: size * scaleFactor }); + this._iconBin = new St.Bin({ + context: St.get_clutter_context(), + x_expand: true, + height: size * scaleFactor, + width: size * scaleFactor + }); this.add_actor(this._iconBin); @@ -732,8 +746,11 @@ var Source = GObject.registerClass({ // Provides a sane default implementation, override if you need // something more fancy. createIcon(size) { - return new St.Icon({ gicon: this.getIcon(), - icon_size: size }); + return new St.Icon({ + context: St.get_clutter_context(), + gicon: this.getIcon(), + icon_size: size + }); } getIcon() { @@ -816,6 +833,7 @@ var MessageTray = GObject.registerClass({ }, class MessageTray extends St.Widget { _init() { super._init({ + context: St.get_clutter_context(), visible: false, clip_to_allocation: true, layout_manager: new Clutter.BinLayout(), @@ -836,14 +854,17 @@ var MessageTray = GObject.registerClass({ GObject.BindingFlags.SYNC_CREATE); this.add_constraint(constraint); - this._bannerBin = new St.Widget({ name: 'notification-container', - reactive: true, - track_hover: true, - y_align: Clutter.ActorAlign.START, - x_align: Clutter.ActorAlign.CENTER, - y_expand: true, - x_expand: true, - layout_manager: new Clutter.BinLayout() }); + this._bannerBin = new St.Widget({ + context: St.get_clutter_context(), + name: 'notification-container', + reactive: true, + track_hover: true, + y_align: Clutter.ActorAlign.START, + x_align: Clutter.ActorAlign.CENTER, + y_expand: true, + x_expand: true, + layout_manager: new Clutter.BinLayout() + }); this._bannerBin.connect('key-release-event', this._onNotificationKeyRelease.bind(this)); this._bannerBin.connect('notify::hover', diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index caa874454f..1f406f2c40 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -31,10 +31,13 @@ var ModalDialog = GObject.registerClass({ Signals: { 'opened': {}, 'closed': {} }, }, class ModalDialog extends St.Widget { _init(params) { - super._init({ visible: false, - x: 0, - y: 0, - accessible_role: Atk.Role.DIALOG }); + super._init({ + context: St.get_clutter_context(), + visible: false, + x: 0, + y: 0, + accessible_role: Atk.Role.DIALOG + }); params = Params.parse(params, { shellReactive: false, styleClass: null, @@ -58,11 +61,15 @@ var ModalDialog = GObject.registerClass({ this.add_constraint(constraint); this.backgroundStack = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), x_expand: true, y_expand: true, }); - this._backgroundBin = new St.Bin({ child: this.backgroundStack }); + this._backgroundBin = new St.Bin({ + context: St.get_clutter_context(), + child: this.backgroundStack + }); this._monitorConstraint = new Layout.MonitorConstraint(); this._backgroundBin.add_constraint(this._monitorConstraint); this.add_actor(this._backgroundBin); @@ -77,7 +84,10 @@ var ModalDialog = GObject.registerClass({ radialEffect: true }); this._lightbox.highlight(this._backgroundBin); - this._eventBlocker = new Clutter.Actor({ reactive: true }); + this._eventBlocker = new Clutter.Actor({ + context: St.get_clutter_context(), + reactive: true + }); this.backgroundStack.add_actor(this._eventBlocker); } diff --git a/js/ui/mpris.js b/js/ui/mpris.js index b7cc8ea190..93ae5efd72 100644 --- a/js/ui/mpris.js +++ b/js/ui/mpris.js @@ -25,7 +25,10 @@ class MediaMessage extends MessageList.Message { this._player = player; - this._icon = new St.Icon({ style_class: 'media-message-cover-icon' }); + this._icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'media-message-cover-icon' + }); this.setIcon(this._icon); // reclaim space used by unused elements diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 69137b1b23..b0eae1c449 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -452,8 +452,11 @@ class FdoNotificationDaemonSource extends MessageTray.Source { if (this.app) { return this.app.create_icon_texture(size); } else if (this._gicon) { - return new St.Icon({ gicon: this._gicon, - icon_size: size }); + return new St.Icon({ + context: St.get_clutter_context(), + gicon: this._gicon, + icon_size: size + }); } else { return null; } diff --git a/js/ui/osdMonitorLabeler.js b/js/ui/osdMonitorLabeler.js index b242ecca1c..4ebfb82f4a 100644 --- a/js/ui/osdMonitorLabeler.js +++ b/js/ui/osdMonitorLabeler.js @@ -8,16 +8,26 @@ const Main = imports.ui.main; var OsdMonitorLabel = GObject.registerClass( class OsdMonitorLabel extends St.Widget { _init(monitor, label) { - super._init({ x_expand: true, y_expand: true }); + super._init({ + context: St.get_clutter_context(), + x_expand: true, + y_expand: true + }); this._monitor = monitor; - this._box = new St.BoxLayout({ style_class: 'osd-window', - vertical: true }); + this._box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'osd-window', + vertical: true + }); this.add_actor(this._box); - this._label = new St.Label({ style_class: 'osd-monitor-label', - text: label }); + this._label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'osd-monitor-label', + text: label + }); this._box.add(this._label); Main.uiGroup.add_child(this); diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js index bae4b862ad..38fb914a0e 100644 --- a/js/ui/osdWindow.js +++ b/js/ui/osdWindow.js @@ -45,6 +45,7 @@ var OsdWindow = GObject.registerClass( class OsdWindow extends St.Widget { _init(monitorIndex) { super._init({ + context: St.get_clutter_context(), x_expand: true, y_expand: true, x_align: Clutter.ActorAlign.CENTER, @@ -56,15 +57,23 @@ class OsdWindow extends St.Widget { this.add_constraint(constraint); this._boxConstraint = new OsdWindowConstraint(); - this._box = new St.BoxLayout({ style_class: 'osd-window', - vertical: true }); + this._box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'osd-window', + vertical: true + }); this._box.add_constraint(this._boxConstraint); this.add_actor(this._box); - this._icon = new St.Icon({ y_expand: true }); + this._icon = new St.Icon({ + context: St.get_clutter_context(), + y_expand: true + }); this._box.add_child(this._icon); - this._label = new St.Label(); + this._label = new St.Label({ + context: St.get_clutter_context(), + }); this._box.add(this._label); this._level = new BarLevel.BarLevel({ diff --git a/js/ui/overview.js b/js/ui/overview.js index 87bf835b03..88a14a7f54 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -65,6 +65,7 @@ var OverviewActor = GObject.registerClass( class OverviewActor extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), name: 'overview', /* Translators: This is the main view to select activities. See also note for "Activities" string. */ @@ -145,7 +146,9 @@ var Overview = class { if (this.isDummy) return; - this._desktopFade = new St.Widget(); + this._desktopFade = new St.Widget({ + context: St.get_clutter_context(), + }); Main.layoutManager.overviewGroup.add_child(this._desktopFade); this._activationTime = 0; @@ -159,8 +162,11 @@ var Overview = class { // During transitions, we raise this to the top to avoid having the overview // area be reactive; it causes too many issues such as double clicks on // Dash elements, or mouseover handlers in the workspaces. - this._coverPane = new Clutter.Actor({ opacity: 0, - reactive: true }); + this._coverPane = new Clutter.Actor({ + context: St.get_clutter_context(), + opacity: 0, + reactive: true + }); Main.layoutManager.overviewGroup.add_child(this._coverPane); this._coverPane.connect('event', () => Clutter.EVENT_STOP); this._coverPane.hide(); @@ -325,8 +331,12 @@ var Overview = class { return null; let window = windows[0]; - let clone = new Clutter.Clone({ source: window, - x: window.x, y: window.y }); + let clone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: window, + x: window.x, + y: window.y + }); clone.source.connect('destroy', () => { clone.destroy(); }); diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 6cbaa22ba9..512287d5fb 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -296,6 +296,7 @@ var ControlsManager = GObject.registerClass( class ControlsManager extends St.Widget { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'controls-manager', x_expand: true, y_expand: true, @@ -305,6 +306,7 @@ class ControlsManager extends St.Widget { this._ignoreShowAppsButtonToggle = false; this._searchEntry = new St.Entry({ + context: St.get_clutter_context(), style_class: 'search-entry', /* Translators: this is the text displayed in the search entry when no search is @@ -316,6 +318,7 @@ class ControlsManager extends St.Widget { }); this._searchEntry.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); this._searchEntryBin = new St.Bin({ + context: St.get_clutter_context(), child: this._searchEntry, x_align: Clutter.ActorAlign.CENTER, }); diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index 9804f9e305..1bff240a6a 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -27,6 +27,7 @@ var PadChooser = GObject.registerClass({ }, class PadChooser extends St.Button { _init(device, groupDevices) { super._init({ + context: St.get_clutter_context(), style_class: 'pad-chooser-button', toggle_mode: true, }); @@ -34,6 +35,7 @@ var PadChooser = GObject.registerClass({ this._padChooserMenu = null; let arrow = new St.Icon({ + context: St.get_clutter_context(), style_class: 'popup-menu-arrow', icon_name: 'pan-down-symbolic', accessible_role: Atk.Role.ARROW, @@ -92,7 +94,11 @@ var KeybindingEntry = GObject.registerClass({ Signals: { 'keybinding-edited': { param_types: [GObject.TYPE_STRING] } }, }, class KeybindingEntry extends St.Entry { _init() { - super._init({ hint_text: _("New shortcut…"), style: 'width: 10em' }); + super._init({ + context: St.get_clutter_context(), + hint_text: _("New shortcut…"), + style: 'width: 10em' + }); } vfunc_captured_event(event) { @@ -113,22 +119,34 @@ var ActionComboBox = GObject.registerClass({ Signals: { 'action-selected': { param_types: [GObject.TYPE_INT] } }, }, class ActionComboBox extends St.Button { _init() { - super._init({ style_class: 'button' }); + super._init({ + context: St.get_clutter_context(), + style_class: 'button' + }); this.set_toggle_mode(true); let boxLayout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL, spacing: 6 }); - let box = new St.Widget({ layout_manager: boxLayout }); + let box = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: boxLayout + }); this.set_child(box); - this._label = new St.Label({ style_class: 'combo-box-label' }); + this._label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'combo-box-label' + }); box.add_child(this._label); - let arrow = new St.Icon({ style_class: 'popup-menu-arrow', - icon_name: 'pan-down-symbolic', - accessible_role: Atk.Role.ARROW, - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + let arrow = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'popup-menu-arrow', + icon_name: 'pan-down-symbolic', + accessible_role: Atk.Role.ARROW, + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); box.add_child(arrow); this._editMenu = new PopupMenu.PopupMenu(this, 0, St.Side.TOP); @@ -198,7 +216,10 @@ var ActionEditor = GObject.registerClass({ let boxLayout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL, spacing: 12 }); - super._init({ layout_manager: boxLayout }); + super._init({ + context: St.get_clutter_context(), + layout_manager: boxLayout + }); this._actionComboBox = new ActionComboBox(); this._actionComboBox.connect('action-selected', this._onActionSelected.bind(this)); @@ -208,9 +229,12 @@ var ActionEditor = GObject.registerClass({ this._keybindingEdit.connect('keybinding-edited', this._onKeybindingEdited.bind(this)); this.add_actor(this._keybindingEdit); - this._doneButton = new St.Button({ label: _("Done"), - style_class: 'button', - x_expand: false }); + this._doneButton = new St.Button({ + context: St.get_clutter_context(), + label: _("Done"), + style_class: 'button', + x_expand: false + }); this._doneButton.connect('clicked', this._onEditingDone.bind(this)); this.add_actor(this._doneButton); } @@ -302,7 +326,10 @@ var PadDiagram = GObject.registerClass({ this._css = new TextDecoder().decode(css); this._labels = []; this._activeButtons = []; - super._init(params); + const defaultParams = { + context: St.get_clutter_context(), + }; + super._init(Object.assign(defaultParams, params)); } get image() { @@ -553,7 +580,9 @@ var PadDiagram = GObject.registerClass({ if (!found) return false; - let label = new St.Label(); + let label = new St.Label({ + context: St.get_clutter_context(), + }); this._labels.push({ label, action, idx, dir, x, y, arrangement }); this.add_actor(label); return true; @@ -626,6 +655,7 @@ var PadOsd = GObject.registerClass({ }, class PadOsd extends St.BoxLayout { _init(padDevice, settings, imagePath, editionMode, monitorIndex) { super._init({ + context: St.get_clutter_context(), style_class: 'pad-osd-window', vertical: true, x_expand: true, @@ -675,23 +705,35 @@ var PadOsd = GObject.registerClass({ let constraint = new Layout.MonitorConstraint({ index: monitorIndex }); this.add_constraint(constraint); - this._titleBox = new St.BoxLayout({ style_class: 'pad-osd-title-box', - vertical: false, - x_expand: false, - x_align: Clutter.ActorAlign.CENTER }); + this._titleBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'pad-osd-title-box', + vertical: false, + x_expand: false, + x_align: Clutter.ActorAlign.CENTER + }); this.add_actor(this._titleBox); - let labelBox = new St.BoxLayout({ style_class: 'pad-osd-title-menu-box', - vertical: true }); + let labelBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'pad-osd-title-menu-box', + vertical: true + }); this._titleBox.add_actor(labelBox); - this._titleLabel = new St.Label({ style: 'font-side: larger; font-weight: bold;', - x_align: Clutter.ActorAlign.CENTER }); + this._titleLabel = new St.Label({ + context: St.get_clutter_context(), + style: 'font-side: larger; font-weight: bold;', + x_align: Clutter.ActorAlign.CENTER + }); this._titleLabel.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); this._titleLabel.clutter_text.set_text(padDevice.get_device_name()); labelBox.add_actor(this._titleLabel); - this._tipLabel = new St.Label({ x_align: Clutter.ActorAlign.CENTER }); + this._tipLabel = new St.Label({ + context: St.get_clutter_context(), + x_align: Clutter.ActorAlign.CENTER + }); labelBox.add_actor(this._tipLabel); this._updatePadChooser(); @@ -707,12 +749,16 @@ var PadOsd = GObject.registerClass({ this.add_actor(this._padDiagram); this._updateActionLabels(); - let buttonBox = new St.Widget({ layout_manager: new Clutter.BinLayout(), - x_expand: true, - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER }); + let buttonBox = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout(), + x_expand: true, + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER + }); this.add_actor(buttonBox); this._editButton = new St.Button({ + context: St.get_clutter_context(), label: _('Edit…'), style_class: 'button', can_focus: true, diff --git a/js/ui/pageIndicators.js b/js/ui/pageIndicators.js index 63a31d679c..b00e45e9e1 100644 --- a/js/ui/pageIndicators.js +++ b/js/ui/pageIndicators.js @@ -14,6 +14,7 @@ var PageIndicators = GObject.registerClass({ _init(orientation = Clutter.Orientation.VERTICAL) { let vertical = orientation == Clutter.Orientation.VERTICAL; super._init({ + context: St.get_clutter_context(), style_class: 'page-indicators', vertical, x_expand: true, y_expand: true, @@ -54,12 +55,16 @@ var PageIndicators = GObject.registerClass({ if (diff > 0) { for (let i = 0; i < diff; i++) { let pageIndex = this._nPages + i; - let indicator = new St.Button({ style_class: 'page-indicator', - button_mask: St.ButtonMask.ONE | - St.ButtonMask.TWO | - St.ButtonMask.THREE, - reactive: this._reactive }); + let indicator = new St.Button({ + context: St.get_clutter_context(), + style_class: 'page-indicator', + button_mask: St.ButtonMask.ONE | + St.ButtonMask.TWO | + St.ButtonMask.THREE, + reactive: this._reactive + }); indicator.child = new St.Widget({ + context: St.get_clutter_context(), style_class: 'page-indicator-icon', pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), }); diff --git a/js/ui/panel.js b/js/ui/panel.js index dafba690a5..e610f58b66 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -41,13 +41,19 @@ var AppMenuButton = GObject.registerClass({ this._targetApp = null; this._busyNotifyId = 0; - let bin = new St.Bin({ name: 'appMenu' }); + let bin = new St.Bin({ + context: St.get_clutter_context(), + name: 'appMenu' + }); this.add_actor(bin); this.bind_property("reactive", this, "can-focus", 0); this.reactive = false; - this._container = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); + this._container = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'panel-status-menu-box' + }); bin.set_child(this._container); let textureCache = St.TextureCache.get_default(); @@ -56,6 +62,7 @@ var AppMenuButton = GObject.registerClass({ let iconEffect = new Clutter.DesaturateEffect(); this._iconBox = new St.Bin({ + context: St.get_clutter_context(), style_class: 'app-menu-icon', y_align: Clutter.ActorAlign.CENTER, }); @@ -67,8 +74,11 @@ var AppMenuButton = GObject.registerClass({ iconEffect.enabled = themeNode.get_icon_style() == St.IconStyle.SYMBOLIC; }); - this._label = new St.Label({ y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + this._label = new St.Label({ + context: St.get_clutter_context(), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); this._container.add_actor(this._label); this._visible = !Main.overview.visible; @@ -268,8 +278,11 @@ class ActivitiesButton extends PanelMenu.Button { /* Translators: If there is no suitable word for "Activities" in your language, you can use the word for "Overview". */ - this._label = new St.Label({ text: _("Activities"), - y_align: Clutter.ActorAlign.CENTER }); + this._label = new St.Label({ + context: St.get_clutter_context(), + text: _("Activities"), + y_align: Clutter.ActorAlign.CENTER + }); this.add_actor(this._label); this.label_actor = this._label; @@ -349,7 +362,10 @@ class PanelCorner extends St.DrawingArea { _init(side) { this._side = side; - super._init({ style_class: 'panel-corner' }); + super._init({ + context: St.get_clutter_context(), + style_class: 'panel-corner' + }); } _findRightmostButton(container) { @@ -559,7 +575,10 @@ class AggregateMenu extends PanelMenu.Button { let menuLayout = new AggregateLayout(); this.menu.box.set_layout_manager(menuLayout); - this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' }); + this._indicators = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'panel-status-indicators-box' + }); this.add_child(this._indicators); if (Config.HAVE_NETWORKMANAGER) @@ -637,8 +656,11 @@ const PANEL_ITEM_IMPLEMENTATIONS = { var Panel = GObject.registerClass( class Panel extends St.Widget { _init() { - super._init({ name: 'panel', - reactive: true }); + super._init({ + context: St.get_clutter_context(), + name: 'panel', + reactive: true + }); this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); @@ -648,11 +670,20 @@ class Panel extends St.Widget { this.menuManager = new PopupMenu.PopupMenuManager(this); - this._leftBox = new St.BoxLayout({ name: 'panelLeft' }); + this._leftBox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'panelLeft' + }); this.add_child(this._leftBox); - this._centerBox = new St.BoxLayout({ name: 'panelCenter' }); + this._centerBox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'panelCenter' + }); this.add_child(this._centerBox); - this._rightBox = new St.BoxLayout({ name: 'panelRight' }); + this._rightBox = new St.BoxLayout({ + context: St.get_clutter_context(), + name: 'panelRight' + }); this.add_child(this._rightBox); this._leftCorner = new PanelCorner(St.Side.LEFT); diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index 0c2478f8db..c8a39bb21f 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -11,6 +11,7 @@ var ButtonBox = GObject.registerClass( class ButtonBox extends St.Widget { _init(params) { params = Params.parse(params, { + context: St.get_clutter_context(), style_class: 'panel-button', x_expand: true, y_expand: true, @@ -20,7 +21,10 @@ class ButtonBox extends St.Widget { this._delegate = this; - this.container = new St.Bin({ child: this }); + this.container = new St.Bin({ + context: St.get_clutter_context(), + child: this + }); this.connect('style-changed', this._onStyleChanged.bind(this)); this.connect('destroy', this._onDestroy.bind(this)); @@ -202,6 +206,7 @@ var SystemIndicator = GObject.registerClass( class SystemIndicator extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'panel-status-indicators-box', reactive: true, visible: false, @@ -221,7 +226,10 @@ class SystemIndicator extends St.BoxLayout { } _addIndicator() { - let icon = new St.Icon({ style_class: 'system-status-icon' }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'system-status-icon' + }); this.add_actor(icon); icon.connect('notify::visible', this._syncIndicatorsVisible.bind(this)); this._syncIndicatorsVisible(); diff --git a/js/ui/pointerA11yTimeout.js b/js/ui/pointerA11yTimeout.js index 263cc3eaf2..a5900778db 100644 --- a/js/ui/pointerA11yTimeout.js +++ b/js/ui/pointerA11yTimeout.js @@ -16,6 +16,7 @@ var PieTimer = GObject.registerClass({ _init() { this._angle = 0; super._init({ + context: St.get_clutter_context(), style_class: 'pie-timer', opacity: 0, visible: false, diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index ff83d2ceb2..302837e16f 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -48,11 +48,14 @@ function arrowIcon(side) { break; } - let arrow = new St.Icon({ style_class: 'popup-menu-arrow', - icon_name: iconName, - accessible_role: Atk.Role.ARROW, - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + let arrow = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'popup-menu-arrow', + icon_name: iconName, + accessible_role: Atk.Role.ARROW, + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); return arrow; } @@ -78,15 +81,21 @@ var PopupBaseMenuItem = GObject.registerClass({ style_class: null, can_focus: true, }); - super._init({ style_class: 'popup-menu-item', - reactive: params.reactive, - track_hover: params.reactive, - can_focus: params.can_focus, - accessible_role: Atk.Role.MENU_ITEM }); + super._init({ + context: St.get_clutter_context(), + style_class: 'popup-menu-item', + reactive: params.reactive, + track_hover: params.reactive, + can_focus: params.can_focus, + accessible_role: Atk.Role.MENU_ITEM + }); this._delegate = this; this._ornament = Ornament.NONE; - this._ornamentLabel = new St.Label({ style_class: 'popup-menu-ornament' }); + this._ornamentLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'popup-menu-ornament' + }); this.add(this._ornamentLabel); this._parent = null; @@ -272,7 +281,10 @@ class PopupMenuItem extends PopupBaseMenuItem { _init(text, params) { super._init(params); - this.label = new St.Label({ text }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text: text + }); this.add_child(this.label); this.label_actor = this.label; } @@ -288,7 +300,10 @@ class PopupSeparatorMenuItem extends PopupBaseMenuItem { can_focus: false, }); - this.label = new St.Label({ text: text || '' }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text: text || '' + }); this.add(this.label); this.label_actor = this.label; @@ -297,6 +312,7 @@ class PopupSeparatorMenuItem extends PopupBaseMenuItem { this._syncVisibility(); this._separator = new St.Widget({ + context: St.get_clutter_context(), style_class: 'popup-separator-menu-item-separator', x_expand: true, y_expand: true, @@ -322,6 +338,7 @@ var Switch = GObject.registerClass({ this._state = false; super._init({ + context: St.get_clutter_context(), style_class: 'toggle-switch', accessible_role: Atk.Role.CHECK_BOX, state, @@ -356,7 +373,10 @@ var PopupSwitchMenuItem = GObject.registerClass({ _init(text, active, params) { super._init(params); - this.label = new St.Label({ text }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text: text + }); this._switch = new Switch(active); this.accessible_role = Atk.Role.CHECK_MENU_ITEM; @@ -366,12 +386,14 @@ var PopupSwitchMenuItem = GObject.registerClass({ this.add_child(this.label); this._statusBin = new St.Bin({ + context: St.get_clutter_context(), x_align: Clutter.ActorAlign.END, x_expand: true, }); this.add_child(this._statusBin); this._statusLabel = new St.Label({ + context: St.get_clutter_context(), text: '', style_class: 'popup-status-menu-item', }); @@ -439,10 +461,16 @@ class PopupImageMenuItem extends PopupBaseMenuItem { _init(text, icon, params) { super._init(params); - this._icon = new St.Icon({ style_class: 'popup-menu-icon', - x_align: Clutter.ActorAlign.END }); + this._icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'popup-menu-icon', + x_align: Clutter.ActorAlign.END + }); this.add_child(this._icon); - this.label = new St.Label({ text }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text: text + }); this.add_child(this.label); this.label_actor = this.label; @@ -468,6 +496,7 @@ var PopupMenuBase = class { this._parent = null; this.box = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, x_expand: true, y_expand: true, @@ -1008,9 +1037,12 @@ var PopupSubMenu = class extends PopupMenuBase { // Since a function of a submenu might be to provide a "More.." expander // with long content, we make it scrollable - the scrollbar will only take // effect if a CSS max-height is set on the top menu. - this.actor = new St.ScrollView({ style_class: 'popup-sub-menu', - hscrollbar_policy: St.PolicyType.NEVER, - vscrollbar_policy: St.PolicyType.NEVER }); + this.actor = new St.ScrollView({ + context: St.get_clutter_context(), + style_class: 'popup-sub-menu', + hscrollbar_policy: St.PolicyType.NEVER, + vscrollbar_policy: St.PolicyType.NEVER + }); this.actor.add_actor(this.box); this.actor._delegate = this; @@ -1172,17 +1204,24 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem { this.add_style_class_name('popup-submenu-menu-item'); if (wantIcon) { - this.icon = new St.Icon({ style_class: 'popup-menu-icon' }); + this.icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'popup-menu-icon' + }); this.add_child(this.icon); } - this.label = new St.Label({ text, - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + this.label = new St.Label({ + context: St.get_clutter_context(), + text, + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); this.add_child(this.label); this.label_actor = this.label; let expander = new St.Bin({ + context: St.get_clutter_context(), style_class: 'popup-menu-item-expander', x_expand: true, }); @@ -1191,8 +1230,11 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem { this._triangle = arrowIcon(St.Side.RIGHT); this._triangle.pivot_point = new Graphene.Point({ x: 0.5, y: 0.6 }); - this._triangleBin = new St.Widget({ y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + this._triangleBin = new St.Widget({ + context: St.get_clutter_context(), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); this._triangleBin.add_child(this._triangle); this.add_child(this._triangleBin); diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index 137516bdcb..ac5560a6e7 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -228,7 +228,10 @@ var RemoteSearchProvider = class { } if (gicon) - icon = new St.Icon({ gicon, icon_size: size }); + icon = new St.Icon({ + context: St.get_clutter_context(), + gicon, icon_size: size + }); return icon; } diff --git a/js/ui/ripples.js b/js/ui/ripples.js index f38062228f..aea572bd04 100644 --- a/js/ui/ripples.js +++ b/js/ui/ripples.js @@ -12,25 +12,34 @@ var Ripples = class Ripples { this._px = px; this._py = py; - this._ripple1 = new St.BoxLayout({ style_class: styleClass, - opacity: 0, - can_focus: false, - reactive: false, - visible: false }); + this._ripple1 = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: styleClass, + opacity: 0, + can_focus: false, + reactive: false, + visible: false + }); this._ripple1.set_pivot_point(px, py); - this._ripple2 = new St.BoxLayout({ style_class: styleClass, - opacity: 0, - can_focus: false, - reactive: false, - visible: false }); + this._ripple2 = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: styleClass, + opacity: 0, + can_focus: false, + reactive: false, + visible: false + }); this._ripple2.set_pivot_point(px, py); - this._ripple3 = new St.BoxLayout({ style_class: styleClass, - opacity: 0, - can_focus: false, - reactive: false, - visible: false }); + this._ripple3 = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: styleClass, + opacity: 0, + can_focus: false, + reactive: false, + visible: false + }); this._ripple3.set_pivot_point(px, py); } diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index cf835972ea..1bb79cf663 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -61,6 +61,7 @@ class RunDialog extends ModalDialog.ModalDialog { this.contentLayout.add_actor(content); let entry = new St.Entry({ + context: St.get_clutter_context(), style_class: 'run-dialog-entry', can_focus: true, }); @@ -73,6 +74,7 @@ class RunDialog extends ModalDialog.ModalDialog { let defaultDescriptionText = _('Press ESC to close'); this._descriptionLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'run-dialog-description', text: defaultDescriptionText, }); diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 87b79b353d..a215c804c5 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -48,6 +48,7 @@ var ScreenShield = class { this._lockScreenState = MessageTray.State.HIDDEN; this._lockScreenGroup = new St.Widget({ + context: St.get_clutter_context(), x_expand: true, y_expand: true, reactive: true, @@ -57,6 +58,7 @@ var ScreenShield = class { }); this._lockDialogGroup = new St.Widget({ + context: St.get_clutter_context(), x_expand: true, y_expand: true, reactive: true, diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index bf537b7d6d..b8ddbbb442 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -347,6 +347,7 @@ class SelectArea extends St.Widget { this._result = null; super._init({ + context: St.get_clutter_context(), visible: false, reactive: true, x: 0, @@ -361,6 +362,7 @@ class SelectArea extends St.Widget { this.add_constraint(constraint); this._rubberband = new St.Widget({ + context: St.get_clutter_context(), style_class: 'select-area-rubberband', visible: false, }); @@ -570,7 +572,11 @@ var RecolorEffect = GObject.registerClass({ var PickPixel = GObject.registerClass( class PickPixel extends St.Widget { _init(screenshot) { - super._init({ visible: false, reactive: true }); + super._init({ + context: St.get_clutter_context(), + visible: false, + reactive: true + }); this._screenshot = screenshot; @@ -604,6 +610,7 @@ class PickPixel extends St.Widget { smoothing: 0.07, }); this._previewCursor = new St.Icon({ + context: St.get_clutter_context(), icon_name: 'color-pick', icon_size: Meta.prefs_get_cursor_size(), effect: this._recolorEffect, diff --git a/js/ui/search.js b/js/ui/search.js index 7300b053e3..4122640821 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -16,6 +16,14 @@ var MAX_LIST_SEARCH_RESULTS_ROWS = 5; var MaxWidthBox = GObject.registerClass( class MaxWidthBox extends St.BoxLayout { + _init(params) { + const defaultParams = { + context: St.get_clutter_context(), + }; + + super._init(Object.assign(defaultParams, params)); + } + vfunc_allocate(box) { let themeNode = this.get_theme_node(); let maxWidth = themeNode.get_max_width(); @@ -40,6 +48,7 @@ class SearchResult extends St.Button { this._resultsView = resultsView; super._init({ + context: St.get_clutter_context(), reactive: true, can_focus: true, track_hover: true, @@ -69,6 +78,7 @@ class ListSearchResult extends SearchResult { this.style_class = 'list-search-result'; let content = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'list-search-result-content', vertical: false, x_align: Clutter.ActorAlign.START, @@ -80,6 +90,7 @@ class ListSearchResult extends SearchResult { this._termsChangedId = 0; let titleBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'list-search-result-title', y_align: Clutter.ActorAlign.CENTER, }); @@ -92,6 +103,7 @@ class ListSearchResult extends SearchResult { titleBox.add(icon); let title = new St.Label({ + context: St.get_clutter_context(), text: this.metaInfo['name'], y_align: Clutter.ActorAlign.CENTER, }); @@ -101,6 +113,7 @@ class ListSearchResult extends SearchResult { if (this.metaInfo['description']) { this._descriptionLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'list-search-result-description', y_align: Clutter.ActorAlign.CENTER, }); @@ -142,6 +155,7 @@ class GridSearchResult extends SearchResult { this.icon = new IconGrid.BaseIcon(this.metaInfo['name'], { createIcon: this.metaInfo['createIcon'] }); let content = new St.Bin({ + context: St.get_clutter_context(), child: this.icon, x_align: Clutter.ActorAlign.START, x_expand: true, @@ -162,7 +176,11 @@ var SearchResultsBase = GObject.registerClass({ }, }, class SearchResultsBase extends St.BoxLayout { _init(provider, resultsView) { - super._init({ style_class: 'search-section', vertical: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'search-section', + vertical: true + }); this.provider = provider; this._resultsView = resultsView; @@ -170,10 +188,15 @@ var SearchResultsBase = GObject.registerClass({ this._terms = []; this._focusChild = null; - this._resultDisplayBin = new St.Bin(); + this._resultDisplayBin = new St.Bin({ + context: St.get_clutter_context(), + }); this.add_child(this._resultDisplayBin); - let separator = new St.Widget({ style_class: 'search-section-separator' }); + let separator = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'search-section-separator' + }); this.add(separator); this._resultDisplays = {}; @@ -298,7 +321,10 @@ class ListSearchResults extends SearchResultsBase { _init(provider, resultsView) { super._init(provider, resultsView); - this._container = new St.BoxLayout({ style_class: 'search-section-content' }); + this._container = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'search-section-content' + }); this.providerInfo = new ProviderInfo(provider); this.providerInfo.connect('key-focus-in', this._keyFocusIn.bind(this)); this.providerInfo.connect('clicked', () => { @@ -310,6 +336,7 @@ class ListSearchResults extends SearchResultsBase { this._container.add_child(this.providerInfo); this._content = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'list-search-results', vertical: true, x_expand: true, @@ -472,7 +499,10 @@ class GridSearchResults extends SearchResultsBase { _init(provider, resultsView) { super._init(provider, resultsView); - this._grid = new St.Widget({ style_class: 'grid-search-results' }); + this._grid = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'grid-search-results' + }); this._grid.layout_manager = new GridSearchResultsLayout(); this._grid.connect('style-changed', () => { @@ -481,6 +511,7 @@ class GridSearchResults extends SearchResultsBase { }); this._resultDisplayBin.set_child(new St.Bin({ + context: St.get_clutter_context(), child: this._grid, x_align: Clutter.ActorAlign.CENTER, })); @@ -552,7 +583,11 @@ var SearchResultsView = GObject.registerClass({ Signals: { 'terms-changed': {} }, }, class SearchResultsView extends St.BoxLayout { _init() { - super._init({ name: 'searchResults', vertical: true }); + super._init({ + context: St.get_clutter_context(), + name: 'searchResults', + vertical: true + }); this._parentalControlsManager = ParentalControlsManager.getDefault(); this._parentalControlsManager.connect('app-filter-changed', this._reloadRemoteProviders.bind(this)); @@ -564,6 +599,7 @@ var SearchResultsView = GObject.registerClass({ }); this._scrollView = new St.ScrollView({ + context: St.get_clutter_context(), overlay_scrollbars: true, style_class: 'search-display vfade', x_expand: true, @@ -579,11 +615,15 @@ var SearchResultsView = GObject.registerClass({ this.add_child(this._scrollView); this._statusText = new St.Label({ + context: St.get_clutter_context(), style_class: 'search-statustext', x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, }); - this._statusBin = new St.Bin({ y_expand: true }); + this._statusBin = new St.Bin({ + context: St.get_clutter_context(), + y_expand: true + }); this.add_child(this._statusBin); this._statusBin.add_actor(this._statusText); @@ -906,6 +946,7 @@ class ProviderInfo extends St.Button { _init(provider) { this.provider = provider; super._init({ + context: St.get_clutter_context(), style_class: 'search-provider-icon', reactive: true, can_focus: true, @@ -914,21 +955,36 @@ class ProviderInfo extends St.Button { y_align: Clutter.ActorAlign.START, }); - this._content = new St.BoxLayout({ vertical: false, - style_class: 'list-search-provider-content' }); + this._content = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: false, + style_class: 'list-search-provider-content' + }); this.set_child(this._content); - let icon = new St.Icon({ icon_size: this.PROVIDER_ICON_SIZE, - gicon: provider.appInfo.get_icon() }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + icon_size: this.PROVIDER_ICON_SIZE, + gicon: provider.appInfo.get_icon() + }); - let detailsBox = new St.BoxLayout({ style_class: 'list-search-provider-details', - vertical: true, - x_expand: true }); + let detailsBox = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'list-search-provider-details', + vertical: true, + x_expand: true + }); - let nameLabel = new St.Label({ text: provider.appInfo.get_name(), - x_align: Clutter.ActorAlign.START }); + let nameLabel = new St.Label({ + context: St.get_clutter_context(), + text: provider.appInfo.get_name(), + x_align: Clutter.ActorAlign.START + }); - this._moreLabel = new St.Label({ x_align: Clutter.ActorAlign.START }); + this._moreLabel = new St.Label({ + context: St.get_clutter_context(), + x_align: Clutter.ActorAlign.START + }); detailsBox.add_actor(nameLabel); detailsBox.add_actor(this._moreLabel); diff --git a/js/ui/searchController.js b/js/ui/searchController.js index 5d25897c79..0d293ad7b3 100644 --- a/js/ui/searchController.js +++ b/js/ui/searchController.js @@ -9,6 +9,13 @@ const ShellEntry = imports.ui.shellEntry; var FocusTrap = GObject.registerClass( class FocusTrap extends St.Widget { + _init(params) { + const defaultParams = { + context: St.get_clutter_context(), + }; + super._init(Object.assign(defaultParams, params)); + } + vfunc_navigate_focus(from, direction) { if (direction === St.DirectionType.TAB_FORWARD || direction === St.DirectionType.TAB_BACKWARD) @@ -34,6 +41,7 @@ var SearchController = GObject.registerClass({ }, class SearchController extends St.Widget { _init(searchEntry, showAppsButton) { super._init({ + context: St.get_clutter_context(), name: 'searchController', layout_manager: new Clutter.BinLayout(), x_expand: true, @@ -71,10 +79,12 @@ var SearchController = GObject.registerClass({ global.stage.connect('notify::key-focus', this._onStageKeyFocusChanged.bind(this)); this._entry.set_primary_icon(new St.Icon({ + context: St.get_clutter_context(), style_class: 'search-entry-icon', icon_name: 'edit-find-symbolic', })); this._clearIcon = new St.Icon({ + context: St.get_clutter_context(), style_class: 'search-entry-icon', icon_name: 'edit-clear-symbolic', }); diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js index a2010b39e0..29eb82c708 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -160,7 +160,10 @@ function addContextMenu(entry, params) { var CapsLockWarning = GObject.registerClass( class CapsLockWarning extends St.Label { _init(params) { - let defaultParams = { style_class: 'caps-lock-warning-label' }; + let defaultParams = { + context: St.get_clutter_context(), + style_class: 'caps-lock-warning-label' + }; super._init(Object.assign(defaultParams, params)); this.text = _('Caps lock is on.'); diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index 2956c0e967..50f68cac01 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -273,6 +273,7 @@ var ShellMountPasswordDialog = GObject.registerClass({ let passwordGridLayout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL }); let passwordGrid = new St.Widget({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-grid', layout_manager: passwordGridLayout, }); @@ -292,7 +293,10 @@ var ShellMountPasswordDialog = GObject.registerClass({ this._keyfilesCheckbox.connect("clicked", this._onKeyfilesCheckboxClicked.bind(this)); content.add_child(this._keyfilesCheckbox); - this._keyfilesLabel = new St.Label({ visible: false }); + this._keyfilesLabel = new St.Label({ + context: St.get_clutter_context(), + visible: false + }); this._keyfilesLabel.clutter_text.set_markup( /* Translators: %s is the Disks application */ _('To unlock a volume that uses keyfiles, use the %s utility instead.') @@ -302,6 +306,7 @@ var ShellMountPasswordDialog = GObject.registerClass({ content.add_child(this._keyfilesLabel); this._pimEntry = new St.PasswordEntry({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-entry', hint_text: _('PIM Number'), can_focus: true, @@ -322,6 +327,7 @@ var ShellMountPasswordDialog = GObject.registerClass({ } this._passwordEntry = new St.PasswordEntry({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-password-entry', hint_text: _('Password'), can_focus: true, @@ -344,12 +350,16 @@ var ShellMountPasswordDialog = GObject.registerClass({ } curGridRow += 1; - let warningBox = new St.BoxLayout({ vertical: true }); + let warningBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); let capsLockWarning = new ShellEntry.CapsLockWarning(); warningBox.add_child(capsLockWarning); this._errorMessageLabel = new St.Label({ + context: St.get_clutter_context(), style_class: 'prompt-dialog-error-label', opacity: 0, }); diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index a0513f68c8..7e766e3273 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -35,6 +35,7 @@ class ATIndicator extends PanelMenu.Button { super._init(0.5, _("Accessibility")); this.add_child(new St.Icon({ + context: St.get_clutter_context(), style_class: 'system-status-icon', icon_name: 'preferences-desktop-accessibility-symbolic', })); diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js index 17247880f5..62c1a2d25d 100644 --- a/js/ui/status/brightness.js +++ b/js/ui/status/brightness.js @@ -38,8 +38,11 @@ class Indicator extends PanelMenu.SystemIndicator { this._sliderChanged.bind(this)); this._slider.accessible_name = _("Brightness"); - let icon = new St.Icon({ icon_name: 'display-brightness-symbolic', - style_class: 'popup-menu-icon' }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'display-brightness-symbolic', + style_class: 'popup-menu-icon' + }); this._item.add(icon); this._item.add_child(this._slider); this._item.connect('button-press-event', (actor, event) => { diff --git a/js/ui/status/dwellClick.js b/js/ui/status/dwellClick.js index 4b1d8a2c13..56b55f8dba 100644 --- a/js/ui/status/dwellClick.js +++ b/js/ui/status/dwellClick.js @@ -35,8 +35,11 @@ class DwellClickIndicator extends PanelMenu.Button { _init() { super._init(0.5, _("Dwell Click")); - this._icon = new St.Icon({ style_class: 'system-status-icon', - icon_name: 'pointer-primary-click-symbolic' }); + this._icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'system-status-icon', + icon_name: 'pointer-primary-click-symbolic' + }); this.add_child(this._icon); this._a11ySettings = new Gio.Settings({ schema_id: MOUSE_A11Y_SCHEMA }); diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index bc50f3d376..d321558c7e 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -22,10 +22,14 @@ class LayoutMenuItem extends PopupMenu.PopupBaseMenuItem { super._init(); this.label = new St.Label({ + context: St.get_clutter_context(), text: displayName, x_expand: true, }); - this.indicator = new St.Label({ text: shortName }); + this.indicator = new St.Label({ + context: St.get_clutter_context(), + text: shortName + }); this.add_child(this.label); this.add(this.indicator); this.label_actor = this.label; @@ -114,10 +118,17 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList { } _addIcon(item) { - let box = new St.BoxLayout({ vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); - let bin = new St.Bin({ style_class: 'input-source-switcher-symbol' }); + let bin = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'input-source-switcher-symbol' + }); let symbol = new St.Label({ + context: St.get_clutter_context(), text: item.shortName, x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, @@ -126,6 +137,7 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList { box.add_child(bin); let text = new St.Label({ + context: St.get_clutter_context(), text: item.displayName, x_align: Clutter.ActorAlign.CENTER, }); @@ -789,6 +801,13 @@ function getInputSourceManager() { var InputSourceIndicatorContainer = GObject.registerClass( class InputSourceIndicatorContainer extends St.Widget { + _init(params) { + const defaultParams = { + context: St.get_clutter_context(), + }; + super._init(Object.assign(defaultParams, params)); + } + vfunc_get_preferred_width(forHeight) { // Here, and in vfunc_get_preferred_height, we need to query // for the height of all children, but we ignore the results @@ -888,8 +907,11 @@ class InputSourceIndicator extends PanelMenu.Button { let menuItem = new LayoutMenuItem(is.displayName, is.shortName); menuItem.connect('activate', () => is.activate(true)); - let indicatorLabel = new St.Label({ text: is.shortName, - visible: false }); + let indicatorLabel = new St.Label({ + context: St.get_clutter_context(), + text: is.shortName, + visible: false + }); this._menuItems[i] = menuItem; this._indicatorLabels[i] = indicatorLabel; diff --git a/js/ui/status/location.js b/js/ui/status/location.js index 7e0222b72c..a93b97f72b 100644 --- a/js/ui/status/location.js +++ b/js/ui/status/location.js @@ -401,12 +401,14 @@ var GeolocationDialog = GObject.registerClass({ }); let reasonLabel = new St.Label({ + context: St.get_clutter_context(), text: reason, style_class: 'message-dialog-description', }); content.add_child(reasonLabel); let infoLabel = new St.Label({ + context: St.get_clutter_context(), text: _('Location access can be changed at any time from the privacy settings.'), style_class: 'message-dialog-description', }); diff --git a/js/ui/status/network.js b/js/ui/status/network.js index a67af20656..9e707ede7d 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -688,9 +688,12 @@ var NMWirelessDialogItem = GObject.registerClass({ this._network = network; this._ap = network.accessPoints[0]; - super._init({ style_class: 'nm-dialog-item', - can_focus: true, - reactive: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-item', + can_focus: true, + reactive: true + }); let action = new Clutter.ClickAction(); action.connect('clicked', () => this.grab_key_focus()); @@ -698,6 +701,7 @@ var NMWirelessDialogItem = GObject.registerClass({ let title = ssidToLabel(this._ap.get_ssid()); this._label = new St.Label({ + context: St.get_clutter_context(), text: title, x_expand: true, }); @@ -705,22 +709,32 @@ var NMWirelessDialogItem = GObject.registerClass({ this.label_actor = this._label; this.add_child(this._label); - this._selectedIcon = new St.Icon({ style_class: 'nm-dialog-icon', - icon_name: 'object-select-symbolic' }); + this._selectedIcon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-icon', + icon_name: 'object-select-symbolic' + }); this.add(this._selectedIcon); this._icons = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'nm-dialog-icons', x_align: Clutter.ActorAlign.END, }); this.add_child(this._icons); - this._secureIcon = new St.Icon({ style_class: 'nm-dialog-icon' }); + this._secureIcon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-icon' + }); if (this._ap._secType != NMAccessPointSecurity.NONE) this._secureIcon.icon_name = 'network-wireless-encrypted-symbolic'; this._icons.add_actor(this._secureIcon); - this._signalIcon = new St.Icon({ style_class: 'nm-dialog-icon' }); + this._signalIcon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-icon' + }); this._icons.add_actor(this._signalIcon); this._sync(); @@ -901,16 +915,31 @@ class NMWirelessDialog extends ModalDialog.ModalDialog { } _buildLayout() { - let headline = new St.BoxLayout({ style_class: 'nm-dialog-header-hbox' }); + let headline = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-header-hbox' + }); - let icon = new St.Icon({ style_class: 'nm-dialog-header-icon', - icon_name: 'network-wireless-signal-excellent-symbolic' }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-header-icon', + icon_name: 'network-wireless-signal-excellent-symbolic' + }); - let titleBox = new St.BoxLayout({ vertical: true }); - let title = new St.Label({ style_class: 'nm-dialog-header', - text: _("Wi-Fi Networks") }); - let subtitle = new St.Label({ style_class: 'nm-dialog-subheader', - text: _("Select a network") }); + let titleBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); + let title = new St.Label({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-header', + text: _("Wi-Fi Networks") + }); + let subtitle = new St.Label({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-subheader', + text: _("Select a network") + }); titleBox.add(title); titleBox.add(subtitle); @@ -921,12 +950,19 @@ class NMWirelessDialog extends ModalDialog.ModalDialog { this.contentLayout.add(headline); this._stack = new St.Widget({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), y_expand: true, }); - this._itemBox = new St.BoxLayout({ vertical: true }); - this._scrollView = new St.ScrollView({ style_class: 'nm-dialog-scroll-view' }); + this._itemBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); + this._scrollView = new St.ScrollView({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-scroll-view' + }); this._scrollView.set_x_expand(true); this._scrollView.set_y_expand(true); this._scrollView.set_policy(St.PolicyType.NEVER, @@ -934,27 +970,51 @@ class NMWirelessDialog extends ModalDialog.ModalDialog { this._scrollView.add_actor(this._itemBox); this._stack.add_child(this._scrollView); - this._noNetworksBox = new St.BoxLayout({ vertical: true, - style_class: 'no-networks-box', - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER }); + this._noNetworksBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + style_class: 'no-networks-box', + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER + }); this._noNetworksSpinner = new Animation.Spinner(16); this._noNetworksBox.add_actor(this._noNetworksSpinner); - this._noNetworksBox.add_actor(new St.Label({ style_class: 'no-networks-label', - text: _("No Networks") })); + this._noNetworksBox.add_actor(new St.Label({ + context: St.get_clutter_context(), + style_class: 'no-networks-label', + text: _("No Networks") + })); this._stack.add_child(this._noNetworksBox); - this._airplaneBox = new St.BoxLayout({ vertical: true, - style_class: 'nm-dialog-airplane-box', - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER }); - this._airplaneIcon = new St.Icon({ icon_size: 48 }); - this._airplaneHeadline = new St.Label({ style_class: 'nm-dialog-airplane-headline headline' }); - this._airplaneText = new St.Label({ style_class: 'nm-dialog-airplane-text' }); + this._airplaneBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true, + style_class: 'nm-dialog-airplane-box', + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER + }); + this._airplaneIcon = new St.Icon({ + context: St.get_clutter_context(), + icon_size: 48 + }); + this._airplaneHeadline = new St.Label({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-airplane-headline headline' + }); + this._airplaneText = new St.Label({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-airplane-text' + }); - let airplaneSubStack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); - this._airplaneButton = new St.Button({ style_class: 'modal-dialog-button button' }); + let airplaneSubStack = new St.Widget({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout() + }); + this._airplaneButton = new St.Button({ + context: St.get_clutter_context(), + style_class: 'modal-dialog-button button' + }); this._airplaneButton.connect('clicked', () => { if (this._rfkill.airplaneMode) this._rfkill.airplaneMode = false; @@ -962,8 +1022,11 @@ class NMWirelessDialog extends ModalDialog.ModalDialog { this._client.wireless_enabled = true; }); airplaneSubStack.add_actor(this._airplaneButton); - this._airplaneInactive = new St.Label({ style_class: 'nm-dialog-airplane-text', - text: _("Use hardware switch to turn off") }); + this._airplaneInactive = new St.Label({ + context: St.get_clutter_context(), + style_class: 'nm-dialog-airplane-text', + text: _("Use hardware switch to turn off") + }); airplaneSubStack.add_actor(this._airplaneInactive); this._airplaneBox.add_child(this._airplaneIcon); diff --git a/js/ui/status/power.js b/js/ui/status/power.js index c79ff798e9..02d4301811 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -30,6 +30,7 @@ class Indicator extends PanelMenu.SystemIndicator { this._indicator = this._addIndicator(); this._percentageLabel = new St.Label({ + context: St.get_clutter_context(), y_expand: true, y_align: Clutter.ActorAlign.CENTER, }); diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 6f71109c52..273a7b31a4 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -98,7 +98,9 @@ class Indicator extends PanelMenu.SystemIndicator { this._settingsItem = item; } else { log('Missing required core component Settings, expect trouble…'); - this._settingsItem = new St.Widget(); + this._settingsItem = new St.Widget({ + context: St.get_clutter_context(), + }); } item = new PopupMenu.PopupImageMenuItem(_('Lock'), 'changes-prevent-symbolic'); diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 0b3221f672..674fed1675 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -52,7 +52,10 @@ var StreamSlider = class { this._notifyVolumeChange(); }); - this._icon = new St.Icon({ style_class: 'popup-menu-icon' }); + this._icon = new St.Icon({ + context: St.get_clutter_context(), + style_class: 'popup-menu-icon' + }); this.item.add(this._icon); this.item.add_child(this._slider); this.item.connect('button-press-event', (actor, event) => { diff --git a/js/ui/switchMonitor.js b/js/ui/switchMonitor.js index 5ac5825224..ff30f2db65 100644 --- a/js/ui/switchMonitor.js +++ b/js/ui/switchMonitor.js @@ -79,14 +79,21 @@ class SwitchMonitorSwitcher extends SwitcherPopup.SwitcherList { } _addIcon(item) { - let box = new St.BoxLayout({ style_class: 'alt-tab-app', - vertical: true }); + let box = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'alt-tab-app', + vertical: true + }); - let icon = new St.Icon({ icon_name: item.icon, - icon_size: APP_ICON_SIZE }); + let icon = new St.Icon({ + context: St.get_clutter_context(), + icon_name: item.icon, + icon_size: APP_ICON_SIZE + }); box.add_child(icon); let text = new St.Label({ + context: St.get_clutter_context(), text: item.label, x_align: Clutter.ActorAlign.CENTER, }); diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index b1e2730068..0dc679efb9 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -33,9 +33,12 @@ var SwitcherPopup = GObject.registerClass({ GTypeFlags: GObject.TypeFlags.ABSTRACT, }, class SwitcherPopup extends St.Widget { _init(items) { - super._init({ style_class: 'switcher-popup', - reactive: true, - visible: false }); + super._init({ + context: St.get_clutter_context(), + style_class: 'switcher-popup', + reactive: true, + visible: false + }); this._switcherList = null; @@ -356,8 +359,11 @@ var SwitcherPopup = GObject.registerClass({ var SwitcherButton = GObject.registerClass( class SwitcherButton extends St.Button { _init(square) { - super._init({ style_class: 'item-box', - reactive: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'item-box', + reactive: true + }); this._square = square; } @@ -376,12 +382,18 @@ var SwitcherList = GObject.registerClass({ 'item-removed': { param_types: [GObject.TYPE_INT] } }, }, class SwitcherList extends St.Widget { _init(squareItems) { - super._init({ style_class: 'switcher-list' }); + super._init({ + context: St.get_clutter_context(), + style_class: 'switcher-list' + }); - this._list = new St.BoxLayout({ style_class: 'switcher-list-item-container', - vertical: false, - x_expand: true, - y_expand: true }); + this._list = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'switcher-list-item-container', + vertical: false, + x_expand: true, + y_expand: true + }); let layoutManager = this._list.get_layout_manager(); @@ -390,21 +402,30 @@ var SwitcherList = GObject.registerClass({ this._list.spacing = this._list.get_theme_node().get_length('spacing'); }); - this._scrollView = new St.ScrollView({ style_class: 'hfade', - enable_mouse_scrolling: false }); + this._scrollView = new St.ScrollView({ + context: St.get_clutter_context(), + style_class: 'hfade', + enable_mouse_scrolling: false + }); this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.NEVER); this._scrollView.add_actor(this._list); this.add_actor(this._scrollView); // Those arrows indicate whether scrolling in one direction is possible - this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow', - pseudo_class: 'highlighted' }); + this._leftArrow = new St.DrawingArea({ + context: St.get_clutter_context(), + style_class: 'switcher-arrow', + pseudo_class: 'highlighted' + }); this._leftArrow.connect('repaint', () => { drawArrow(this._leftArrow, St.Side.LEFT); }); - this._rightArrow = new St.DrawingArea({ style_class: 'switcher-arrow', - pseudo_class: 'highlighted' }); + this._rightArrow = new St.DrawingArea({ + context: St.get_clutter_context(), + style_class: 'switcher-arrow', + pseudo_class: 'highlighted' + }); this._rightArrow.connect('repaint', () => { drawArrow(this._rightArrow, St.Side.RIGHT); }); diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index 370385abc4..43280c1011 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -32,13 +32,18 @@ var NotificationsBox = GObject.registerClass({ }, class NotificationsBox extends St.BoxLayout { _init() { super._init({ + context: St.get_clutter_context(), vertical: true, name: 'unlockDialogNotifications', style_class: 'unlock-dialog-notifications-container', }); - this._scrollView = new St.ScrollView({ hscrollbar_policy: St.PolicyType.NEVER }); + this._scrollView = new St.ScrollView({ + context: St.get_clutter_context(), + hscrollbar_policy: St.PolicyType.NEVER + }); this._notificationBox = new St.BoxLayout({ + context: St.get_clutter_context(), vertical: true, style_class: 'unlock-dialog-notifications-container', }); @@ -80,6 +85,7 @@ var NotificationsBox = GObject.registerClass({ box.add_child(sourceActor); let textBox = new St.BoxLayout({ + context: St.get_clutter_context(), x_expand: true, y_expand: true, y_align: Clutter.ActorAlign.CENTER, @@ -87,6 +93,7 @@ var NotificationsBox = GObject.registerClass({ box.add_child(textBox); let title = new St.Label({ + context: St.get_clutter_context(), text: source.title, style_class: 'unlock-dialog-notification-label', x_expand: true, @@ -96,6 +103,7 @@ var NotificationsBox = GObject.registerClass({ let count = source.unseenCount; let countLabel = new St.Label({ + context: St.get_clutter_context(), text: count.toString(), visible: count > 1, style_class: 'unlock-dialog-notification-count-text', @@ -108,13 +116,20 @@ var NotificationsBox = GObject.registerClass({ _makeNotificationDetailedSource(source, box) { let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE); - let sourceBin = new St.Bin({ child: sourceActor }); + let sourceBin = new St.Bin({ + context: St.get_clutter_context(), + child: sourceActor + }); box.add(sourceBin); - let textBox = new St.BoxLayout({ vertical: true }); + let textBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); box.add_child(textBox); let title = new St.Label({ + context: St.get_clutter_context(), text: source.title.replace(/\n/g, ' '), style_class: 'unlock-dialog-notification-label', }); @@ -135,7 +150,10 @@ var NotificationsBox = GObject.registerClass({ : GLib.markup_escape_text(bodyText, -1); } - let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' }); + let label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'unlock-dialog-notification-count-text' + }); label.clutter_text.set_markup('%s %s'.format(n.title, body)); textBox.add(label); @@ -191,6 +209,7 @@ var NotificationsBox = GObject.registerClass({ }; obj.sourceBox = new St.BoxLayout({ + context: St.get_clutter_context(), style_class: 'unlock-dialog-notification-source', x_expand: true, }); @@ -317,17 +336,24 @@ var NotificationsBox = GObject.registerClass({ var Clock = GObject.registerClass( class UnlockDialogClock extends St.BoxLayout { _init() { - super._init({ style_class: 'unlock-dialog-clock', vertical: true }); + super._init({ + context: St.get_clutter_context(), + style_class: 'unlock-dialog-clock', + vertical: true + }); this._time = new St.Label({ + context: St.get_clutter_context(), style_class: 'unlock-dialog-clock-time', x_align: Clutter.ActorAlign.CENTER, }); this._date = new St.Label({ + context: St.get_clutter_context(), style_class: 'unlock-dialog-clock-date', x_align: Clutter.ActorAlign.CENTER, }); this._hint = new St.Label({ + context: St.get_clutter_context(), style_class: 'unlock-dialog-clock-hint', x_align: Clutter.ActorAlign.CENTER, opacity: 0, @@ -474,6 +500,7 @@ var UnlockDialog = GObject.registerClass({ }, class UnlockDialog extends St.Widget { _init(parentActor) { super._init({ + context: St.get_clutter_context(), accessible_role: Atk.Role.WINDOW, style_class: 'unlock-dialog', visible: false, @@ -521,7 +548,9 @@ var UnlockDialog = GObject.registerClass({ this.add_action(tapAction); // Background - this._backgroundGroup = new Clutter.Actor(); + this._backgroundGroup = new Clutter.Actor({ + context: St.get_clutter_context(), + }); this.add_child(this._backgroundGroup); this._bgManagers = []; @@ -541,7 +570,10 @@ var UnlockDialog = GObject.registerClass({ // Authentication & Clock stack this._stack = new Shell.Stack(); - this._promptBox = new St.BoxLayout({ vertical: true }); + this._promptBox = new St.BoxLayout({ + context: St.get_clutter_context(), + vertical: true + }); this._promptBox.set_pivot_point(0.5, 0.5); this._promptBox.hide(); this._stack.add_child(this._promptBox); @@ -561,13 +593,17 @@ var UnlockDialog = GObject.registerClass({ // Switch User button this._otherUserButton = new St.Button({ + context: St.get_clutter_context(), style_class: 'modal-dialog-button button switch-user-button', accessible_name: _('Log in as another user'), reactive: false, opacity: 0, x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.END, - child: new St.Icon({ icon_name: 'system-users-symbolic' }), + child: new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'system-users-symbolic' + }), }); this._otherUserButton.set_pivot_point(0.5, 0.5); this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this)); @@ -587,7 +623,9 @@ var UnlockDialog = GObject.registerClass({ this._updateUserSwitchVisibility(); // Main Box - let mainBox = new St.Widget(); + let mainBox = new St.Widget({ + context: St.get_clutter_context(), + }); mainBox.add_constraint(new Layout.MonitorConstraint({ primary: true })); mainBox.add_child(this._stack); mainBox.add_child(this._notificationsBox); @@ -629,6 +667,7 @@ var UnlockDialog = GObject.registerClass({ _createBackground(monitorIndex) { let monitor = Main.layoutManager.monitors[monitorIndex]; let widget = new St.Widget({ + context: St.get_clutter_context(), style_class: 'screen-shield-background', x: monitor.x, y: monitor.y, diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index c376028af3..185c279efb 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -25,6 +25,7 @@ class Avatar extends St.Bin { }); super._init({ + context: St.get_clutter_context(), style_class: params.styleClass, reactive: params.reactive, width: params.iconSize * themeContext.scaleFactor, @@ -97,6 +98,7 @@ class Avatar extends St.Bin { } else { this.style = null; this.child = new St.Icon({ + context: St.get_clutter_context(), icon_name: 'avatar-default-symbolic', icon_size: this._iconSize, }); @@ -107,16 +109,25 @@ class Avatar extends St.Bin { var UserWidgetLabel = GObject.registerClass( class UserWidgetLabel extends St.Widget { _init(user) { - super._init({ layout_manager: new Clutter.BinLayout() }); + super._init({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout() + }); this._user = user; - this._realNameLabel = new St.Label({ style_class: 'user-widget-label', - y_align: Clutter.ActorAlign.CENTER }); + this._realNameLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'user-widget-label', + y_align: Clutter.ActorAlign.CENTER + }); this.add_child(this._realNameLabel); - this._userNameLabel = new St.Label({ style_class: 'user-widget-label', - y_align: Clutter.ActorAlign.CENTER }); + this._userNameLabel = new St.Label({ + context: St.get_clutter_context(), + style_class: 'user-widget-label', + y_align: Clutter.ActorAlign.CENTER + }); this.add_child(this._userNameLabel); this._currentLabel = null; @@ -198,6 +209,7 @@ class UserWidget extends St.BoxLayout { let styleClass = vertical ? 'user-widget vertical' : 'user-widget horizontal'; super._init({ + context: St.get_clutter_context(), styleClass, vertical, xAlign, @@ -222,6 +234,7 @@ class UserWidget extends St.BoxLayout { this._userChangedId = this._user.connect('changed', this._updateUser.bind(this)); } else { this._label = new St.Label({ + context: St.get_clutter_context(), style_class: 'user-widget-label', text: 'Empty User', opacity: 0, diff --git a/js/ui/welcomeDialog.js b/js/ui/welcomeDialog.js index cf6540fe23..df9d23370c 100644 --- a/js/ui/welcomeDialog.js +++ b/js/ui/welcomeDialog.js @@ -37,7 +37,10 @@ class WelcomeDialog extends ModalDialog.ModalDialog { const description = _('If you want to learn your way around, check out the tour.'); const content = new Dialog.MessageDialogContent({ title, description }); - const icon = new St.Widget({ style_class: 'welcome-dialog-image' }); + const icon = new St.Widget({ + context: St.get_clutter_context(), + style_class: 'welcome-dialog-image' + }); content.insert_child_at_index(icon, 0); this.contentLayout.add_child(content); diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index caaecec410..a0b7268f6d 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -388,7 +388,9 @@ var WorkspaceTracker = class { var TilePreview = GObject.registerClass( class TilePreview extends St.Widget { _init() { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); global.window_group.add_actor(this); this._reset(); @@ -535,11 +537,17 @@ var AppSwitchAction = GObject.registerClass({ var ResizePopup = GObject.registerClass( class ResizePopup extends St.Widget { _init() { - super._init({ layout_manager: new Clutter.BinLayout() }); - this._label = new St.Label({ style_class: 'resize-popup', - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER, - x_expand: true, y_expand: true }); + super._init({ + context: St.get_clutter_context(), + layout_manager: new Clutter.BinLayout() + }); + this._label = new St.Label({ + context: St.get_clutter_context(), + style_class: 'resize-popup', + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER, + x_expand: true, y_expand: true + }); this.add_child(this._label); Main.uiGroup.add_actor(this); } @@ -1284,7 +1292,10 @@ var WindowManager = class { // Position a clone of the window on top of the old position, // while actor updates are frozen. let actorContent = actor.paint_to_content(oldFrameRect); - let actorClone = new St.Widget({ content: actorContent }); + let actorClone = new St.Widget({ + context: St.get_clutter_context(), + content: actorContent + }); actorClone.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS); actorClone.set_position(oldFrameRect.x, oldFrameRect.y); actorClone.set_size(oldFrameRect.width, oldFrameRect.height); diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js index 27cecdac23..928871de5b 100644 --- a/js/ui/windowMenu.js +++ b/js/ui/windowMenu.js @@ -196,7 +196,10 @@ var WindowMenuManager = class { constructor() { this._manager = new PopupMenu.PopupMenuManager(Main.layoutManager.dummyCursor); - this._sourceActor = new St.Widget({ reactive: true, visible: false }); + this._sourceActor = new St.Widget({ + context: St.get_clutter_context(), + reactive: true, visible: false + }); this._sourceActor.connect('button-press-event', () => { this._manager.activeMenu.toggle(); }); diff --git a/js/ui/windowPreview.js b/js/ui/windowPreview.js index e67ec9ec0f..f9407fa1d6 100644 --- a/js/ui/windowPreview.js +++ b/js/ui/windowPreview.js @@ -46,6 +46,7 @@ var WindowPreview = GObject.registerClass({ this._overviewAdjustment = overviewAdjustment; super._init({ + context: St.get_clutter_context(), reactive: true, can_focus: true, accessible_role: Atk.Role.PUSH_BUTTON, @@ -53,6 +54,7 @@ var WindowPreview = GObject.registerClass({ }); const windowContainer = new Clutter.Actor({ + context: St.get_clutter_context(), pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), }); this.window_container = windowContainer; @@ -146,6 +148,7 @@ var WindowPreview = GObject.registerClass({ const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); this._title = new St.Label({ + context: St.get_clutter_context(), visible: false, style_class: 'window-caption', text: this._getCaption(), @@ -185,9 +188,13 @@ var WindowPreview = GObject.registerClass({ ? St.Side.LEFT : St.Side.RIGHT; this._closeButton = new St.Button({ + context: St.get_clutter_context(), visible: false, style_class: 'window-close', - child: new St.Icon({ icon_name: 'preview-close-symbolic' }), + child: new St.Icon({ + context: St.get_clutter_context(), + icon_name: 'preview-close-symbolic' + }), }); this._closeButton.add_constraint(new Clutter.BindConstraint({ source: windowContainer, diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 6c32f01da9..40d6750346 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -929,6 +929,7 @@ var WorkspaceBackground = GObject.registerClass( class WorkspaceBackground extends St.Widget { _init(monitorIndex, stateAdjustment) { super._init({ + context: St.get_clutter_context(), style_class: 'workspace-background', layout_manager: new Clutter.BinLayout(), x_expand: true, @@ -945,11 +946,13 @@ class WorkspaceBackground extends St.Widget { }); this._bin = new Clutter.Actor({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), clip_to_allocation: true, }); this._backgroundGroup = new Meta.BackgroundGroup({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), x_expand: true, y_expand: true, @@ -1064,6 +1067,7 @@ var Workspace = GObject.registerClass( class Workspace extends St.Widget { _init(metaWorkspace, monitorIndex, overviewAdjustment) { super._init({ + context: St.get_clutter_context(), style_class: 'window-picker', pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), layout_manager: new Clutter.BinLayout(), @@ -1079,6 +1083,7 @@ class Workspace extends St.Widget { // Window previews this._container = new Clutter.Actor({ + context: St.get_clutter_context(), reactive: true, x_expand: true, y_expand: true, diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index d240fe1562..98023005a4 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -14,7 +14,9 @@ const WORKSPACE_SPACING = 100; const WorkspaceGroup = GObject.registerClass( class WorkspaceGroup extends Clutter.Actor { _init(workspace, monitor, movingWindow) { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); this._workspace = workspace; this._monitor = monitor; @@ -22,7 +24,9 @@ class WorkspaceGroup extends Clutter.Actor { this._windowRecords = []; if (this._workspace) { - this._background = new Meta.BackgroundGroup(); + this._background = new Meta.BackgroundGroup({ + context: St.get_clutter_context(), + }); this.add_actor(this._background); @@ -88,6 +92,7 @@ class WorkspaceGroup extends Clutter.Actor { for (const windowActor of windowActors) { const clone = new Clutter.Clone({ + context: St.get_clutter_context(), source: windowActor, x: windowActor.x - this._monitor.x, y: windowActor.y - this._monitor.y, @@ -134,6 +139,7 @@ const MonitorGroup = GObject.registerClass({ }, class MonitorGroup extends St.Widget { _init(monitor, workspaceIndices, movingWindow) { super._init({ + context: St.get_clutter_context(), clip_to_allocation: true, style_class: 'workspace-animation', }); @@ -143,7 +149,9 @@ const MonitorGroup = GObject.registerClass({ const constraint = new Layout.MonitorConstraint({ index: monitor.index }); this.add_constraint(constraint); - this._container = new Clutter.Actor(); + this._container = new Clutter.Actor({ + context: St.get_clutter_context(), + }); this.add_child(this._container); const stickyGroup = new WorkspaceGroup(null, monitor, movingWindow); diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js index 5b65bec8ad..6da2e13a9d 100644 --- a/js/ui/workspaceSwitcherPopup.js +++ b/js/ui/workspaceSwitcherPopup.js @@ -12,6 +12,7 @@ var WorkspaceSwitcherPopupList = GObject.registerClass( class WorkspaceSwitcherPopupList extends St.Widget { _init() { super._init({ + context: St.get_clutter_context(), style_class: 'workspace-switcher', offscreen_redirect: Clutter.OffscreenRedirect.ALWAYS, }); @@ -122,17 +123,23 @@ class WorkspaceSwitcherPopupList extends St.Widget { var WorkspaceSwitcherPopup = GObject.registerClass( class WorkspaceSwitcherPopup extends St.Widget { _init() { - super._init({ x: 0, - y: 0, - width: global.screen_width, - height: global.screen_height, - style_class: 'workspace-switcher-group' }); + super._init({ + context: St.get_clutter_context(), + x: 0, + y: 0, + width: global.screen_width, + height: global.screen_height, + style_class: 'workspace-switcher-group' + }); Main.uiGroup.add_actor(this); this._timeoutId = 0; - this._container = new St.BoxLayout({ style_class: 'workspace-switcher-container' }); + this._container = new St.BoxLayout({ + context: St.get_clutter_context(), + style_class: 'workspace-switcher-container' + }); this.add_child(this._container); this._list = new WorkspaceSwitcherPopupList(); @@ -161,15 +168,30 @@ class WorkspaceSwitcherPopup extends St.Widget { let indicator = null; if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.UP) - indicator = new St.Bin({ style_class: 'ws-switcher-active-up' }); + indicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'ws-switcher-active-up' + }); else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.DOWN) - indicator = new St.Bin({ style_class: 'ws-switcher-active-down' }); + indicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'ws-switcher-active-down' + }); else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.LEFT) - indicator = new St.Bin({ style_class: 'ws-switcher-active-left' }); + indicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'ws-switcher-active-left' + }); else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.RIGHT) - indicator = new St.Bin({ style_class: 'ws-switcher-active-right' }); + indicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'ws-switcher-active-right' + }); else - indicator = new St.Bin({ style_class: 'ws-switcher-box' }); + indicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'ws-switcher-box' + }); this._list.add_actor(indicator); } diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 412527c938..21ce378a5b 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -53,8 +53,12 @@ var WindowClone = GObject.registerClass({ }, }, class WindowClone extends Clutter.Actor { _init(realWindow) { - let clone = new Clutter.Clone({ source: realWindow }); + let clone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: realWindow + }); super._init({ + context: St.get_clutter_context(), layout_manager: new PrimaryActorLayout(clone), reactive: true, }); @@ -138,7 +142,10 @@ var WindowClone = GObject.registerClass({ } _doAddAttachedDialog(metaDialog, realDialog) { - let clone = new Clutter.Clone({ source: realDialog }); + let clone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: realDialog + }); this._updateDialogPosition(realDialog, clone); clone._updateId = realDialog.connect('notify::position', dialog => { @@ -260,6 +267,7 @@ var WorkspaceThumbnail = GObject.registerClass({ }, class WorkspaceThumbnail extends St.Widget { _init(metaWorkspace, monitorIndex) { super._init({ + context: St.get_clutter_context(), clip_to_allocation: true, style_class: 'workspace-thumbnail', pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }), @@ -271,10 +279,14 @@ var WorkspaceThumbnail = GObject.registerClass({ this._removed = false; - this._viewport = new Clutter.Actor(); + this._viewport = new Clutter.Actor({ + context: St.get_clutter_context(), + }); this.add_child(this._viewport); - this._contents = new Clutter.Actor(); + this._contents = new Clutter.Actor({ + context: St.get_clutter_context(), + }); this._viewport.add_child(this._contents); this.connect('destroy', this._onDestroy.bind(this)); @@ -625,6 +637,7 @@ var ThumbnailsBox = GObject.registerClass({ }, class ThumbnailsBox extends St.Widget { _init(scrollAdjustment, monitorIndex) { super._init({ + context: St.get_clutter_context(), style_class: 'workspace-thumbnails', reactive: true, x_align: Clutter.ActorAlign.CENTER, @@ -633,7 +646,10 @@ var ThumbnailsBox = GObject.registerClass({ this._delegate = this; - let indicator = new St.Bin({ style_class: 'workspace-thumbnail-indicator' }); + let indicator = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'workspace-thumbnail-indicator' + }); // We don't want the indicator to affect drag-and-drop Shell.util_set_hidden_from_pick(indicator, true); @@ -645,7 +661,10 @@ var ThumbnailsBox = GObject.registerClass({ this._dropWorkspace = -1; this._dropPlaceholderPos = -1; - this._dropPlaceholder = new St.Bin({ style_class: 'placeholder' }); + this._dropPlaceholder = new St.Bin({ + context: St.get_clutter_context(), + style_class: 'placeholder' + }); this.add_actor(this._dropPlaceholder); this._spliceIndex = -1; diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 3761881d01..111ebedb12 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -27,6 +27,7 @@ var WorkspacesViewBase = GObject.registerClass({ }, class WorkspacesViewBase extends St.Widget { _init(monitorIndex, overviewAdjustment) { super._init({ + context: St.get_clutter_context(), style_class: 'workspaces-view', x_expand: true, y_expand: true, @@ -609,6 +610,7 @@ class SecondaryMonitorDisplay extends St.Widget { this._overviewAdjustment = overviewAdjustment; super._init({ + context: St.get_clutter_context(), style_class: 'secondary-monitor-workspaces', constraints: new Layout.MonitorConstraint({ index: this._monitorIndex, @@ -835,6 +837,7 @@ var WorkspacesDisplay = GObject.registerClass( class WorkspacesDisplay extends St.Widget { _init(controls, scrollAdjustment, overviewAdjustment) { super._init({ + context: St.get_clutter_context(), layout_manager: new Clutter.BinLayout(), }); diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js index 95549f3dbb..0d6be70bd6 100644 --- a/js/ui/xdndHandler.js +++ b/js/ui/xdndHandler.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Clutter } = imports.gi; +const { Clutter, St } = imports.gi; const Signals = imports.signals; const DND = imports.ui.dnd; @@ -13,7 +13,12 @@ var XdndHandler = class { this._cursorWindowClone = null; // Used as a drag actor in case we don't have a cursor window clone - this._dummy = new Clutter.Actor({ width: 1, height: 1, opacity: 0 }); + this._dummy = new Clutter.Actor({ + context: St.get_clutter_context(), + width: 1, + height: 1, + opacity: 0 + }); Main.uiGroup.add_actor(this._dummy); this._dummy.hide(); @@ -62,7 +67,10 @@ var XdndHandler = class { let constraintPosition = new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.POSITION, source: cursorWindow }); - this._cursorWindowClone = new Clutter.Clone({ source: cursorWindow }); + this._cursorWindowClone = new Clutter.Clone({ + context: St.get_clutter_context(), + source: cursorWindow + }); Main.uiGroup.add_actor(this._cursorWindowClone); // Make sure that the clone has the same position as the source diff --git a/src/main.c b/src/main.c index 3cd9e10a5b..611fad18d7 100644 --- a/src/main.c +++ b/src/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -488,6 +489,7 @@ main (int argc, char **argv) { g_autoptr (MetaContext) context = NULL; GError *error = NULL; + MetaBackend *backend; int ecode = EXIT_SUCCESS; bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); @@ -533,6 +535,9 @@ main (int argc, char **argv) shell_introspection_init (); shell_fonts_init (); + backend = meta_context_get_backend (context); + st_init (meta_backend_get_clutter_context (backend)); + g_log_set_default_handler (default_log_handler, NULL); /* Initialize the global object */ diff --git a/src/shell-app.c b/src/shell-app.c index 1dfd82d8e4..4e6a1d82fc 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -270,7 +270,7 @@ shell_app_create_icon_texture (ShellApp *app, { ClutterActor *ret; - ret = st_icon_new (); + ret = st_icon_new (st_get_clutter_context ()); st_icon_set_icon_size (ST_ICON (ret), size); st_icon_set_fallback_icon_name (ST_ICON (ret), "application-x-executable"); diff --git a/src/shell-window-preview-layout.c b/src/shell-window-preview-layout.c index a759a74f17..e7b4bf8b84 100644 --- a/src/shell-window-preview-layout.c +++ b/src/shell-window-preview-layout.c @@ -363,7 +363,8 @@ shell_window_preview_layout_add_window (ShellWindowPreviewLayout *self, } window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); - actor = clutter_clone_new (window_actor); + actor = clutter_clone_new (clutter_actor_get_context (window_actor), + window_actor); window_info = g_new0 (WindowInfo, 1); diff --git a/src/st/meson.build b/src/st/meson.build index 8004dfdbc1..41b97ab48f 100644 --- a/src/st/meson.build +++ b/src/st/meson.build @@ -6,6 +6,7 @@ st_headers = [ 'st-box-layout.h', 'st-button.h', 'st-clipboard.h', + 'st-context.h', 'st-drawing-area.h', 'st-entry.h', 'st-focus-manager.h', @@ -117,6 +118,7 @@ st_sources = [ 'st-box-layout.c', 'st-button.c', 'st-clipboard.c', + 'st-context.c', 'st-drawing-area.c', 'st-entry.c', 'st-focus-manager.c', diff --git a/src/st/st-bin.c b/src/st/st-bin.c index e96768626f..d2d5b7e2c6 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -324,15 +324,18 @@ st_bin_init (StBin *bin) /** * st_bin_new: + * @clutter_context: The clutter context * * Creates a new #StBin, a simple container for one child. * * Returns: the newly created #StBin actor */ StWidget * -st_bin_new (void) +st_bin_new (ClutterContext *clutter_context) { - return g_object_new (ST_TYPE_BIN, NULL); + return g_object_new (ST_TYPE_BIN, + "context", clutter_context, + NULL); } /** diff --git a/src/st/st-bin.h b/src/st/st-bin.h index 7784f45b3d..a00b7cd390 100644 --- a/src/st/st-bin.h +++ b/src/st/st-bin.h @@ -43,7 +43,7 @@ struct _StBinClass StWidgetClass parent_class; }; -StWidget * st_bin_new (void); +StWidget * st_bin_new (ClutterContext *clutter_context); void st_bin_set_child (StBin *bin, ClutterActor *child); ClutterActor *st_bin_get_child (StBin *bin); diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 895e688acc..9827e45e8c 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -218,15 +218,18 @@ st_box_layout_init (StBoxLayout *self) /** * st_box_layout_new: + * @clutter_context: The Clutter context * * Create a new #StBoxLayout. * * Returns: a newly allocated #StBoxLayout */ StWidget * -st_box_layout_new (void) +st_box_layout_new (ClutterContext *clutter_context) { - return g_object_new (ST_TYPE_BOX_LAYOUT, NULL); + return g_object_new (ST_TYPE_BOX_LAYOUT, + "context", clutter_context, + NULL); } /** diff --git a/src/st/st-box-layout.h b/src/st/st-box-layout.h index 82f5a70457..9738567e6b 100644 --- a/src/st/st-box-layout.h +++ b/src/st/st-box-layout.h @@ -50,7 +50,7 @@ struct _StBoxLayout StBoxLayoutPrivate *priv; }; -StWidget *st_box_layout_new (void); +StWidget *st_box_layout_new (ClutterContext *clutter_context); void st_box_layout_set_vertical (StBoxLayout *box, gboolean vertical); diff --git a/src/st/st-button.c b/src/st/st-button.c index eae245928a..d754149e2f 100644 --- a/src/st/st-button.c +++ b/src/st/st-button.c @@ -574,19 +574,23 @@ st_button_init (StButton *button) /** * st_button_new: + * @clutter_context: The Clutter context * * Create a new button * * Returns: a new #StButton */ StWidget * -st_button_new (void) +st_button_new (ClutterContext *clutter_context) { - return g_object_new (ST_TYPE_BUTTON, NULL); + return g_object_new (ST_TYPE_BUTTON, + "context", clutter_context, + NULL); } /** * st_button_new_with_label: + * @clutter_context: The Clutter context * @text: text to set the label to * * Create a new #StButton with the specified label @@ -594,9 +598,13 @@ st_button_new (void) * Returns: a new #StButton */ StWidget * -st_button_new_with_label (const gchar *text) +st_button_new_with_label (ClutterContext *clutter_context, + const char *text) { - return g_object_new (ST_TYPE_BUTTON, "label", text, NULL); + return g_object_new (ST_TYPE_BUTTON, + "context", clutter_context, + "label", text, + NULL); } /** @@ -628,11 +636,15 @@ st_button_set_label (StButton *button, const gchar *text) { StButtonPrivate *priv; + ClutterActor *actor; + ClutterContext *clutter_context; ClutterActor *label; g_return_if_fail (ST_IS_BUTTON (button)); priv = st_button_get_instance_private (button); + actor = CLUTTER_ACTOR (button); + clutter_context = clutter_actor_get_context (actor); g_free (priv->text); @@ -650,6 +662,7 @@ st_button_set_label (StButton *button, else { label = g_object_new (CLUTTER_TYPE_TEXT, + "context", clutter_context, "text", priv->text, "line-alignment", PANGO_ALIGN_CENTER, "ellipsize", PANGO_ELLIPSIZE_END, diff --git a/src/st/st-button.h b/src/st/st-button.h index 6040e4182f..d3a6ae6994 100644 --- a/src/st/st-button.h +++ b/src/st/st-button.h @@ -43,8 +43,9 @@ struct _StButtonClass void (* clicked) (StButton *button, int clicked_button); }; -StWidget *st_button_new (void); -StWidget *st_button_new_with_label (const gchar *text); +StWidget *st_button_new (ClutterContext *clutter_context); +StWidget *st_button_new_with_label (ClutterContext *clutter_context, + const char *text); const gchar *st_button_get_label (StButton *button); void st_button_set_label (StButton *button, const gchar *text); diff --git a/src/st/st-context.c b/src/st/st-context.c new file mode 100644 index 0000000000..7dd23abce9 --- /dev/null +++ b/src/st/st-context.c @@ -0,0 +1,34 @@ +/* + * Copyright 2021 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + * more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include "st-context.h" + +static ClutterContext *st_clutter_context = NULL; + +void +st_init (ClutterContext *clutter_context) +{ + g_warn_if_fail (!st_clutter_context); + st_clutter_context = clutter_context; +} + +ClutterContext * +st_get_clutter_context (void) +{ + return st_clutter_context; +} diff --git a/src/st/st-context.h b/src/st/st-context.h new file mode 100644 index 0000000000..8f57d54694 --- /dev/null +++ b/src/st/st-context.h @@ -0,0 +1,34 @@ +/* + * Copyright 2021 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + * more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#ifndef ST_CONTEXT_H +#define ST_CONTEXT_H + +#include + +/** + * st_get_clutter_context: + * + * Returns: (transfer none): The Clutter context instance + */ +ClutterContext * st_get_clutter_context (void); + +/** + * st_init: (skip) + */ +void st_init (ClutterContext *clutter_context); + +#endif /* ST_CONTEXT_H */ diff --git a/src/st/st-entry.c b/src/st/st-entry.c index a8edb2de4d..323ddaf955 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -116,6 +116,27 @@ G_DEFINE_TYPE_WITH_PRIVATE (StEntry, st_entry, ST_TYPE_WIDGET); static GType st_entry_accessible_get_type (void) G_GNUC_CONST; +static void clutter_text_reactive_changed_cb (ClutterActor *text, + GParamSpec *pspec, + gpointer user_data); + +static void clutter_text_focus_in_cb (ClutterText *text, + ClutterActor *actor); + +static void clutter_text_focus_out_cb (ClutterText *text, + ClutterActor *actor); + +static gboolean clutter_text_button_press_event (ClutterActor *actor, + ClutterButtonEvent *event, + gpointer user_data); + +static void clutter_text_cursor_changed (ClutterText *text, + StEntry *entry); + +static void clutter_text_changed_cb (GObject *object, + GParamSpec *pspec, + gpointer user_data); + static void st_entry_set_property (GObject *gobject, guint prop_id, @@ -219,6 +240,61 @@ st_entry_dispose (GObject *object) G_OBJECT_CLASS (st_entry_parent_class)->dispose (object); } +static void +st_entry_constructed (GObject *object) +{ + StEntry *entry = ST_ENTRY (object); + ClutterActor *actor = CLUTTER_ACTOR (entry); + ClutterContext *clutter_context = clutter_actor_get_context (actor); + StEntryPrivate *priv; + + priv = st_entry_get_instance_private (entry); + + priv->entry = g_object_new (CLUTTER_TYPE_TEXT, + "context", clutter_context, + "line-alignment", PANGO_ALIGN_LEFT, + "editable", TRUE, + "reactive", TRUE, + "single-line-mode", TRUE, + NULL); + + g_object_bind_property (G_OBJECT (entry), "reactive", + priv->entry, "reactive", + G_BINDING_DEFAULT); + + g_signal_connect(priv->entry, "notify::reactive", + G_CALLBACK (clutter_text_reactive_changed_cb), entry); + + g_signal_connect (priv->entry, "key-focus-in", + G_CALLBACK (clutter_text_focus_in_cb), entry); + + g_signal_connect (priv->entry, "key-focus-out", + G_CALLBACK (clutter_text_focus_out_cb), entry); + + g_signal_connect (priv->entry, "button-press-event", + G_CALLBACK (clutter_text_button_press_event), entry); + + g_signal_connect (priv->entry, "cursor-changed", + G_CALLBACK (clutter_text_cursor_changed), entry); + + g_signal_connect (priv->entry, "notify::text", + G_CALLBACK (clutter_text_changed_cb), entry); + + priv->spacing = 6.0f; + + priv->text_shadow_material = NULL; + priv->shadow_width = -1.; + priv->shadow_height = -1.; + + clutter_actor_add_child (CLUTTER_ACTOR (entry), priv->entry); + clutter_actor_set_reactive ((ClutterActor *) entry, TRUE); + + /* set cursor hidden until we receive focus */ + clutter_text_set_cursor_visible ((ClutterText *) priv->entry, FALSE); + + G_OBJECT_CLASS (st_entry_parent_class)->constructed (object); +} + static void st_entry_update_hint_visibility (StEntry *self) { @@ -863,6 +939,7 @@ st_entry_class_init (StEntryClass *klass) gobject_class->set_property = st_entry_set_property; gobject_class->get_property = st_entry_get_property; gobject_class->dispose = st_entry_dispose; + gobject_class->constructed = st_entry_constructed; actor_class->get_preferred_width = st_entry_get_preferred_width; actor_class->get_preferred_height = st_entry_get_preferred_height; @@ -1021,54 +1098,11 @@ st_entry_class_init (StEntryClass *klass) static void st_entry_init (StEntry *entry) { - StEntryPrivate *priv; - - priv = st_entry_get_instance_private (entry); - - priv->entry = g_object_new (CLUTTER_TYPE_TEXT, - "line-alignment", PANGO_ALIGN_LEFT, - "editable", TRUE, - "reactive", TRUE, - "single-line-mode", TRUE, - NULL); - - g_object_bind_property (G_OBJECT (entry), "reactive", - priv->entry, "reactive", - G_BINDING_DEFAULT); - - g_signal_connect(priv->entry, "notify::reactive", - G_CALLBACK (clutter_text_reactive_changed_cb), entry); - - g_signal_connect (priv->entry, "key-focus-in", - G_CALLBACK (clutter_text_focus_in_cb), entry); - - g_signal_connect (priv->entry, "key-focus-out", - G_CALLBACK (clutter_text_focus_out_cb), entry); - - g_signal_connect (priv->entry, "button-press-event", - G_CALLBACK (clutter_text_button_press_event), entry); - - g_signal_connect (priv->entry, "cursor-changed", - G_CALLBACK (clutter_text_cursor_changed), entry); - - g_signal_connect (priv->entry, "notify::text", - G_CALLBACK (clutter_text_changed_cb), entry); - - priv->spacing = 6.0f; - - priv->text_shadow_material = NULL; - priv->shadow_width = -1.; - priv->shadow_height = -1.; - - clutter_actor_add_child (CLUTTER_ACTOR (entry), priv->entry); - clutter_actor_set_reactive ((ClutterActor *) entry, TRUE); - - /* set cursor hidden until we receive focus */ - clutter_text_set_cursor_visible ((ClutterText *) priv->entry, FALSE); } /** * st_entry_new: + * @clutter_context: The Clutter context * @text: (nullable): text to set the entry to * * Create a new #StEntry with the specified text. @@ -1076,12 +1110,14 @@ st_entry_init (StEntry *entry) * Returns: a new #StEntry */ StWidget * -st_entry_new (const gchar *text) +st_entry_new (ClutterContext *clutter_context, + const char *text) { StWidget *entry; /* add the entry to the stage, but don't allow it to be visible */ entry = g_object_new (ST_TYPE_ENTRY, + "context", clutter_context, "text", text, NULL); @@ -1166,7 +1202,8 @@ st_entry_set_hint_text (StEntry *entry, g_return_if_fail (ST_IS_ENTRY (entry)); - label = st_label_new (text); + label = st_label_new (clutter_actor_get_context (CLUTTER_ACTOR (entry)), + text); st_widget_add_style_class_name (label, "hint-text"); st_entry_set_hint_actor (ST_ENTRY (entry), CLUTTER_ACTOR (label)); diff --git a/src/st/st-entry.h b/src/st/st-entry.h index 2a05759d50..121a895170 100644 --- a/src/st/st-entry.h +++ b/src/st/st-entry.h @@ -40,7 +40,8 @@ struct _StEntryClass void (*secondary_icon_clicked) (StEntry *entry); }; -StWidget *st_entry_new (const gchar *text); +StWidget *st_entry_new (ClutterContext *clutter_context, + const char *text); const gchar *st_entry_get_text (StEntry *entry); void st_entry_set_text (StEntry *entry, const gchar *text); diff --git a/src/st/st-icon.c b/src/st/st-icon.c index 71ba1b6b36..4e92ea275b 100644 --- a/src/st/st-icon.c +++ b/src/st/st-icon.c @@ -582,15 +582,18 @@ st_icon_update_icon_size (StIcon *icon) /** * st_icon_new: + * @clutter_context: A Clutter context * * Create a newly allocated #StIcon. * * Returns: A newly allocated #StIcon */ ClutterActor * -st_icon_new (void) +st_icon_new (ClutterContext *clutter_context) { - return g_object_new (ST_TYPE_ICON, NULL); + return g_object_new (ST_TYPE_ICON, + "context", clutter_context, + NULL); } /** diff --git a/src/st/st-icon.h b/src/st/st-icon.h index 8714ef931c..e1c23f0457 100644 --- a/src/st/st-icon.h +++ b/src/st/st-icon.h @@ -54,7 +54,7 @@ struct _StIcon { StIconPrivate *priv; }; -ClutterActor* st_icon_new (void); +ClutterActor* st_icon_new (ClutterContext *clutter_context); GIcon *st_icon_get_gicon (StIcon *icon); void st_icon_set_gicon (StIcon *icon, diff --git a/src/st/st-label.c b/src/st/st-label.c index 54f16b1550..4114881e50 100644 --- a/src/st/st-label.c +++ b/src/st/st-label.c @@ -189,6 +189,31 @@ st_label_dispose (GObject *object) G_OBJECT_CLASS (st_label_parent_class)->dispose (object); } +static void +st_label_constructed (GObject *object) +{ + StLabel *label = ST_LABEL (object); + ClutterActor *actor = CLUTTER_ACTOR (label); + ClutterContext *clutter_context = clutter_actor_get_context (actor); + StLabelPrivate *priv; + + label->priv = priv = st_label_get_instance_private (label); + + label->priv->label = g_object_new (CLUTTER_TYPE_TEXT, + "context", clutter_context, + "ellipsize", PANGO_ELLIPSIZE_END, + NULL); + label->priv->text_shadow_pipeline = NULL; + label->priv->shadow_width = -1.; + label->priv->shadow_height = -1.; + + clutter_actor_add_child (actor, priv->label); + + clutter_actor_set_offscreen_redirect (actor, + CLUTTER_OFFSCREEN_REDIRECT_ALWAYS); + G_OBJECT_CLASS (st_label_parent_class)->constructed (object); +} + static void st_label_paint (ClutterActor *actor, ClutterPaintContext *paint_context) @@ -264,6 +289,7 @@ st_label_class_init (StLabelClass *klass) gobject_class->set_property = st_label_set_property; gobject_class->get_property = st_label_get_property; gobject_class->dispose = st_label_dispose; + gobject_class->constructed = st_label_constructed; actor_class->paint = st_label_paint; actor_class->allocate = st_label_allocate; @@ -304,26 +330,11 @@ st_label_class_init (StLabelClass *klass) static void st_label_init (StLabel *label) { - ClutterActor *actor = CLUTTER_ACTOR (label); - StLabelPrivate *priv; - - label->priv = priv = st_label_get_instance_private (label); - - label->priv->label = g_object_new (CLUTTER_TYPE_TEXT, - "ellipsize", PANGO_ELLIPSIZE_END, - NULL); - label->priv->text_shadow_pipeline = NULL; - label->priv->shadow_width = -1.; - label->priv->shadow_height = -1.; - - clutter_actor_add_child (actor, priv->label); - - clutter_actor_set_offscreen_redirect (actor, - CLUTTER_OFFSCREEN_REDIRECT_ALWAYS); } /** * st_label_new: + * @clutter_context: the Clutter context * @text: (nullable): text to set the label to * * Create a new #StLabel with the label specified by @text. @@ -331,14 +342,22 @@ st_label_init (StLabel *label) * Returns: a new #StLabel */ StWidget * -st_label_new (const gchar *text) +st_label_new (ClutterContext *clutter_context, + const char *text) { if (text == NULL || *text == '\0') - return g_object_new (ST_TYPE_LABEL, NULL); + { + return g_object_new (ST_TYPE_LABEL, + "context", clutter_context, + NULL); + } else - return g_object_new (ST_TYPE_LABEL, - "text", text, - NULL); + { + return g_object_new (ST_TYPE_LABEL, + "context", clutter_context, + "text", text, + NULL); + } } /** diff --git a/src/st/st-label.h b/src/st/st-label.h index 456ad3144b..5f931fdb5d 100644 --- a/src/st/st-label.h +++ b/src/st/st-label.h @@ -47,7 +47,8 @@ struct _StLabel StLabelPrivate *priv; }; -StWidget * st_label_new (const gchar *text); +StWidget * st_label_new (ClutterContext *clutter_context, + const char *text); const gchar * st_label_get_text (StLabel *label); void st_label_set_text (StLabel *label, const gchar *text); diff --git a/src/st/st-password-entry.c b/src/st/st-password-entry.c index 3dd8c6c1cf..f5fbcdcdd9 100644 --- a/src/st/st-password-entry.c +++ b/src/st/st-password-entry.c @@ -245,15 +245,18 @@ st_password_entry_init (StPasswordEntry *entry) /** * st_password_entry_new: + * @clutter_context: the Clutter context * * Create a new #StPasswordEntry. * * Returns: a new #StEntry */ StEntry* -st_password_entry_new (void) +st_password_entry_new (ClutterContext *clutter_context) { - return ST_ENTRY (g_object_new (ST_TYPE_PASSWORD_ENTRY, NULL)); + return ST_ENTRY (g_object_new (ST_TYPE_PASSWORD_ENTRY, + "context", clutter_context, + NULL)); } /** diff --git a/src/st/st-password-entry.h b/src/st/st-password-entry.h index 3998068085..b82599aed4 100644 --- a/src/st/st-password-entry.h +++ b/src/st/st-password-entry.h @@ -32,7 +32,7 @@ G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (StPasswordEntry, st_password_entry, ST, PASSWORD_ENTRY, StEntry) -StEntry *st_password_entry_new (void); +StEntry *st_password_entry_new (ClutterContext *clutter_context); gboolean st_password_entry_get_password_visible (StPasswordEntry *entry); void st_password_entry_set_password_visible (StPasswordEntry *entry, gboolean value); diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c index f7188e8247..ac70b039ad 100644 --- a/src/st/st-scroll-bar.c +++ b/src/st/st-scroll-bar.c @@ -100,6 +100,34 @@ handle_button_press_event_cb (ClutterActor *actor, ClutterButtonEvent *event, StScrollBar *bar); +static gboolean +handle_button_release_event_cb (ClutterActor *trough, + ClutterButtonEvent *event, + StScrollBar *bar); + +static gboolean +handle_motion_event_cb (ClutterActor *trough, + ClutterMotionEvent *event, + StScrollBar *bar); + +static void +st_scroll_bar_notify_reactive (StScrollBar *self); + +static gboolean +trough_button_press_event_cb (ClutterActor *actor, + ClutterButtonEvent *event, + StScrollBar *self); + +static gboolean +trough_button_release_event_cb (ClutterActor *actor, + ClutterButtonEvent *event, + StScrollBar *self); + +static gboolean +trough_leave_event_cb (ClutterActor *actor, + ClutterEvent *event, + StScrollBar *self); + static void stop_scrolling (StScrollBar *bar); static void @@ -422,6 +450,44 @@ st_scroll_bar_constructor (GType type, return obj; } +static void +st_scroll_bar_constructed (GObject *object) +{ + StScrollBar *self = ST_SCROLL_BAR (object); + StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (self); + ClutterContext *clutter_context = + clutter_actor_get_context (CLUTTER_ACTOR (object)); + + priv->trough = (ClutterActor *) st_bin_new (clutter_context); + clutter_actor_set_reactive ((ClutterActor *) priv->trough, TRUE); + clutter_actor_set_name (CLUTTER_ACTOR (priv->trough), "trough"); + clutter_actor_add_child (CLUTTER_ACTOR (self), + CLUTTER_ACTOR (priv->trough)); + g_signal_connect (priv->trough, "button-press-event", + G_CALLBACK (trough_button_press_event_cb), self); + g_signal_connect (priv->trough, "button-release-event", + G_CALLBACK (trough_button_release_event_cb), self); + g_signal_connect (priv->trough, "leave-event", + G_CALLBACK (trough_leave_event_cb), self); + + priv->handle = (ClutterActor *) st_button_new (clutter_context); + clutter_actor_set_name (CLUTTER_ACTOR (priv->handle), "hhandle"); + clutter_actor_add_child (CLUTTER_ACTOR (self), + CLUTTER_ACTOR (priv->handle)); + g_signal_connect (priv->handle, "button-press-event", + G_CALLBACK (handle_button_press_event_cb), self); + g_signal_connect (priv->handle, "button-release-event", + G_CALLBACK (handle_button_release_event_cb), self); + g_signal_connect (priv->handle, "motion-event", + G_CALLBACK (handle_motion_event_cb), self); + + clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); + + g_signal_connect (self, "notify::reactive", + G_CALLBACK (st_scroll_bar_notify_reactive), NULL); + G_OBJECT_CLASS (st_scroll_bar_parent_class)->constructed (object); +} + static void adjust_with_direction (StAdjustment *adj, ClutterScrollDirection direction) @@ -505,6 +571,7 @@ st_scroll_bar_class_init (StScrollBarClass *klass) object_class->set_property = st_scroll_bar_set_property; object_class->dispose = st_scroll_bar_dispose; object_class->constructor = st_scroll_bar_constructor; + object_class->constructed = st_scroll_bar_constructed; actor_class->get_preferred_width = st_scroll_bar_get_preferred_width; actor_class->get_preferred_height = st_scroll_bar_get_preferred_height; @@ -879,41 +946,14 @@ st_scroll_bar_notify_reactive (StScrollBar *self) static void st_scroll_bar_init (StScrollBar *self) { - StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (self); - - priv->trough = (ClutterActor *) st_bin_new (); - clutter_actor_set_reactive ((ClutterActor *) priv->trough, TRUE); - clutter_actor_set_name (CLUTTER_ACTOR (priv->trough), "trough"); - clutter_actor_add_child (CLUTTER_ACTOR (self), - CLUTTER_ACTOR (priv->trough)); - g_signal_connect (priv->trough, "button-press-event", - G_CALLBACK (trough_button_press_event_cb), self); - g_signal_connect (priv->trough, "button-release-event", - G_CALLBACK (trough_button_release_event_cb), self); - g_signal_connect (priv->trough, "leave-event", - G_CALLBACK (trough_leave_event_cb), self); - - priv->handle = (ClutterActor *) st_button_new (); - clutter_actor_set_name (CLUTTER_ACTOR (priv->handle), "hhandle"); - clutter_actor_add_child (CLUTTER_ACTOR (self), - CLUTTER_ACTOR (priv->handle)); - g_signal_connect (priv->handle, "button-press-event", - G_CALLBACK (handle_button_press_event_cb), self); - g_signal_connect (priv->handle, "button-release-event", - G_CALLBACK (handle_button_release_event_cb), self); - g_signal_connect (priv->handle, "motion-event", - G_CALLBACK (handle_motion_event_cb), self); - - clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); - - g_signal_connect (self, "notify::reactive", - G_CALLBACK (st_scroll_bar_notify_reactive), NULL); } StWidget * -st_scroll_bar_new (StAdjustment *adjustment) +st_scroll_bar_new (ClutterContext *clutter_context, + StAdjustment *adjustment) { return g_object_new (ST_TYPE_SCROLL_BAR, + "context", clutter_context, "adjustment", adjustment, NULL); } diff --git a/src/st/st-scroll-bar.h b/src/st/st-scroll-bar.h index 2c69fdd2ae..5258dd797e 100644 --- a/src/st/st-scroll-bar.h +++ b/src/st/st-scroll-bar.h @@ -42,7 +42,8 @@ struct _StScrollBarClass void (*scroll_stop) (StScrollBar *bar); }; -StWidget *st_scroll_bar_new (StAdjustment *adjustment); +StWidget *st_scroll_bar_new (ClutterContext *clutter_context, + StAdjustment *adjustment); void st_scroll_bar_set_adjustment (StScrollBar *bar, StAdjustment *adjustment); diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index fe7f3313e3..dad6426393 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -283,6 +283,45 @@ st_scroll_view_dispose (GObject *object) G_OBJECT_CLASS (st_scroll_view_parent_class)->dispose (object); } +static void +st_scroll_view_constructed (GObject *object) +{ + StScrollView *self = ST_SCROLL_VIEW (object); + StScrollViewPrivate *priv = self->priv = st_scroll_view_get_instance_private (self); + ClutterActor *actor = CLUTTER_ACTOR (self); + ClutterContext *clutter_context = clutter_actor_get_context (actor); + + priv->hscrollbar_policy = ST_POLICY_AUTOMATIC; + priv->vscrollbar_policy = ST_POLICY_AUTOMATIC; + + priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, + "actor", self, + NULL); + priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR, + "context", clutter_context, + "adjustment", priv->hadjustment, + "vertical", FALSE, + NULL); + + priv->vadjustment = g_object_new (ST_TYPE_ADJUSTMENT, + "actor", self, + NULL); + priv->vscroll = g_object_new (ST_TYPE_SCROLL_BAR, + "context", clutter_context, + "adjustment", priv->vadjustment, + "vertical", TRUE, + NULL); + + clutter_actor_add_child (CLUTTER_ACTOR (self), priv->hscroll); + clutter_actor_add_child (CLUTTER_ACTOR (self), priv->vscroll); + + /* mouse scroll is enabled by default, so we also need to be reactive */ + priv->mouse_scroll = TRUE; + g_object_set (G_OBJECT (self), "reactive", TRUE, NULL); + + G_OBJECT_CLASS (st_scroll_view_parent_class)->constructed (object); +} + static void st_scroll_view_paint (ClutterActor *actor, ClutterPaintContext *paint_context) @@ -834,6 +873,7 @@ st_scroll_view_class_init (StScrollViewClass *klass) object_class->get_property = st_scroll_view_get_property; object_class->set_property = st_scroll_view_set_property; object_class->dispose = st_scroll_view_dispose; + object_class->constructed = st_scroll_view_constructed; actor_class->paint = st_scroll_view_paint; actor_class->pick = st_scroll_view_pick; @@ -956,33 +996,6 @@ st_scroll_view_class_init (StScrollViewClass *klass) static void st_scroll_view_init (StScrollView *self) { - StScrollViewPrivate *priv = self->priv = st_scroll_view_get_instance_private (self); - - priv->hscrollbar_policy = ST_POLICY_AUTOMATIC; - priv->vscrollbar_policy = ST_POLICY_AUTOMATIC; - - priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, - "actor", self, - NULL); - priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR, - "adjustment", priv->hadjustment, - "vertical", FALSE, - NULL); - - priv->vadjustment = g_object_new (ST_TYPE_ADJUSTMENT, - "actor", self, - NULL); - priv->vscroll = g_object_new (ST_TYPE_SCROLL_BAR, - "adjustment", priv->vadjustment, - "vertical", TRUE, - NULL); - - clutter_actor_add_child (CLUTTER_ACTOR (self), priv->hscroll); - clutter_actor_add_child (CLUTTER_ACTOR (self), priv->vscroll); - - /* mouse scroll is enabled by default, so we also need to be reactive */ - priv->mouse_scroll = TRUE; - g_object_set (G_OBJECT (self), "reactive", TRUE, NULL); } static void @@ -1059,15 +1072,18 @@ clutter_container_iface_init (ClutterContainerIface *iface) /** * st_scroll_view_new: + * @clutter_context: a Clutter context * * Create a new #StScrollView. * * Returns: (transfer full): a new #StScrollView */ StWidget * -st_scroll_view_new (void) +st_scroll_view_new (ClutterContext *clutter_context) { - return g_object_new (ST_TYPE_SCROLL_VIEW, NULL); + return g_object_new (ST_TYPE_SCROLL_VIEW, + "context", clutter_context, + NULL); } /** diff --git a/src/st/st-scroll-view.h b/src/st/st-scroll-view.h index e2acaca2f5..a19d2ef0b9 100644 --- a/src/st/st-scroll-view.h +++ b/src/st/st-scroll-view.h @@ -58,7 +58,7 @@ struct _StScrollView StScrollViewPrivate *priv; }; -StWidget *st_scroll_view_new (void); +StWidget *st_scroll_view_new (ClutterContext *clutter_context); ClutterActor *st_scroll_view_get_hscroll_bar (StScrollView *scroll); ClutterActor *st_scroll_view_get_vscroll_bar (StScrollView *scroll); diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index b7b547a782..c6ee38ab21 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -21,6 +21,7 @@ #include "config.h" +#include "st.h" #include "st-image-content.h" #include "st-texture-cache.h" #include "st-private.h" @@ -76,6 +77,7 @@ static ClutterActor * create_invisible_actor (void) { return g_object_new (CLUTTER_TYPE_ACTOR, + "context", st_get_clutter_context (), "opacity", 0, "request-mode", CLUTTER_REQUEST_CONTENT_SIZE, NULL); @@ -1020,6 +1022,7 @@ st_texture_cache_load_gicon (StTextureCache *cache, return NULL; return g_object_new (CLUTTER_TYPE_ACTOR, + "context", st_get_clutter_context (), "content-gravity", CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT, "width", actor_size, "height", actor_size, @@ -1120,6 +1123,7 @@ load_from_pixbuf (GdkPixbuf *pixbuf, image = pixbuf_to_st_content_image (pixbuf, -1, -1, paint_scale, resource_scale); actor = g_object_new (CLUTTER_TYPE_ACTOR, + "context", st_get_clutter_context (), "request-mode", CLUTTER_REQUEST_CONTENT_SIZE, NULL); clutter_actor_set_content (actor, image); @@ -1387,7 +1391,7 @@ st_texture_cache_load_sliced_image (StTextureCache *cache, { AsyncImageData *data; GTask *result; - ClutterActor *actor = clutter_actor_new (); + ClutterActor *actor = clutter_actor_new (st_get_clutter_context ()); GCancellable *cancellable = g_cancellable_new (); g_return_val_if_fail (G_IS_FILE (file), NULL); diff --git a/src/st/test-theme.c b/src/st/test-theme.c index 3fcbd99bb7..1fe6aeeed7 100644 --- a/src/st/test-theme.c +++ b/src/st/test-theme.c @@ -23,6 +23,7 @@ #include "st-theme-context.h" #include "st-label.h" #include "st-button.h" +#include "st-context.h" #include #include #include @@ -464,7 +465,7 @@ test_pseudo_class (void) assert_text_decoration (group3, "group3", 0); /* Test the StWidget add/remove pseudo_class interfaces */ - label = st_label_new ("foo"); + label = st_label_new (st_get_clutter_context (), "foo"); clutter_actor_add_child (stage, CLUTTER_ACTOR (label)); labelNode = st_widget_get_theme_node (label); -- GitLab From b0a050746d01e190c65fa1becb0edf75440c97e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 22 Sep 2021 09:22:38 +0200 Subject: [PATCH 3/5] inputMethod: Pass ClutterContext to constructor It's now needed, after ClutterInputMethod started requiring a valid ClutterContext after being constructed. --- js/misc/inputMethod.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js index 25b02e35b8..9c0b9c522e 100644 --- a/js/misc/inputMethod.js +++ b/js/misc/inputMethod.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported InputMethod */ -const { Clutter, GLib, Gio, GObject, IBus } = imports.gi; +const { Clutter, GLib, Gio, GObject, IBus, St } = imports.gi; const Keyboard = imports.ui.status.keyboard; @@ -12,7 +12,9 @@ var HIDE_PANEL_TIME = 50; var InputMethod = GObject.registerClass( class InputMethod extends Clutter.InputMethod { _init() { - super._init(); + super._init({ + context: St.get_clutter_context(), + }); this._hints = 0; this._purpose = 0; this._currentFocus = null; -- GitLab From 0bed0038523a5c1e77e8b852488662cedf73555c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 22 Sep 2021 09:23:23 +0200 Subject: [PATCH 4/5] Adapt to Clutter events going via the context --- js/ui/keyboard.js | 12 ++++++++---- js/ui/overview.js | 3 ++- js/ui/swipeTracker.js | 5 +++-- src/gtkactionmuxer.c | 20 ++++++++++++++------ src/gtkactionmuxer.h | 3 ++- src/shell-app.c | 7 ++++++- src/shell-global.c | 4 +++- 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index c4d659c02b..c84947697f 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -2158,13 +2158,17 @@ var KeyboardController = class { } keyvalPress(keyval) { - this._virtualDevice.notify_keyval(Clutter.get_current_event_time() * 1000, - keyval, Clutter.KeyState.PRESSED); + const clutterContext = St.get_clutter_context(); + this._virtualDevice.notify_keyval( + clutterContext.get_current_event_time() * 1000, + keyval, Clutter.KeyState.PRESSED); } keyvalRelease(keyval) { - this._virtualDevice.notify_keyval(Clutter.get_current_event_time() * 1000, - keyval, Clutter.KeyState.RELEASED); + const clutterContext = St.get_clutter_context(); + this._virtualDevice.notify_keyval( + clutterContext.get_current_event_time() * 1000, + keyval, Clutter.KeyState.RELEASED); } }; Signals.addSignalMethods(KeyboardController.prototype); diff --git a/js/ui/overview.js b/js/ui/overview.js index 88a14a7f54..c0bc8c5014 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -578,7 +578,8 @@ var Overview = class { if (!this._shown) return; - let event = Clutter.get_current_event(); + const clutterContext = St.get_clutter_context(); + const event = clutterContext.get_current_event(); if (event) { let type = event.type(); let button = type == Clutter.EventType.BUTTON_PRESS || diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 4546b76b61..797a44d74d 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported SwipeTracker */ -const { Clutter, Gio, GObject, Meta } = imports.gi; +const { Clutter, Gio, GObject, Meta, St } = imports.gi; const Main = imports.ui.main; const Params = imports.misc.params; @@ -300,7 +300,8 @@ const TouchSwipeGesture = GObject.registerClass({ } vfunc_gesture_cancel(_actor) { - let time = Clutter.get_current_event_time(); + const clutterContext = St.get_clutter_context(); + let time = clutterContext.get_current_event_time(); this.emit('cancel', time, this._distance); } diff --git a/src/gtkactionmuxer.c b/src/gtkactionmuxer.c index 7e3e86e03e..561472884b 100644 --- a/src/gtkactionmuxer.c +++ b/src/gtkactionmuxer.c @@ -65,6 +65,8 @@ struct _GtkActionMuxer { GObject parent_instance; + ClutterContext *clutter_context; + GHashTable *observed_actions; GHashTable *groups; GHashTable *primary_accels; @@ -399,13 +401,14 @@ gtk_action_muxer_query_action (GActionGroup *action_group, } static GVariant * -get_platform_data (void) +get_platform_data (GtkActionMuxer *muxer) { gchar time[32]; GVariantBuilder *builder; GVariant *result; - g_snprintf (time, 32, "_TIME%d", clutter_get_current_event_time ()); + g_snprintf (time, 32, "_TIME%d", + clutter_context_get_current_event_time (muxer->clutter_context)); builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}")); @@ -434,7 +437,7 @@ gtk_action_muxer_activate_action (GActionGroup *action_group, if (G_IS_REMOTE_ACTION_GROUP (group->group)) g_remote_action_group_activate_action_full (G_REMOTE_ACTION_GROUP (group->group), unprefixed_name, parameter, - get_platform_data ()); + get_platform_data (muxer)); else g_action_group_activate_action (group->group, unprefixed_name, parameter); } @@ -459,7 +462,7 @@ gtk_action_muxer_change_action_state (GActionGroup *action_group, g_remote_action_group_change_action_state_full (G_REMOTE_ACTION_GROUP (group->group), unprefixed_name, state, - get_platform_data ()); + get_platform_data (muxer)); else g_action_group_change_action_state (group->group, unprefixed_name, state); } @@ -773,9 +776,14 @@ gtk_action_muxer_remove (GtkActionMuxer *muxer, * Creates a new #GtkActionMuxer. */ GtkActionMuxer * -gtk_action_muxer_new (void) +gtk_action_muxer_new (ClutterContext *clutter_context) { - return g_object_new (GTK_TYPE_ACTION_MUXER, NULL); + GtkActionMuxer *muxer; + + muxer = g_object_new (GTK_TYPE_ACTION_MUXER, NULL); + muxer->clutter_context = clutter_context; + + return muxer; } /** diff --git a/src/gtkactionmuxer.h b/src/gtkactionmuxer.h index d71abf48dd..b68f956c9d 100644 --- a/src/gtkactionmuxer.h +++ b/src/gtkactionmuxer.h @@ -20,6 +20,7 @@ #ifndef __GTK_ACTION_MUXER_H__ #define __GTK_ACTION_MUXER_H__ +#include #include G_BEGIN_DECLS @@ -33,7 +34,7 @@ G_BEGIN_DECLS typedef struct _GtkActionMuxer GtkActionMuxer; GType gtk_action_muxer_get_type (void); -GtkActionMuxer * gtk_action_muxer_new (void); +GtkActionMuxer * gtk_action_muxer_new (ClutterContext *clutter_Context); void gtk_action_muxer_insert (GtkActionMuxer *muxer, const gchar *prefix, diff --git a/src/shell-app.c b/src/shell-app.c index 4e6a1d82fc..adc3e952db 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -7,6 +7,8 @@ #include #include +#include +#include #include #include @@ -1485,6 +1487,9 @@ static void create_running_state (ShellApp *app) { MetaDisplay *display = shell_global_get_display (shell_global_get ()); + MetaContext *context = meta_display_get_context (display); + MetaBackend *backend = meta_context_get_backend (context); + ClutterContext *clutter_context = meta_backend_get_clutter_context (backend); MetaWorkspaceManager *workspace_manager = meta_display_get_workspace_manager (display); @@ -1498,7 +1503,7 @@ create_running_state (ShellApp *app) app->running_state->session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_assert (app->running_state->session != NULL); - app->running_state->muxer = gtk_action_muxer_new (); + app->running_state->muxer = gtk_action_muxer_new (clutter_context); } void diff --git a/src/shell-global.c b/src/shell-global.c index e8705f5b08..d842f61f2e 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1425,6 +1425,7 @@ guint32 shell_global_get_current_time (ShellGlobal *global) { guint32 time; + ClutterContext *clutter_context; /* meta_display_get_current_time() will return the correct time when handling an X or Gdk event, but will return CurrentTime @@ -1443,7 +1444,8 @@ shell_global_get_current_time (ShellGlobal *global) if (time != CLUTTER_CURRENT_TIME) return time; - return clutter_get_current_event_time (); + clutter_context = meta_backend_get_clutter_context (global->backend); + return clutter_context_get_current_event_time (clutter_context); } static void -- GitLab From fdee1e5d90ab08972d3d3c991b7aa77d797ab538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 23 Sep 2021 15:33:41 +0200 Subject: [PATCH 5/5] Get text direction from Clutter context --- js/ui/altTab.js | 6 ++++-- js/ui/appDisplay.js | 3 ++- js/ui/appMenu.js | 3 ++- js/ui/dateMenu.js | 3 ++- js/ui/iconGrid.js | 12 ++++++------ js/ui/layout.js | 12 ++++++++---- js/ui/osdMonitorLabeler.js | 3 ++- js/ui/swipeTracker.js | 3 ++- js/ui/windowManager.js | 12 ++++++++---- js/ui/workspaceAnimation.js | 6 ++++-- js/ui/workspaceThumbnail.js | 6 ++++-- src/st/st-texture-cache.c | 5 ++++- 12 files changed, 48 insertions(+), 26 deletions(-) diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 25014191f1..c3163c35db 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -167,7 +167,8 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { } _keyPressHandler(keysym, action) { - const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; if (action == Meta.KeyBindingAction.SWITCH_GROUP) { if (!this._thumbnailsFocused) this._select(this._selectedIndex, 0); @@ -618,7 +619,8 @@ class WindowSwitcherPopup extends SwitcherPopup.SwitcherPopup { } _keyPressHandler(keysym, action) { - const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) this._select(this._next()); else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index fa55602003..177add8890 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -2960,7 +2960,8 @@ var AppFolderDialog = GObject.registerClass({ // and TAB_BACKWARD for up key and left key on ltr // languages let direction; - let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR; + const isLtr = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.LTR; switch (keyEvent.keyval) { case Clutter.KEY_Down: direction = St.DirectionType.TAB_FORWARD; diff --git a/js/ui/appMenu.js b/js/ui/appMenu.js index 87d2218cdf..bd4d28bc91 100644 --- a/js/ui/appMenu.js +++ b/js/ui/appMenu.js @@ -16,7 +16,8 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu { * @param {bool} params.showSingleWindow - show window section for a single window */ constructor(sourceActor, side = St.Side.TOP, params = {}) { - if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) { + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) { if (side === St.Side.LEFT) side = St.Side.RIGHT; else if (side === St.Side.RIGHT) diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index cfc3feef41..41225593bd 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -197,7 +197,8 @@ class EventsSection extends St.Button { title = Util.formatTime(date, { timeOnly: true }); } - const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; if (event.date < this._startDate && !event.allDay) { if (rtl) title = '%s%s'.format(title, ELLIPSIS_CHAR); diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 4153f0989b..2f5a600606 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -691,8 +691,8 @@ var IconGridLayout = GObject.registerClass({ const nEmpty = this.columnsPerPage - itemsInThisRow; const availableWidth = nEmpty * (spacing + childSize); - const isRtl = - Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const isRtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; switch (align) { case Clutter.ActorAlign.CENTER: @@ -783,8 +783,8 @@ var IconGridLayout = GObject.registerClass({ if (this._pageWidth === 0 || this._pageHeight === 0) throw new Error('IconGridLayout.adaptToSize wasn\'t called before allocation'); - const isRtl = - Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const isRtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; const childSize = this._getChildrenMaxSize(); const [leftEmptySpace, topEmptySpace, hSpacing, vSpacing] = @@ -1049,8 +1049,8 @@ var IconGridLayout = GObject.registerClass({ const [leftEmptySpace, topEmptySpace, hSpacing, vSpacing] = this._calculateSpacing(childSize); - const isRtl = - Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const isRtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; let page = this._orientation === Clutter.Orientation.VERTICAL ? Math.floor(y / this._pageHeight) diff --git a/js/ui/layout.js b/js/ui/layout.js index 40f4f5e279..59c20cde0c 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -192,7 +192,8 @@ var LayoutManager = GObject.registerClass({ _init() { super._init(); - this._rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; + this._rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; this.monitors = []; this.primaryMonitor = null; this.primaryIndex = -1; @@ -1124,7 +1125,8 @@ class HotCorner extends Clutter.Actor { let px = 0.0; let py = 0.0; - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) { + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) { px = 1.0; py = 0.0; } @@ -1149,7 +1151,8 @@ class HotCorner extends Clutter.Actor { } if (size > 0) { - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) { + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) { this._verticalBarrier = new Meta.Barrier({ display: global.display, x1: this._x, x2: this._x, y1: this._y, y2: this._y + size, directions: Meta.BarrierDirection.NEGATIVE_X }); @@ -1194,7 +1197,8 @@ class HotCorner extends Clutter.Actor { this.add_child(this._corner); layoutManager.addChrome(this); - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) { + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) { this._corner.set_position(this.width - this._corner.width, 0); this.set_pivot_point(1.0, 0.0); this.translation_x = -this.width; diff --git a/js/ui/osdMonitorLabeler.js b/js/ui/osdMonitorLabeler.js index 4ebfb82f4a..983b4ccae5 100644 --- a/js/ui/osdMonitorLabeler.js +++ b/js/ui/osdMonitorLabeler.js @@ -43,7 +43,8 @@ class OsdMonitorLabel extends St.Widget { _position() { let workArea = Main.layoutManager.getWorkAreaForMonitor(this._monitor); - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) this._box.x = workArea.x + (workArea.width - this._box.width); else this._box.x = workArea.x; diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 797a44d74d..428e60d2c0 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -663,7 +663,8 @@ var SwipeTracker = GObject.registerClass({ } if (this.orientation === Clutter.Orientation.HORIZONTAL && - Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) + St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) delta = -delta; this._progress += delta / distance; diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index a0b7268f6d..d6c7fc2d8f 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1180,7 +1180,8 @@ var WindowManager = class { } xDest = monitor.x; yDest = monitor.y; - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) xDest += monitor.width; xScale = 0; yScale = 0; @@ -1243,7 +1244,8 @@ var WindowManager = class { return; } actor.set_position(monitor.x, monitor.y); - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) actor.x += monitor.width; actor.set_scale(0, 0); } @@ -1763,7 +1765,8 @@ var WindowManager = class { let newWs; let direction; let vertical = workspaceManager.layout_rows == -1; - let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; + let rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; if (action == 'move') { // "Moving" a window to another workspace doesn't make sense when @@ -1888,7 +1891,8 @@ var WindowManager = class { const workspaceManager = global.workspace_manager; const vertical = workspaceManager.layout_rows === -1; - const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; const activeWs = workspaceManager.get_active_workspace(); let ws; switch (direction) { diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index 98023005a4..24fcd0c1e5 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -185,7 +185,8 @@ const MonitorGroup = GObject.registerClass({ if (vertical) y += this.baseDistance; - else if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) + else if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL) x -= this.baseDistance; else x += this.baseDistance; @@ -372,7 +373,8 @@ var WorkspaceAnimationController = class { break; } - if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL && + if (St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL && direction !== Meta.MotionDirection.UP && direction !== Meta.MotionDirection.DOWN) workspaceIndices.reverse(); diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 21ce378a5b..7a4131c5f5 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -913,7 +913,8 @@ var ThumbnailsBox = GObject.registerClass({ source != Main.xdndHandler) return DND.DragMotionResult.CONTINUE; - const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; + const rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; let canCreateWorkspaces = Meta.prefs_get_dynamic_workspaces(); let spacing = this.get_theme_node().get_length('spacing'); @@ -1352,7 +1353,8 @@ var ThumbnailsBox = GObject.registerClass({ vfunc_allocate(box) { this.set_allocation(box); - let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; + let rtl = St.get_clutter_context().get_text_direction() === + Clutter.TextDirection.RTL; if (this._thumbnails.length == 0) // not visible return; diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index c6ee38ab21..ff16335e88 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -26,6 +26,7 @@ #include "st-texture-cache.h" #include "st-private.h" #include "st-settings.h" +#include #include #include #include @@ -996,6 +997,7 @@ st_texture_cache_load_gicon (StTextureCache *cache, gint paint_scale, gfloat resource_scale) { + ClutterContext *clutter_context = st_get_clutter_context (); AsyncTextureLoadData *request; ClutterActor *actor; gint scale; @@ -1046,7 +1048,8 @@ st_texture_cache_load_gicon (StTextureCache *cache, else if (icon_style == ST_ICON_STYLE_SYMBOLIC) lookup_flags |= GTK_ICON_LOOKUP_FORCE_SYMBOLIC; - if (clutter_get_default_text_direction () == CLUTTER_TEXT_DIRECTION_RTL) + if (clutter_context_get_text_direction (clutter_context) == + CLUTTER_TEXT_DIRECTION_RTL) lookup_flags |= GTK_ICON_LOOKUP_DIR_RTL; else lookup_flags |= GTK_ICON_LOOKUP_DIR_LTR; -- GitLab