update ipc

This commit is contained in:
choc 2024-03-13 21:48:59 +08:00
parent 83b80ddd6d
commit 0150cfebbc

View File

@ -1,8 +1,8 @@
From abae607402efeaf16f6e7ea8c50ee86d6847e431 Mon Sep 17 00:00:00 2001 From 5bbb9d70ab0a8322d1556ac0983eb3140b1c5dcd Mon Sep 17 00:00:00 2001
From: choc <notchoc@proton.me> From: choc <notchoc@proton.me>
Date: Mon, 23 Oct 2023 10:35:17 +0800 Date: Mon, 23 Oct 2023 10:35:17 +0800
Subject: [PATCH] implement dwl-ipc-unstable-v2 Subject: [PATCH] implement dwl-ipc-unstable-v2
https://github.com/djpohly/dwl/wiki/ipc https://codeberg.org/dwl/dwl-patches/wiki/ipc
--- ---
Makefile | 13 +- Makefile | 13 +-
@ -13,7 +13,7 @@ Subject: [PATCH] implement dwl-ipc-unstable-v2
create mode 100644 protocols/dwl-ipc-unstable-v2.xml create mode 100644 protocols/dwl-ipc-unstable-v2.xml
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
index 0822ddc..3e38aa5 100644 index a67fdd3..2b45b2c 100644
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -14,10 +14,11 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CF @@ -14,10 +14,11 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CF
@ -22,19 +22,19 @@ index 0822ddc..3e38aa5 100644
all: dwl all: dwl
-dwl: dwl.o util.o -dwl: dwl.o util.o
- $(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@ - $(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
-dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h -dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h
+dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o +dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o
+ $(CC) dwl.o util.o dwl-ipc-unstable-v2-protocol.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@ + $(CC) dwl.o util.o dwl-ipc-unstable-v2-protocol.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
+dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h dwl-ipc-unstable-v2-protocol.h +dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h dwl-ipc-unstable-v2-protocol.h
util.o: util.c util.h util.o: util.c util.h
+dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c dwl-ipc-unstable-v2-protocol.h +dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c dwl-ipc-unstable-v2-protocol.h
# wayland-scanner is a tool which generates C headers and rigging for Wayland # wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up # protocols, which are specified in XML. wlroots requires you to rig these up
@@ -34,6 +35,12 @@ wlr-layer-shell-unstable-v1-protocol.h: @@ -37,6 +38,12 @@ wlr-layer-shell-unstable-v1-protocol.h:
cursor-shape-v1-protocol.h: xdg-shell-protocol.h:
$(WAYLAND_SCANNER) server-header \ $(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@ $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
+dwl-ipc-unstable-v2-protocol.h: +dwl-ipc-unstable-v2-protocol.h:
+ $(WAYLAND_SCANNER) server-header \ + $(WAYLAND_SCANNER) server-header \
+ protocols/dwl-ipc-unstable-v2.xml $@ + protocols/dwl-ipc-unstable-v2.xml $@
@ -57,10 +57,10 @@ index 9009517..3467fed 100644
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index fa76db2..1157c1b 100644 index d508d79..5f8af37 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -61,6 +61,7 @@ @@ -64,6 +64,7 @@
#include <xcb/xcb_icccm.h> #include <xcb/xcb_icccm.h>
#endif #endif
@ -68,7 +68,7 @@ index fa76db2..1157c1b 100644
#include "util.h" #include "util.h"
/* macros */ /* macros */
@@ -138,6 +139,12 @@ typedef struct { @@ -141,6 +142,12 @@ typedef struct {
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@ -81,7 +81,7 @@ index fa76db2..1157c1b 100644
typedef struct { typedef struct {
uint32_t mod; uint32_t mod;
xkb_keysym_t keysym; xkb_keysym_t keysym;
@@ -183,6 +190,7 @@ typedef struct { @@ -186,6 +193,7 @@ typedef struct {
struct Monitor { struct Monitor {
struct wl_list link; struct wl_list link;
@ -89,7 +89,7 @@ index fa76db2..1157c1b 100644
struct wlr_output *wlr_output; struct wlr_output *wlr_output;
struct wlr_scene_output *scene_output; struct wlr_scene_output *scene_output;
struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */ struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */
@@ -266,6 +274,17 @@ static void destroynotify(struct wl_listener *listener, void *data); @@ -278,6 +286,17 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
static void destroysessionlock(struct wl_listener *listener, void *data); static void destroysessionlock(struct wl_listener *listener, void *data);
static void destroysessionmgr(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir); static Monitor *dirtomon(enum wlr_direction dir);
@ -107,7 +107,7 @@ index fa76db2..1157c1b 100644
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
@@ -317,6 +336,7 @@ static void startdrag(struct wl_listener *listener, void *data); @@ -330,6 +349,7 @@ static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg); static void tag(const Arg *arg);
static void tagmon(const Arg *arg); static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
@ -115,7 +115,7 @@ index fa76db2..1157c1b 100644
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
@@ -388,6 +408,9 @@ static struct wlr_box sgeom; @@ -405,6 +425,9 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
@ -125,7 +125,7 @@ index fa76db2..1157c1b 100644
#ifdef XWAYLAND #ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data); static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data);
@@ -667,6 +690,10 @@ cleanupmon(struct wl_listener *listener, void *data) @@ -684,6 +707,10 @@ cleanupmon(struct wl_listener *listener, void *data)
LayerSurface *l, *tmp; LayerSurface *l, *tmp;
size_t i; size_t i;
@ -136,7 +136,7 @@ index fa76db2..1157c1b 100644
/* m->layers[i] are intentionally not unlinked */ /* m->layers[i] are intentionally not unlinked */
for (i = 0; i < LENGTH(m->layers); i++) { for (i = 0; i < LENGTH(m->layers); i++) {
wl_list_for_each_safe(l, tmp, &m->layers[i], link) wl_list_for_each_safe(l, tmp, &m->layers[i], link)
@@ -859,6 +886,8 @@ createmon(struct wl_listener *listener, void *data) @@ -876,6 +903,8 @@ createmon(struct wl_listener *listener, void *data)
m = wlr_output->data = ecalloc(1, sizeof(*m)); m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output; m->wlr_output = wlr_output;
@ -145,7 +145,7 @@ index fa76db2..1157c1b 100644
for (i = 0; i < LENGTH(m->layers); i++) for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]); wl_list_init(&m->layers[i]);
@@ -1165,6 +1194,190 @@ dirtomon(enum wlr_direction dir) @@ -1233,6 +1262,190 @@ dirtomon(enum wlr_direction dir)
return selmon; return selmon;
} }
@ -336,7 +336,7 @@ index fa76db2..1157c1b 100644
void void
focusclient(Client *c, int lift) focusclient(Client *c, int lift)
{ {
@@ -1807,41 +2020,9 @@ void @@ -1905,41 +2118,9 @@ void
printstatus(void) printstatus(void)
{ {
Monitor *m = NULL; Monitor *m = NULL;
@ -380,7 +380,7 @@ index fa76db2..1157c1b 100644
} }
void void
@@ -2399,6 +2580,7 @@ setup(void) @@ -2502,6 +2683,7 @@ setup(void)
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest); LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend)); wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend));
@ -388,7 +388,7 @@ index fa76db2..1157c1b 100644
/* Make sure XWayland clients don't connect to the parent X server, /* 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 * e.g when running in the x11 backend or the wayland backend and the
@@ -2497,6 +2679,13 @@ tile(Monitor *m) @@ -2600,6 +2782,13 @@ tile(Monitor *m)
} }
} }
@ -590,5 +590,5 @@ index 0000000..0a6e7e5
+ </interface> + </interface>
+</protocol> +</protocol>
-- --
2.43.2 2.44.0