Menus put themselves into the stacking list.

Clicking on the menu (but not on an entry) will raise it.
This commit is contained in:
Dana Jansens 2003-05-11 19:50:30 +00:00
parent 58cfbb7f84
commit 81cc0749f8
2 changed files with 12 additions and 1 deletions

View file

@ -874,6 +874,11 @@ static void event_handle_menu(Menu *menu, XEvent *e)
g_message("BUTTON PRESS");
if (e->xbutton.button == 3)
menu_hide(menu);
else if (e->xbutton.button == 1) {
entry = menu_find_entry(menu, e->xbutton.window);
if (!entry)
stacking_raise(MENU_AS_WINDOW(menu));
}
break;
case ButtonRelease:
g_message("BUTTON RELEASED");
@ -894,6 +899,7 @@ static void event_handle_menu(Menu *menu, XEvent *e)
e->xbutton.y < (signed)(h+b)) {
menu_entry_fire(entry);
}
}
break;
case EnterNotify:
@ -909,7 +915,6 @@ static void event_handle_menu(Menu *menu, XEvent *e)
menu_entry_render(entry);
}
break;
}
}
}

View 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);
@ -197,6 +199,9 @@ 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);
return self;
}
@ -355,6 +360,7 @@ void menu_control_show(Menu *self, int x, int y, Client *client) {
stacking_raise(MENU_AS_WINDOW(self));
*/
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);