From cb4907510d412eb5d78c48ae349239253dda3d04 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 3 May 2025 15:45:27 +0800 Subject: [PATCH] feat: add ipc dispatch --- protocols/dwl-ipc-unstable-v2.xml | 7 +++++++ src/maomao.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/protocols/dwl-ipc-unstable-v2.xml b/protocols/dwl-ipc-unstable-v2.xml index cbe2717..fb85bfa 100644 --- a/protocols/dwl-ipc-unstable-v2.xml +++ b/protocols/dwl-ipc-unstable-v2.xml @@ -167,6 +167,13 @@ I would probably just submit raphi's patchset but I don't think that would be po This request allows clients to instruct the compositor to quit maomao. + + + + + + + diff --git a/src/maomao.c b/src/maomao.c index 08893c8..9479d8d 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -494,6 +494,8 @@ static void dwl_ipc_output_set_tags(struct wl_client *client, uint32_t tagmask, uint32_t toggle_tagset); static void dwl_ipc_output_quit(struct wl_client *client, struct wl_resource *resource); +static void dwl_ipc_output_dispatch(struct wl_client *client, + struct wl_resource *resource,const char *dispatch,const char* arg1,const char* arg2); static void dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource); static void focusclient(Client *c, int lift); @@ -703,6 +705,7 @@ static struct zdwl_ipc_output_v2_interface dwl_output_implementation = { .release = dwl_ipc_output_release, .set_tags = dwl_ipc_output_set_tags, .quit = dwl_ipc_output_quit, + .dispatch = dwl_ipc_output_dispatch, .set_layout = dwl_ipc_output_set_layout, .set_client_tags = dwl_ipc_output_set_client_tags}; @@ -3493,6 +3496,20 @@ void dwl_ipc_output_quit(struct wl_client *client, quit(&(Arg){0}); } +void dwl_ipc_output_dispatch(struct wl_client *client, + struct wl_resource *resource, + const char *dispatch, const char *arg1, + const char *arg2) { + + void (*func)(const Arg *); + Arg arg; + func = parse_func_name((char*)dispatch, &arg, (char*)arg1, (char*)arg2); + if(func) { + func(&arg); + } + +} + void dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource) { wl_resource_destroy(resource);