-static void event_handle_menu(Menu *menu, Client *client, XEvent *e)
-{
- MenuEntry *entry;
-
- g_message("EVENT %d", e->type);
- switch (e->type) {
- case ButtonPress:
- 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");
- if (!menu->shown) break;
-
-/* grab_pointer_window(FALSE, None, menu->frame);*/
-
- if (e->xbutton.button == 1) {
- entry = menu_find_entry(menu, e->xbutton.window);
- if (entry) {
- int junk;
- Window wjunk;
- guint ujunk, b, w, h;
- XGetGeometry(ob_display, e->xbutton.window,
- &wjunk, &junk, &junk, &w, &h, &b, &ujunk);
- if (e->xbutton.x >= (signed)-b &&
- e->xbutton.y >= (signed)-b &&
- e->xbutton.x < (signed)(w+b) &&
- e->xbutton.y < (signed)(h+b)) {
- menu_entry_fire(entry);
- }
- }
- }
-
- break;
- case EnterNotify:
- case LeaveNotify:
- g_message("enter/leave");
- entry = menu_find_entry(menu, e->xcrossing.window);
- if (entry) {
- if (menu->mouseover)
- menu->mouseover(entry, e->type == EnterNotify);
- else
- menu_control_mouseover(entry, e->type == EnterNotify);
-
- menu_entry_render(entry);
- }
- break;
- }
-}
-