[gnome-shell] ScreenShield: send a signal to GSD to wake up the screen
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] ScreenShield: send a signal to GSD to wake up the screen
- Date: Tue, 11 Mar 2014 17:10:08 +0000 (UTC)
commit edd66c40d9073f90d41afb6da91e88d71b5e5a29
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Mar 10 19:16:03 2014 +0100
ScreenShield: send a signal to GSD to wake up the screen
Instead of poking through IDLETIME, which confuses the state tracking
and can prevent automatic suspend, send a special signal to GSD
when the screen is to be waken up for a notification.
Someday we'll bring over all the state tracking and avoid this
ping-pong between gnome-shell and gnome-settings-daemon, but
that day's not today.
https://bugzilla.gnome.org/show_bug.cgi?id=712706
js/ui/screenShield.js | 14 +++++++++++---
js/ui/shellDBus.js | 4 ++++
src/shell-util.c | 27 ---------------------------
src/shell-util.h | 2 --
4 files changed, 15 insertions(+), 32 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index c0e58b3..b1e1e7f 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 6dbb5ae..52e9fa8 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -69,6 +69,7 @@ const ScreenSaverIface = '<node> \
<signal name="ActiveChanged"> \
<arg name="new_value" type="b" /> \
</signal> \
+<signal name="WakeUpScreen" /> \
</interface> \
</node>';
@@ -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 61676ec..5ae4fdb 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 fdaec56..d7ab4fd 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]