diff options
Diffstat (limited to 'rootston/xdg_shell_v6.c')
-rw-r--r-- | rootston/xdg_shell_v6.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index e8edaa8f..814c5642 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -14,6 +14,11 @@ static void get_input_bounds(struct roots_view *view, struct wlr_box *box) { assert(view->type == ROOTS_XDG_SHELL_V6_VIEW); struct wlr_xdg_surface_v6 *surf = view->xdg_surface_v6; memcpy(box, surf->geometry, sizeof(struct wlr_box)); + // TODO: real input bounds + box->x -= 10; + box->y -= 10; + box->width += 20; + box->height += 20; } static void activate(struct roots_view *view, bool active) { @@ -37,6 +42,19 @@ static void handle_request_move(struct wl_listener *listener, void *data) { view_begin_move(input, event->cursor, view); } +static void handle_request_resize(struct wl_listener *listener, void *data) { + struct roots_xdg_surface_v6 *roots_xdg_surface = + wl_container_of(listener, roots_xdg_surface, request_resize); + struct roots_view *view = roots_xdg_surface->view; + struct roots_input *input = view->desktop->server->input; + struct wlr_xdg_toplevel_v6_resize_event *e = data; + const struct roots_input_event *event = get_input_event(input, e->serial); + if (!event || input->mode != ROOTS_CURSOR_PASSTHROUGH) { + return; + } + view_begin_resize(input, event->cursor, view); +} + static void handle_destroy(struct wl_listener *listener, void *data) { struct roots_xdg_surface_v6 *roots_xdg_surface = wl_container_of(listener, roots_xdg_surface, destroy); @@ -71,6 +89,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { roots_surface->request_move.notify = handle_request_move; wl_signal_add(&surface->events.request_move, &roots_surface->request_move); wl_list_init(&roots_surface->request_resize.link); + roots_surface->request_resize.notify = handle_request_resize; + wl_signal_add(&surface->events.request_resize, + &roots_surface->request_resize); wl_list_init(&roots_surface->request_show_window_menu.link); struct roots_view *view = calloc(1, sizeof(struct roots_view)); |