ScreenShield: wake up the screen when new notifications appear
This way the user is immediately notified when something happens. https://bugzilla.gnome.org/show_bug.cgi?id=703084
This commit is contained in:
parent
24f142df1d
commit
137cbbd141
@ -305,7 +305,9 @@ const NotificationsBox = new Lang.Class({
|
|||||||
},
|
},
|
||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
});
|
});
|
||||||
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
|
Shell.util_wake_up_screen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -328,7 +330,10 @@ const NotificationsBox = new Lang.Class({
|
|||||||
|
|
||||||
obj.sourceBox.visible = obj.visible &&
|
obj.sourceBox.visible = obj.visible &&
|
||||||
(source.unseenCount > (obj.musicNotification ? 1 : 0));
|
(source.unseenCount > (obj.musicNotification ? 1 : 0));
|
||||||
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
|
if (obj.sourceBox.visible)
|
||||||
|
Shell.util_wake_up_screen();
|
||||||
},
|
},
|
||||||
|
|
||||||
_visibleChanged: function(source, obj) {
|
_visibleChanged: function(source, obj) {
|
||||||
@ -342,6 +347,8 @@ const NotificationsBox = new Lang.Class({
|
|||||||
source.unseenCount > (obj.musicNotification ? 1 : 0);
|
source.unseenCount > (obj.musicNotification ? 1 : 0);
|
||||||
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
|
if (obj.sourceBox.visible)
|
||||||
|
Shell.util_wake_up_screen();
|
||||||
},
|
},
|
||||||
|
|
||||||
_detailedChanged: function(source, obj) {
|
_detailedChanged: function(source, obj) {
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
#include <gdk/gdkx.h>
|
||||||
|
#include <X11/extensions/XTest.h>
|
||||||
|
|
||||||
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
@ -402,3 +404,30 @@ shell_util_create_pixbuf_from_data (const guchar *data,
|
|||||||
bits_per_sample, width, height, rowstride,
|
bits_per_sample, width, height, rowstride,
|
||||||
(GdkPixbufDestroyNotify) g_free, NULL);
|
(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 ();
|
||||||
|
}
|
||||||
|
@ -44,6 +44,8 @@ GdkPixbuf *shell_util_create_pixbuf_from_data (const guchar *data,
|
|||||||
int height,
|
int height,
|
||||||
int rowstride);
|
int rowstride);
|
||||||
|
|
||||||
|
void shell_util_wake_up_screen (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __SHELL_UTIL_H__ */
|
#endif /* __SHELL_UTIL_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user