[maemo-commits] [maemo-commits] r11885 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon May 28 13:38:52 EEST 2007
Author: xan
Date: 2007-05-28 13:38:51 +0300 (Mon, 28 May 2007)
New Revision: 11885

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtkmenushell.c
Log:
	* gtk/gtkmenushell.c: use the XTest extension to emit button press/release
	events from the GtkMenuShell handlers. With this it will appear as if the
	menu didn't have a grab, and the user will be able to do things like opening
	a menu when there's already a menu opened with just one click.
	See https://projects.maemo.org/bugzilla/show_bug.cgi?id=58347 for more details.

	Fixes: NB#58347


Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2007-05-28 10:34:51 UTC (rev 11884)
+++ projects/haf/trunk/gtk+/ChangeLog	2007-05-28 10:38:51 UTC (rev 11885)
@@ -1,3 +1,13 @@
+2007-05-28  Xan Lopez  <xan.lopez at nokia.com>
+
+	* gtk/gtkmenushell.c: use the XTest extension to emit button press/release
+	events from the GtkMenuShell handlers. With this it will appear as if the
+	menu didn't have a grab, and the user will be able to do things like opening
+	a menu when there's already a menu opened with just one click.
+	See https://projects.maemo.org/bugzilla/show_bug.cgi?id=58347 for more details.
+
+	Fixes: NB#58347
+
 2007-05-25  Michael Natterer  <mitch at imendio.com>
 
 	* gtk/gtkmenushell.c (gtk_menu_shell_class_init): add settings

Modified: projects/haf/trunk/gtk+/gtk/gtkmenushell.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkmenushell.c	2007-05-28 10:34:51 UTC (rev 11884)
+++ projects/haf/trunk/gtk+/gtk/gtkmenushell.c	2007-05-28 10:38:51 UTC (rev 11885)
@@ -43,6 +43,11 @@
 #include "gtkintl.h"
 #include "gtkalias.h"
 
+#if defined(MAEMO_CHANGES) && defined(HAVE_XTST)
+#include <X11/extensions/XTest.h>
+#include "x11/gdkx.h"
+#endif
+
 #define PACK_DIRECTION(m)                                 \
    (GTK_IS_MENU_BAR (m)                                   \
      ? gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (m)) \
@@ -590,12 +595,23 @@
     }
   else
     {
+#if defined(MAEMO_CHANGES) && defined(HAVE_XTST)
+      GdkDisplay *display = gtk_widget_get_display (widget);
+#endif
+
       widget = gtk_get_event_widget ((GdkEvent*) event);
       if (widget == GTK_WIDGET (menu_shell))
 	{
 	  gtk_menu_shell_deactivate (menu_shell);
 	  g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
 	}
+
+#if defined(MAEMO_CHANGES) && defined(HAVE_XTST)
+      XTestFakeButtonEvent (gdk_x11_display_get_xdisplay (display),
+                            event->button,
+                            TRUE,
+                            0);
+#endif
     }
 
   if (menu_item && _gtk_menu_item_is_selectable (menu_item) &&
@@ -768,8 +784,19 @@
 
       if (deactivate)
         {
+#if defined(MAEMO_CHANGES) && defined(HAVE_XTST)
+          GdkDisplay *display = gtk_widget_get_display (widget);
+#endif
+
           gtk_menu_shell_deactivate (menu_shell);
           g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
+
+#if defined(MAEMO_CHANGES) && defined(HAVE_XTST)
+          XTestFakeButtonEvent (gdk_x11_display_get_xdisplay (display),
+                                event->button,
+                                FALSE,
+                                0);
+#endif
         }
 
       priv->activated_submenu = FALSE;


More information about the maemo-commits mailing list