]> Dogcows Code - chaz/openbox/blobdiff - openbox/menuframe.c
remove a bunch of g_new()/g_free() by returning Rect const*'s from screen area functi...
[chaz/openbox] / openbox / menuframe.c
index 4ee5d31e436cbc0e665838bb0add670760a908fe..d7f09aad0d92b0eaa0006dff5a659912ff992030 100644 (file)
@@ -27,6 +27,7 @@
 #include "openbox.h"
 #include "config.h"
 #include "obt/prop.h"
+#include "obt/keyboard.h"
 #include "obrender/theme.h"
 
 #define PADDING 2
@@ -154,6 +155,13 @@ void menu_frame_free(ObMenuFrame *self)
     }
 }
 
+ObtIC* menu_frame_ic(ObMenuFrame *self)
+{
+    /* menus are always used through a grab right now, so they can always use
+       the grab input context */
+    return grab_input_context();
+}
+
 static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
                                               ObMenuFrame *frame)
 {
@@ -313,7 +321,7 @@ static void menu_frame_place_submenu(ObMenuFrame *self, gint *x, gint *y)
 void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
                                gint *dx, gint *dy)
 {
-    Rect *a = NULL;
+    Rect const *a = NULL;
     gint pos, half;
 
     *dx = *dy = 0;
@@ -337,8 +345,6 @@ void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
         *dx = MAX(*dx, a->x - x);
         *dy = MAX(*dy, a->y - y);
     }
-
-    g_free(a);
 }
 
 static void menu_entry_frame_render(ObMenuEntryFrame *self)
@@ -825,7 +831,7 @@ void menu_frame_render(ObMenuFrame *self)
 static void menu_frame_update(ObMenuFrame *self)
 {
     GList *mit, *fit;
-    Rect *a;
+    Rect const *a;
     gint h;
 
     menu_pipe_execute(self->menu);
@@ -923,8 +929,6 @@ static void menu_frame_update(ObMenuFrame *self)
         }
     }
 
-    g_free(a);
-
     menu_frame_render(self);
 }
 
@@ -1262,9 +1266,10 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state)
         GSList *acts = self->entry->data.normal.actions;
         ObClient *client = self->frame->client;
         ObMenuFrame *frame = self->frame;
+        guint mods = obt_keyboard_only_modmasks(state);
 
         /* release grabs before executing the shit */
-        if (!(state & ControlMask)) {
+        if (!(mods & ControlMask)) {
             event_cancel_all_key_grabs();
             frame = NULL;
         }
This page took 0.027891 seconds and 4 git commands to generate.