mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -05:00
wayland-surface: Support xdg_surface_resize as well
This commit is contained in:
parent
3c7cd1f38c
commit
b72315e27a
@ -570,6 +570,32 @@ xdg_surface_pong (struct wl_client *client,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
begin_grab_op_on_surface (MetaWaylandSurface *surface,
|
||||||
|
MetaWaylandSeat *seat,
|
||||||
|
MetaGrabOp grab_op)
|
||||||
|
{
|
||||||
|
MetaWindow *window = surface->window;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (grab_op == META_GRAB_OP_NONE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return meta_display_begin_grab_op (window->display,
|
||||||
|
window->screen,
|
||||||
|
window,
|
||||||
|
grab_op,
|
||||||
|
TRUE, /* pointer_already_grabbed */
|
||||||
|
FALSE, /* frame_action */
|
||||||
|
1, /* button. XXX? */
|
||||||
|
0, /* modmask */
|
||||||
|
meta_display_get_current_time_roundtrip (window->display),
|
||||||
|
wl_fixed_to_int (seat->pointer.grab_x),
|
||||||
|
wl_fixed_to_int (seat->pointer.grab_y));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_surface_move (struct wl_client *client,
|
xdg_surface_move (struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
@ -578,38 +604,58 @@ xdg_surface_move (struct wl_client *client,
|
|||||||
{
|
{
|
||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
MetaWaylandSurfaceExtension *xdg_surface = wl_resource_get_user_data (resource);
|
MetaWaylandSurfaceExtension *xdg_surface = wl_resource_get_user_data (resource);
|
||||||
MetaWindow *window;
|
|
||||||
|
|
||||||
if (seat->pointer.button_count == 0 ||
|
if (seat->pointer.button_count == 0 ||
|
||||||
seat->pointer.grab_serial != serial ||
|
seat->pointer.grab_serial != serial ||
|
||||||
seat->pointer.focus != xdg_surface->surface)
|
seat->pointer.focus != xdg_surface->surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window = xdg_surface->surface->window;
|
begin_grab_op_on_surface (xdg_surface->surface, seat, META_GRAB_OP_MOVING);
|
||||||
if (!window)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
meta_display_begin_grab_op (window->display,
|
static MetaGrabOp
|
||||||
window->screen,
|
grab_op_for_edge (int edge)
|
||||||
window,
|
{
|
||||||
META_GRAB_OP_MOVING,
|
switch (edge)
|
||||||
TRUE, /* pointer_already_grabbed */
|
{
|
||||||
FALSE, /* frame_action */
|
case XDG_SURFACE_RESIZE_EDGE_TOP_LEFT:
|
||||||
1, /* button. XXX? */
|
return META_GRAB_OP_RESIZING_NW;
|
||||||
0, /* modmask */
|
case XDG_SURFACE_RESIZE_EDGE_TOP:
|
||||||
meta_display_get_current_time_roundtrip (window->display),
|
return META_GRAB_OP_RESIZING_N;
|
||||||
wl_fixed_to_int (seat->pointer.grab_x),
|
case XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT:
|
||||||
wl_fixed_to_int (seat->pointer.grab_y));
|
return META_GRAB_OP_RESIZING_NE;
|
||||||
|
case XDG_SURFACE_RESIZE_EDGE_RIGHT:
|
||||||
|
return META_GRAB_OP_RESIZING_E;
|
||||||
|
case XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT:
|
||||||
|
return META_GRAB_OP_RESIZING_SE;
|
||||||
|
case XDG_SURFACE_RESIZE_EDGE_BOTTOM:
|
||||||
|
return META_GRAB_OP_RESIZING_S;
|
||||||
|
case XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT:
|
||||||
|
return META_GRAB_OP_RESIZING_SW;
|
||||||
|
case XDG_SURFACE_RESIZE_EDGE_LEFT:
|
||||||
|
return META_GRAB_OP_RESIZING_W;
|
||||||
|
default:
|
||||||
|
g_warning ("invalid edge: %d", edge);
|
||||||
|
return META_GRAB_OP_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_surface_resize (struct wl_client *client,
|
xdg_surface_resize (struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
struct wl_resource *seat,
|
struct wl_resource *seat_resource,
|
||||||
guint32 serial,
|
guint32 serial,
|
||||||
guint32 edges)
|
guint32 edges)
|
||||||
{
|
{
|
||||||
g_warning ("TODO: support xdg_surface.resize");
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
|
MetaWaylandSurfaceExtension *xdg_surface = wl_resource_get_user_data (resource);
|
||||||
|
|
||||||
|
if (seat->pointer.button_count == 0 ||
|
||||||
|
seat->pointer.grab_serial != serial ||
|
||||||
|
seat->pointer.focus != xdg_surface->surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
begin_grab_op_on_surface (xdg_surface->surface, seat, grab_op_for_edge (edges));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user