[mutter/wip/compositor-menu: 7/13] wayland: Add support for set_surface_type
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/compositor-menu: 7/13] wayland: Add support for set_surface_type
- Date: Fri, 14 Mar 2014 14:27:14 +0000 (UTC)
commit d294fa45d14bbc67175747501cb94b6c2e998670
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Mar 13 16:45:26 2014 -0400
wayland: Add support for set_surface_type
protocol/xdg-shell.xml | 17 +++++++++++++++++
src/wayland/meta-wayland-surface.c | 27 +++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml
index a2913c4..47ff260 100644
--- a/protocol/xdg-shell.xml
+++ b/protocol/xdg-shell.xml
@@ -201,6 +201,23 @@
<arg name="app_id" type="string"/>
</request>
+ <enum name="surface_type">
+ <description summary="surface types">
+ Surface
+ </description>
+ <entry name="normal" value="0" summary="A normal window. This is the default type."/>
+ <entry name="modal_dialog" value="1" summary="A modal dialog."/>
+ </enum>
+
+ <request name="set_surface_type">
+ <description summary="set the surface type">
+ Sets the type of the surface. These are high-level "roles" of
+ surfaces designed to give the compositor more heuristics about
+ how to place and manage the window.
+ </description>
+ <arg name="surface_type" type="uint" summary="a surface type from surface_type"/>
+ </request>
+
<request name="move">
<description summary="start an interactive move">
Start a pointer-driven move of the surface.
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 86f3dd8..680c79c 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -749,6 +749,32 @@ xdg_surface_set_app_id (struct wl_client *client,
meta_window_set_wm_class (surface->window, app_id, app_id);
}
+static MetaWindowType
+window_type_from_surface_type (uint32_t surface_type)
+{
+ switch (surface_type)
+ {
+ case XDG_SURFACE_SURFACE_TYPE_NORMAL:
+ return META_WINDOW_NORMAL;
+ case XDG_SURFACE_SURFACE_TYPE_MODAL_DIALOG:
+ return META_WINDOW_MODAL_DIALOG;
+ default:
+ g_warning ("Unknown surface type: %d\n", surface_type);
+ return META_WINDOW_NORMAL;
+ }
+}
+
+static void
+xdg_surface_set_surface_type (struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t surface_type)
+{
+ MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
+
+ meta_window_set_type (surface->window,
+ window_type_from_surface_type (surface_type));
+}
+
static gboolean
begin_grab_op_on_surface (MetaWaylandSurface *surface,
MetaWaylandSeat *seat,
@@ -898,6 +924,7 @@ static const struct xdg_surface_interface meta_wayland_xdg_surface_interface = {
xdg_surface_set_margin,
xdg_surface_set_title,
xdg_surface_set_app_id,
+ xdg_surface_set_surface_type,
xdg_surface_move,
xdg_surface_resize,
xdg_surface_set_output,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]