mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-16 21:50:34 +00:00
wayland: Add support for show_window_menu
This commit is contained in:
parent
0430ae0ca5
commit
0d402601b2
@ -1934,6 +1934,40 @@ gdk_wayland_window_set_shadow_width (GdkWindow *window,
|
||||
gdk_wayland_window_sync_margin (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_window_show_window_menu (GdkWindow *window,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkEventButton *event_button = (GdkEventButton *) event;
|
||||
struct wl_seat *seat;
|
||||
double x, y;
|
||||
GdkWaylandDeviceData *device;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!impl->xdg_surface)
|
||||
return FALSE;
|
||||
|
||||
seat = gdk_wayland_device_get_wl_seat (event_button->device);
|
||||
device = wl_seat_get_user_data (seat);
|
||||
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
|
||||
xdg_surface_show_window_menu (impl->xdg_surface,
|
||||
seat,
|
||||
_gdk_wayland_device_get_button_press_serial (device),
|
||||
x, y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
{
|
||||
@ -2023,6 +2057,7 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->get_scale_factor = gdk_wayland_window_get_scale_factor;
|
||||
impl_class->set_opaque_region = gdk_wayland_window_set_opaque_region;
|
||||
impl_class->set_shadow_width = gdk_wayland_window_set_shadow_width;
|
||||
impl_class->show_window_menu = gdk_wayland_window_show_window_menu;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -198,6 +198,26 @@
|
||||
<arg name="app_id" type="string"/>
|
||||
</request>
|
||||
|
||||
<request name="show_window_menu">
|
||||
<description summary="show the window menu">
|
||||
Clients implementing client-side decorations might want to show
|
||||
a context menu when right-clicking on the decorations, giving the
|
||||
user a menu that they can use to maximize or minimize the window.
|
||||
|
||||
This request asks the compositor to pop up such a window menu at
|
||||
the given position, relative to the parent surface. There are
|
||||
no guarantees as to what the window menu contains.
|
||||
|
||||
Your surface must have focus on the seat passed in to pop up the
|
||||
window menu.
|
||||
</description>
|
||||
|
||||
<arg name="seat" type="object" interface="wl_seat" summary="the seat to pop the window up on"/>
|
||||
<arg name="serial" type="uint" summary="serial of the event to pop up the window for"/>
|
||||
<arg name="x" type="int" summary="the x position to pop up the window menu at"/>
|
||||
<arg name="y" type="int" summary="the y position to pop up the window menu at"/>
|
||||
</request>
|
||||
|
||||
<request name="move">
|
||||
<description summary="start an interactive move">
|
||||
Start a pointer-driven move of the surface.
|
||||
|
Loading…
Reference in New Issue
Block a user