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:
Jasper St. Pierre
2014-05-22 08:35:11 -04:00
parent 50b81fe4b9
commit 6513cbb470
12 changed files with 74 additions and 17 deletions

View File

@ -1101,6 +1101,8 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
case G_DESKTOP_TITLEBAR_ACTION_MENU:
meta_core_show_window_menu (display,
frame->xwindow,
event->x_root,
event->y_root,
event->time);
break;
}
@ -1210,9 +1212,29 @@ meta_frames_button_press_event (GtkWidget *widget,
redraw_control (frames, frame, control);
if (control == META_FRAME_CONTROL_MENU)
meta_core_show_window_menu (display,
frame->xwindow,
event->time);
{
MetaFrameGeometry fgeom;
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 &&
(control == META_FRAME_CONTROL_RESIZE_SE ||