summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorDaijiro Fukuda <[email protected]>2023-01-10 20:45:53 +0900
committerGitHub <[email protected]>2023-01-10 12:45:53 +0100
commitc6376acfc465d589db584ff36788a01360ec0771 (patch)
tree7fe18ae5ec6eaa04b85eb8464d10cc46b21feec8 /src
parent3028bffd4c39e622c0a2b95f275ae6156a86639f (diff)
downloadraylib-c6376acfc465d589db584ff36788a01360ec0771.tar.gz
raylib-c6376acfc465d589db584ff36788a01360ec0771.zip
Set initial window position for display-sized fullscreen (#2742)
Diffstat (limited to 'src')
-rw-r--r--src/rcore.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rcore.c b/src/rcore.c
index 2d68606d..27b1a1f3 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -4091,8 +4091,18 @@ static bool InitGraphicsDevice(int width, int height)
if (CORE.Window.fullscreen)
{
// remember center for switchinging from fullscreen to window
- CORE.Window.position.x = CORE.Window.display.width/2 - CORE.Window.screen.width/2;
- CORE.Window.position.y = CORE.Window.display.height/2 - CORE.Window.screen.height/2;
+ if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width))
+ {
+ // If screen width/height equal to the dislpay, we can't calclulate the window pos for toggling fullscreened/windowed.
+ // Toggling fullscreened/windowed with pos(0, 0) can cause problems in some platforms, such as X11.
+ CORE.Window.position.x = CORE.Window.display.width/4;
+ CORE.Window.position.y = CORE.Window.display.height/4;
+ }
+ else
+ {
+ CORE.Window.position.x = CORE.Window.display.width/2 - CORE.Window.screen.width/2;
+ CORE.Window.position.y = CORE.Window.display.height/2 - CORE.Window.screen.height/2;
+ }
if (CORE.Window.position.x < 0) CORE.Window.position.x = 0;
if (CORE.Window.position.y < 0) CORE.Window.position.y = 0;