From 232da2f992013ea80976f55a2f45f55202917478 Mon Sep 17 00:00:00 2001

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

Date: Tue, 3 Aug 2021 06:58:38 +0300

Subject: [PATCH 1/1] InputWidget: Slower blink; adjusted colors

Slowed down the cursor blinking by half. Adjusted the focused input widget colors to be less harsh in dark mode.


src/ui/color.c | 9 ++++++---

src/ui/inputwidget.c | 40 ++++++++++++++++++++++++++++++++++------

2 files changed, 40 insertions(+), 9 deletions(-)

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

index 05ec1f6f..656de6f0 100644

--- a/src/ui/color.c

+++ b/src/ui/color.c

@@ -85,6 +85,7 @@ void setThemePalette_Color(enum iColorTheme theme) {

 const int accentLo    = (prefs->accent == cyan_ColorAccent ? teal_ColorId : brown_ColorId);

 const int altAccentHi = (prefs->accent == cyan_ColorAccent ? orange_ColorId : cyan_ColorId);

 const int altAccentLo = (prefs->accent == cyan_ColorAccent ? brown_ColorId : teal_ColorId);

 switch (theme) {

     case pureBlack_ColorTheme: {

         copy_(uiBackground_ColorId, black_ColorId);

@@ -123,7 +124,7 @@ void setThemePalette_Color(enum iColorTheme theme) {

         copy_(uiInputTextFocused_ColorId, white_ColorId);

         copy_(uiInputFrame_ColorId, gray25_ColorId);

         copy_(uiInputFrameHover_ColorId, accentHi);

         copy_(uiInputCursor_ColorId, altAccentHi);

         copy_(uiInputCursorText_ColorId, black_ColorId);

         copy_(uiHeading_ColorId, accentHi);

@@ -171,10 +172,12 @@ void setThemePalette_Color(enum iColorTheme theme) {

                   mix_Color(get_Color(black_ColorId), get_Color(gray25_ColorId), 0.7f));

         copy_(uiInputBackgroundFocused_ColorId, black_ColorId);

         copy_(uiInputText_ColorId, gray75_ColorId);

         copy_(uiInputFrame_ColorId, uiInputBackground_ColorId);

         copy_(uiInputFrameHover_ColorId, accentHi);

         copy_(uiInputCursor_ColorId, altAccentHi);

         copy_(uiInputCursorText_ColorId, black_ColorId);

         copy_(uiHeading_ColorId, accentHi);

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

index 8ed52022..bd6927a6 100644

--- a/src/ui/inputwidget.c

+++ b/src/ui/inputwidget.c

@@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

include "macos.h"

#endif

-static const int refreshInterval_InputWidget_ = 256;

+static const int refreshInterval_InputWidget_ = 512;

static const size_t maxUndo_InputWidget_ = 64;

static const int unlimitedWidth_InputWidget_ = 1000000; /* TODO: WrapText disables some functionality if maxWidth==0 */

@@ -216,6 +216,7 @@ struct Impl_InputWidget {

 iArray          undoStack;

 int             font;

 iClick          click;

 int             cursorVis;

 uint32_t        timer;

 iTextBuf *      buffered; /* pre-rendered static text */

@@ -600,6 +601,7 @@ void init_InputWidget(iInputWidget *d, size_t maxLen) {

 splitToLines_(&iStringLiteral(""), &d->lines);

 setFlags_Widget(w, fixedHeight_WidgetFlag, iTrue); /* resizes its own height */

 init_Click(&d->click, d, SDL_BUTTON_LEFT);

 d->timer = 0;

 d->cursorVis = 0;

 d->buffered = NULL;

@@ -1467,6 +1469,31 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {

                          ? SDL_SYSTEM_CURSOR_IBEAM

                          : SDL_SYSTEM_CURSOR_ARROW);

 }

 switch (processEvent_Click(&d->click, ev)) {

     case none_ClickResult:

         break;

@@ -1497,6 +1524,7 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {

                 selectAll_InputWidget(d);

             }

         }

         return iTrue;

     }

     case aborted_ClickResult:

@@ -1889,12 +1917,11 @@ static void draw_InputWidget_(const iInputWidget *d) {

     wrapText.wrapFunc = NULL;

     wrapText.context  = NULL;

 }

 /* Draw the insertion point. */

     for (int i = d->cursor.y - 1; i >= visLines.start; i--) {

         const iInputLine *line = constAt_Array(&d->lines, i);

         visWrapsAbove += numWrapLines_InputLine_(line);

@@ -1938,6 +1965,7 @@ static void draw_InputWidget_(const iInputWidget *d) {

                        cursorChar);

     }

 }

 drawChildren_Widget(w);

}

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/patch/232da2f992013ea80976f55a2f45f55202917478.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
71.721608 milliseconds
Gemini-to-HTML Time
2.533016 milliseconds

This content has been proxied by September (3851b).