X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmenu.c;h=862917685a2d70eea83db54270e197dc265525ee;hb=a4a0cb78294bb1809b836ea1e86e9d7294bb2929;hp=3373616fef026758c2789ffe8bbe6872eefcc9e8;hpb=b77e40e1c7710323aa59a778338d8e18b591f718;p=chaz%2Fopenbox diff --git a/openbox/menu.c b/openbox/menu.c index 3373616f..86291768 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -7,7 +7,7 @@ #include "geom.h" #include "plugin.h" -static GHashTable *menu_hash = NULL; +GHashTable *menu_hash = NULL; #define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask | \ LeaveWindowMask) @@ -17,9 +17,9 @@ static GHashTable *menu_hash = NULL; void menu_control_show(Menu *self, int x, int y, Client *client); -void menu_destroy_hash_key(gpointer data) +void menu_destroy_hash_key(Menu *menu) { - g_free(data); + g_free(menu); } void menu_destroy_hash_value(Menu *self) @@ -39,7 +39,7 @@ void menu_destroy_hash_value(Menu *self) stacking_remove(self); - appearance_free(self->a_title); + RrAppearanceFree(self->a_title); XDestroyWindow(ob_display, self->title); XDestroyWindow(ob_display, self->frame); XDestroyWindow(ob_display, self->items); @@ -54,9 +54,9 @@ void menu_entry_free(MenuEntry *self) g_hash_table_remove(window_map, &self->item); - appearance_free(self->a_item); - appearance_free(self->a_disabled); - appearance_free(self->a_hilite); + RrAppearanceFree(self->a_item); + RrAppearanceFree(self->a_disabled); + RrAppearanceFree(self->a_hilite); XDestroyWindow(ob_display, self->item); g_free(self); @@ -73,7 +73,7 @@ void menu_startup() menu_destroy_hash_key, (GDestroyNotify)menu_destroy_hash_value); - m = menu_new(NULL, "root", NULL); + m = menu_new("sex menu", "root", NULL); a = action_from_string("execute"); a->data.execute.path = g_strdup("xterm"); @@ -83,6 +83,8 @@ void menu_startup() menu_add_entry(m, menu_entry_new_separator("--")); a = action_from_string("exit"); menu_add_entry(m, menu_entry_new("exit", a)); + + /* s = menu_new("subsex menu", "submenu", m); a = action_from_string("execute"); a->data.execute.path = g_strdup("xclock"); @@ -90,14 +92,6 @@ void menu_startup() menu_add_entry(m, menu_entry_new_submenu("subz", s)); - t = (Menu *)plugin_create("timed_menu"); - if (t) { - a = action_from_string("execute"); - a->data.execute.path = g_strdup("xeyes"); - menu_add_entry(t, menu_entry_new("xeyes", a)); - menu_add_entry(m, menu_entry_new_submenu("timed", t)); - } - s = menu_new("empty", "chub", m); menu_add_entry(m, menu_entry_new_submenu("empty", s)); @@ -119,17 +113,7 @@ void menu_startup() menu_add_entry(s, menu_entry_new("exit", a)); menu_add_entry(m, menu_entry_new_submenu("long", s)); - - m = menu_new(NULL, "client", NULL); - a = action_from_string("iconify"); - menu_add_entry(m, menu_entry_new("iconify", a)); - a = action_from_string("toggleshade"); - menu_add_entry(m, menu_entry_new("(un)shade", a)); - a = action_from_string("togglemaximizefull"); - menu_add_entry(m, menu_entry_new("(un)maximize", a)); - a = action_from_string("close"); - menu_add_entry(m, menu_entry_new("close", a)); - + */ } void menu_shutdown() @@ -141,8 +125,8 @@ static Window createWindow(Window parent, unsigned long mask, XSetWindowAttributes *attrib) { return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0, - render_depth, InputOutput, render_visual, - mask, attrib); + RrDepth(ob_rr_inst), InputOutput, + RrVisual(ob_rr_inst), mask, attrib); } @@ -189,8 +173,8 @@ Menu *menu_new_full(char *label, char *name, Menu *parent, XMapWindow(ob_display, self->title); XMapWindow(ob_display, self->items); - self->a_title = appearance_copy(theme_a_menu_title); - self->a_items = appearance_copy(theme_a_menu); + self->a_title = RrAppearanceCopy(theme_a_menu_title); + self->a_items = RrAppearanceCopy(theme_a_menu); g_hash_table_insert(window_map, &self->frame, self); g_hash_table_insert(window_map, &self->title, self); @@ -250,9 +234,9 @@ void menu_add_entry(Menu *menu, MenuEntry *entry) attrib.event_mask = ENTRY_EVENTMASK; entry->item = createWindow(menu->items, CWEventMask, &attrib); XMapWindow(ob_display, entry->item); - entry->a_item = appearance_copy(theme_a_menu_item); - entry->a_disabled = appearance_copy(theme_a_menu_disabled); - entry->a_hilite = appearance_copy(theme_a_menu_hilite); + entry->a_item = RrAppearanceCopy(theme_a_menu_item); + entry->a_disabled = RrAppearanceCopy(theme_a_menu_disabled); + entry->a_hilite = RrAppearanceCopy(theme_a_menu_hilite); menu->invalid = TRUE; @@ -288,7 +272,6 @@ void menu_show_full(Menu *self, int x, int y, Client *client) } } - void menu_hide(Menu *self) { if (self->shown) { XUnmapWindow(ob_display, self->frame); @@ -390,7 +373,8 @@ void menu_control_mouseover(MenuEntry *self, gboolean enter) { theme_bevel; menu_show_full(self->submenu, x, - self->parent->location.y + self->y, NULL); + self->parent->location.y + self->y, + self->parent->client); } } }