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
This commit is contained in:
Giovanni Campagna
2014-03-10 19:16:03 +01:00
parent fc4bc5277a
commit edd66c40d9
4 changed files with 15 additions and 32 deletions

View File

@ -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)

View File

@ -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);