-
Notifications
You must be signed in to change notification settings - Fork 3
/
fullscreenmonitor.patch
56 lines (54 loc) · 1.74 KB
/
fullscreenmonitor.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git src/engine/main.cpp src/engine/main.cpp
index 1270a20..fc485a3 100644
--- src/engine/main.cpp
+++ src/engine/main.cpp
@@ -645,7 +644,8 @@ void setupscreen()
curvsync = -1;
SDL_Rect desktop;
- if(SDL_GetDisplayBounds(0, &desktop) < 0) fatal("failed querying desktop bounds: %s", SDL_GetError());
+ extern int fullscreenmonitor;
+ if(SDL_GetDisplayBounds(fullscreenmonitor, &desktop) < 0) fatal("failed querying desktop bounds: %s", SDL_GetError());
desktopw = desktop.w;
desktoph = desktop.h;
@@ -662,6 +663,8 @@ void setupscreen()
int winx = SDL_WINDOWPOS_UNDEFINED, winy = SDL_WINDOWPOS_UNDEFINED, winw = scr_w, winh = scr_h, flags = SDL_WINDOW_RESIZABLE;
if(fullscreen)
{
+ winx = desktop.x;
+ winy = desktop.y;
if(fullscreendesktop)
{
winw = desktopw;
diff --git src/p1xbraten/fullscreenmonitor.cpp src/p1xbraten/fullscreenmonitor.cpp
new file mode 100644
index 0000000..90179d9
--- /dev/null
+++ src/p1xbraten/fullscreenmonitor.cpp
@@ -0,0 +1,27 @@
+#include "engine.h"
+
+void setfullscreenmonitor(int);
+MOD(VARF, fullscreenmonitor, 0, 0, 10, setfullscreenmonitor(fullscreenmonitor));
+
+void setfullscreenmonitor(int monitor)
+{
+ if(!screen) return;
+
+ int currentmonitor = SDL_GetWindowDisplayIndex(screen);
+ if(fullscreenmonitor >= SDL_GetNumVideoDisplays())
+ {
+ fullscreenmonitor = currentmonitor;
+ return;
+ }
+
+ extern int fullscreen;
+ extern void resetgl();
+ if(fullscreen && monitor!=currentmonitor) resetgl();
+}
+
+ICOMMAND(getnummonitors, "", (), intret(SDL_GetNumVideoDisplays()));
+ICOMMAND(getmonitorname, "i", (int *id),
+{
+ const char *name = SDL_GetDisplayName(*id);
+ result(name ? name : "");
+});