]> Dogcows Code - chaz/openbox/blobdiff - openbox/menuframe.c
fix escape's behavior in menus. make static stuff that shouldnt be used by others
[chaz/openbox] / openbox / menuframe.c
index a42c138da1bca9722d907f07a5a8b959ccef27f2..b908ad4ff0a6be146562d62a0265c0c6ef24d26f 100644 (file)
@@ -45,6 +45,7 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
 static void menu_entry_frame_free(ObMenuEntryFrame *self);
 static void menu_frame_update(ObMenuFrame *self);
 static gboolean menu_entry_frame_submenu_timeout(gpointer data);
+static void menu_frame_hide(ObMenuFrame *self);
 
 static Window createWindow(Window parent, gulong mask,
                            XSetWindowAttributes *attrib)
@@ -911,10 +912,13 @@ static gboolean menu_frame_show(ObMenuFrame *self)
 
     if (menu_frame_visible == NULL) {
         /* no menus shown yet */
-        if (!grab_pointer(TRUE, TRUE, OB_CURSOR_POINTER))
+
+        /* grab the pointer in such a way as to pass through "owner events"
+           so that we can get enter/leave notifies in the menu. */
+        if (!grab_pointer(TRUE, FALSE, OB_CURSOR_POINTER))
             return FALSE;
-        if (!grab_keyboard(TRUE)) {
-            grab_pointer(FALSE, TRUE, OB_CURSOR_POINTER);
+        if (!grab_keyboard()) {
+            ungrab_pointer();
             return FALSE;
         }
     }
@@ -1010,7 +1014,7 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
     return TRUE;
 }
 
-void menu_frame_hide(ObMenuFrame *self)
+static void menu_frame_hide(ObMenuFrame *self)
 {
     GList *it = g_list_find(menu_frame_visible, self);
 
@@ -1032,8 +1036,8 @@ void menu_frame_hide(ObMenuFrame *self)
 
     if (menu_frame_visible == NULL) {
         /* last menu shown */
-        grab_pointer(FALSE, TRUE, OB_CURSOR_NONE);
-        grab_keyboard(FALSE);
+        ungrab_pointer();
+        ungrab_keyboard();
     }
 
     XUnmapWindow(ob_display, self->window);
This page took 0.026226 seconds and 4 git commands to generate.