From: Mikael Magnusson Date: Sun, 8 Feb 2009 07:51:25 +0000 (+0100) Subject: Warp to the top of the combined menu and back. X-Git-Tag: mikabox-3.4.7.2~18^2 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=e8b1607346d9547c46a0cdc4477a5c9cc20c8755;p=mikachu%2Fopenbox.git Warp to the top of the combined menu and back. --- diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c index 203614c9..49f11853 100644 --- a/openbox/client_list_combined_menu.c +++ b/openbox/client_list_combined_menu.c @@ -155,6 +155,7 @@ void client_list_combined_menu_startup(gboolean reconfig) combined_menu = menu_new(MENU_NAME, _("Windows"), TRUE, NULL); menu_set_update_func(combined_menu, self_update); menu_set_execute_func(combined_menu, menu_execute); + combined_menu->warp = TRUE; } void client_list_combined_menu_shutdown(gboolean reconfig) diff --git a/openbox/menu.h b/openbox/menu.h index 43efd413..ef2484da 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -86,6 +86,8 @@ struct _ObMenu ObMenuDestroyFunc destroy_func; ObMenuPlaceFunc place_func; + gboolean warp; + /* Pipe-menu parent, we get destroyed when it is destroyed */ ObMenu *pipe_creator; diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 1e767e96..28d5219c 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -975,15 +975,23 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y, menu_frame_place_topmenu(self, &x, &y); menu_frame_move(self, x, y); - XMapWindow(obt_display, self->window); if (screen_pointer_pos(&px, &py)) { - ObMenuEntryFrame *e = menu_entry_frame_under(px, py); - if (e && e->frame == self) - e->ignore_enters++; + + if (self->menu->warp) { + x += self->area.width / 2; + XWarpPointer(obt_display, None, obt_root(ob_screen), 0, 0, 0, 0, x, y); + self->ox = px; + self->oy = py; + } else { + ObMenuEntryFrame *e = menu_entry_frame_under(px, py); + if (e && e->frame == self) + e->ignore_enters++; + } } + return TRUE; } @@ -1056,6 +1064,9 @@ static void menu_frame_hide(ObMenuFrame *self) ungrab_keyboard(); } + if (self->menu->warp) + XWarpPointer(obt_display, None, obt_root(ob_screen), 0, 0, 0, 0, self->ox, self->oy); + XUnmapWindow(obt_display, self->window); menu_frame_free(self); diff --git a/openbox/menuframe.h b/openbox/menuframe.h index 1d5dd0cb..fda942d6 100644 --- a/openbox/menuframe.h +++ b/openbox/menuframe.h @@ -46,6 +46,7 @@ struct _ObMenuFrame /* The client that the visual instance of the menu is associated with for its actions */ struct _ObClient *client; + gint ox, oy; ObMenuFrame *parent; ObMenuEntryFrame *parent_entry;