From 69541c037e67635787b334b326a4850f1703a763 Mon Sep 17 00:00:00 2001

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

Date: Fri, 4 Feb 2022 15:12:59 +0200

Subject: [PATCH 1/1] IndicatorWidget: Use the normal animation method

This old timer-based animation predates the ticker convention.


src/ui/indicatorwidget.c | 66 +++++++++-------------------------------

1 file changed, 15 insertions(+), 51 deletions(-)

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

index bc0bd0fa..e16550ff 100644

--- a/src/ui/indicatorwidget.c

+++ b/src/ui/indicatorwidget.c

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

#include <SDL_timer.h>

-static int timerId_; /* common timer for all indicators */

-static int animCount_; /* number of animating indicators */

-static uint32_t postRefresh_(uint32_t interval, void *context) {

-}

-static void startTimer_(void) {

-}

-static void stopTimer_(void) {

-}

-struct Impl_IndicatorWidget{

+struct Impl_IndicatorWidget {

 iWidget widget;

 iAnim   pos;

};

@@ -64,6 +39,14 @@ iLocalDef iBool isActive_IndicatorWidget_(const iIndicatorWidget *d) {

 return isSelected_Widget(d);

}

+static void animate_IndicatorWidget_(void *ptr) {

+}

static void setActive_IndicatorWidget_(iIndicatorWidget *d, iBool set) {

 setFlags_Widget(as_Widget(d), selected_WidgetFlag, set);

}

@@ -75,22 +58,8 @@ void init_IndicatorWidget(iIndicatorWidget *d) {

 setFlags_Widget(w, unhittable_WidgetFlag, iTrue);

}

-static void startTimer_IndicatorWidget_(iIndicatorWidget *d) {

-}

-static void stopTimer_IndicatorWidget_(iIndicatorWidget *d) {

-}

void deinit_IndicatorWidget(iIndicatorWidget *d) {

}

static iBool isCompleted_IndicatorWidget_(const iIndicatorWidget *d) {

@@ -116,12 +85,7 @@ void draw_IndicatorWidget_(const iIndicatorWidget *d) {

iBool processEvent_IndicatorWidget_(iIndicatorWidget *d, const SDL_Event *ev) {

 iWidget *w = &d->widget;

     const char *cmd = command_UserEvent(ev);

     if (startsWith_CStr(cmd, "document.request.")) {

         if (pointerLabel_Command(cmd, "doc") == parent_Widget(w)) {

@@ -130,23 +94,23 @@ iBool processEvent_IndicatorWidget_(iIndicatorWidget *d, const SDL_Event *ev) {

                 setValue_Anim(&d->pos, 0, 0);

                 setValue_Anim(&d->pos, 0.75f, 4000);

                 setFlags_Anim(&d->pos, easeOut_AnimFlag, iTrue);

             }

             else if (equal_Command(cmd, "finished")) {

                 if (value_Anim(&d->pos) > 0.01f) {

                     setValue_Anim(&d->pos, 1.0f, 250);

                     setFlags_Anim(&d->pos, easeOut_AnimFlag, iFalse);

                 }

                 else {

                     setValue_Anim(&d->pos, 0, 0);

                     refresh_Widget(d);

                 }

             }

             else if (equal_Command(cmd, "cancelled")) {

                 setValue_Anim(&d->pos, 0, 0);

                 refresh_Widget(d);

             }

         }

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.8/patch/69541c037e67635787b334b326a4850f1703a763.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
55.790798 milliseconds
Gemini-to-HTML Time
3.161203 milliseconds

This content has been proxied by September (ba2dc).