diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index c0e58b379..b1e1e7f8f 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -301,7 +301,7 @@ const NotificationsBox = new Lang.Class({ }); this._updateVisibility(); - Shell.util_wake_up_screen(); + this.emit('wake-up-screen'); } }, @@ -327,7 +327,7 @@ const NotificationsBox = new Lang.Class({ this._updateVisibility(); if (obj.sourceBox.visible) - Shell.util_wake_up_screen(); + this.emit('wake-up-screen'); }, _visibleChanged: function(source, obj) { @@ -342,7 +342,7 @@ const NotificationsBox = new Lang.Class({ this._updateVisibility(); if (obj.sourceBox.visible) - Shell.util_wake_up_screen(); + this.emit('wake-up-screen'); }, _detailedChanged: function(source, obj) { @@ -380,6 +380,7 @@ const NotificationsBox = new Lang.Class({ this._sources.delete(source); }, }); +Signals.addSignalMethods(NotificationsBox.prototype); const Arrow = new Lang.Class({ Name: 'Arrow', @@ -1151,6 +1152,7 @@ const ScreenShield = new Lang.Class({ this._lockScreenContents.add_actor(this._lockScreenContentsBox); this._notificationsBox = new NotificationsBox(); + this._wakeUpScreenId = this._notificationsBox.connect('wake-up-screen', Lang.bind(this, this._wakeUpScreen)); this._lockScreenContentsBox.add(this._notificationsBox.actor, { x_fill: true, y_fill: true, expand: true }); @@ -1158,11 +1160,17 @@ const ScreenShield = new Lang.Class({ this._hasLockScreen = true; }, + _wakeUpScreen: function() { + this._onUserBecameActive(); + this.emit('wake-up-screen'); + }, + _clearLockScreen: function() { this._clock.destroy(); this._clock = null; if (this._notificationsBox) { + this._notificationsBox.disconnect(this._wakeUpScreenId); this._notificationsBox.destroy(); this._notificationsBox = null; } diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js index 6dbb5aeb6..52e9fa8f6 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -69,6 +69,7 @@ const ScreenSaverIface = ' \ \ \ \ + \ \ '; @@ -407,6 +408,9 @@ const ScreenSaverDBus = new Lang.Class({ screenShield.connect('active-changed', Lang.bind(this, function(shield) { this._dbusImpl.emit_signal('ActiveChanged', GLib.Variant.new('(b)', [shield.active])); })); + screenShield.connect('wake-up-screen', Lang.bind(this, function(shield) { + this._dbusImpl.emit_signal('WakeUpScreen', null); + })); this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenSaverIface, this); this._dbusImpl.export(Gio.DBus.session, '/org/gnome/ScreenSaver'); diff --git a/src/shell-util.c b/src/shell-util.c index 61676ecd9..5ae4fdb3c 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -313,33 +313,6 @@ shell_util_create_pixbuf_from_data (const guchar *data, (GdkPixbufDestroyNotify) g_free, NULL); } -/** - * shell_util_wake_up_screen: - * - * Send a fake key event, resetting the IDLETIME counter and - * causing gnome-settings-daemon to wake up the screen. - */ -/* Shamelessly taken from gnome-settings-daemon/plugins/power/gpm-common.c */ -void -shell_util_wake_up_screen (void) -{ - static gboolean inited = FALSE; - static KeyCode keycode1, keycode2; - static gboolean first_keycode = FALSE; - - if (inited == FALSE) { - keycode1 = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_KEY_Alt_L); - keycode2 = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_KEY_Alt_R); - } - - gdk_error_trap_push (); - /* send a left or right alt key; first press, then release */ - XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), first_keycode ? keycode1 : keycode2, True, CurrentTime); - XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), first_keycode ? keycode1 : keycode2, False, CurrentTime); - first_keycode = !first_keycode; - gdk_error_trap_pop_ignored (); -} - void shell_util_cursor_tracker_to_clutter (MetaCursorTracker *tracker, ClutterTexture *texture) diff --git a/src/shell-util.h b/src/shell-util.h index fdaec560a..d7ab4fdcf 100644 --- a/src/shell-util.h +++ b/src/shell-util.h @@ -41,8 +41,6 @@ GdkPixbuf *shell_util_create_pixbuf_from_data (const guchar *data, int height, int rowstride); -void shell_util_wake_up_screen (void); - void shell_util_cursor_tracker_to_clutter (MetaCursorTracker *tracker, ClutterTexture *texture);