diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-22 22:14:36 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-22 23:10:19 +1000 |
commit | 5ba2ae9c6a4372cbf6f8867b711bb55ef6937cb4 (patch) | |
tree | d2a4d15c12f19fb7ef26a40b3701870fca9ab773 | |
parent | Fix focus bug with floating containers (diff) | |
download | sway-5ba2ae9c6a4372cbf6f8867b711bb55ef6937cb4.tar.gz sway-5ba2ae9c6a4372cbf6f8867b711bb55ef6937cb4.tar.zst sway-5ba2ae9c6a4372cbf6f8867b711bb55ef6937cb4.zip |
Implement request_move and request_resize for xwayland views
I discovered we have to send a click event when ending the move or
resize operation to make xwayland's requests work correctly.
-rw-r--r-- | sway/desktop/xwayland.c | 41 | ||||
-rw-r--r-- | sway/input/cursor.c | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index bce0a37b..2546168b 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -305,6 +305,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
305 | wl_list_remove(&xwayland_view->destroy.link); | 305 | wl_list_remove(&xwayland_view->destroy.link); |
306 | wl_list_remove(&xwayland_view->request_configure.link); | 306 | wl_list_remove(&xwayland_view->request_configure.link); |
307 | wl_list_remove(&xwayland_view->request_fullscreen.link); | 307 | wl_list_remove(&xwayland_view->request_fullscreen.link); |
308 | wl_list_remove(&xwayland_view->request_move.link); | ||
309 | wl_list_remove(&xwayland_view->request_resize.link); | ||
308 | wl_list_remove(&xwayland_view->set_title.link); | 310 | wl_list_remove(&xwayland_view->set_title.link); |
309 | wl_list_remove(&xwayland_view->set_class.link); | 311 | wl_list_remove(&xwayland_view->set_class.link); |
310 | wl_list_remove(&xwayland_view->set_window_type.link); | 312 | wl_list_remove(&xwayland_view->set_window_type.link); |
@@ -400,6 +402,37 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
400 | transaction_commit_dirty(); | 402 | transaction_commit_dirty(); |
401 | } | 403 | } |
402 | 404 | ||
405 | static void handle_request_move(struct wl_listener *listener, void *data) { | ||
406 | struct sway_xwayland_view *xwayland_view = | ||
407 | wl_container_of(listener, xwayland_view, request_move); | ||
408 | struct sway_view *view = &xwayland_view->view; | ||
409 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | ||
410 | if (!xsurface->mapped) { | ||
411 | return; | ||
412 | } | ||
413 | if (!container_is_floating(view->swayc)) { | ||
414 | return; | ||
415 | } | ||
416 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
417 | seat_begin_move(seat, view->swayc, seat->last_button); | ||
418 | } | ||
419 | |||
420 | static void handle_request_resize(struct wl_listener *listener, void *data) { | ||
421 | struct sway_xwayland_view *xwayland_view = | ||
422 | wl_container_of(listener, xwayland_view, request_resize); | ||
423 | struct sway_view *view = &xwayland_view->view; | ||
424 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | ||
425 | if (!xsurface->mapped) { | ||
426 | return; | ||
427 | } | ||
428 | if (!container_is_floating(view->swayc)) { | ||
429 | return; | ||
430 | } | ||
431 | struct wlr_xwayland_resize_event *e = data; | ||
432 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
433 | seat_begin_resize(seat, view->swayc, seat->last_button, e->edges); | ||
434 | } | ||
435 | |||
403 | static void handle_set_title(struct wl_listener *listener, void *data) { | 436 | static void handle_set_title(struct wl_listener *listener, void *data) { |
404 | struct sway_xwayland_view *xwayland_view = | 437 | struct sway_xwayland_view *xwayland_view = |
405 | wl_container_of(listener, xwayland_view, set_title); | 438 | wl_container_of(listener, xwayland_view, set_title); |
@@ -495,6 +528,14 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { | |||
495 | &xwayland_view->request_fullscreen); | 528 | &xwayland_view->request_fullscreen); |
496 | xwayland_view->request_fullscreen.notify = handle_request_fullscreen; | 529 | xwayland_view->request_fullscreen.notify = handle_request_fullscreen; |
497 | 530 | ||
531 | wl_signal_add(&xsurface->events.request_move, | ||
532 | &xwayland_view->request_move); | ||
533 | xwayland_view->request_move.notify = handle_request_move; | ||
534 | |||
535 | wl_signal_add(&xsurface->events.request_resize, | ||
536 | &xwayland_view->request_resize); | ||
537 | xwayland_view->request_resize.notify = handle_request_resize; | ||
538 | |||
498 | wl_signal_add(&xsurface->events.set_title, &xwayland_view->set_title); | 539 | wl_signal_add(&xsurface->events.set_title, &xwayland_view->set_title); |
499 | xwayland_view->set_title.notify = handle_set_title; | 540 | xwayland_view->set_title.notify = handle_set_title; |
500 | 541 | ||
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 54cd3bf7..f9b59fcc 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -474,6 +474,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
474 | if (cursor->seat->operation != OP_NONE && | 474 | if (cursor->seat->operation != OP_NONE && |
475 | button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) { | 475 | button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) { |
476 | seat_end_mouse_operation(cursor->seat); | 476 | seat_end_mouse_operation(cursor->seat); |
477 | seat_pointer_notify_button(cursor->seat, time_msec, button, state); | ||
477 | return; | 478 | return; |
478 | } | 479 | } |
479 | if (time_msec == 0) { | 480 | if (time_msec == 0) { |