Convert to wlr_xwayland_surface_try_from_wlr_surface()

Accomodate for the breaking changes in [1].

[1]: fbf5982e38
master
Simon Ser 2 years ago
parent 40eb29e7c5
commit ae2d14ceeb

@ -228,6 +228,9 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
struct sway_container *cont = node && node->type == N_CONTAINER ? struct sway_container *cont = node && node->type == N_CONTAINER ?
node->sway_container : NULL; node->sway_container : NULL;
#if HAVE_XWAYLAND
struct wlr_xwayland_surface *xsurface;
#endif
if (wlr_surface_is_layer_surface(surface)) { if (wlr_surface_is_layer_surface(surface)) {
// Handle tapping a layer surface // Handle tapping a layer surface
struct wlr_layer_surface_v1 *layer = struct wlr_layer_surface_v1 *layer =
@ -264,17 +267,14 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
} }
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
// Handle tapping on an xwayland unmanaged view // Handle tapping on an xwayland unmanaged view
else if (wlr_surface_is_xwayland_surface(surface)) { else if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) &&
struct wlr_xwayland_surface *xsurface = xsurface->override_redirect &&
wlr_xwayland_surface_from_wlr_surface(surface);
if (xsurface->override_redirect &&
wlr_xwayland_or_surface_wants_focus(xsurface)) { wlr_xwayland_or_surface_wants_focus(xsurface)) {
struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
wlr_xwayland_set_seat(xwayland, seat->wlr_seat); wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
seat_set_focus_surface(seat, xsurface->surface, false); seat_set_focus_surface(seat, xsurface->surface, false);
transaction_commit_dirty(); transaction_commit_dirty();
} }
}
#endif #endif
wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool); wlr_tablet_v2_tablet_tool_notify_down(tool->tablet_v2_tool);
@ -514,18 +514,16 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
// Handle clicking on xwayland unmanaged view // Handle clicking on xwayland unmanaged view
if (surface && wlr_surface_is_xwayland_surface(surface)) { struct wlr_xwayland_surface *xsurface;
struct wlr_xwayland_surface *xsurface = if (surface &&
wlr_xwayland_surface_from_wlr_surface(surface); (xsurface = wlr_xwayland_surface_try_from_wlr_surface(surface)) &&
if (xsurface->override_redirect && xsurface->override_redirect &&
wlr_xwayland_or_surface_wants_focus(xsurface)) { wlr_xwayland_or_surface_wants_focus(xsurface)) {
struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland; struct wlr_xwayland *xwayland = server.xwayland.wlr_xwayland;
wlr_xwayland_set_seat(xwayland, seat->wlr_seat); wlr_xwayland_set_seat(xwayland, seat->wlr_seat);
seat_set_focus_surface(seat, xsurface->surface, false); seat_set_focus_surface(seat, xsurface->surface, false);
transaction_commit_dirty(); transaction_commit_dirty();
seat_pointer_notify_button(seat, time_msec, button, state); seat_pointer_notify_button(seat, time_msec, button, state);
return;
}
} }
#endif #endif

@ -526,7 +526,7 @@ static void view_populate_pid(struct sway_view *view) {
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
case SWAY_VIEW_XWAYLAND:; case SWAY_VIEW_XWAYLAND:;
struct wlr_xwayland_surface *surf = struct wlr_xwayland_surface *surf =
wlr_xwayland_surface_from_wlr_surface(view->surface); wlr_xwayland_surface_try_from_wlr_surface(view->surface);
pid = surf->pid; pid = surf->pid;
break; break;
#endif #endif
@ -853,9 +853,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
bool set_focus = should_focus(view); bool set_focus = should_focus(view);
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
if (wlr_surface_is_xwayland_surface(wlr_surface)) { struct wlr_xwayland_surface *xsurface;
struct wlr_xwayland_surface *xsurface = if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) {
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
set_focus &= wlr_xwayland_icccm_input_model(xsurface) != set_focus &= wlr_xwayland_icccm_input_model(xsurface) !=
WLR_ICCCM_INPUT_MODEL_NONE; WLR_ICCCM_INPUT_MODEL_NONE;
} }
@ -1197,12 +1196,8 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
return view_from_wlr_xdg_surface(xdg_surface); return view_from_wlr_xdg_surface(xdg_surface);
} }
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
if (wlr_surface_is_xwayland_surface(wlr_surface)) { struct wlr_xwayland_surface *xsurface;
struct wlr_xwayland_surface *xsurface = if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface))) {
wlr_xwayland_surface_from_wlr_surface(wlr_surface);
if (xsurface == NULL) {
return NULL;
}
return view_from_wlr_xwayland_surface(xsurface); return view_from_wlr_xwayland_surface(xsurface);
} }
#endif #endif

Loading…
Cancel
Save