]> Dogcows Code - chaz/openbox/blobdiff - openbox/menu.c
Added a menu to read from a pipe.
[chaz/openbox] / openbox / menu.c
index b271cf31e811220688f906fb4821a321de291471..11d040092bb1b917a4247260309832610c080069 100644 (file)
@@ -38,6 +38,8 @@ void menu_destroy_hash_value(Menu *self)
     g_hash_table_remove(menu_map, &self->frame);
     g_hash_table_remove(menu_map, &self->items);
 
+    stacking_remove(self);
+
     appearance_free(self->a_title);
     XDestroyWindow(ob_display, self->title);
     XDestroyWindow(ob_display, self->frame);
@@ -90,12 +92,12 @@ void menu_startup()
 
     menu_add_entry(m, menu_entry_new_submenu("subz", s));
 
-    /*
     t = (Menu *)plugin_create("timed_menu");
     a = action_from_string("execute");
     a->data.execute.path = g_strdup("xeyes");
-    menu_add_entry(t, menu_entry_new("xeyes", a));*/
-
+    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));
 
@@ -117,8 +119,8 @@ 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("client menu", "client", NULL);
+    
+    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");
@@ -152,6 +154,7 @@ Menu *menu_new_full(char *label, char *name, Menu *parent,
     Menu *self;
 
     self = g_new0(Menu, 1);
+    self->obwin.type = Window_Menu;
     self->label = g_strdup(label);
     self->name = g_strdup(name);
     self->parent = parent;
@@ -194,6 +197,10 @@ Menu *menu_new_full(char *label, char *name, Menu *parent,
     g_hash_table_insert(menu_map, &self->title, self);
     g_hash_table_insert(menu_map, &self->items, self);
     g_hash_table_insert(menu_hash, g_strdup(name), self);
+
+    stacking_add(self);
+    stacking_raise(MENU_AS_WINDOW(self));
+
     return self;
 }
 
@@ -234,7 +241,9 @@ void menu_add_entry(Menu *menu, MenuEntry *entry)
 {
     XSetWindowAttributes attrib;
 
-    g_assert(menu != NULL && entry != NULL && entry->item == None);
+    g_assert(menu != NULL);
+    g_assert(entry != NULL);
+    g_assert(entry->item == None);
 
     menu->entries = g_list_append(menu->entries, entry);
     entry->parent = menu;
@@ -293,6 +302,18 @@ void menu_hide(Menu *self) {
     }
 }
 
+void menu_clear(Menu *self) {
+    GList *it;
+  
+    for (it = self->entries; it; it = it->next) {
+       MenuEntry *entry = it->data;
+       menu_entry_free(entry);
+    }
+    self->entries = NULL;
+    self->invalid = TRUE;
+}
+
+
 MenuEntry *menu_find_entry(Menu *menu, Window win)
 {
     GList *it;
@@ -335,8 +356,8 @@ void menu_control_show(Menu *self, int x, int y, Client *client) {
              MIN(y, screen_physical_size.height - self->size.height));
 
     if (!self->shown) {
-       stacking_raise_internal(self->frame);
        XMapWindow(ob_display, self->frame);
+        stacking_raise(MENU_AS_WINDOW(self));
        self->shown = TRUE;
     } else if (self->shown && self->open_submenu) {
        menu_hide(self->open_submenu);
This page took 0.024149 seconds and 4 git commands to generate.