logo

inaban

Unnamed repository; edit this file 'description' to name the repository.
commit: 1425a47140f31c45d2806765481909cc08eeffe9
parent: a6667ce9fb19a328cefcc3620cfa66526ff061ab
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  1 Jul 2019 11:10:01 +0200

Deny XDG-Shell move and resize requests

Diffstat:

Minaban.c56++++----------------------------------------------------
1 file changed, 4 insertions(+), 52 deletions(-)

diff --git a/inaban.c b/inaban.c @@ -626,57 +626,9 @@ xdg_surface_destroy(struct wl_listener *listener, void *data) } static void -begin_interactive(struct inaban_view *view, enum inaban_cursor_mode mode, uint32_t edges) +xdg_deny_request(struct wl_listener *listener, void *data) { - /* This function sets up an interactive move or resize operation, where the - * compositor stops propegating pointer events to clients and instead - * consumes them itself, to move or resize windows. */ - struct inaban_server *server = view->server; - struct wlr_surface *focused_surface = server->seat->pointer_state.focused_surface; - if(view->xdg_surface->surface != focused_surface) - return; /* Deny move/resize requests from unfocused clients. */ - server->grabbed_view = view; - server->cursor_mode = mode; - struct wlr_box geo_box; - wlr_xdg_surface_get_geometry(view->xdg_surface, &geo_box); - if(mode == INABAN_CURSOR_MOVE) - { - server->grab_x = server->cursor->x - view->x; - server->grab_y = server->cursor->y - view->y; - } - else - { - server->grab_x = server->cursor->x + geo_box.x; - server->grab_y = server->cursor->y + geo_box.y; - } - server->grab_width = geo_box.width; - server->grab_height = geo_box.height; - server->resize_edges = edges; -} - -static void -xdg_toplevel_request_move(struct wl_listener *listener, void *data) -{ - /* This event is raised when a client would like to begin an interactive - * move, typically because the user clicked on their client-side - * decorations. Note that a more sophisticated compositor should check the - * provied serial against a list of button press serials sent to this - * client, to prevent the client from requesting this whenever they want. */ - struct inaban_view *view = wl_container_of(listener, view, request_move); - begin_interactive(view, INABAN_CURSOR_MOVE, 0); -} - -static void -xdg_toplevel_request_resize(struct wl_listener *listener, void *data) -{ - /* This event is raised when a client would like to begin an interactive - * resize, typically because the user clicked on their client-side - * decorations. Note that a more sophisticated compositor should check the - * provied serial against a list of button press serials sent to this - * client, to prevent the client from requesting this whenever they want. */ - struct wlr_xdg_toplevel_resize_event *event = data; - struct inaban_view *view = wl_container_of(listener, view, request_resize); - begin_interactive(view, INABAN_CURSOR_RESIZE, event->edges); + return; } static void @@ -703,9 +655,9 @@ server_new_xdg_surface(struct wl_listener *listener, void *data) /* cotd */ struct wlr_xdg_toplevel *toplevel = xdg_surface->toplevel; - view->request_move.notify = xdg_toplevel_request_move; + view->request_move.notify = xdg_deny_request; wl_signal_add(&toplevel->events.request_move, &view->request_move); - view->request_resize.notify = xdg_toplevel_request_resize; + view->request_resize.notify = xdg_deny_request; wl_signal_add(&toplevel->events.request_resize, &view->request_resize); /* Add it to the list of views. */