#include "geom.h"
#include "plugin.h"
-static GHashTable *menu_hash = NULL;
+GHashTable *menu_hash = NULL;
#define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask | \
LeaveWindowMask)
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)
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);
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);
void menu_startup()
{
Menu *m;
+/*
Menu *s;
Menu *t;
+*/
Action *a;
menu_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- menu_destroy_hash_key,
+ (GDestroyNotify)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");
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");
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));
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()
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);
}
self->title = createWindow(self->frame, CWEventMask, &attrib);
self->items = createWindow(self->frame, 0, &attrib);
- XSetWindowBorderWidth(ob_display, self->frame, theme_bwidth);
- XSetWindowBackground(ob_display, self->frame, theme_b_color->pixel);
- XSetWindowBorderWidth(ob_display, self->title, theme_bwidth);
- XSetWindowBorder(ob_display, self->frame, theme_b_color->pixel);
- XSetWindowBorder(ob_display, self->title, theme_b_color->pixel);
+ XSetWindowBorderWidth(ob_display, self->frame, ob_rr_theme->bwidth);
+ XSetWindowBackground(ob_display, self->frame, ob_rr_theme->b_color->pixel);
+ XSetWindowBorderWidth(ob_display, self->title, ob_rr_theme->bwidth);
+ XSetWindowBorder(ob_display, self->frame, ob_rr_theme->b_color->pixel);
+ XSetWindowBorder(ob_display, self->title, ob_rr_theme->b_color->pixel);
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(ob_rr_theme->a_menu_title);
+ self->a_items = RrAppearanceCopy(ob_rr_theme->a_menu);
g_hash_table_insert(window_map, &self->frame, self);
g_hash_table_insert(window_map, &self->title, self);
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(ob_rr_theme->a_menu_item);
+ entry->a_disabled = RrAppearanceCopy(ob_rr_theme->a_menu_disabled);
+ entry->a_hilite = RrAppearanceCopy(ob_rr_theme->a_menu_hilite);
menu->invalid = TRUE;
}
}
-
void menu_hide(Menu *self) {
if (self->shown) {
XUnmapWindow(ob_display, self->frame);
/* TODO: I don't understand why these bevels should be here.
Something must be wrong in the width calculation */
x = self->parent->location.x + self->parent->size.width +
- theme_bevel;
+ ob_rr_theme->bevel;
/* need to get the width. is this bad?*/
menu_render(self->submenu);
if (self->submenu->size.width + x > screen_physical_size.width)
x = self->parent->location.x - self->submenu->size.width -
- theme_bevel;
+ ob_rr_theme->bevel;
menu_show_full(self->submenu, x,
- self->parent->location.y + self->y, NULL);
+ self->parent->location.y + self->y,
+ self->parent->client);
}
}
}