Add back coordinates to the window menu
It looks weird to have Alt+Space pop up under the cursor instead of the top-left corner of the window, and the Wayland request will pass through the coordinates as well. Add it to the compositor interface, and extend the _GTK_SHOW_WINDOW_MENU ClientMessage to support it as well.
This commit is contained in:
parent
50b81fe4b9
commit
6513cbb470
@ -1359,7 +1359,9 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||||
MetaWindow *window)
|
MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
{
|
{
|
||||||
meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window);
|
meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, x, y);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,9 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||||
MetaWindow *window)
|
MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
{
|
{
|
||||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||||
@ -369,5 +371,5 @@ meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (klass->show_window_menu)
|
if (klass->show_window_menu)
|
||||||
klass->show_window_menu (plugin, window);
|
klass->show_window_menu (plugin, window, x, y);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,8 @@ gboolean meta_plugin_manager_show_tile_preview (MetaPluginManager *mgr,
|
|||||||
gboolean meta_plugin_manager_hide_tile_preview (MetaPluginManager *mgr);
|
gboolean meta_plugin_manager_hide_tile_preview (MetaPluginManager *mgr);
|
||||||
|
|
||||||
void meta_plugin_manager_show_window_menu (MetaPluginManager *mgr,
|
void meta_plugin_manager_show_window_menu (MetaPluginManager *mgr,
|
||||||
MetaWindow *window);
|
MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -374,6 +374,8 @@ meta_core_change_workspace (Display *xdisplay,
|
|||||||
void
|
void
|
||||||
meta_core_show_window_menu (Display *xdisplay,
|
meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
|
int root_x,
|
||||||
|
int root_y,
|
||||||
guint32 timestamp)
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||||
@ -382,7 +384,7 @@ meta_core_show_window_menu (Display *xdisplay,
|
|||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_focus (window, timestamp);
|
meta_window_focus (window, timestamp);
|
||||||
|
|
||||||
meta_window_show_menu (window);
|
meta_window_show_menu (window, root_x, root_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
|
@ -134,6 +134,8 @@ const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
|
|||||||
|
|
||||||
void meta_core_show_window_menu (Display *xdisplay,
|
void meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
|
int root_x,
|
||||||
|
int root_y,
|
||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2726,7 +2726,16 @@ handle_activate_window_menu (MetaDisplay *display,
|
|||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
if (display->focus_window)
|
if (display->focus_window)
|
||||||
meta_window_show_menu (display->focus_window);
|
{
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
meta_window_get_position (display->focus_window, &x, &y);
|
||||||
|
|
||||||
|
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||||
|
x += display->focus_window->rect.width;
|
||||||
|
|
||||||
|
meta_window_show_menu (display->focus_window, x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -605,7 +605,9 @@ void meta_window_set_focused_internal (MetaWindow *window,
|
|||||||
|
|
||||||
void meta_window_current_workspace_changed (MetaWindow *window);
|
void meta_window_current_workspace_changed (MetaWindow *window);
|
||||||
|
|
||||||
void meta_window_show_menu (MetaWindow *window);
|
void meta_window_show_menu (MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
@ -5313,10 +5313,12 @@ meta_window_recalc_features (MetaWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_show_menu (MetaWindow *window)
|
meta_window_show_menu (MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
{
|
{
|
||||||
g_return_if_fail (!window->override_redirect);
|
g_return_if_fail (!window->override_redirect);
|
||||||
meta_compositor_show_window_menu (window->display->compositor, window);
|
meta_compositor_show_window_menu (window->display->compositor, window, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -7976,7 +7978,9 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
if (meta_prefs_get_raise_on_click ())
|
if (meta_prefs_get_raise_on_click ())
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_show_menu (window);
|
meta_window_show_menu (window,
|
||||||
|
event->button.x,
|
||||||
|
event->button.y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (fully_modified && (int) event->button.button == 1)
|
else if (fully_modified && (int) event->button.button == 1)
|
||||||
|
@ -123,6 +123,8 @@ void meta_compositor_show_tile_preview (MetaCompositor *compositor,
|
|||||||
int tile_monitor_number);
|
int tile_monitor_number);
|
||||||
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
||||||
void meta_compositor_show_window_menu (MetaCompositor *compositor,
|
void meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||||
MetaWindow *window);
|
MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
#endif /* META_COMPOSITOR_H */
|
#endif /* META_COMPOSITOR_H */
|
||||||
|
@ -165,7 +165,9 @@ struct _MetaPluginClass
|
|||||||
void (*hide_tile_preview) (MetaPlugin *plugin);
|
void (*hide_tile_preview) (MetaPlugin *plugin);
|
||||||
|
|
||||||
void (*show_window_menu) (MetaPlugin *plugin,
|
void (*show_window_menu) (MetaPlugin *plugin,
|
||||||
MetaWindow *window);
|
MetaWindow *window,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MetaPluginClass::kill_window_effects:
|
* MetaPluginClass::kill_window_effects:
|
||||||
|
@ -1101,6 +1101,8 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
|||||||
case G_DESKTOP_TITLEBAR_ACTION_MENU:
|
case G_DESKTOP_TITLEBAR_ACTION_MENU:
|
||||||
meta_core_show_window_menu (display,
|
meta_core_show_window_menu (display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
|
event->x_root,
|
||||||
|
event->y_root,
|
||||||
event->time);
|
event->time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1210,9 +1212,29 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
redraw_control (frames, frame, control);
|
redraw_control (frames, frame, control);
|
||||||
|
|
||||||
if (control == META_FRAME_CONTROL_MENU)
|
if (control == META_FRAME_CONTROL_MENU)
|
||||||
meta_core_show_window_menu (display,
|
{
|
||||||
frame->xwindow,
|
MetaFrameGeometry fgeom;
|
||||||
event->time);
|
GdkRectangle *rect;
|
||||||
|
int dx, dy;
|
||||||
|
|
||||||
|
meta_frames_calc_geometry (frames, frame, &fgeom);
|
||||||
|
|
||||||
|
rect = control_rect (META_FRAME_CONTROL_MENU, &fgeom);
|
||||||
|
|
||||||
|
/* get delta to convert to root coords */
|
||||||
|
dx = event->x_root - event->x;
|
||||||
|
dy = event->y_root - event->y;
|
||||||
|
|
||||||
|
/* Align to the right end of the menu rectangle if RTL */
|
||||||
|
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||||
|
dx += rect->width;
|
||||||
|
|
||||||
|
meta_core_show_window_menu (display,
|
||||||
|
frame->xwindow,
|
||||||
|
rect->x + dx,
|
||||||
|
rect->y + rect->height + dy,
|
||||||
|
event->time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (event->button == 1 &&
|
else if (event->button == 1 &&
|
||||||
(control == META_FRAME_CONTROL_RESIZE_SE ||
|
(control == META_FRAME_CONTROL_RESIZE_SE ||
|
||||||
|
@ -2729,7 +2729,13 @@ meta_window_x11_client_message (MetaWindow *window,
|
|||||||
else if (event->xclient.message_type ==
|
else if (event->xclient.message_type ==
|
||||||
display->atom__GTK_SHOW_WINDOW_MENU)
|
display->atom__GTK_SHOW_WINDOW_MENU)
|
||||||
{
|
{
|
||||||
meta_window_show_menu (window);
|
gulong x, y;
|
||||||
|
|
||||||
|
/* l[0] is device_id, which we don't use */
|
||||||
|
x = event->xclient.data.l[1];
|
||||||
|
y = event->xclient.data.l[2];
|
||||||
|
|
||||||
|
meta_window_show_menu (window, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user