From 4fa5c100469a2ed98f6cdf05e63f91e05c961270 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 16 Sep 2019 08:51:02 +1000 Subject: [PATCH] Revert "Don't unset fullscreen before going into fullscreen" This reverts commit 004b1b95d16f10b1072b3c780aaaf967cce193a5. --- src/Window.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Window.c b/src/Window.c index 6ebf7f773..3f1fd2738 100644 --- a/src/Window.c +++ b/src/Window.c @@ -2258,6 +2258,7 @@ void Window_FreeFramebuffer(Bitmap* bmp) { #include static AGLContext ctx_handle; +static bool ctx_firstFullscreen; static int ctx_windowWidth, ctx_windowHeight; static void GLContext_Check(int code, const char* place) { @@ -2322,6 +2323,16 @@ static void GLContext_SetFullscreen(void) { GLContext_Check(code, "aglSetFullScreen"); GLContext_MakeCurrent(); + /* This is a weird hack to workaround a bug where the first time a context */ + /* is made fullscreen, we just end up with a blank screen. So we undo it as fullscreen */ + /* and redo it as fullscreen. */ + if (!ctx_firstFullscreen) { + ctx_firstFullscreen = true; + GLContext_UnsetFullscreen(); + GLContext_SetFullscreen(); + return; + } + win_fullscreen = true; ctx_windowWidth = Window_Width; ctx_windowHeight = Window_Height; @@ -2362,10 +2373,15 @@ void GLContext_Init(struct GraphicsMode* mode) { GLContext_Check(0, "Destroying pixel format"); GLContext_SetDrawable(); + GLContext_Update(); GLContext_MakeCurrent(); } -void GLContext_Update(void) { aglUpdateContext(ctx_handle); } +void GLContext_Update(void) { + if (win_fullscreen) return; + GLContext_SetDrawable(); + aglUpdateContext(ctx_handle); +} void GLContext_Free(void) { if (!ctx_handle) return;