X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmenuframe.c;h=85f09519f3a8f91ce9c2c789263323cf66a271f2;hb=d179d6428ae585a3b8a13479bfe4586e41de2ff9;hp=4ee5d31e436cbc0e665838bb0add670760a908fe;hpb=0cd6f4e43c355ef6b568c769a4ecb2983d5f3fa6;p=chaz%2Fopenbox diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 4ee5d31e..85f09519 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -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 @@ -107,7 +108,7 @@ ObMenuFrame* menu_frame_new(ObMenu *menu, guint show_from, ObClient *client) ObMenuFrame *self; XSetWindowAttributes attr; - self = g_new0(ObMenuFrame, 1); + self = g_slice_new0(ObMenuFrame); self->obwin.type = OB_WINDOW_CLASS_MENUFRAME; self->menu = menu; self->selected = NULL; @@ -150,17 +151,24 @@ void menu_frame_free(ObMenuFrame *self) XDestroyWindow(obt_display, self->window); - g_free(self); + g_slice_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) { ObMenuEntryFrame *self; XSetWindowAttributes attr; - self = g_new0(ObMenuEntryFrame, 1); + self = g_slice_new0(ObMenuEntryFrame); self->entry = entry; self->frame = frame; @@ -208,7 +216,7 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self) g_hash_table_remove(menu_frame_map, &self->bullet); } - g_free(self); + g_slice_free(ObMenuEntryFrame, self); } } @@ -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; }