From e8295f0065e8ecddab2e291e420098ac7981e0a9 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sun, 29 Oct 2023 14:01:56 +0200

Subject: [PATCH 1/1] TUI: Fixed build


src/ui/keys.c | 4 ++++

src/ui/text_simple.c | 8 ++++++--

src/ui/util.c | 2 ++

src/ui/window.c | 2 +-

4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/ui/keys.c b/src/ui/keys.c

index 065325a7..0e0621d4 100644

--- a/src/ui/keys.c

+++ b/src/ui/keys.c

@@ -506,10 +506,14 @@ const iPtrArray *list_Keys(void) {

}

iBool isDown_Keys(const iBinding *binding) {

+#if defined (iPlatformTerminal)

+#else

 int numKeys = 0;

 const uint8_t *keys = SDL_GetKeyboardState(&numKeys);

 const int scancode = SDL_GetScancodeFromKey(binding->key);

 const int scancode2 = (scancode == SDL_SCANCODE_RALT ? SDL_SCANCODE_LALT :

                        scancode == SDL_SCANCODE_LALT ? SDL_SCANCODE_RALT : scancode);

 return (scancode < numKeys && keys[scancode]) || (scancode2 < numKeys && keys[scancode2]);

+#endif

}

diff --git a/src/ui/text_simple.c b/src/ui/text_simple.c

index a975630e..06b2cb6b 100644

--- a/src/ui/text_simple.c

+++ b/src/ui/text_simple.c

@@ -63,7 +63,7 @@ iLocalDef iBool isMeasuring_(enum iRunMode mode) {

}

static void runSimple_Font_(iFont *d, const iRunArgs *args) {

    and other non-complex LTR scripts. Composed glyphs are not supported (must rely on text

    being in a pre-composed form). This algorithm is used if HarfBuzz is not available. */

 const iInt2 orig        = args->pos;

@@ -146,7 +146,11 @@ static void runSimple_Font_(iFont *d, const iRunArgs *args) {

                 iColor clr = get_Color(args->color);

                 ansiColors_Color(capturedRange_RegExpMatch(&m, 1),

                                  current_Text()->baseFgColorId,

#if defined (LAGRANGE_ENABLE_STB_TRUETYPE)

                 SDL_SetTextureColorMod(cache, clr.r, clr.g, clr.b);

#endif

diff --git a/src/ui/util.c b/src/ui/util.c

index a31a629d..29ef6093 100644

--- a/src/ui/util.c

+++ b/src/ui/util.c

@@ -1531,10 +1531,12 @@ void openMenuAnchorFlags_Widget(iWidget *d, iRect windowAnchorRect, int menuOpen

             }

         }

         iWindow *win = newPopup_Window(menuPos, d); /* window takes the widget */

+#if !defined (iPlatformTerminal)

         if (isFromMenuBar && menuPos.y + menuSize.y > bottom_Rect(displayRect)) {

             const int maxMenuHeight = bottom_Rect(displayRect) - menuPos.y;

             SDL_SetWindowMaximumSize(win->win, displayRect.size.x, maxMenuHeight);

         }

+#endif

         setCurrent_Window(win);

         SDL_SetWindowTitle(win->win, "Menu");

         arrange_Widget(d);

diff --git a/src/ui/window.c b/src/ui/window.c

index 769d089c..a14c02db 100644

--- a/src/ui/window.c

+++ b/src/ui/window.c

@@ -783,7 +783,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) {

     SDL_Surface *surf = loadImage_(&imageLogo_Resources, 0);

     d->logo = SDL_CreateTextureFromSurface(d->base.render, surf);

     SDL_SetTextureBlendMode(d->logo, SDL_BLENDMODE_BLEND);

-#if SDL_VERSION_ATLEAST(2, 0, 12)

+#if SDL_VERSION_ATLEAST(2, 0, 12) && !defined (iPlatformTerminal)

     SDL_SetTextureScaleMode(d->logo, SDL_ScaleModeBest);

#endif

     free(surf->pixels);

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/dev/patch/e8295f0065e8ecddab2e291e420098ac7981e0a9.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
28.588011 milliseconds
Gemini-to-HTML Time
0.956411 milliseconds

This content has been proxied by September (ba2dc).