Index: libs/ui/chooser_renderer_list.c |
— | — | @@ -82,9 +82,10 @@ |
83 | 83 | {
|
84 | 84 | const struct chooser_renderer_list_params* params;
|
85 | 85 | params = (const struct chooser_renderer_list_params*)(data->info->rendererparams);
|
| 86 | + const struct chooser_item* selected = data->selected;
|
86 | 87 | struct chooser_renderer_list_data* rdata;
|
87 | 88 | rdata = (struct chooser_renderer_list_data*)(data->rendererdata);
|
88 | | - chooser_renderer_list_scroll_into_view(data, data->selected);
|
| 89 | + chooser_renderer_list_scroll_into_view(data, selected);
|
89 | 90 | const struct chooser_item* item = rdata->top_item;
|
90 | 91 | if (params->copy_dest.buf.addr == params->fill_dest.loc.buf.addr
|
91 | 92 | && params->copy_dest.buf.stride == params->fill_dest.loc.buf.stride
|
— | — | @@ -157,7 +158,7 @@ |
158 | 159 | uint32_t text_color;
|
159 | 160 | const struct libui_surface* icon;
|
160 | 161 | int icon_opacity;
|
161 | | - if (item == data->selected)
|
| 162 | + if (item == selected)
|
162 | 163 | {
|
163 | 164 | fill_color = iparams->fill_color_selected;
|
164 | 165 | text_color = iparams->text_color_selected;
|
Index: libs/ui/chooser_renderer_iconflow.c |
— | — | @@ -73,6 +73,7 @@ |
74 | 74 | rdata->lastupdate = time; |
75 | 75 | if (data->position - rdata->viewposition) rc = CHOOSER_RESULT_REDRAW; |
76 | 76 | else rdata->lastupdate = 0; |
| 77 | + const struct chooser_item* selected = data->selected; |
77 | 78 | if (params->copy_dest.buf.addr == params->fill_dest.loc.buf.addr |
78 | 79 | && params->copy_dest.buf.stride == params->fill_dest.loc.buf.stride |
79 | 80 | && params->copy_dest.pos.x == params->fill_dest.loc.pos.x |
— | — | @@ -147,7 +148,7 @@ |
148 | 149 | const struct chooser_item* item = data->info->items; |
149 | 150 | while (true) |
150 | 151 | { |
151 | | - if (item == data->selected && dir == 1) |
| 152 | + if (item == selected && dir == 1) |
152 | 153 | { |
153 | 154 | dir = -1; |
154 | 155 | item = &data->info->items[data->info->itemcount - 1]; |
— | — | @@ -155,12 +156,12 @@ |
156 | 157 | } |
157 | 158 | iparams = (const struct chooser_renderer_iconflow_itemdata*)(item->renderparams); |
158 | 159 | const struct libui_surface* icon; |
159 | | - if (item == data->selected) icon = &iparams->icon_selected; |
| 160 | + if (item == selected) icon = &iparams->icon_selected; |
160 | 161 | else icon = &iparams->icon; |
161 | 162 | int ix, iy, io; |
162 | 163 | int dist = pos - vpos; |
163 | 164 | chooser_renderer_iconflow_geticondata(x, y, w, h, spi * iiv, dist, icon, &ix, &iy, &io); |
164 | | - if (item == data->selected) |
| 165 | + if (item == selected) |
165 | 166 | { |
166 | 167 | io = 255; |
167 | 168 | if (iparams->text && iparams->text_color) |
— | — | @@ -171,7 +172,7 @@ |
172 | 173 | && ix + icon->size.x <= x + w && iy + icon->size.y <= y + h) |
173 | 174 | blenda(icon->size.x, icon->size.y, io, buf, ix, iy, stride, buf, ix, iy, stride, |
174 | 175 | icon->loc.buf.addr, icon->loc.pos.x, icon->loc.pos.y, icon->loc.buf.stride); |
175 | | - if (item == data->selected) break; |
| 176 | + if (item == selected) break; |
176 | 177 | item += dir; |
177 | 178 | pos += dir * spi; |
178 | 179 | } |
— | — | @@ -190,6 +191,7 @@ |
191 | 192 | const struct chooser_renderer_iconflow_params* params; |
192 | 193 | params = (const struct chooser_renderer_iconflow_params*)(data->info->rendererparams); |
193 | 194 | if (x >= params->viewport.size.x || y >= params->viewport.size.y) return NULL; |
| 195 | + const struct chooser_item* selected = data->selected; |
194 | 196 | struct chooser_renderer_iconflow_data* rdata; |
195 | 197 | rdata = (struct chooser_renderer_iconflow_data*)(data->rendererdata); |
196 | 198 | const struct chooser_item* result = NULL; |
— | — | @@ -206,7 +208,7 @@ |
207 | 209 | const struct chooser_item* item = data->info->items; |
208 | 210 | while (true) |
209 | 211 | { |
210 | | - if (item == data->selected && dir == 1) |
| 212 | + if (item == selected && dir == 1) |
211 | 213 | { |
212 | 214 | dir = -1; |
213 | 215 | item = &data->info->items[data->info->itemcount - 1]; |
— | — | @@ -214,13 +216,13 @@ |
215 | 217 | } |
216 | 218 | iparams = (const struct chooser_renderer_iconflow_itemdata*)(item->renderparams); |
217 | 219 | const struct libui_surface* icon; |
218 | | - if (item == data->selected) icon = &iparams->icon_selected; |
| 220 | + if (item == selected) icon = &iparams->icon_selected; |
219 | 221 | else icon = &iparams->icon; |
220 | 222 | int ix, iy, o; |
221 | 223 | int dist = pos - vpos; |
222 | 224 | chooser_renderer_iconflow_geticondata(vx, vy, vw, vh, spi * iiv, dist, icon, &ix, &iy, &o); |
223 | 225 | if (x >= ix && y >= ix && x < ix + icon->size.x && y < iy + icon->size.y) result = item; |
224 | | - if (item == data->selected) break; |
| 226 | + if (item == selected) break; |
225 | 227 | item += dir; |
226 | 228 | pos += dir * spi; |
227 | 229 | } |