aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-01 20:24:40 +0100
committerKirill Primak <vyivel@eclair.cafe>2023-02-02 14:53:15 +0300
commit9959e6b8dc9b7fbfcccd516e38bc50681f38e275 (patch)
tree8a59226530bc87f2299ee9934f99618ab089af81 /sway/input
parentb31e97e55d76185840f6794811bc8d8b4cd1ebf4 (diff)
Convert to *_try_from_wlr_surface()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3991
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c9
-rw-r--r--sway/input/seatop_default.c18
2 files changed, 11 insertions, 16 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index efd67a76..ad69e7c3 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -53,12 +53,9 @@ static struct wlr_surface *layer_surface_at(struct sway_output *output,
}
static bool surface_is_xdg_popup(struct wlr_surface *surface) {
- if (wlr_surface_is_xdg_surface(surface)) {
- struct wlr_xdg_surface *xdg_surface =
- wlr_xdg_surface_from_wlr_surface(surface);
- return xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
- }
- return false;
+ struct wlr_xdg_surface *xdg_surface =
+ wlr_xdg_surface_try_from_wlr_surface(surface);
+ return xdg_surface != NULL && xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
}
static struct wlr_surface *layer_surface_popup_at(struct sway_output *output,
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index a1c1d319..0dcb87ab 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -228,17 +228,15 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
struct sway_container *cont = node && node->type == N_CONTAINER ?
node->sway_container : NULL;
+ struct wlr_layer_surface_v1 *layer;
#if HAVE_XWAYLAND
struct wlr_xwayland_surface *xsurface;
#endif
- if (wlr_surface_is_layer_surface(surface)) {
+ if ((layer = wlr_layer_surface_v1_try_from_wlr_surface(surface)) &&
+ layer->current.keyboard_interactive) {
// Handle tapping a layer surface
- struct wlr_layer_surface_v1 *layer =
- wlr_layer_surface_v1_from_wlr_surface(surface);
- if (layer->current.keyboard_interactive) {
- seat_set_focus_layer(seat, layer);
- transaction_commit_dirty();
- }
+ seat_set_focus_layer(seat, layer);
+ transaction_commit_dirty();
} else if (cont) {
bool is_floating_or_child = container_is_floating_or_child(cont);
bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont);
@@ -368,9 +366,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
}
// Handle clicking a layer surface
- if (surface && wlr_surface_is_layer_surface(surface)) {
- struct wlr_layer_surface_v1 *layer =
- wlr_layer_surface_v1_from_wlr_surface(surface);
+ struct wlr_layer_surface_v1 *layer;
+ if (surface &&
+ (layer = wlr_layer_surface_v1_try_from_wlr_surface(surface))) {
if (layer->current.keyboard_interactive) {
seat_set_focus_layer(seat, layer);
transaction_commit_dirty();