wayland: Add support for the set_margin request

This commit is contained in:
Jasper St. Pierre
2014-02-07 17:29:35 -05:00
parent 0c213c8fee
commit def5e86673
5 changed files with 74 additions and 11 deletions

View File

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

View File

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

View File

@ -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);
}

View File

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