simplify client_for_each_surface
All the XDG surface iterator does is iterate the main wlr_surface, then iterate the popups. If we inline that function, we can merge part of it with the X11 case.
This commit is contained in:
parent
d4e08c0762
commit
2e9c4d8ea9
30
client.h
30
client.h
|
@ -5,7 +5,7 @@
|
||||||
* that they will simply compile out if the chosen #defines leave them unused.
|
* that they will simply compile out if the chosen #defines leave them unused.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Leave this function first; it's used in the others */
|
/* Leave these functions first; they're used in the others */
|
||||||
static inline int
|
static inline int
|
||||||
client_is_x11(Client *c)
|
client_is_x11(Client *c)
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,16 @@ client_is_x11(Client *c)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct wlr_surface *
|
||||||
|
client_surface(Client *c)
|
||||||
|
{
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (client_is_x11(c))
|
||||||
|
return c->surface.xwayland->surface;
|
||||||
|
#endif
|
||||||
|
return c->surface.xdg->surface;
|
||||||
|
}
|
||||||
|
|
||||||
/* The others */
|
/* The others */
|
||||||
static inline void
|
static inline void
|
||||||
client_activate_surface(struct wlr_surface *s, int activated)
|
client_activate_surface(struct wlr_surface *s, int activated)
|
||||||
|
@ -35,14 +45,12 @@ client_activate_surface(struct wlr_surface *s, int activated)
|
||||||
static inline void
|
static inline void
|
||||||
client_for_each_surface(Client *c, wlr_surface_iterator_func_t fn, void *data)
|
client_for_each_surface(Client *c, wlr_surface_iterator_func_t fn, void *data)
|
||||||
{
|
{
|
||||||
|
wlr_surface_for_each_surface(client_surface(c), fn, data);
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c))
|
||||||
wlr_surface_for_each_surface(c->surface.xwayland->surface,
|
|
||||||
fn, data);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
wlr_xdg_surface_for_each_surface(c->surface.xdg, fn, data);
|
wlr_xdg_surface_for_each_popup_surface(c->surface.xdg, fn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char *
|
static inline const char *
|
||||||
|
@ -152,16 +160,6 @@ client_set_tiled(Client *c, uint32_t edges)
|
||||||
WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT);
|
WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct wlr_surface *
|
|
||||||
client_surface(Client *c)
|
|
||||||
{
|
|
||||||
#ifdef XWAYLAND
|
|
||||||
if (client_is_x11(c))
|
|
||||||
return c->surface.xwayland->surface;
|
|
||||||
#endif
|
|
||||||
return c->surface.xdg->surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct wlr_surface *
|
static inline struct wlr_surface *
|
||||||
client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
|
client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue