-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;
- }
-}
-
-void event_add_fd_handler(event_fd_handler *h) {
- g_datalist_id_set_data(&fd_handler_list, h->fd, h);
- FD_SET(h->fd, &allset);
- max_fd = MAX(max_fd, h->fd);
-}
-
-void find_max_fd_foreach(GQuark n, gpointer data, gpointer max)
-{
- *((unsigned int *)max) = MAX(*((unsigned int *)max), n);
-}
-
-void event_remove_fd(int n)
-{
- int tmpmax = 0;
- FD_CLR(n, &allset);
- g_datalist_id_remove_data(&fd_handler_list, (GQuark)n);
- g_datalist_foreach(&fd_handler_list, find_max_fd_foreach, (gpointer)&tmpmax);
- max_fd = MAX(x_fd, tmpmax);
-}
-
-void fd_event_handle_foreach(GQuark n, gpointer data, gpointer user_data)
-{
- if (FD_ISSET( (int)n, &selset)) {
- event_fd_handler *h = (event_fd_handler *)data;
- g_assert(h->fd == (int)n);
- h->handler(h->fd, h->data);
- }
-}
-
-void fd_event_handle()
-{
- g_datalist_foreach(&fd_handler_list, fd_event_handle_foreach, NULL);
-}
-
-static void event_handle_dock(Dock *s, XEvent *e)