diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-01 19:45:21 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-02-01 23:38:12 +0100 |
commit | ae2d14ceeb60daf558c879658af596e1e5970ded (patch) | |
tree | d87652ae74dc92d79882f4e28156b3aa51bb66bc | |
parent | ipc: add support for output event (diff) | |
download | sway-ae2d14ceeb60daf558c879658af596e1e5970ded.tar.gz sway-ae2d14ceeb60daf558c879658af596e1e5970ded.tar.zst sway-ae2d14ceeb60daf558c879658af596e1e5970ded.zip |
Convert to wlr_xwayland_surface_try_from_wlr_surface()
Accomodate for the breaking changes in [1].
[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/fbf5982e3838ee28b5345e98832f6956c402b225
-rw-r--r-- | sway/input/seatop_default.c | 42 | ||||
-rw-r--r-- | sway/tree/view.c | 15 |
2 files changed, 25 insertions, 32 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 6c69a0ea..a1c1d319 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -228,6 +228,9 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
228 | struct sway_container *cont = node && node->type == N_CONTAINER ? | 228 | struct sway_container *cont = node && node->type == N_CONTAINER ? |
229 | node->sway_container : NULL; | 229 | node->sway_container : NULL; |
230 | 230 | ||
231 | #if HAVE_XWAYLAND | ||
232 | struct wlr_xwayland_surface *xsurface; | ||
233 | #endif | ||
231 | if (wlr_surface_is_layer_surface(surface)) { | 234 | if (wlr_surface_is_layer_surface(surface)) { |
232 | // Handle tapping a layer surface | 235 | // Handle tapping a layer surface |
233 | struct wlr_layer_surface_v1 *layer = | 236 | struct wlr_layer_surface_v1 *layer = |
@@ -264,16 +267,13 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
264 | } | 267 | } |
265 | #if HAVE_XWAYLAND | 268 | #if HAVE_XWAYLAND |
266 | // Handle tapping on an xwayland unmanaged view | 269 | // Handle tapping on an xwayland unmanaged view |
267 | else if (wlr_surface_is_xwayland_surface(surface)) { | 270 | else if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) && |
268 | struct wlr_xwayland_surface *xsurface = | 271 | xsurface->override_redirect && |
269 | wlr_xwayland_surface_from_wlr_surface(surface); | 272 | wlr_xwayland_or_surface_wants_focus(xsurface)) { |
270 | if (xsurface->override_redirect && | 273 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; |
271 | wlr_xwayland_or_surface_wants_focus(xsurface)) { | 274 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); |
272 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; | 275 | seat_set_focus_surface(seat, xsurface->surface, false); |
273 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); | 276 | transaction_commit_dirty(); |
274 | seat_set_focus_surface(seat, xsurface->surface, false); | ||
275 | transaction_commit_dirty(); | ||
276 | } | ||
277 | } | 277 | } |
278 | #endif | 278 | #endif |
279 | 279 | ||
@@ -514,18 +514,16 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
514 | 514 | ||
515 | #if HAVE_XWAYLAND | 515 | #if HAVE_XWAYLAND |
516 | // Handle clicking on xwayland unmanaged view | 516 | // Handle clicking on xwayland unmanaged view |
517 | if (surface && wlr_surface_is_xwayland_surface(surface)) { | 517 | struct wlr_xwayland_surface *xsurface; |
518 | struct wlr_xwayland_surface *xsurface = | 518 | if (surface && |
519 | wlr_xwayland_surface_from_wlr_surface(surface); | 519 | (xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) && |
520 | if (xsurface->override_redirect && | 520 | xsurface->override_redirect && |
521 | wlr_xwayland_or_surface_wants_focus(xsurface)) { | 521 | wlr_xwayland_or_surface_wants_focus(xsurface)) { |
522 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; | 522 | struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; |
523 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); | 523 | wlr_xwayland_set_seat(xwayland, seat->wlr_seat); |
524 | seat_set_focus_surface(seat, xsurface->surface, false); | 524 | seat_set_focus_surface(seat, xsurface->surface, false); |
525 | transaction_commit_dirty(); | 525 | transaction_commit_dirty(); |
526 | seat_pointer_notify_button(seat, time_msec, button, state); | 526 | seat_pointer_notify_button(seat, time_msec, button, state); |
527 | return; | ||
528 | } | ||
529 | } | 527 | } |
530 | #endif | 528 | #endif |
531 | 529 | ||
diff --git a/sway/tree/view.c b/sway/tree/view.c index 2894fa79..db902562 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -526,7 +526,7 @@ static void view_populate_pid(struct sway_view *view) { | |||
526 | #if HAVE_XWAYLAND | 526 | #if HAVE_XWAYLAND |
527 | case SWAY_VIEW_XWAYLAND:; | 527 | case SWAY_VIEW_XWAYLAND:; |
528 | struct wlr_xwayland_surface *surf = | 528 | struct wlr_xwayland_surface *surf = |
529 | wlr_xwayland_surface_from_wlr_surface(view->surface); | 529 | wlr_xwayland_surface_try_from_wlr_surface(view->surface); |
530 | pid = surf->pid; | 530 | pid = surf->pid; |
531 | break; | 531 | break; |
532 | #endif | 532 | #endif |
@@ -853,9 +853,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
853 | bool set_focus = should_focus(view); | 853 | bool set_focus = should_focus(view); |
854 | 854 | ||
855 | #if HAVE_XWAYLAND | 855 | #if HAVE_XWAYLAND |
856 | if (wlr_surface_is_xwayland_surface(wlr_surface)) { | 856 | struct wlr_xwayland_surface *xsurface; |
857 | struct wlr_xwayland_surface *xsurface = | 857 | if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { |
858 | wlr_xwayland_surface_from_wlr_surface(wlr_surface); | ||
859 | set_focus &= wlr_xwayland_icccm_input_model(xsurface) != | 858 | set_focus &= wlr_xwayland_icccm_input_model(xsurface) != |
860 | WLR_ICCCM_INPUT_MODEL_NONE; | 859 | WLR_ICCCM_INPUT_MODEL_NONE; |
861 | } | 860 | } |
@@ -1197,12 +1196,8 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { | |||
1197 | return view_from_wlr_xdg_surface(xdg_surface); | 1196 | return view_from_wlr_xdg_surface(xdg_surface); |
1198 | } | 1197 | } |
1199 | #if HAVE_XWAYLAND | 1198 | #if HAVE_XWAYLAND |
1200 | if (wlr_surface_is_xwayland_surface(wlr_surface)) { | 1199 | struct wlr_xwayland_surface *xsurface; |
1201 | struct wlr_xwayland_surface *xsurface = | 1200 | if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) { |
1202 | wlr_xwayland_surface_from_wlr_surface(wlr_surface); | ||
1203 | if (xsurface == NULL) { | ||
1204 | return NULL; | ||
1205 | } | ||
1206 | return view_from_wlr_xwayland_surface(xsurface); | 1201 | return view_from_wlr_xwayland_surface(xsurface); |
1207 | } | 1202 | } |
1208 | #endif | 1203 | #endif |