This commit is contained in:
tsukasa
2026-07-12 01:07:23 +08:00
commit 01a1dbec8e
39 changed files with 12038 additions and 0 deletions
+407
View File
@@ -0,0 +1,407 @@
/*
* Attempt to consolidate unavoidable suck into one file, away from dwl.c. This
* file is not meant to be pretty. We use a .h file with static inline
* functions instead of a separate .c module, or function pointers like sway, so
* that they will simply compile out if the chosen #defines leave them unused.
*/
/* Leave these functions first; they're used in the others */
static inline int
client_is_x11(Client *c)
{
#ifdef XWAYLAND
return c->type == X11;
#endif
return 0;
}
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 int
toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc, LayerSurface **pl)
{
struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
struct wlr_surface *root_surface;
struct wlr_layer_surface_v1 *layer_surface;
Client *c = NULL;
LayerSurface *l = NULL;
int type = -1;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
#endif
if (!s)
return -1;
root_surface = wlr_surface_get_root_surface(s);
#ifdef XWAYLAND
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(root_surface))) {
c = xsurface->data;
type = c->type;
goto end;
}
#endif
if ((layer_surface = wlr_layer_surface_v1_try_from_wlr_surface(root_surface))) {
l = layer_surface->data;
type = LayerShell;
goto end;
}
xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface);
while (xdg_surface) {
tmp_xdg_surface = NULL;
switch (xdg_surface->role) {
case WLR_XDG_SURFACE_ROLE_POPUP:
if (!xdg_surface->popup || !xdg_surface->popup->parent)
return -1;
tmp_xdg_surface = wlr_xdg_surface_try_from_wlr_surface(xdg_surface->popup->parent);
if (!tmp_xdg_surface)
return toplevel_from_wlr_surface(xdg_surface->popup->parent, pc, pl);
xdg_surface = tmp_xdg_surface;
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
c = xdg_surface->data;
type = c->type;
goto end;
case WLR_XDG_SURFACE_ROLE_NONE:
return -1;
}
}
end:
if (pl)
*pl = l;
if (pc)
*pc = c;
return type;
}
/* The others */
static inline void
client_activate_surface(struct wlr_surface *s, int activated)
{
struct wlr_xdg_toplevel *toplevel;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
wlr_xwayland_surface_activate(xsurface, activated);
return;
}
#endif
if ((toplevel = wlr_xdg_toplevel_try_from_wlr_surface(s)))
wlr_xdg_toplevel_set_activated(toplevel, activated);
}
static inline uint32_t
client_set_bounds(Client *c, int32_t width, int32_t height)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return 0;
#endif
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION && width >= 0 && height >= 0
&& (c->bounds.width != width || c->bounds.height != height)) {
c->bounds.width = width;
c->bounds.height = height;
return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height);
}
return 0;
}
static inline const char *
client_get_appid(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->class ? c->surface.xwayland->class : "broken";
#endif
return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id : "broken";
}
static inline void
client_get_clip(Client *c, struct wlr_box *clip)
{
*clip = (struct wlr_box){
.x = 0,
.y = 0,
.width = c->geom.width - c->bw,
.height = c->geom.height - c->bw,
};
#ifdef XWAYLAND
if (client_is_x11(c))
return;
#endif
clip->x = c->surface.xdg->geometry.x;
clip->y = c->surface.xdg->geometry.y;
}
static inline void
client_get_geometry(Client *c, struct wlr_box *geom)
{
#ifdef XWAYLAND
if (client_is_x11(c)) {
geom->x = c->surface.xwayland->x;
geom->y = c->surface.xwayland->y;
geom->width = c->surface.xwayland->width;
geom->height = c->surface.xwayland->height;
return;
}
#endif
*geom = c->surface.xdg->geometry;
}
static inline Client *
client_get_parent(Client *c)
{
Client *p = NULL;
#ifdef XWAYLAND
if (client_is_x11(c)) {
if (c->surface.xwayland->parent)
toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, NULL);
return p;
}
#endif
if (c->surface.xdg->toplevel->parent)
toplevel_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface, &p, NULL);
return p;
}
static inline int
client_has_children(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return !wl_list_empty(&c->surface.xwayland->children);
#endif
/* surface.xdg->link is never empty because it always contains at least the
* surface itself. */
return wl_list_length(&c->surface.xdg->link) > 1;
}
static inline const char *
client_get_title(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->title ? c->surface.xwayland->title : "broken";
#endif
return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title : "broken";
}
static inline int
client_is_float_type(Client *c)
{
struct wlr_xdg_toplevel *toplevel;
struct wlr_xdg_toplevel_state state;
#ifdef XWAYLAND
if (client_is_x11(c)) {
struct wlr_xwayland_surface *surface = c->surface.xwayland;
xcb_size_hints_t *size_hints = surface->size_hints;
if (surface->modal)
return 1;
if (wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG)
|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH)
|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR)
|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY)) {
return 1;
}
return size_hints && size_hints->min_width > 0 && size_hints->min_height > 0
&& (size_hints->max_width == size_hints->min_width
|| size_hints->max_height == size_hints->min_height);
}
#endif
toplevel = c->surface.xdg->toplevel;
state = toplevel->current;
return toplevel->parent || (state.min_width != 0 && state.min_height != 0
&& (state.min_width == state.max_width
|| state.min_height == state.max_height));
}
static inline int
client_is_rendered_on_mon(Client *c, Monitor *m)
{
/* This is needed for when you don't want to check formal assignment,
* but rather actual displaying of the pixels.
* Usually VISIBLEON suffices and is also faster. */
struct wlr_surface_output *s;
int unused_lx, unused_ly;
if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
return 0;
wl_list_for_each(s, &client_surface(c)->current_outputs, link)
if (s->output == m->wlr_output)
return 1;
return 0;
}
static inline int
client_is_stopped(Client *c)
{
int pid;
siginfo_t in = {0};
#ifdef XWAYLAND
if (client_is_x11(c))
return 0;
#endif
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
if (waitid(P_PID, pid, &in, WNOHANG|WCONTINUED|WSTOPPED|WNOWAIT) < 0) {
/* This process is not our child process, while is very unlikely that
* it is stopped, in order to do not skip frames, assume that it is. */
if (errno == ECHILD)
return 1;
} else if (in.si_pid) {
if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
return 1;
if (in.si_code == CLD_CONTINUED)
return 0;
}
return 0;
}
static inline int
client_is_unmanaged(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->override_redirect;
#endif
return 0;
}
static inline void
client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
{
if (kb)
wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes,
kb->num_keycodes, &kb->modifiers);
else
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
}
static inline void
client_send_close(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_close(c->surface.xwayland);
return;
}
#endif
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
}
static inline void
client_set_border_color(Client *c, const float inner[static 4], const float outer[static 4])
{
int i;
for (i = 0; i < 4; i++) {
wlr_scene_rect_set_color(c->inner_border[i], inner);
wlr_scene_rect_set_color(c->outer_border[i], outer);
}
}
static inline void
client_set_fullscreen(Client *c, int fullscreen)
{
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_set_fullscreen(c->surface.xwayland, fullscreen);
return;
}
#endif
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)
{
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_configure(c->surface.xwayland,
c->geom.x + c->bw, c->geom.y + c->bw, width, height);
return 0;
}
#endif
if ((int32_t)width == c->surface.xdg->toplevel->current.width
&& (int32_t)height == c->surface.xdg->toplevel->current.height)
return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
}
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);
return;
}
#endif
if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
>= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
} else {
wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel, edges != WLR_EDGE_NONE);
}
}
static inline void
client_set_suspended(Client *c, int suspended)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return;
#endif
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
}
static inline int
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;
#endif
return 0;
}
static inline int
client_wants_fullscreen(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->fullscreen;
#endif
return c->surface.xdg->toplevel->requested.fullscreen;
}
+284
View File
@@ -0,0 +1,284 @@
#include "dwl-ipc-unstable-v2-protocol.h"
/* Forward declarations for dwl.c static functions */
static void arrange(Monitor *m);
static void focusclient(Client *c, int lift);
static Client *focustop(Monitor *m);
static void printstatus(void);
/* globals */
static struct wl_global *ipc_global = NULL;
/* All bound manager objects */
static struct wl_list ipc_managers; /* IpcManager.link */
typedef struct {
struct wl_resource *resource;
struct wl_list link; /* ipc_managers */
struct wl_list outputs; /* IpcOutput.link */
} IpcManager;
typedef struct {
struct wl_resource *resource;
Monitor *mon;
struct wl_list link; /* IpcManager.outputs */
} IpcOutput;
/* helpers */
static IpcOutput *
ipc_output_for_mon(IpcManager *mgr, Monitor *m)
{
IpcOutput *o;
wl_list_for_each(o, &mgr->outputs, link)
if (o->mon == m)
return o;
return NULL;
}
/* Send the full state of monitor m to one IpcOutput resource */
static void
ipc_send_output_state(IpcOutput *ipc_out)
{
Monitor *m = ipc_out->mon;
struct wl_resource *res = ipc_out->resource;
Client *c;
uint32_t occ = 0, urg = 0, sel_tags = 0;
int tag, focused;
/* Compute occupancy/urgency (same logic as printstatus, I think) */
wl_list_for_each(c, &clients, link) {
if (c->mon != m)
continue;
occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
}
c = focustop(m);
sel_tags = c ? c->tags : 0;
/* active */
zdwl_ipc_output_v2_send_active(res, m == selmon ? 1 : 0);
/* per-tag state */
for (tag = 0; tag < TAGCOUNT; tag++) {
uint32_t mask = 1u << tag;
uint32_t state = ZDWL_IPC_OUTPUT_V2_TAG_STATE_NONE;
uint32_t clients_on_tag = 0;
if (m->tagset[m->seltags] & mask)
state = ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
if (urg & mask)
state = ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
if (occ & mask)
clients_on_tag = 1; /* report ≥1, not exact count */
focused = (sel_tags & mask) ? 1 : 0;
zdwl_ipc_output_v2_send_tag(res, tag, state, clients_on_tag, focused);
}
/* layout index */
{
uint32_t i;
for (i = 0; i < LENGTH(layouts); i++)
if (&layouts[i] == m->lt[m->sellt])
break;
zdwl_ipc_output_v2_send_layout(res, i);
}
/* layout symbol */
zdwl_ipc_output_v2_send_layout_symbol(res, m->ltsymbol);
/* title/appid/fullscreen/floating */
if (c) {
zdwl_ipc_output_v2_send_title(res, client_get_title(c));
zdwl_ipc_output_v2_send_appid(res, client_get_appid(c));
if (wl_resource_get_version(res) >= 2) {
zdwl_ipc_output_v2_send_fullscreen(res, c->isfullscreen ? 1 : 0);
zdwl_ipc_output_v2_send_floating(res, c->isfloating ? 1 : 0);
}
} else {
zdwl_ipc_output_v2_send_title(res, "");
zdwl_ipc_output_v2_send_appid(res, "");
if (wl_resource_get_version(res) >= 2) {
zdwl_ipc_output_v2_send_fullscreen(res, 0);
zdwl_ipc_output_v2_send_floating(res, 0);
}
}
/* frame — signals end of this batch of events */
zdwl_ipc_output_v2_send_frame(res);
}
/* Called instead of (or alongside) the old printstatus() */
static void
ipc_printstatus(void)
{
IpcManager *mgr;
Monitor *m;
wl_list_for_each(mgr, &ipc_managers, link) {
wl_list_for_each(m, &mons, link) {
IpcOutput *out = ipc_output_for_mon(mgr, m);
if (out)
ipc_send_output_state(out);
}
}
}
/* zdwl_ipc_output_v2 requests */
static void
ipc_output_handle_release(struct wl_client *client, struct wl_resource *resource)
{
wl_resource_destroy(resource);
}
static void
ipc_output_handle_set_tags(struct wl_client *client, struct wl_resource *resource,
uint32_t tagmask, uint32_t toggle_tagset)
{
IpcOutput *out = wl_resource_get_user_data(resource);
Monitor *m = out->mon;
if (!m) return;
if (toggle_tagset)
m->seltags ^= 1;
m->tagset[m->seltags] = tagmask & TAGMASK;
focusclient(focustop(m), 1);
arrange(m);
printstatus();
}
static void
ipc_output_handle_set_client_tags(struct wl_client *client,
struct wl_resource *resource, uint32_t and_tags, uint32_t xor_tags)
{
IpcOutput *out = wl_resource_get_user_data(resource);
Monitor *m = out->mon;
Client *sel;
uint32_t newtags;
if (!m) return;
sel = focustop(m);
if (!sel) return;
newtags = (sel->tags & and_tags) ^ xor_tags;
if (!newtags) return;
sel->tags = newtags;
focusclient(focustop(m), 1);
arrange(m);
printstatus();
}
static void
ipc_output_handle_set_layout(struct wl_client *client,
struct wl_resource *resource, uint32_t idx)
{
IpcOutput *out = wl_resource_get_user_data(resource);
Monitor *m = out->mon;
if (!m || idx >= LENGTH(layouts)) return;
m->lt[m->sellt] = &layouts[idx];
strncpy(m->ltsymbol, layouts[idx].symbol, LENGTH(m->ltsymbol));
arrange(m);
printstatus();
}
static const struct zdwl_ipc_output_v2_interface ipc_output_impl = {
.release = ipc_output_handle_release,
.set_tags = ipc_output_handle_set_tags,
.set_client_tags = ipc_output_handle_set_client_tags,
.set_layout = ipc_output_handle_set_layout,
};
static void
ipc_output_destroy(struct wl_resource *resource)
{
IpcOutput *out = wl_resource_get_user_data(resource);
wl_list_remove(&out->link);
free(out);
}
/* zdwl_ipc_manager_v2 requests */
static void
ipc_manager_handle_release(struct wl_client *client, struct wl_resource *resource)
{
wl_resource_destroy(resource);
}
static void
ipc_manager_handle_get_output(struct wl_client *client, struct wl_resource *resource,
uint32_t id, struct wl_resource *output_resource)
{
IpcManager *mgr = wl_resource_get_user_data(resource);
struct wlr_output *wlr_out = wlr_output_from_resource(output_resource);
Monitor *m = (wlr_out && wlr_out->data) ? wlr_out->data : NULL;
IpcOutput *out = ecalloc(1, sizeof(*out));
out->mon = m;
out->resource = wl_resource_create(client, &zdwl_ipc_output_v2_interface,
wl_resource_get_version(resource), id);
if (!out->resource) {
free(out);
wl_client_post_no_memory(client);
return;
}
wl_resource_set_implementation(out->resource, &ipc_output_impl,
out, ipc_output_destroy);
wl_list_insert(&mgr->outputs, &out->link);
if (m)
ipc_send_output_state(out);
}
static const struct zdwl_ipc_manager_v2_interface ipc_manager_impl = {
.release = ipc_manager_handle_release,
.get_output = ipc_manager_handle_get_output,
};
static void
ipc_manager_destroy(struct wl_resource *resource)
{
IpcManager *mgr = wl_resource_get_user_data(resource);
IpcOutput *out, *tmp;
wl_list_for_each_safe(out, tmp, &mgr->outputs, link)
wl_resource_destroy(out->resource);
wl_list_remove(&mgr->link);
free(mgr);
}
/* global bind */
static void
ipc_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
IpcManager *mgr = ecalloc(1, sizeof(*mgr));
wl_list_init(&mgr->outputs);
mgr->resource = wl_resource_create(client, &zdwl_ipc_manager_v2_interface,
version, id);
if (!mgr->resource) {
free(mgr);
wl_client_post_no_memory(client);
return;
}
wl_resource_set_implementation(mgr->resource, &ipc_manager_impl,
mgr, ipc_manager_destroy);
wl_list_insert(&ipc_managers, &mgr->link);
/* Announce tags and layouts */
zdwl_ipc_manager_v2_send_tags(mgr->resource, TAGCOUNT);
for (uint32_t i = 0; i < LENGTH(layouts); i++)
zdwl_ipc_manager_v2_send_layout(mgr->resource, layouts[i].symbol);
}
static void
ipc_init(void)
{
wl_list_init(&ipc_managers);
ipc_global = wl_global_create(dpy, &zdwl_ipc_manager_v2_interface,
2, NULL, ipc_bind);
}
+210
View File
@@ -0,0 +1,210 @@
/* My shitty port of Mango's ext-workspace.h for my compositor;
* thanks DreamMaoMao for doing most of the heavy lifting
* by actually writing the thing, it didn't work the first
* few tries and I barely have any idea how this code works anyway.
* To say that it's the eighth wonder of the world
* would be an understatement
*/
#include "wlr_ext_workspace_v1.h"
#define EXT_WORKSPACE_CAPS \
(EXT_WORKSPACE_HANDLE_V1_WORKSPACE_CAPABILITIES_ACTIVATE | \
EXT_WORKSPACE_HANDLE_V1_WORKSPACE_CAPABILITIES_DEACTIVATE)
/* types */
struct ext_workspace {
struct wl_list link;
uint32_t tag;
Monitor *m;
struct wlr_ext_workspace_handle_v1 *handle;
};
/* global */
static struct wlr_ext_workspace_manager_v1 *ext_workspace_manager;
static struct wl_list ext_workspaces;
static struct wl_listener ext_commit_listener;
static struct wl_listener ext_destroy_listener;
/* helpers */
static int
get_tag_status(uint32_t tag, Monitor *m)
{
Client *c;
uint32_t mask = 1 << (tag - 1);
wl_list_for_each(c, &clients, link) {
if (c->mon != m)
continue;
if (!(c->tags & mask))
continue;
if (c->isurgent)
return 2;
return 1;
}
return 0;
}
static const char *
tag_name(uint32_t tag)
{
static const char *names[] = {
"1", "2", "3", "4", "5", "6", "7", "8", "9",
};
if (tag >= 1 && tag <= LENGTH(names))
return names[tag - 1];
return "?";
}
/* workspace lifecycle */
static void
ext_workspace_destroy(struct ext_workspace *ws)
{
wlr_ext_workspace_handle_v1_destroy(ws->handle);
wl_list_remove(&ws->link);
free(ws);
}
static void
ext_workspace_create(uint32_t tag, Monitor *m)
{
const char *name = tag_name(tag);
struct ext_workspace *ws = ecalloc(1, sizeof(*ws));
ws->tag = tag;
ws->m = m;
ws->handle = wlr_ext_workspace_handle_v1_create(
ext_workspace_manager, name, EXT_WORKSPACE_CAPS);
ws->handle->data = ws;
wlr_ext_workspace_handle_v1_set_group(ws->handle, m->ext_group);
wlr_ext_workspace_handle_v1_set_name(ws->handle, name);
wl_list_insert(ext_workspaces.prev, &ws->link);
}
/* monitor integration */
static void
ext_workspace_createmon(Monitor *m)
{
uint32_t i;
m->ext_group = wlr_ext_workspace_group_handle_v1_create(
ext_workspace_manager, 0);
wlr_ext_workspace_group_handle_v1_output_enter(
m->ext_group, m->wlr_output);
for (i = 1; i <= TAGCOUNT; i++)
ext_workspace_create(i, m);
}
static void
ext_workspace_cleanupmon(Monitor *m)
{
struct ext_workspace *ws, *tmp;
wl_list_for_each_safe(ws, tmp, &ext_workspaces, link)
if (ws->m == m)
ext_workspace_destroy(ws);
wlr_ext_workspace_group_handle_v1_output_leave(
m->ext_group, m->wlr_output);
wlr_ext_workspace_group_handle_v1_destroy(m->ext_group);
m->ext_group = NULL;
}
/* status */
static void
ext_workspace_printstatus(Monitor *m)
{
struct ext_workspace *ws;
wl_list_for_each(ws, &ext_workspaces, link) {
if (ws->m != m)
continue;
int status = get_tag_status(ws->tag, m);
int active = !!(m->tagset[m->seltags] & (1 << (ws->tag - 1)) & TAGMASK);
wlr_ext_workspace_handle_v1_set_urgent(ws->handle, status == 2);
wlr_ext_workspace_handle_v1_set_hidden(ws->handle, 0);
wlr_ext_workspace_handle_v1_set_active(ws->handle, active);
}
}
/* commit handler */
static void
handle_ext_commit(struct wl_listener *listener, void *data)
{
struct wlr_ext_workspace_v1_commit_event *event = data;
struct wlr_ext_workspace_v1_request *req;
wl_list_for_each(req, event->requests, link) {
struct ext_workspace *ws = NULL;
struct ext_workspace *w;
switch (req->type) {
case WLR_EXT_WORKSPACE_V1_REQUEST_ACTIVATE:
if (!req->activate.workspace)
break;
wl_list_for_each(w, &ext_workspaces, link) {
if (w->handle == req->activate.workspace) {
ws = w;
break;
}
}
if (!ws)
break;
view(&(Arg){.ui = 1 << (ws->tag - 1)});
break;
case WLR_EXT_WORKSPACE_V1_REQUEST_DEACTIVATE:
if (!req->deactivate.workspace)
break;
wl_list_for_each(w, &ext_workspaces, link) {
if (w->handle == req->deactivate.workspace) {
ws = w;
break;
}
}
if (!ws)
break;
toggleview(&(Arg){.ui = 1 << (ws->tag - 1)});
break;
default:
break;
}
}
}
/* init */
static void
handle_ext_destroy(struct wl_listener *listener, void *data)
{
wl_list_remove(&ext_commit_listener.link);
wl_list_remove(&ext_destroy_listener.link);
}
static void
workspaces_init(void)
{
ext_workspace_manager = wlr_ext_workspace_manager_v1_create(dpy, 1);
wl_list_init(&ext_workspaces);
ext_commit_listener.notify = handle_ext_commit;
wl_signal_add(&ext_workspace_manager->events.commit,
&ext_commit_listener);
ext_destroy_listener.notify = handle_ext_destroy;
wl_signal_add(&ext_workspace_manager->events.destroy,
&ext_destroy_listener);
}
+1
View File
@@ -0,0 +1 @@
/nix/store/0i6c2awwzk0padnbmx1fi8akh0g76wr0-lua-5.4.7/include/lauxlib.h
+1
View File
@@ -0,0 +1 @@
/nix/store/0i6c2awwzk0padnbmx1fi8akh0g76wr0-lua-5.4.7/include/lua.h
+1
View File
@@ -0,0 +1 @@
/nix/store/0i6c2awwzk0padnbmx1fi8akh0g76wr0-lua-5.4.7/include/luaconf.h
+1
View File
@@ -0,0 +1 @@
/nix/store/0i6c2awwzk0padnbmx1fi8akh0g76wr0-lua-5.4.7/include/lualib.h