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