summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-05-14 00:24:06 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-05-14 00:29:35 -0500
commit3c11ad9aa6d3d8d69c926d5c767aedfdf1cd03b1 (patch)
tree95547df618a41bf352f5c34d70700afb8633a5ab
parent06d9230a9611ab70041c7dbb1bf3d9e9ea497271 (diff)
fix segfault when dragging chromium tabs
-rw-r--r--client.h15
-rw-r--r--dwl.c2
2 files changed, 10 insertions, 7 deletions
diff --git a/client.h b/client.h
index 2ea0d22..a7b546a 100644
--- a/client.h
+++ b/client.h
@@ -30,16 +30,19 @@ client_surface(Client *c)
static inline void
client_activate_surface(struct wlr_surface *s, int activated)
{
+ struct wlr_xdg_surface *surface;
#ifdef XWAYLAND
- if (wlr_surface_is_xwayland_surface(s)) {
- wlr_xwayland_surface_activate(
- wlr_xwayland_surface_from_wlr_surface(s), activated);
+ struct wlr_xwayland_surface *xsurface;
+ if (wlr_surface_is_xwayland_surface(s)
+ && (xsurface = wlr_xwayland_surface_from_wlr_surface(s))) {
+ wlr_xwayland_surface_activate(xsurface, activated);
return;
}
#endif
- if (wlr_surface_is_xdg_surface(s))
- wlr_xdg_toplevel_set_activated(
- wlr_xdg_surface_from_wlr_surface(s), activated);
+ if (wlr_surface_is_xdg_surface(s)
+ && (surface = wlr_xdg_surface_from_wlr_surface(s))
+ && surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
+ wlr_xdg_toplevel_set_activated(surface, activated);
}
static inline void
diff --git a/dwl.c b/dwl.c
index 55e9f35..abff38a 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1121,7 +1121,7 @@ focusclient(Client *c, int lift)
} else {
Client *w;
struct wlr_scene_node *node = old->data;
- if ((w = node->data))
+ if (old->role_data && (w = node->data))
for (i = 0; i < 4; i++)
wlr_scene_rect_set_color(w->border[i], bordercolor);