From fe584b9f00b2ee6b8088b3659c90e275bfaba3da Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 13:19:59 -0500 Subject: [PATCH] wayland: Update to latest xdg-shell.xml --- gdk/wayland/gdkwindow-wayland.c | 54 ++++++++++++++----- gdk/wayland/protocol/xdg-shell.xml | 83 ++++++++++++++++++++++++------ 2 files changed, 109 insertions(+), 28 deletions(-) diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 5c2f121bda..183470e031 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -938,9 +938,7 @@ xdg_surface_configure (void *data, struct xdg_surface *xdg_surface, uint32_t edges, int32_t width, - int32_t height, - uint32_t maximized, - uint32_t fullscreen) + int32_t height) { GdkWindow *window = GDK_WINDOW (data); GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); @@ -953,16 +951,6 @@ xdg_surface_configure (void *data, &height); gdk_wayland_window_configure (window, width, height, edges); - - if (maximized) - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED); - else - gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0); - - if (fullscreen) - gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); - else - gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0); } static void @@ -981,11 +969,47 @@ xdg_surface_focused_unset (void *data, gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0); } +static void +xdg_surface_request_set_fullscreen (void *data, + struct xdg_surface *xdg_surface) +{ + GdkWindow *window = GDK_WINDOW (data); + gdk_window_fullscreen (window); +} + +static void +xdg_surface_request_unset_fullscreen (void *data, + struct xdg_surface *xdg_surface) +{ + GdkWindow *window = GDK_WINDOW (data); + gdk_window_unfullscreen (window); +} + +static void +xdg_surface_request_set_maximized (void *data, + struct xdg_surface *xdg_surface) +{ + GdkWindow *window = GDK_WINDOW (data); + gdk_window_maximize (window); +} + +static void +xdg_surface_request_unset_maximized (void *data, + struct xdg_surface *xdg_surface) +{ + GdkWindow *window = GDK_WINDOW (data); + gdk_window_unmaximize (window); +} + static const struct xdg_surface_listener xdg_surface_listener = { xdg_surface_ping, xdg_surface_configure, xdg_surface_focused_set, xdg_surface_focused_unset, + xdg_surface_request_set_fullscreen, + xdg_surface_request_unset_fullscreen, + xdg_surface_request_set_maximized, + xdg_surface_request_unset_maximized, }; static void @@ -1717,6 +1741,7 @@ gdk_wayland_window_maximize (GdkWindow *window) return; xdg_surface_set_maximized (impl->xdg_surface); + gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED); } static void @@ -1731,6 +1756,7 @@ gdk_wayland_window_unmaximize (GdkWindow *window) return; xdg_surface_unset_maximized (impl->xdg_surface); + gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0); } static void @@ -1749,6 +1775,7 @@ gdk_wayland_window_fullscreen (GdkWindow *window) xdg_surface_set_fullscreen (impl->xdg_surface); impl->fullscreen = TRUE; + gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); } static void @@ -1767,6 +1794,7 @@ gdk_wayland_window_unfullscreen (GdkWindow *window) xdg_surface_unset_fullscreen (impl->xdg_surface); impl->fullscreen = FALSE; + gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0); } static void diff --git a/gdk/wayland/protocol/xdg-shell.xml b/gdk/wayland/protocol/xdg-shell.xml index e1249b06e1..4e5cff8df9 100644 --- a/gdk/wayland/protocol/xdg-shell.xml +++ b/gdk/wayland/protocol/xdg-shell.xml @@ -223,9 +223,6 @@ area might adjust its content position to leave the viewable content unmoved). Valid edge values are from resize_edge enum. - The maximized parameter informs if the surface is in a maximized - state. Same for the fullscreen parameter. - The client is free to dismiss all but the last configure event it received. @@ -236,8 +233,6 @@ - - @@ -255,16 +250,43 @@ + + + Event sent from the compositor to the client requesting that the client + goes to a fullscreen state. It's the client job to call set_fullscreen + and really trigger the fullscreen state. + + + + + + Event sent from the compositor to the client requesting that the client + leaves the fullscreen state. It's the client job to call + unset_fullscreen and really leave the fullscreen state. + + + Set the surface as fullscreen. - The compositor must reply to this request with a configure event - with the dimensions for the output on which the surface will be - made fullscreen. + After this request, the compositor should send a configure event + informing the output size. - Once the fullscreen state is set, a "fullscreen_set" event will - be sent to the client. + This request informs the compositor that the next attached buffer + committed will be in a fullscreen state. The buffer size should be the + same size as the size informed in the configure event, if the client + doesn't want to leave any empty area. + + In other words: the next attached buffer after set_maximized is the new + maximized buffer. And the surface will be positioned at the maximized + position on commit. + + A simple way to synchronize and wait for the correct configure event is + to use a wl_display.sync request right after the set_fullscreen + request. When the sync callback returns, the last configure event + received just before it will be the correct one, and should contain the + right size for the surface to maximize. Setting one state won't unset another state. Use xdg_surface.unset_fullscreen for unsetting it. @@ -274,19 +296,48 @@ Unset the surface fullscreen state. + + Same negotiation as set_fullscreen must be used. + + + Event sent from the compositor to the client requesting that the client + goes to a maximized state. It's the client job to call set_maximized + and really trigger the maximized state. + + + + + + Event sent from the compositor to the client requesting that the client + leaves the maximized state. It's the client job to call unset_maximized + and really leave the maximized state. + + + Set the surface as maximized. - The compositor must reply to this request with a configure event - with the dimensions for the output on which the surface will be - made maximized. + After this request, the compositor will send a configure event + informing the output size minus panel and other MW decorations. - Once the maximized state is set, a "maximized_set" event will be - sent to the client. + This request informs the compositor that the next attached buffer + committed will be in a maximized state. The buffer size should be the + same size as the size informed in the configure event, if the client + doesn't want to leave any empty area. + + In other words: the next attached buffer after set_maximized is the new + maximized buffer. And the surface will be positioned at the maximized + position on commit. + + A simple way to synchronize and wait for the correct configure event is + to use a wl_display.sync request right after the set_maximized request. + When the sync callback returns, the last configure event received just + before it will be the correct one, and should contain the right size + for the surface to maximize. Setting one state won't unset another state. Use xdg_surface.unset_maximized for unsetting it. @@ -296,6 +347,8 @@ Unset the surface maximized state. + + Same negotiation as set_maximized must be used.