[gtk+] wayland: Update to latest xdg-shell protocol
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Update to latest xdg-shell protocol
- Date: Tue, 13 May 2014 06:40:10 +0000 (UTC)
commit 9b4668c82c2368ce9598a91756fd182859619466
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Apr 11 17:31:27 2014 -0700
wayland: Update to latest xdg-shell protocol
gdk/wayland/gdkwindow-wayland.c | 117 ++++++++++++----------------
gdk/wayland/protocol/xdg-shell.xml | 149 +++++++++++++-----------------------
2 files changed, 101 insertions(+), 165 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index b172ad6..9a66ad0 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -113,6 +113,8 @@ struct _GdkWindowImplWayland
cairo_surface_t *cairo_surface;
+ int32_t next_attach_serial;
+
gchar *title;
/* Time of most recent user interaction. */
@@ -520,6 +522,12 @@ gdk_wayland_window_attach_image (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return;
+ if (impl->next_attach_serial > 0)
+ {
+ xdg_surface_ack_configure (impl->xdg_surface, impl->next_attach_serial);
+ impl->next_attach_serial = 0;
+ }
+
/* Attach this new buffer to the surface */
wl_surface_attach (impl->surface,
_gdk_wayland_shm_surface_get_wl_buffer (impl->cairo_surface),
@@ -800,63 +808,51 @@ static void
xdg_surface_configure (void *data,
struct xdg_surface *xdg_surface,
int32_t width,
- int32_t height)
+ int32_t height,
+ struct wl_array *states,
+ uint32_t serial)
{
GdkWindow *window = GDK_WINDOW (data);
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+ GdkWindowState new_state = 0;
+ uint32_t *p;
- gdk_window_constrain_size (&impl->geometry_hints,
- impl->geometry_mask,
- width,
- height,
- &width,
- &height);
-
- gdk_wayland_window_configure (window, width, height);
-}
-
-static void
-xdg_surface_change_state (void *data,
- struct xdg_surface *xdg_surface,
- uint32_t state_type,
- uint32_t value,
- uint32_t serial)
-{
- GdkWindow *window = GDK_WINDOW (data);
-
- switch (state_type)
+ if (width > 0 && height > 0)
{
- case XDG_SURFACE_STATE_MAXIMIZED:
- if (value)
- gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED);
- else
- gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0);
- break;
- case XDG_SURFACE_STATE_FULLSCREEN:
- if (value)
- gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
- else
- gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
- break;
+ gdk_window_constrain_size (&impl->geometry_hints,
+ impl->geometry_mask,
+ width,
+ height,
+ &width,
+ &height);
+
+ gdk_wayland_window_configure (window, width, height);
}
- xdg_surface_ack_change_state (xdg_surface, state_type, value, serial);
-}
-
-static void
-xdg_surface_activated (void *data,
- struct xdg_surface *xdg_surface)
-{
- GdkWindow *window = GDK_WINDOW (data);
- gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
-}
+ wl_array_for_each(p, states)
+ {
+ uint32_t state = *p;
+ switch (state)
+ {
+ case XDG_SURFACE_STATE_FULLSCREEN:
+ new_state |= GDK_WINDOW_STATE_FULLSCREEN;
+ break;
+ case XDG_SURFACE_STATE_MAXIMIZED:
+ new_state |= GDK_WINDOW_STATE_MAXIMIZED;
+ break;
+ case XDG_SURFACE_STATE_ACTIVATED:
+ new_state |= GDK_WINDOW_STATE_FOCUSED;
+ break;
+ case XDG_SURFACE_STATE_RESIZING:
+ break;
+ default:
+ /* Unknown state */
+ break;
+ }
+ }
-static void
-xdg_surface_deactivated (void *data,
- struct xdg_surface *xdg_surface)
-{
- GdkWindow *window = GDK_WINDOW (data);
- gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
+ _gdk_set_window_state (window, new_state);
+ impl->next_attach_serial = serial;
}
static void
@@ -879,9 +875,6 @@ xdg_surface_close (void *data,
static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_configure,
- xdg_surface_change_state,
- xdg_surface_activated,
- xdg_surface_deactivated,
xdg_surface_close,
};
@@ -1612,10 +1605,7 @@ gdk_wayland_window_maximize (GdkWindow *window)
if (!impl->xdg_surface)
return;
- xdg_surface_request_change_state (impl->xdg_surface,
- XDG_SURFACE_STATE_MAXIMIZED,
- TRUE,
- 0 /* serial, unused */);
+ xdg_surface_set_maximized (impl->xdg_surface);
}
static void
@@ -1629,10 +1619,7 @@ gdk_wayland_window_unmaximize (GdkWindow *window)
if (!impl->xdg_surface)
return;
- xdg_surface_request_change_state (impl->xdg_surface,
- XDG_SURFACE_STATE_MAXIMIZED,
- FALSE,
- 0 /* serial, unused */);
+ xdg_surface_unset_maximized (impl->xdg_surface);
}
static void
@@ -1646,10 +1633,7 @@ gdk_wayland_window_fullscreen (GdkWindow *window)
if (!impl->xdg_surface)
return;
- xdg_surface_request_change_state (impl->xdg_surface,
- XDG_SURFACE_STATE_FULLSCREEN,
- TRUE,
- 0 /* serial, unused */);
+ xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
}
static void
@@ -1663,10 +1647,7 @@ gdk_wayland_window_unfullscreen (GdkWindow *window)
if (!impl->xdg_surface)
return;
- xdg_surface_request_change_state (impl->xdg_surface,
- XDG_SURFACE_STATE_FULLSCREEN,
- FALSE,
- 0 /* serial, unused */);
+ xdg_surface_unset_fullscreen (impl->xdg_surface);
}
static void
diff --git a/gdk/wayland/protocol/xdg-shell.xml b/gdk/wayland/protocol/xdg-shell.xml
index 7882693..3c18610 100644
--- a/gdk/wayland/protocol/xdg-shell.xml
+++ b/gdk/wayland/protocol/xdg-shell.xml
@@ -241,40 +241,6 @@
<arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
</request>
- <event name="configure">
- <description summary="suggest resize">
- The configure event asks the client to resize its surface.
-
- The size is a hint, in the sense that the client is free to
- ignore it if it doesn't resize, pick a smaller size (to
- satisfy aspect ratio or resize in steps of NxM pixels).
-
- The client is free to dismiss all but the last configure
- event it received.
-
- The width and height arguments specify the size of the window
- in surface local coordinates.
- </description>
-
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- </event>
-
- <request name="set_output">
- <description summary="set the default output used by this surface">
- Set the default output used by this surface when it is first mapped.
-
- If this value is NULL (default), it's up to the compositor to choose
- which display will be used to map this surface.
-
- When fullscreen or maximized state are set on this surface, and it
- wasn't mapped yet, the output set with this method will be used.
- Otherwise, the output where the surface is currently mapped will be
- used.
- </description>
- <arg name="output" type="object" interface="wl_output" allow-null="true"/>
- </request>
-
<enum name="state">
<description summary="types of state on the surface">
The different state values used on the surface. This is designed for
@@ -297,89 +263,78 @@
0x1000 - 0x1FFF: GNOME
</description>
<entry name="maximized" value="1" summary="the surface is maximized">
- A non-zero value indicates the surface is maximized. Otherwise,
- the surface is unmaximized.
+ The surface is maximized. The window geometry specified in the configure
+ event must be obeyed by the client.
</entry>
<entry name="fullscreen" value="2" summary="the surface is fullscreen">
- A non-zero value indicates the surface is fullscreen. Otherwise,
- the surface is not fullscreen.
+ The surface is fullscreen. The window geometry specified in the configure
+ event must be obeyed by the client.
+ </entry>
+ <entry name="resizing" value="3">
+ The surface is being resized. The window geometry specified in the
+ configure event is a maximum; the client cannot resize beyond it.
+ Clients that have aspect ratio or cell sizing configuration can use
+ a smaller size, however.
+ </entry>
+ <entry name="activated" value="4">
+ Client window decorations should be painted as if the window is
+ active. Do not assume this means that the window actually has
+ keyboard or pointer focus.
</entry>
</enum>
- <request name="request_change_state">
- <description summary="client requests to change a surface's state">
- This asks the compositor to change the state. If the compositor wants
- to change the state, it will send a change_state event with the same
- state_type, value, and serial, and the event flow continues as if it
- it was initiated by the compositor.
+ <event name="configure">
+ <description summary="suggest a surface chnage">
+ The configure event asks the client to resize its surface.
- If the compositor does not want to change the state, it will send a
- change_state to the client with the old value of the state.
- </description>
- <arg name="state_type" type="uint" summary="the state to set"/>
- <arg name="value" type="uint" summary="the value to change the state to"/>
- <arg name="serial" type="uint" summary="an event serial">
- This serial is so the client can know which change_state event corresponds
- to which request_change_state request it sent out.
- </arg>
- </request>
+ The width and height arguments specify a hint to the window
+ about how its surface should be resized in surface local
+ coordinates. The states listed in the event specify how the
+ width/height arguments should be interpreted.
- <event name="change_state">
- <description summary="compositor wants to change a surface's state">
- This event tells the client to change a surface's state. The client
- should respond with an ack_change_state request to the compositor to
- guarantee that the compositor knows that the client has seen it.
+ A client should arrange a new surface, and then send a
+ ack_configure request with the serial sent in this configure
+ event before attaching a new surface.
+
+ If the client receives multiple configure events before it
+ can respond to one, it is free to discard all but the last
+ event it received.
</description>
- <arg name="state_type" type="uint" summary="the state to set"/>
- <arg name="value" type="uint" summary="the value to change the state to"/>
- <arg name="serial" type="uint" summary="a serial for the compositor's own tracking"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ <arg name="states" type="array"/>
+ <arg name="serial" type="uint"/>
</event>
- <request name="ack_change_state">
- <description summary="ack a change_state event">
- When a change_state event is received, a client should then ack it
- using the ack_change_state request to ensure that the compositor
+ <request name="ack_configure">
+ <description summary="ack a configure event">
+ When a configure event is received, a client should then ack it
+ using the ack_configure request to ensure that the compositor
knows the client has seen the event.
By this point, the state is confirmed, and the next attach should
- contain the buffer drawn for the new state value.
-
- The values here need to be the same as the values in the cooresponding
- change_state event.
+ contain the buffer drawn for the configure event you are acking.
</description>
- <arg name="state_type" type="uint" summary="the state to set"/>
- <arg name="value" type="uint" summary="the value to change the state to"/>
- <arg name="serial" type="uint" summary="a serial to pass to change_state"/>
+ <arg name="serial" type="uint" summary="a serial to configure for"/>
</request>
- <request name="set_minimized">
- <description summary="minimize the surface">
- Minimize the surface.
- </description>
- </request>
+ <request name="set_maximized" />
+ <request name="unset_maximized" />
- <event name="activated">
- <description summary="surface was activated">
- The activated_set event is sent when this surface has been
- activated, which means that the surface has user attention.
- Window decorations should be updated accordingly. You should
- not use this event for anything but the style of decorations
- you display, use wl_keyboard.enter and wl_keyboard.leave for
- determining keyboard focus.
- </description>
- </event>
+ <request name="set_fullscreen">
+ <description summary="set the window as fullscreen on a monitor">
+ Make the surface fullscreen.
- <event name="deactivated">
- <description summary="surface was deactivated">
- The deactivate event is sent when this surface has been
- deactivated, which means that the surface lost user attention.
- Window decorations should be updated accordingly. You should
- not use this event for anything but the style of decorations
- you display, use wl_keyboard.enter and wl_keyboard.leave for
- determining keyboard focus.
+ You can specify an output that you would prefer to be fullscreen.
+ If this value is NULL, it's up to the compositor to choose which
+ display will be used to map this surface.
</description>
- </event>
+ <arg name="output" type="object" interface="wl_output" allow-null="true"/>
+ </request>
+ <request name="unset_fullscreen" />
+
+ <request name="set_minimized" />
<event name="close">
<description summary="surface wants to be closed">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]