- self = g_new0(ObMenu, 1);
- self->obwin.type = Window_Menu;
- self->label = g_strdup(label);
- self->name = g_strdup(name);
- self->parent = parent;
- self->open_submenu = NULL;
- self->over = NULL;
-
- self->entries = NULL;
- self->shown = FALSE;
- self->invalid = TRUE;
-
- /* default controllers */
- self->show = (show != NULL ? show : menu_show_full);
- self->hide = (hide != NULL ? hide : menu_hide);
- self->update = (update != NULL ? update : menu_render);
- self->mouseover = (mouseover != NULL ? mouseover :
- menu_control_mouseover);
- self->selected = (selected != NULL ? selected : menu_entry_fire);
-
- self->plugin = NULL;
- self->plugin_data = NULL;
-
- attrib.override_redirect = TRUE;
- attrib.event_mask = FRAME_EVENTMASK;
- self->frame = createWindow(RootWindow(ob_display, ob_screen),
- CWOverrideRedirect|CWEventMask, &attrib);
- attrib.event_mask = TITLE_EVENTMASK;
- self->title = createWindow(self->frame, CWEventMask, &attrib);
- self->items = createWindow(self->frame, 0, &attrib);
-
- self->a_title = self->a_items = NULL;
-
- XMapWindow(ob_display, self->title);
- XMapWindow(ob_display, self->items);
-
- g_hash_table_insert(window_map, &self->frame, self);
- g_hash_table_insert(window_map, &self->title, self);
- g_hash_table_insert(window_map, &self->items, self);
- g_hash_table_insert(menu_hash, g_strdup(name), self);
-
- stacking_add(MENU_AS_WINDOW(self));
- stacking_raise(MENU_AS_WINDOW(self));