fix segfault when dragging chromium tabs

This commit is contained in:
Leonardo Hernández Hernández 2022-05-14 00:24:06 -05:00
parent 06d9230a96
commit 3c11ad9aa6
No known key found for this signature in database
GPG key ID: E538897EE11B9624
2 changed files with 10 additions and 7 deletions

View file

@ -30,16 +30,19 @@ client_surface(Client *c)
static inline void static inline void
client_activate_surface(struct wlr_surface *s, int activated) client_activate_surface(struct wlr_surface *s, int activated)
{ {
struct wlr_xdg_surface *surface;
#ifdef XWAYLAND #ifdef XWAYLAND
if (wlr_surface_is_xwayland_surface(s)) { struct wlr_xwayland_surface *xsurface;
wlr_xwayland_surface_activate( if (wlr_surface_is_xwayland_surface(s)
wlr_xwayland_surface_from_wlr_surface(s), activated); && (xsurface = wlr_xwayland_surface_from_wlr_surface(s))) {
wlr_xwayland_surface_activate(xsurface, activated);
return; return;
} }
#endif #endif
if (wlr_surface_is_xdg_surface(s)) if (wlr_surface_is_xdg_surface(s)
wlr_xdg_toplevel_set_activated( && (surface = wlr_xdg_surface_from_wlr_surface(s))
wlr_xdg_surface_from_wlr_surface(s), activated); && surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
wlr_xdg_toplevel_set_activated(surface, activated);
} }
static inline void static inline void

2
dwl.c
View file

@ -1121,7 +1121,7 @@ focusclient(Client *c, int lift)
} else { } else {
Client *w; Client *w;
struct wlr_scene_node *node = old->data; struct wlr_scene_node *node = old->data;
if ((w = node->data)) if (old->role_data && (w = node->data))
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
wlr_scene_rect_set_color(w->border[i], bordercolor); wlr_scene_rect_set_color(w->border[i], bordercolor);