freemyipod r831 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r830‎ | r831 | r832 >
Date:17:48, 25 December 2011
Author:theseven
Status:new
Tags:
Comment:
libui: Fix tick_force_redraw being ignored by chooser_action_handler_wheel
Modified paths:
  • /libs/ui/chooser.c (modified) (history)
  • /libs/ui/chooser_action_handler_wheel.c (modified) (history)

Diff [purge]

Index: libs/ui/chooser.c
@@ -92,8 +92,6 @@
9393 mutex_lock(&data.statemutex, TIMEOUT_BLOCK);
9494 if (data.canceled) goto cancel;
9595 if (data.finished) goto finished;
96 - redrawneeded |= data.redrawneeded;
97 - data.redrawneeded = false;
9896 if ((long)(lasttick + info->tickinterval - USEC_TIMER) < 0)
9997 {
10098 if (info->actionhandler->handletick)
@@ -109,6 +107,8 @@
110108 }
111109 lasttick = USEC_TIMER;
112110 }
 111+ redrawneeded |= data.redrawneeded;
 112+ data.redrawneeded = false;
113113 mutex_unlock(&data.statemutex);
114114 if (redrawneeded) redrawneeded = info->renderer->render(&data) == CHOOSER_RESULT_REDRAW;
115115 }
Index: libs/ui/chooser_action_handler_wheel.c
@@ -91,11 +91,13 @@
9292
9393 static enum chooser_result chooser_action_handler_wheel_handletick(struct chooser_data* data)
9494 {
 95+ enum chooser_result rc = CHOOSER_RESULT_OK;
9596 const struct chooser_action_handler_wheel_params* params;
9697 params = (const struct chooser_action_handler_wheel_params*)(data->info->actionhandlerparams);
9798 struct chooser_action_handler_wheel_data* adata;
9899 adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
99 - if (adata->timeout_remaining == TIMEOUT_BLOCK) return CHOOSER_RESULT_OK;
 100+ if (params->tick_force_redraw) rc = CHOOSER_RESULT_REDRAW;
 101+ if (adata->timeout_remaining == TIMEOUT_BLOCK) return rc;
100102 long time = USEC_TIMER;
101103 adata->timeout_remaining -= time - adata->lasttick;
102104 adata->lasttick = time;
@@ -107,8 +109,7 @@
108110 data->selected = &data->info->items[params->timeout_item];
109111 return CHOOSER_RESULT_FINISHED;
110112 }
111 - if (params->tick_force_redraw) return CHOOSER_RESULT_REDRAW;
112 - return CHOOSER_RESULT_OK;
 113+ return rc;
113114 }
114115
115116 static int chooser_action_handler_wheel_stepsperitem(struct chooser_data* data)