+ frame_adjust_shape(client->frame);
+ }
+#endif
+ }
+}
+
+static void event_handle_menu(ObClient *client, XEvent *e)
+{
+ static MenuEntry *over = NULL;
+ MenuEntry *entry;
+ Menu *top;
+ GSList *it;
+
+ top = g_slist_nth_data(menu_visible, 0);
+
+ g_message("EVENT %d", e->type);
+ switch (e->type) {
+ case KeyPress:
+ if (over) {
+ if (over->parent->mouseover)
+ over->parent->mouseover(over, FALSE);
+ else
+ menu_control_mouseover(over, FALSE);
+ menu_entry_render(over);
+ over = NULL;
+ }
+/*
+ if (top->hide)
+ top->hide(top);
+ else
+*/
+ menu_hide(top);
+ break;
+ case ButtonPress:
+ if (e->xbutton.button > 3) break;
+
+ g_message("BUTTON PRESS");
+ break;
+ case ButtonRelease:
+ if (e->xbutton.button > 3) break;
+
+ g_message("BUTTON RELEASED");
+
+ for (it = menu_visible; it; it = g_slist_next(it)) {
+ Menu *m = it->data;
+ if (e->xbutton.x_root >= m->location.x - ob_rr_theme->bwidth &&
+ e->xbutton.y_root >= m->location.y - ob_rr_theme->bwidth &&
+ e->xbutton.x_root < m->location.x + m->size.width +
+ ob_rr_theme->bwidth &&
+ e->xbutton.y_root < m->location.y + m->size.height +
+ ob_rr_theme->bwidth) {
+ if ((entry = menu_find_entry_by_pos(it->data,
+ e->xbutton.x_root -
+ m->location.x,
+ e->xbutton.y_root -
+ m->location.y))) {
+ if (over) {
+ if (over->parent->mouseover)
+ over->parent->mouseover(over, FALSE);
+ else
+ menu_control_mouseover(over, FALSE);
+ menu_entry_render(over);
+ over = NULL;
+ /* this hides the menu */
+ menu_entry_fire(entry);
+ }
+ }
+ break;
+ }
+ }
+ if (!it) {
+ if (over) {
+ if (over->parent->mouseover)
+ over->parent->mouseover(over, FALSE);
+ else
+ menu_control_mouseover(over, FALSE);
+ menu_entry_render(over);
+ over = NULL;
+ }
+/*
+ if (top->hide)
+ top->hide(top);
+ else
+*/
+ menu_hide(top);
+ }
+
+ break;
+ case MotionNotify:
+ g_message("motion");
+ for (it = menu_visible; it; it = g_slist_next(it)) {
+ Menu *m = it->data;
+ if ((entry = menu_find_entry_by_pos(it->data,
+ e->xmotion.x_root -
+ m->location.x,
+ e->xmotion.y_root -
+ m->location.y))) {
+ if (over && entry != over) {
+ if (over->parent->mouseover)
+ over->parent->mouseover(over, FALSE);
+ else
+ menu_control_mouseover(over, FALSE);
+ menu_entry_render(over);
+ }
+
+ over = entry;
+ if (over->parent->mouseover)
+ over->parent->mouseover(over, TRUE);
+ else
+ menu_control_mouseover(over, TRUE);
+ menu_entry_render(over);
+ break;
+ }
+ }
+ if (!it && over) {
+ if (over->parent->mouseover)
+ over->parent->mouseover(over, FALSE);
+ else
+ menu_control_mouseover(over, FALSE);
+ menu_entry_render(over);
+ over = NULL;