[totem] scrsaver: Don't send out X11 events if not focused



commit 5a4eee111fb6af3fdd215394feee721e59a8e1cb
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Sep 5 14:42:01 2011 +0100

    scrsaver: Don't send out X11 events if not focused
    
    Should stop OpenOffice menus popping up.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654250

 lib/totem-scrsaver.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/lib/totem-scrsaver.c b/lib/totem-scrsaver.c
index e3e580e..0572610 100644
--- a/lib/totem-scrsaver.c
+++ b/lib/totem-scrsaver.c
@@ -273,6 +273,13 @@ fake_event (TotemScrsaver *scr)
 {
 	if (scr->priv->disabled)
 	{
+		/* If the video window isn't focused, don't send out the
+		 * events. Note that it probably breaks when popups are used
+		 * but we can't do much about that... */
+		if (scr->priv->window != NULL &&
+		    gtk_window_has_toplevel_focus (scr->priv->window) == FALSE)
+			return;
+
 		XLockDisplay (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
 		XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), *scr->priv->keycode,
 				True, CurrentTime);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]