a3db19
From 214c4f390faa40199c03a80594313760ffe9c5a6 Mon Sep 17 00:00:00 2001
a3db19
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
a3db19
Date: Fri, 20 Sep 2019 13:17:40 +0200
a3db19
Subject: [PATCH 1/2] unlockDialog: Use inheritance instead of composition
a3db19
a3db19
The screen shield creates the unlock dialog based on the session mode.
a3db19
a3db19
However since commit 0c0d76f7d6990 turned LoginDialog into an actor
a3db19
subclass (while UnlockDialog kept using the delegate pattern), it is
a3db19
no longer possible to handle both objects the same way without warnings.
a3db19
a3db19
Allow this again by turning UnlockDialog into an actor subclass as well.
a3db19
a3db19
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/736
a3db19
---
a3db19
 js/ui/unlockDialog.js | 46 ++++++++++++++++++++++++-------------------
a3db19
 1 file changed, 26 insertions(+), 20 deletions(-)
a3db19
a3db19
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
a3db19
index 4b0470f4b..55abb652d 100644
a3db19
--- a/js/ui/unlockDialog.js
a3db19
+++ b/js/ui/unlockDialog.js
a3db19
@@ -1,8 +1,7 @@
a3db19
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
a3db19
 
a3db19
 const { AccountsService, Atk, Clutter,
a3db19
-        Gdm, Gio, GLib, Meta, Shell, St } = imports.gi;
a3db19
-const Signals = imports.signals;
a3db19
+        Gdm, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
a3db19
 
a3db19
 const Layout = imports.ui.layout;
a3db19
 const Main = imports.ui.main;
a3db19
@@ -12,15 +11,19 @@ const AuthPrompt = imports.gdm.authPrompt;
a3db19
 // The timeout before going back automatically to the lock screen (in seconds)
a3db19
 const IDLE_TIMEOUT = 2 * 60;
a3db19
 
a3db19
-var UnlockDialog = class {
a3db19
-    constructor(parentActor) {
a3db19
-        this.actor = new St.Widget({ accessible_role: Atk.Role.WINDOW,
a3db19
-                                     style_class: 'login-dialog',
a3db19
-                                     layout_manager: new Clutter.BoxLayout(),
a3db19
-                                     visible: false });
a3db19
+var UnlockDialog = GObject.registerClass({
a3db19
+    Signals: { 'failed': {} },
a3db19
+}, class UnlockDialog extends St.Widget {
a3db19
+    _init(parentActor) {
a3db19
+        super._init({
a3db19
+            accessible_role: Atk.Role.WINDOW,
a3db19
+            style_class: 'login-dialog',
a3db19
+            layout_manager: new Clutter.BoxLayout(),
a3db19
+            visible: false,
a3db19
+        });
a3db19
 
a3db19
-        this.actor.add_constraint(new Layout.MonitorConstraint({ primary: true }));
a3db19
-        parentActor.add_child(this.actor);
a3db19
+        this.add_constraint(new Layout.MonitorConstraint({ primary: true }));
a3db19
+        parentActor.add_child(this);
a3db19
 
a3db19
         this._userManager = AccountsService.UserManager.get_default();
a3db19
         this._userName = GLib.get_user_name();
a3db19
@@ -31,7 +34,7 @@ var UnlockDialog = class {
a3db19
                                              y_align: Clutter.ActorAlign.CENTER,
a3db19
                                              x_expand: true,
a3db19
                                              y_expand: true });
a3db19
-        this.actor.add_child(this._promptBox);
a3db19
+        this.add_child(this._promptBox);
a3db19
 
a3db19
         this._gdmClient = new Gdm.Client();
a3db19
 
a3db19
@@ -70,10 +73,12 @@ var UnlockDialog = class {
a3db19
         this._authPrompt.reset();
a3db19
         this._updateSensitivity(true);
a3db19
 
a3db19
-        Main.ctrlAltTabManager.addGroup(this.actor, _("Unlock Window"), 'dialog-password-symbolic');
a3db19
+        Main.ctrlAltTabManager.addGroup(this, _("Unlock Window"), 'dialog-password-symbolic');
a3db19
 
a3db19
         this._idleMonitor = Meta.IdleMonitor.get_core();
a3db19
         this._idleWatchId = this._idleMonitor.add_idle_watch(IDLE_TIMEOUT * 1000, this._escape.bind(this));
a3db19
+
a3db19
+        this.connect('destroy', this._onDestroy.bind(this));
a3db19
     }
a3db19
 
a3db19
     _updateSensitivity(sensitive) {
a3db19
@@ -112,9 +117,8 @@ var UnlockDialog = class {
a3db19
         this._authPrompt.cancel();
a3db19
     }
a3db19
 
a3db19
-    destroy() {
a3db19
+    _onDestroy() {
a3db19
         this.popModal();
a3db19
-        this.actor.destroy();
a3db19
 
a3db19
         if (this._idleWatchId) {
a3db19
             this._idleMonitor.remove_watch(this._idleWatchId);
a3db19
@@ -137,13 +141,16 @@ var UnlockDialog = class {
a3db19
     }
a3db19
 
a3db19
     open(timestamp) {
a3db19
-        this.actor.show();
a3db19
+        this.show();
a3db19
 
a3db19
         if (this._isModal)
a3db19
             return true;
a3db19
 
a3db19
-        if (!Main.pushModal(this.actor, { timestamp: timestamp,
a3db19
-                                          actionMode: Shell.ActionMode.UNLOCK_SCREEN }))
a3db19
+        let modalParams = {
a3db19
+            timestamp,
a3db19
+            actionMode: Shell.ActionMode.UNLOCK_SCREEN,
a3db19
+        };
a3db19
+        if (!Main.pushModal(this, modalParams))
a3db19
             return false;
a3db19
 
a3db19
         this._isModal = true;
a3db19
@@ -153,9 +160,8 @@ var UnlockDialog = class {
a3db19
 
a3db19
     popModal(timestamp) {
a3db19
         if (this._isModal) {
a3db19
-            Main.popModal(this.actor, timestamp);
a3db19
+            Main.popModal(this, timestamp);
a3db19
             this._isModal = false;
a3db19
         }
a3db19
     }
a3db19
-};
a3db19
-Signals.addSignalMethods(UnlockDialog.prototype);
a3db19
+});
a3db19
-- 
a3db19
2.31.1
a3db19
a3db19
a3db19
From cddeb2f4e38928e0d5e0f3a852961f639536aff3 Mon Sep 17 00:00:00 2001
a3db19
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
a3db19
Date: Fri, 20 Sep 2019 13:14:40 +0200
a3db19
Subject: [PATCH 2/2] screenShield: Stop using deprecated actor property
a3db19
a3db19
Both LoginDialog and UnlockDialog are now actor subclasses, so stop
a3db19
using the deprecated actor delegate that will trigger a warning.
a3db19
a3db19
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/736
a3db19
---
a3db19
 js/ui/screenShield.js | 4 ++--
a3db19
 1 file changed, 2 insertions(+), 2 deletions(-)
a3db19
a3db19
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
a3db19
index 2d0a429be..f97a9288a 100644
a3db19
--- a/js/ui/screenShield.js
a3db19
+++ b/js/ui/screenShield.js
a3db19
@@ -917,8 +917,8 @@ var ScreenShield = class {
a3db19
         this._lockScreenGroup.hide();
a3db19
 
a3db19
         if (this._dialog) {
a3db19
-            this._dialog.actor.grab_key_focus();
a3db19
-            this._dialog.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
a3db19
+            this._dialog.grab_key_focus();
a3db19
+            this._dialog.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
a3db19
         }
a3db19
     }
a3db19
 
a3db19
-- 
a3db19
2.31.1
a3db19