void menu_frame_move_on_screen(ObMenuFrame *self)
{
- Rect *a;
+ Rect *a = NULL;
guint i;
gint dx = 0, dy = 0;
gint pos, half;
if (g_list_find(menu_frame_visible, self))
return;
+ if (menu_frame_visible == NULL) {
+ /* no menus shown yet */
+ if (!grab_pointer(TRUE, OB_CURSOR_NONE))
+ return;
+ if (!grab_keyboard(TRUE)) {
+ grab_pointer(FALSE, OB_CURSOR_NONE);
+ return;
+ }
+ }
+
if (parent) {
if (parent->child)
menu_frame_hide(parent->child);
}
self->parent = parent;
- if (menu_frame_visible == NULL) {
- /* no menus shown yet */
- grab_pointer(TRUE, OB_CURSOR_NONE);
- grab_keyboard(TRUE);
- }
-
/* determine if the underlying menu is already visible */
for (it = menu_frame_visible; it; it = g_list_next(it)) {
ObMenuFrame *f = it->data;