diff --git a/mmsg/mmsg.c b/mmsg/mmsg.c index ba073aa..787d97b 100644 --- a/mmsg/mmsg.c +++ b/mmsg/mmsg.c @@ -42,6 +42,7 @@ static int32_t eflag; static int32_t kflag; static int32_t bflag; static int32_t Aflag; +static int32_t pflag; static uint32_t occ, seltags, total_clients, urg; @@ -288,6 +289,28 @@ static void dwl_ipc_output_keymode(void *data, printf("keymode %s\n", keymode); } +static void dwl_ipc_output_cursor_x(void *data, + struct zdwl_ipc_output_v2 *dwl_ipc_output, + int32_t x) { + if (!pflag) + return; + char *output_name = data; + if (output_name) + printf("%s ", output_name); + printf("cursor_x %d\n", x); +} + +static void dwl_ipc_output_cursor_y(void *data, + struct zdwl_ipc_output_v2 *dwl_ipc_output, + int32_t y) { + if (!pflag) + return; + char *output_name = data; + if (output_name) + printf("%s ", output_name); + printf("cursor_y %d\n", y); +} + static void dwl_ipc_output_fullscreen(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output, uint32_t is_fullscreen) { @@ -427,6 +450,8 @@ static const struct zdwl_ipc_output_v2_listener dwl_ipc_output_listener = { .kb_layout = dwl_ipc_output_kb_layout, .keymode = dwl_ipc_output_keymode, .scalefactor = dwl_ipc_output_scalefactor, + .cursor_x = dwl_ipc_output_cursor_x, + .cursor_y = dwl_ipc_output_cursor_y, .frame = dwl_ipc_output_frame, }; @@ -504,7 +529,7 @@ static void usage(void) { "\t%s [-OTLq]\n" "\t%s [-o ] -s [-t ] [-l ] [-c ] [-d " ",,,,,]\n" - "\t%s [-o ] (-g | -w) [-OotlcvmfxekbA]\n", + "\t%s [-o ] (-g | -w) [-OotlcvmfxekbAp]\n", argv0, argv0, argv0); exit(2); } @@ -752,6 +777,12 @@ int32_t main(int32_t argc, char *argv[]) { usage(); mode |= GET; break; + case 'p': + pflag = 1; + if (mode == SET) + usage(); + mode |= GET; + break; default: fprintf(stderr, "bad option %c\n", ARGC()); usage(); @@ -762,9 +793,9 @@ int32_t main(int32_t argc, char *argv[]) { if (mode & GET && !output_name && !(oflag || tflag || lflag || Oflag || Tflag || Lflag || cflag || vflag || mflag || fflag || xflag || eflag || kflag || bflag || - Aflag || dflag)) + Aflag || pflag || dflag)) oflag = tflag = lflag = cflag = vflag = mflag = fflag = xflag = eflag = - kflag = bflag = Aflag = 1; + kflag = bflag = Aflag = pflag = 1; display = wl_display_connect(NULL); if (!display) diff --git a/protocols/dwl-ipc-unstable-v2.xml b/protocols/dwl-ipc-unstable-v2.xml index 5852107..6da9ca7 100644 --- a/protocols/dwl-ipc-unstable-v2.xml +++ b/protocols/dwl-ipc-unstable-v2.xml @@ -248,6 +248,20 @@ I would probably just submit raphi's patchset but I don't think that would be po + + + Indicates the x coordinate of the cursor. + + + + + + + Indicates the y coordinate of the cursor. + + + + diff --git a/src/ext-protocol/dwl-ipc.h b/src/ext-protocol/dwl-ipc.h index ab0bdb8..f25982c 100644 --- a/src/ext-protocol/dwl-ipc.h +++ b/src/ext-protocol/dwl-ipc.h @@ -211,6 +211,18 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) { monitor->wlr_output->scale * 100); } + if (wl_resource_get_version(ipc_output->resource) >= + ZDWL_IPC_OUTPUT_V2_CURSOR_X_SINCE_VERSION) { + zdwl_ipc_output_v2_send_cursor_x(ipc_output->resource, + (int32_t)cursor->x); + } + + if (wl_resource_get_version(ipc_output->resource) >= + ZDWL_IPC_OUTPUT_V2_CURSOR_Y_SINCE_VERSION) { + zdwl_ipc_output_v2_send_cursor_y(ipc_output->resource, + (int32_t)cursor->y); + } + zdwl_ipc_output_v2_send_frame(ipc_output->resource); }