always set the same monitor and tags for child clients of a client
fixes #272
This commit is contained in:
parent
e082292606
commit
90a12c90a0
52
client.h
52
client.h
|
@ -26,6 +26,25 @@ client_surface(Client *c)
|
|||
return c->surface.xdg->surface;
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
client_from_wlr_surface(struct wlr_surface *s)
|
||||
{
|
||||
struct wlr_xdg_surface *surface;
|
||||
|
||||
#ifdef XWAYLAND
|
||||
struct wlr_xwayland_surface *xsurface;
|
||||
if (s && wlr_surface_is_xwayland_surface(s)
|
||||
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s)))
|
||||
return xsurface->data;
|
||||
#endif
|
||||
if (s && wlr_surface_is_xdg_surface(s)
|
||||
&& (surface = wlr_xdg_surface_from_wlr_surface(s))
|
||||
&& surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
|
||||
return surface->data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The others */
|
||||
static inline void
|
||||
client_activate_surface(struct wlr_surface *s, int activated)
|
||||
|
@ -117,6 +136,20 @@ client_get_title(Client *c)
|
|||
return c->surface.xdg->toplevel->title;
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
client_get_parent(Client *c)
|
||||
{
|
||||
Client *p;
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c) && c->surface.xwayland->parent)
|
||||
return client_from_wlr_surface(c->surface.xwayland->parent->surface);
|
||||
#endif
|
||||
if (c->surface.xdg->toplevel->parent)
|
||||
return client_from_wlr_surface(c->surface.xdg->toplevel->parent->surface);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
client_is_float_type(Client *c)
|
||||
{
|
||||
|
@ -235,25 +268,6 @@ client_restack_surface(Client *c)
|
|||
return;
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
client_from_wlr_surface(struct wlr_surface *s)
|
||||
{
|
||||
struct wlr_xdg_surface *surface;
|
||||
|
||||
#ifdef XWAYLAND
|
||||
struct wlr_xwayland_surface *xsurface;
|
||||
if (wlr_surface_is_xwayland_surface(s)
|
||||
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s)))
|
||||
return xsurface->data;
|
||||
#endif
|
||||
if (wlr_surface_is_xdg_surface(s)
|
||||
&& (surface = wlr_xdg_surface_from_wlr_surface(s))
|
||||
&& surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
|
||||
return surface->data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
toplevel_from_popup(struct wlr_xdg_popup *popup)
|
||||
{
|
||||
|
|
9
dwl.c
9
dwl.c
|
@ -1388,7 +1388,7 @@ void
|
|||
mapnotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||
Client *c = wl_container_of(listener, c, map);
|
||||
Client *p, *c = wl_container_of(listener, c, map);
|
||||
int i;
|
||||
|
||||
/* Create scene tree for this client and its border */
|
||||
|
@ -1432,7 +1432,14 @@ mapnotify(struct wl_listener *listener, void *data)
|
|||
wl_list_insert(&fstack, &c->flink);
|
||||
|
||||
/* Set initial monitor, tags, floating status, and focus */
|
||||
if ((p = client_get_parent(c))) {
|
||||
/* Set the same monitor and tags than its parent */
|
||||
c->isfloating = 1;
|
||||
wlr_scene_node_reparent(c->scene, layers[LyrFloat]);
|
||||
setmon(c, p->mon, p->tags);
|
||||
} else {
|
||||
applyrules(c);
|
||||
}
|
||||
printstatus();
|
||||
|
||||
if (c->isfullscreen)
|
||||
|
|
Loading…
Reference in a new issue