wayland: Add support for set_surface_type

This commit is contained in:
Jasper St. Pierre 2014-03-13 16:45:26 -04:00
parent e278d65f05
commit d294fa45d1
2 changed files with 44 additions and 0 deletions

View File

@ -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.

View File

@ -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,