mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-14 06:59:43 -05:00
React to xdg shell resize requests
This commit is contained in:
parent
0c48ef5ad8
commit
97679b8e12
5 changed files with 39 additions and 4 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue