Pass button_rect when opening window menu from button

When opening the window menu without an associated control - e.g.
by right-clicking the titlebar or by keyboard - using coordinates
for the menu position is appropriate. However when the menu is
associated with a window button, the expected behavior in the
shell can be implemented much easier with the full button geometry:
the menu will point to the center of the button's bottom edge
rather than align to the left/right side of the titlebar as it
does now, and the clickable area where a release event does not
dismiss the menu will match the actual clickable area in mutter.

So add an additional show_window_menu_for_rect() function and
use it when opening the menu from a button.

https://bugzilla.gnome.org/show_bug.cgi?id=731058
This commit is contained in:
Florian Müllner
2014-05-31 00:52:06 +02:00
parent 53425fa721
commit b64548ee1f
10 changed files with 90 additions and 13 deletions

View File

@ -392,6 +392,22 @@ meta_core_show_window_menu (Display *xdisplay,
meta_window_show_menu (window, menu, root_x, root_y);
}
void
meta_core_show_window_menu_for_rect (Display *xdisplay,
Window frame_xwindow,
MetaWindowMenuType menu,
MetaRectangle *rect,
guint32 timestamp)
{
MetaWindow *window = get_window (xdisplay, frame_xwindow);
if (meta_prefs_get_raise_on_click ())
meta_window_raise (window);
meta_window_focus (window, timestamp);
meta_window_show_menu_for_rect (window, menu, rect);
}
const char*
meta_core_get_workspace_name_with_index (Display *xdisplay,
Window xroot,

View File

@ -26,6 +26,7 @@
/* Don't include core headers here */
#include <gdk/gdkx.h>
#include <meta/common.h>
#include <meta/boxes.h>
typedef enum
{
@ -138,6 +139,12 @@ void meta_core_show_window_menu (Display *xdisplay,
int root_y,
guint32 timestamp);
void meta_core_show_window_menu_for_rect (Display *xdisplay,
Window frame_xwindow,
MetaWindowMenuType menu,
MetaRectangle *rect,
guint32 timestamp);
gboolean meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow,
MetaGrabOp op,

View File

@ -575,6 +575,10 @@ void meta_window_show_menu (MetaWindow *window,
int x,
int y);
void meta_window_show_menu_for_rect (MetaWindow *window,
MetaWindowMenuType menu,
MetaRectangle *rect);
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
const ClutterEvent *event);

View File

@ -5251,6 +5251,15 @@ meta_window_show_menu (MetaWindow *window,
meta_compositor_show_window_menu (window->display->compositor, window, menu, x, y);
}
void
meta_window_show_menu_for_rect (MetaWindow *window,
MetaWindowMenuType menu,
MetaRectangle *rect)
{
g_return_if_fail (!window->override_redirect);
meta_compositor_show_window_menu_for_rect (window->display->compositor, window, menu, rect);
}
void
meta_window_shove_titlebar_onscreen (MetaWindow *window)
{