This commit is contained in:
λmolinae 2025-02-02 13:09:20 -06:00
parent c930463deb
commit 16d6775ac2
10 changed files with 148 additions and 158 deletions

View file

@ -126,14 +126,15 @@ client_get_appid(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->class ? c->surface.xwayland->class : "broken";
return c->surface.xwayland->class;
#endif
return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id : "broken";
return c->surface.xdg->toplevel->app_id;
}
static inline void
client_get_clip(Client *c, struct wlr_box *clip)
{
struct wlr_box xdg_geom = {0};
*clip = (struct wlr_box){
.x = 0,
.y = 0,
@ -146,8 +147,9 @@ client_get_clip(Client *c, struct wlr_box *clip)
return;
#endif
clip->x = c->surface.xdg->geometry.x;
clip->y = c->surface.xdg->geometry.y;
wlr_xdg_surface_get_geometry(c->surface.xdg, &xdg_geom);
clip->x = xdg_geom.x;
clip->y = xdg_geom.y;
}
static inline void
@ -162,7 +164,7 @@ client_get_geometry(Client *c, struct wlr_box *geom)
return;
}
#endif
*geom = c->surface.xdg->geometry;
wlr_xdg_surface_get_geometry(c->surface.xdg, geom);
}
static inline Client *
@ -198,9 +200,9 @@ client_get_title(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->title ? c->surface.xwayland->title : "broken";
return c->surface.xwayland->title;
#endif
return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title : "broken";
return c->surface.xdg->toplevel->title;
}
static inline int
@ -299,6 +301,17 @@ client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
}
static inline void
client_restack_surface(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
wlr_xwayland_surface_restack(c->surface.xwayland, NULL,
XCB_STACK_MODE_ABOVE);
#endif
return;
}
static inline void
client_send_close(Client *c)
{
@ -331,13 +344,6 @@ client_set_fullscreen(Client *c, int fullscreen)
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
}
static inline void
client_set_scale(struct wlr_surface *s, float scale)
{
wlr_fractional_scale_v1_notify_scale(s, scale);
wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
}
static inline uint32_t
client_set_size(Client *c, uint32_t width, uint32_t height)
{
@ -358,11 +364,8 @@ static inline void
client_set_tiled(Client *c, uint32_t edges)
{
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_set_maximized(c->surface.xwayland,
edges != WLR_EDGE_NONE, edges != WLR_EDGE_NONE);
if (client_is_x11(c))
return;
}
#endif
if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
>= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
@ -388,8 +391,8 @@ client_wants_focus(Client *c)
{
#ifdef XWAYLAND
return client_is_unmanaged(c)
&& wlr_xwayland_surface_override_redirect_wants_focus(c->surface.xwayland)
&& wlr_xwayland_surface_icccm_input_model(c->surface.xwayland) != WLR_ICCCM_INPUT_MODEL_NONE;
&& wlr_xwayland_or_surface_wants_focus(c->surface.xwayland)
&& wlr_xwayland_icccm_input_model(c->surface.xwayland) != WLR_ICCCM_INPUT_MODEL_NONE;
#endif
return 0;
}