mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
wayland: Add support for the set_margin request
This commit is contained in:
parent
0c213c8fee
commit
def5e86673
@ -124,6 +124,32 @@
|
||||
<arg name="parent" type="object" interface="wl_surface" allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<request name="set_margin">
|
||||
<description summary="set the visible frame boundaries">
|
||||
This tells the compositor what the visible size of the window
|
||||
should be, so it can use it to determine what borders to use for
|
||||
constrainment and alignment.
|
||||
|
||||
CSD often has invisible areas for decoration purposes, like drop
|
||||
shadows. These "shadow" drawings need to be subtracted out of the
|
||||
normal boundaries of the window when computing where to place
|
||||
windows (e.g. to set this window so it's centered on top of another,
|
||||
or to put it to the left or right of the screen.)
|
||||
|
||||
This value should change as little as possible at runtime, to
|
||||
prevent flicker.
|
||||
|
||||
This value is also ignored when the window is maximized or
|
||||
fullscreen, and assumed to be 0.
|
||||
|
||||
If never called, this value is assumed to be 0.
|
||||
</description>
|
||||
<arg name="left_margin" type="int"/>
|
||||
<arg name="right_margin" type="int"/>
|
||||
<arg name="top_margin" type="int"/>
|
||||
<arg name="bottom_margin" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_title">
|
||||
<description summary="set surface title">
|
||||
Set a short title for the surface.
|
||||
|
@ -733,6 +733,9 @@ void meta_window_set_transient_for (MetaWindow *window,
|
||||
void meta_window_set_opacity (MetaWindow *window,
|
||||
guint opacity);
|
||||
|
||||
void meta_window_set_custom_frame_extents (MetaWindow *window,
|
||||
GtkBorder *extents);
|
||||
|
||||
void meta_window_handle_enter (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
guint root_x,
|
||||
|
@ -303,22 +303,18 @@ reload_gtk_frame_extents (MetaWindow *window,
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkBorder *extents = &window->custom_frame_extents;
|
||||
|
||||
window->has_custom_frame_extents = TRUE;
|
||||
extents->left = (int)value->v.cardinal_list.cardinals[0];
|
||||
extents->right = (int)value->v.cardinal_list.cardinals[1];
|
||||
extents->top = (int)value->v.cardinal_list.cardinals[2];
|
||||
extents->bottom = (int)value->v.cardinal_list.cardinals[3];
|
||||
GtkBorder extents;
|
||||
extents.left = (int)value->v.cardinal_list.cardinals[0];
|
||||
extents.right = (int)value->v.cardinal_list.cardinals[1];
|
||||
extents.top = (int)value->v.cardinal_list.cardinals[2];
|
||||
extents.bottom = (int)value->v.cardinal_list.cardinals[3];
|
||||
meta_window_set_custom_frame_extents (window, &extents);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
window->has_custom_frame_extents = FALSE;
|
||||
meta_window_set_custom_frame_extents (window, NULL);
|
||||
}
|
||||
|
||||
if (!initial)
|
||||
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -10882,3 +10882,20 @@ meta_window_get_toplevel_xwindow (MetaWindow *window)
|
||||
{
|
||||
return window->frame ? window->frame->xwindow : window->xwindow;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_set_custom_frame_extents (MetaWindow *window,
|
||||
GtkBorder *extents)
|
||||
{
|
||||
if (extents)
|
||||
{
|
||||
window->has_custom_frame_extents = TRUE;
|
||||
window->custom_frame_extents = *extents;
|
||||
}
|
||||
else
|
||||
{
|
||||
window->has_custom_frame_extents = FALSE;
|
||||
}
|
||||
|
||||
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
||||
}
|
||||
|
@ -720,6 +720,26 @@ xdg_surface_set_transient_for (struct wl_client *client,
|
||||
meta_window_set_transient_for (surface->window, transient_for);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_surface_set_margin (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
int32_t left_margin,
|
||||
int32_t right_margin,
|
||||
int32_t top_margin,
|
||||
int32_t bottom_margin)
|
||||
{
|
||||
MetaWaylandSurfaceExtension *xdg_surface = wl_resource_get_user_data (resource);
|
||||
MetaWaylandSurface *surface = wl_container_of (xdg_surface, surface, xdg_surface);
|
||||
GtkBorder extents;
|
||||
|
||||
extents.left = left_margin;
|
||||
extents.right = right_margin;
|
||||
extents.top = top_margin;
|
||||
extents.bottom = bottom_margin;
|
||||
|
||||
meta_window_set_custom_frame_extents (surface->window, &extents);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_surface_set_title (struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
@ -901,6 +921,7 @@ xdg_surface_set_minimized (struct wl_client *client,
|
||||
static const struct xdg_surface_interface meta_wayland_xdg_surface_interface = {
|
||||
xdg_surface_destroy,
|
||||
xdg_surface_set_transient_for,
|
||||
xdg_surface_set_margin,
|
||||
xdg_surface_set_title,
|
||||
xdg_surface_set_app_id,
|
||||
xdg_surface_pong,
|
||||
|
Loading…
Reference in New Issue
Block a user