mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-04 13:29:56 -05:00
feat: support get scale by mmsg
This commit is contained in:
parent
15354898c8
commit
eedff5b085
4 changed files with 37 additions and 4 deletions
27
mmsg/mmsg.c
27
mmsg/mmsg.c
|
|
@ -41,6 +41,7 @@ static int xflag;
|
||||||
static int eflag;
|
static int eflag;
|
||||||
static int kflag;
|
static int kflag;
|
||||||
static int bflag;
|
static int bflag;
|
||||||
|
static int Aflag;
|
||||||
|
|
||||||
static uint32_t occ, seltags, total_clients, urg;
|
static uint32_t occ, seltags, total_clients, urg;
|
||||||
|
|
||||||
|
|
@ -264,6 +265,18 @@ static void dwl_ipc_output_kb_layout(void *data,
|
||||||
printf("kb_layout %s\n", kb_layout);
|
printf("kb_layout %s\n", kb_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dwl_ipc_output_scalefactor(void *data,
|
||||||
|
struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
||||||
|
const unsigned int scalefactor) {
|
||||||
|
if (!Aflag)
|
||||||
|
return;
|
||||||
|
char *output_name = data;
|
||||||
|
if (output_name)
|
||||||
|
printf("%s ", output_name);
|
||||||
|
printf("scale_factor %f\n", scalefactor / 100.0f);
|
||||||
|
}
|
||||||
|
|
||||||
static void dwl_ipc_output_keymode(void *data,
|
static void dwl_ipc_output_keymode(void *data,
|
||||||
struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
||||||
const char *keymode) {
|
const char *keymode) {
|
||||||
|
|
@ -413,6 +426,7 @@ static const struct zdwl_ipc_output_v2_listener dwl_ipc_output_listener = {
|
||||||
.last_layer = dwl_ipc_output_last_layer,
|
.last_layer = dwl_ipc_output_last_layer,
|
||||||
.kb_layout = dwl_ipc_output_kb_layout,
|
.kb_layout = dwl_ipc_output_kb_layout,
|
||||||
.keymode = dwl_ipc_output_keymode,
|
.keymode = dwl_ipc_output_keymode,
|
||||||
|
.scalefactor = dwl_ipc_output_scalefactor,
|
||||||
.frame = dwl_ipc_output_frame,
|
.frame = dwl_ipc_output_frame,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -490,7 +504,7 @@ static void usage(void) {
|
||||||
"\t%s [-OTLq]\n"
|
"\t%s [-OTLq]\n"
|
||||||
"\t%s [-o <output>] -s [-t <tags>] [-l <layout>] [-c <tags>] [-d "
|
"\t%s [-o <output>] -s [-t <tags>] [-l <layout>] [-c <tags>] [-d "
|
||||||
"<cmd>,<arg1>,<arg2>,<arg3>,<arg4>,<arg5>]\n"
|
"<cmd>,<arg1>,<arg2>,<arg3>,<arg4>,<arg5>]\n"
|
||||||
"\t%s [-o <output>] (-g | -w) [-Ootlcvmfxekb]\n",
|
"\t%s [-o <output>] (-g | -w) [-OotlcvmfxekbA]\n",
|
||||||
argv0, argv0, argv0);
|
argv0, argv0, argv0);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
@ -732,6 +746,12 @@ int main(int argc, char *argv[]) {
|
||||||
usage();
|
usage();
|
||||||
mode |= GET;
|
mode |= GET;
|
||||||
break;
|
break;
|
||||||
|
case 'A':
|
||||||
|
Aflag = 1;
|
||||||
|
if (mode == SET)
|
||||||
|
usage();
|
||||||
|
mode |= GET;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "bad option %c\n", ARGC());
|
fprintf(stderr, "bad option %c\n", ARGC());
|
||||||
usage();
|
usage();
|
||||||
|
|
@ -741,9 +761,10 @@ int main(int argc, char *argv[]) {
|
||||||
usage();
|
usage();
|
||||||
if (mode & GET && !output_name &&
|
if (mode & GET && !output_name &&
|
||||||
!(oflag || tflag || lflag || Oflag || Tflag || Lflag || cflag ||
|
!(oflag || tflag || lflag || Oflag || Tflag || Lflag || cflag ||
|
||||||
vflag || mflag || fflag || xflag || eflag || kflag || bflag || dflag))
|
vflag || mflag || fflag || xflag || eflag || kflag || bflag ||
|
||||||
|
Aflag || dflag))
|
||||||
oflag = tflag = lflag = cflag = vflag = mflag = fflag = xflag = eflag =
|
oflag = tflag = lflag = cflag = vflag = mflag = fflag = xflag = eflag =
|
||||||
kflag = bflag = 1;
|
kflag = bflag = Aflag = 1;
|
||||||
|
|
||||||
display = wl_display_connect(NULL);
|
display = wl_display_connect(NULL);
|
||||||
if (!display)
|
if (!display)
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,13 @@ I would probably just submit raphi's patchset but I don't think that would be po
|
||||||
<arg name="keymode" type="string" summary="current keybind mode."/>
|
<arg name="keymode" type="string" summary="current keybind mode."/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
<event name="scalefactor" since="2">
|
||||||
|
<description summary="scale factor of monitor.">
|
||||||
|
scale factor of monitor.
|
||||||
|
</description>
|
||||||
|
<arg name="scalefactor" type="uint" summary="scale factor of monitor."/>
|
||||||
|
</event>
|
||||||
|
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,12 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
|
||||||
zdwl_ipc_output_v2_send_keymode(ipc_output->resource, keymode.mode);
|
zdwl_ipc_output_v2_send_keymode(ipc_output->resource, keymode.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wl_resource_get_version(ipc_output->resource) >=
|
||||||
|
ZDWL_IPC_OUTPUT_V2_SCALEFACTOR_SINCE_VERSION) {
|
||||||
|
zdwl_ipc_output_v2_send_scalefactor(ipc_output->resource,
|
||||||
|
monitor->wlr_output->scale * 100);
|
||||||
|
}
|
||||||
|
|
||||||
zdwl_ipc_output_v2_send_frame(ipc_output->resource);
|
zdwl_ipc_output_v2_send_frame(ipc_output->resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5369,7 +5369,6 @@ void updatemons(struct wl_listener *listener, void *data) {
|
||||||
if ((c = focustop(m)) && c->isfullscreen)
|
if ((c = focustop(m)) && c->isfullscreen)
|
||||||
resize(c, m->m, 0);
|
resize(c, m->m, 0);
|
||||||
|
|
||||||
|
|
||||||
config_head->state.x = m->m.x;
|
config_head->state.x = m->m.x;
|
||||||
config_head->state.y = m->m.y;
|
config_head->state.y = m->m.y;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue