mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 18:33:14 +00:00
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.
This commit is contained in:
parent
3faceadffe
commit
5ba2ae9c6a
|
@ -305,6 +305,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
wl_list_remove(&xwayland_view->destroy.link);
|
wl_list_remove(&xwayland_view->destroy.link);
|
||||||
wl_list_remove(&xwayland_view->request_configure.link);
|
wl_list_remove(&xwayland_view->request_configure.link);
|
||||||
wl_list_remove(&xwayland_view->request_fullscreen.link);
|
wl_list_remove(&xwayland_view->request_fullscreen.link);
|
||||||
|
wl_list_remove(&xwayland_view->request_move.link);
|
||||||
|
wl_list_remove(&xwayland_view->request_resize.link);
|
||||||
wl_list_remove(&xwayland_view->set_title.link);
|
wl_list_remove(&xwayland_view->set_title.link);
|
||||||
wl_list_remove(&xwayland_view->set_class.link);
|
wl_list_remove(&xwayland_view->set_class.link);
|
||||||
wl_list_remove(&xwayland_view->set_window_type.link);
|
wl_list_remove(&xwayland_view->set_window_type.link);
|
||||||
|
@ -400,6 +402,37 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
|
||||||
transaction_commit_dirty();
|
transaction_commit_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_request_move(struct wl_listener *listener, void *data) {
|
||||||
|
struct sway_xwayland_view *xwayland_view =
|
||||||
|
wl_container_of(listener, xwayland_view, request_move);
|
||||||
|
struct sway_view *view = &xwayland_view->view;
|
||||||
|
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||||
|
if (!xsurface->mapped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!container_is_floating(view->swayc)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||||
|
seat_begin_move(seat, view->swayc, seat->last_button);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_request_resize(struct wl_listener *listener, void *data) {
|
||||||
|
struct sway_xwayland_view *xwayland_view =
|
||||||
|
wl_container_of(listener, xwayland_view, request_resize);
|
||||||
|
struct sway_view *view = &xwayland_view->view;
|
||||||
|
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||||
|
if (!xsurface->mapped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!container_is_floating(view->swayc)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
struct wlr_xwayland_resize_event *e = data;
|
||||||
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||||
|
seat_begin_resize(seat, view->swayc, seat->last_button, e->edges);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_set_title(struct wl_listener *listener, void *data) {
|
static void handle_set_title(struct wl_listener *listener, void *data) {
|
||||||
struct sway_xwayland_view *xwayland_view =
|
struct sway_xwayland_view *xwayland_view =
|
||||||
wl_container_of(listener, xwayland_view, set_title);
|
wl_container_of(listener, xwayland_view, set_title);
|
||||||
|
@ -495,6 +528,14 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
||||||
&xwayland_view->request_fullscreen);
|
&xwayland_view->request_fullscreen);
|
||||||
xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
|
xwayland_view->request_fullscreen.notify = handle_request_fullscreen;
|
||||||
|
|
||||||
|
wl_signal_add(&xsurface->events.request_move,
|
||||||
|
&xwayland_view->request_move);
|
||||||
|
xwayland_view->request_move.notify = handle_request_move;
|
||||||
|
|
||||||
|
wl_signal_add(&xsurface->events.request_resize,
|
||||||
|
&xwayland_view->request_resize);
|
||||||
|
xwayland_view->request_resize.notify = handle_request_resize;
|
||||||
|
|
||||||
wl_signal_add(&xsurface->events.set_title, &xwayland_view->set_title);
|
wl_signal_add(&xsurface->events.set_title, &xwayland_view->set_title);
|
||||||
xwayland_view->set_title.notify = handle_set_title;
|
xwayland_view->set_title.notify = handle_set_title;
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
|
||||||
if (cursor->seat->operation != OP_NONE &&
|
if (cursor->seat->operation != OP_NONE &&
|
||||||
button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) {
|
button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) {
|
||||||
seat_end_mouse_operation(cursor->seat);
|
seat_end_mouse_operation(cursor->seat);
|
||||||
|
seat_pointer_notify_button(cursor->seat, time_msec, button, state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (time_msec == 0) {
|
if (time_msec == 0) {
|
||||||
|
|
Loading…
Reference in a new issue