Skip to content

Commit dcdab81

Browse files
DPI awareness, pass correct window size to url
1 parent 9de9212 commit dcdab81

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ffrunner.res: ffrunner.rc
2020
$(WINDRES) ffrunner.rc -O coff -o ffrunner.res
2121

2222
ffrunner.exe: ffrunner.res $(SRC) $(HDR)
23-
$(CC) -std=c99 -pedantic -mwindows -Wl,--large-address-aware -O0 -g $(SRC) -o ffrunner.exe ffrunner.res -lwindowscodecs -lwininet -ldxgi
23+
$(CC) -std=c99 -pedantic -mwindows -Wl,--large-address-aware -O0 -g $(SRC) -o ffrunner.exe ffrunner.res -lwindowscodecs -lwininet -ldxgi -lshcore
2424

2525
gdbs:
2626
wine /usr/share/win32/gdbserver.exe localhost:10000 ffrunner.exe

ffrunner.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,19 @@ main(int argc, char **argv)
564564
print_args();
565565
init_logging(args.logPath, args.verboseLogging);
566566

567+
PROCESS_DPI_AWARENESS dpi;
568+
if (GetProcessDpiAwareness(NULL, &dpi) == S_OK) {
569+
if (dpi == PROCESS_DPI_UNAWARE) {
570+
if (SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE) == S_OK) {
571+
logmsg("Set DPI awareness to PROCESS_PER_MONITOR_DPI_AWARE\n");
572+
} else {
573+
logmsg("Failed to set DPI awareness: %d\n", GetLastError());
574+
}
575+
}
576+
} else {
577+
logmsg("Failed to get DPI awareness: %d\n", GetLastError());
578+
}
579+
567580
if (args.serverAddress == NULL) {
568581
logmsg("No server address provided.");
569582
exit(1);
@@ -623,6 +636,10 @@ main(int argc, char **argv)
623636
ret = NP_Initialize(&netscapeFuncs);
624637
logmsg("returned %d\n", ret);
625638

639+
char width[16], height[16];
640+
snprintf(width, sizeof(width), "%d", args.windowWidth);
641+
snprintf(height, sizeof(height), "%d", args.windowHeight);
642+
626643
char *argn[] = {
627644
"src",
628645
"width",
@@ -637,8 +654,8 @@ main(int argc, char **argv)
637654
};
638655
char *argp[] = {
639656
srcUrl,
640-
"1280",
641-
"680",
657+
width,
658+
height,
642659
"000000",
643660
"000000",
644661
"true",

ffrunner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <windows.h>
1111
#include <wininet.h>
12+
#include <shellscalingapi.h>
1213
#include <dxgi.h>
1314

1415
#include "npapi/npapi.h"

0 commit comments

Comments
 (0)