Skip to content

Commit 5aa432c

Browse files
committed
Fullscreen opens in primary screen with current resolution
1 parent 90f29f7 commit 5aa432c

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

demosys/context/glfw.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,23 @@ def __init__(self):
5656

5757
monitor = None
5858
if settings.WINDOW.get('fullscreen'):
59+
# Use the primary monitors current resolution
5960
monitor = glfw.get_primary_monitor()
60-
modes = glfw.get_video_modes(monitor)
61-
62-
print("Supported fullscreen resolutions:")
63-
print("\n".join(str(m) for m in modes))
64-
65-
# Pick a mode close to the configured one
66-
for mode in modes:
67-
if self.width <= mode[0][0]:
68-
self.width, self.height = mode[0]
69-
print("picked fullscreen mode:", mode)
70-
break
61+
mode = glfw.get_video_mode(monitor)
62+
63+
self.width, self.height = mode.size.width, mode.size.height
64+
print("picked fullscreen mode:", mode)
65+
66+
# modes = glfw.get_video_modes(monitor)
67+
# print("Supported fullscreen resolutions:")
68+
# print("\n".join(str(m) for m in modes))
69+
#
70+
# # Pick a mode close to the configured one
71+
# for mode in modes:
72+
# if self.width <= mode[0][0]:
73+
# self.width, self.height = mode[0]
74+
# print("picked fullscreen mode:", mode)
75+
# break
7176

7277
print("Window size:", self.width, self.height)
7378
self.window = glfw.create_window(self.width, self.height, self.title, monitor, None)

0 commit comments

Comments
 (0)