From c7454e46951fffefd5266e14a8b4eaf036f10e0a Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 17 May 2026 15:53:13 +1000 Subject: [PATCH] move glx context into platform window --- dlib/platform.d | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlib/platform.d b/dlib/platform.d index 2afaa32..b84e170 100644 --- a/dlib/platform.d +++ b/dlib/platform.d @@ -614,6 +614,10 @@ struct PlatformWindow TicketMut cb_mut; Selection[CBM.max] selections; version(linux) u32 cb_transfer_size; + static if(__traits(compiles, { GLXContext context; })) + { + GLXContext glx_context; + } }; struct Library @@ -833,15 +837,15 @@ CreateWindow( None, ]; - GLXContext context = glXCreateContextAttribsARB(window.display, chosen_fb_config, null, True, context_attributes.ptr); + window.glx_context = glXCreateContextAttribsARB(window.display, chosen_fb_config, null, True, context_attributes.ptr); - if(!context) + if(!window.glx_context) { Errf("Failed to create OpenGL context"); return false; } - glXMakeCurrent(window.display, window.window, context); + glXMakeCurrent(window.display, window.window, window.glx_context); GLLoadFuncs(); }