diff options
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 210 |
1 files changed, 0 insertions, 210 deletions
@@ -55,7 +55,6 @@ #include <wlr/types/wlr_xdg_shell.h> #include <wlr/util/log.h> #include <xkbcommon/xkbcommon.h> -#include "net-tapesoftware-dwl-wm-unstable-v1-protocol.h" #ifdef XWAYLAND #include <wlr/xwayland.h> #include <xcb/xcb.h> @@ -190,12 +189,6 @@ typedef struct { void (*arrange)(Monitor *); } Layout; -typedef struct { - struct wl_list link; - struct wl_resource *resource; - struct Monitor *monitor; -} DwlWmMonitor; - struct Monitor { struct wl_list link; struct wl_list dwl_ipc_outputs; @@ -210,7 +203,6 @@ struct Monitor { struct wlr_box m; /* monitor area, layout-relative */ struct wlr_box w; /* window area, layout-relative */ struct wl_list layers[4]; /* LayerSurface.link */ - struct wl_list dwl_wm_monitor_link; const Layout *lt[2]; Pertag *pertag; unsigned int seltags; @@ -366,10 +358,6 @@ static void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, LayerSurface **pl, double *nx, double *ny); static void zoom(const Arg *arg); -static void dwl_wm_bind(struct wl_client *client, void *data, - uint32_t version, uint32_t id); -static void dwl_wm_printstatus(Monitor *monitor); - /* variables */ static const char broken[] = "broken"; static pid_t child_pid = -1; @@ -744,7 +732,6 @@ void cleanupmon(struct wl_listener *listener, void *data) { Monitor *m = wl_container_of(listener, m, destroy); - DwlWmMonitor *mon, *montmp; LayerSurface *l, *tmp; size_t i; @@ -764,10 +751,6 @@ cleanupmon(struct wl_listener *listener, void *data) wl_list_remove(&m->request_state.link); m->wlr_output->data = NULL; wlr_output_layout_remove(output_layout, m->wlr_output); - wl_list_for_each_safe(mon, montmp, &m->dwl_wm_monitor_link, link) { - wl_resource_set_user_data(mon->resource, NULL); - free(mon); - } wlr_scene_output_destroy(m->scene_output); free(m->pertag); @@ -947,7 +930,6 @@ createmon(struct wl_listener *listener, void *data) size_t i; struct wlr_output_state state; Monitor *m; - wl_list_init(&m->dwl_wm_monitor_link); if (!wlr_output_init_render(wlr_output, alloc, drw)) return; @@ -2120,7 +2102,6 @@ printstatus(void) Monitor *m = NULL; wl_list_for_each(m, &mons, link) dwl_ipc_output_printstatus(m); - dwl_wm_printstatus(m); } void @@ -2687,7 +2668,6 @@ setup(void) wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend)); wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, 2, NULL, dwl_ipc_manager_bind); - wl_global_create(dpy, &znet_tapesoftware_dwl_wm_v1_interface, 1, NULL, dwl_wm_bind); /* Make sure XWayland clients don't connect to the parent X server, * e.g when running in the x11 backend or the wayland backend and the @@ -3325,193 +3305,3 @@ main(int argc, char *argv[]) usage: die("Usage: %s [-v] [-d] [-s startup command]", argv[0]); } - -/* dwl_wm_monitor_v1 */ -static void -dwl_wm_monitor_handle_release(struct wl_client *client, struct wl_resource *resource) -{ - wl_resource_destroy(resource); -} - -static void -dwl_wm_monitor_handle_destroy(struct wl_resource *resource) -{ - DwlWmMonitor *mon = wl_resource_get_user_data(resource); - if (mon) { - wl_list_remove(&mon->link); - free(mon); - } -} - -static void -dwl_wm_printstatus_to(Monitor *m, const DwlWmMonitor *mon) -{ - Client *c, *focused; - int tagmask, state, numclients, focused_client; - focused = focustop(m); - znet_tapesoftware_dwl_wm_monitor_v1_send_selected(mon->resource, m == selmon); - - for (int tag = 0; tag<LENGTH(tags); tag++) { - numclients = state = 0; - focused_client = -1; - tagmask = 1 << tag; - if ((tagmask & m->tagset[m->seltags]) != 0) - state = state | ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE; - wl_list_for_each(c, &clients, link) { - if (c->mon != m) - continue; - if (!(c->tags & tagmask)) - continue; - if (c == focused) - focused_client = numclients; - numclients++; - if (c->isurgent) - state = state | ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT; - } - znet_tapesoftware_dwl_wm_monitor_v1_send_tag(mon->resource, - tag, state, numclients, focused_client); - } - znet_tapesoftware_dwl_wm_monitor_v1_send_layout(mon->resource, m->lt[m->sellt] - layouts); - znet_tapesoftware_dwl_wm_monitor_v1_send_title(mon->resource, - focused ? client_get_title(focused) : ""); - znet_tapesoftware_dwl_wm_monitor_v1_send_frame(mon->resource); -} - -static void -dwl_wm_printstatus(Monitor *m) -{ - DwlWmMonitor *mon; - wl_list_for_each(mon, &m->dwl_wm_monitor_link, link) { - dwl_wm_printstatus_to(m, mon); - } -} - -static void -dwl_wm_monitor_handle_set_tags(struct wl_client *client, struct wl_resource *resource, - uint32_t t, uint32_t toggle_tagset) -{ - DwlWmMonitor *mon; - Monitor *m; - mon = wl_resource_get_user_data(resource); - if (!mon) - return; - m = mon->monitor; - if ((t & TAGMASK) == m->tagset[m->seltags]) - return; - if (toggle_tagset) - m->seltags ^= 1; - if (t & TAGMASK) - m->tagset[m->seltags] = t & TAGMASK; - - focusclient(focustop(m), 1); - arrange(m); - printstatus(); -} - -static void -dwl_wm_monitor_handle_set_layout(struct wl_client *client, struct wl_resource *resource, - uint32_t layout) -{ - DwlWmMonitor *mon; - Monitor *m; - mon = wl_resource_get_user_data(resource); - if (!mon) - return; - m = mon->monitor; - if (layout >= LENGTH(layouts)) - return; - if (layout != m->lt[m->sellt] - layouts) - m->sellt ^= 1; - - m->lt[m->sellt] = &layouts[layout]; - arrange(m); - printstatus(); -} - -static void -dwl_wm_monitor_handle_set_client_tags(struct wl_client *client, struct wl_resource *resource, - uint32_t and, uint32_t xor) -{ - DwlWmMonitor *mon; - Client *sel; - unsigned int newtags; - mon = wl_resource_get_user_data(resource); - if (!mon) - return; - sel = focustop(mon->monitor); - if (!sel) - return; - newtags = (sel->tags & and) ^ xor; - if (newtags) { - sel->tags = newtags; - focusclient(focustop(selmon), 1); - arrange(selmon); - printstatus(); - } -} - -static const struct znet_tapesoftware_dwl_wm_monitor_v1_interface dwl_wm_monitor_implementation = { - .release = dwl_wm_monitor_handle_release, - .set_tags = dwl_wm_monitor_handle_set_tags, - .set_layout = dwl_wm_monitor_handle_set_layout, - .set_client_tags = dwl_wm_monitor_handle_set_client_tags, -}; - -/* dwl_wm_v1 */ -static void -dwl_wm_handle_release(struct wl_client *client, struct wl_resource *resource) -{ - wl_resource_destroy(resource); -} - -static void -dwl_wm_handle_get_monitor(struct wl_client *client, struct wl_resource *resource, - uint32_t id, struct wl_resource *output) -{ - DwlWmMonitor *dwl_wm_monitor; - struct wlr_output *wlr_output = wlr_output_from_resource(output); - struct Monitor *m = wlr_output->data; - struct wl_resource *dwlOutputResource = wl_resource_create(client, - &znet_tapesoftware_dwl_wm_monitor_v1_interface, wl_resource_get_version(resource), id); - if (!resource) { - wl_client_post_no_memory(client); - return; - } - dwl_wm_monitor = calloc(1, sizeof(DwlWmMonitor)); - dwl_wm_monitor->resource = dwlOutputResource; - dwl_wm_monitor->monitor = m; - wl_resource_set_implementation(dwlOutputResource, &dwl_wm_monitor_implementation, - dwl_wm_monitor, dwl_wm_monitor_handle_destroy); - wl_list_insert(&m->dwl_wm_monitor_link, &dwl_wm_monitor->link); - dwl_wm_printstatus_to(m, dwl_wm_monitor); -} - -static void -dwl_wm_handle_destroy(struct wl_resource *resource) -{ - /* no state to destroy */ -} - -static const struct znet_tapesoftware_dwl_wm_v1_interface dwl_wm_implementation = { - .release = dwl_wm_handle_release, - .get_monitor = dwl_wm_handle_get_monitor, -}; - -static void -dwl_wm_bind(struct wl_client *client, void *data, - uint32_t version, uint32_t id) -{ - struct wl_resource *resource = wl_resource_create(client, - &znet_tapesoftware_dwl_wm_v1_interface, version, id); - if (!resource) { - wl_client_post_no_memory(client); - return; - } - - wl_resource_set_implementation(resource, &dwl_wm_implementation, NULL, dwl_wm_handle_destroy); - - for (int i = 0; i < LENGTH(tags); i++) - znet_tapesoftware_dwl_wm_v1_send_tag(resource, tags[i]); - for (int i = 0; i < LENGTH(layouts); i++) - znet_tapesoftware_dwl_wm_v1_send_layout(resource, layouts[i].symbol); -} |
