+
+/*
+ Default menu controller action for showing.
+*/
+
+void menu_control_show(Menu *self, int x, int y, Client *client) {
+ g_assert(!self->invalid);
+
+ XMoveWindow(ob_display, self->frame,
+ MIN(x, screen_physical_size.width - self->size.width),
+ MIN(y, screen_physical_size.height - self->size.height));
+ POINT_SET(self->location,
+ MIN(x, screen_physical_size.width - self->size.width),
+ MIN(y, screen_physical_size.height - self->size.height));
+
+ if (!self->shown) {
+ 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);
+ }
+}
+
+void menu_control_mouseover(MenuEntry *self, gboolean enter) {
+ int x;
+ self->hilite = enter;
+
+ if (enter) {
+ if (self->parent->open_submenu && self->submenu
+ != self->parent->open_submenu)
+ menu_hide(self->parent->open_submenu);
+
+ if (self->submenu) {
+ self->parent->open_submenu = self->submenu;
+
+ /* shouldn't be invalid since it must be displayed */
+ g_assert(!self->parent->invalid);
+ /* TODO: I don't understand why these bevels should be here.
+ Something must be wrong in the width calculation */
+ x = self->parent->location.x + self->parent->size.width +
+ ob_rr_theme->bevel;
+
+ /* need to get the width. is this bad?*/
+ menu_render(self->submenu);
+
+ if (self->submenu->size.width + x > screen_physical_size.width)
+ x = self->parent->location.x - self->submenu->size.width -
+ ob_rr_theme->bevel;
+
+ menu_show_full(self->submenu, x,
+ self->parent->location.y + self->y,
+ self->parent->client);
+ }
+ }
+}