Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions mmsg/mmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -504,7 +529,7 @@ static void usage(void) {
"\t%s [-OTLq]\n"
"\t%s [-o <output>] -s [-t <tags>] [-l <layout>] [-c <tags>] [-d "
"<cmd>,<arg1>,<arg2>,<arg3>,<arg4>,<arg5>]\n"
"\t%s [-o <output>] (-g | -w) [-OotlcvmfxekbA]\n",
"\t%s [-o <output>] (-g | -w) [-OotlcvmfxekbAp]\n",
argv0, argv0, argv0);
exit(2);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions protocols/dwl-ipc-unstable-v2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,20 @@ I would probably just submit raphi's patchset but I don't think that would be po
<arg name="scalefactor" type="uint" summary="scale factor of monitor."/>
</event>

<event name="cursor_x" since="2">
<description summary="cursor x position">
Indicates the x coordinate of the cursor.
</description>
<arg name="x" type="int" summary="x coordinate of the cursor"/>
</event>

<event name="cursor_y" since="2">
<description summary="cursor y position">
Indicates the y coordinate of the cursor.
</description>
<arg name="y" type="int" summary="y coordinate of the cursor"/>
</event>

</interface>

</protocol>
12 changes: 12 additions & 0 deletions src/ext-protocol/dwl-ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down