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