Lagrange [work/v1.8]

Window: Automatic software rendering fallback

=> e3495ede6128250b7b3f4326a784be2fa6a10b22

diff --git a/src/ui/window.c b/src/ui/window.c
index d66015a8..686a6dd6 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -380,12 +380,6 @@ void create_Window_(iWindow *d, iRect rect, uint32_t flags) {
         }
 #endif
     }
-#if 0
-    if (SDL_CreateWindowAndRenderer(
-            width_Rect(rect), height_Rect(rect), flags, &d->win, &d->render)) {
-        return iFalse;
-    }
-#endif
     const iBool setPos = left_Rect(rect) >= 0 || top_Rect(rect) >= 0;
     d->win = SDL_CreateWindow("",
                               setPos ? left_Rect(rect) : SDL_WINDOWPOS_CENTERED,
@@ -394,8 +388,20 @@ void create_Window_(iWindow *d, iRect rect, uint32_t flags) {
                               height_Rect(rect),
                               flags);
     if (!d->win) {
-        fprintf(stderr, "[window] failed to create window: %s\n", SDL_GetError());
-        exit(-3);
+        if (flags & SDL_WINDOW_OPENGL) {
+            /* Try without OpenGL support, then. */
+            setForceSoftwareRender_App(iTrue);
+            d->win = SDL_CreateWindow("",
+                                      setPos ? left_Rect(rect) : SDL_WINDOWPOS_CENTERED,
+                                      setPos ? top_Rect(rect) : SDL_WINDOWPOS_CENTERED,
+                                      width_Rect(rect),
+                                      height_Rect(rect),
+                                      flags & ~SDL_WINDOW_OPENGL);
+        }
+        if (!d->win) {
+            fprintf(stderr, "[window] failed to create window: %s\n", SDL_GetError());
+            exit(-3);
+        }
     }
     if (forceSoftwareRender_App()) {
         SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.8/cdiff/e3495ede6128250b7b3f4326a784be2fa6a10b22
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
134.837751 milliseconds
Gemini-to-HTML Time
0.171412 milliseconds

This content has been proxied by September (ba2dc).