diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-09 13:33:52 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-10 06:29:31 +0300 |
commit | c09d4a5593c4d2ce6814dfd96b5da3368ec9b198 (patch) | |
tree | 4e28157e53ff0cb1e2fcfa02615eb1024fff1ddd /src/ui/listwidget.c | |
parent | e0256c5b7c1e92db42cef1556eee849dff92c513 (diff) |
Touch: Hover behavior improvements
Don't show hover on links and lists when no finger is actively touching.
Diffstat (limited to 'src/ui/listwidget.c')
-rw-r--r-- | src/ui/listwidget.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index 95a59090..1f5572bd 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -25,6 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
25 | #include "paint.h" | 25 | #include "paint.h" |
26 | #include "util.h" | 26 | #include "util.h" |
27 | #include "command.h" | 27 | #include "command.h" |
28 | #include "touch.h" | ||
28 | #include "visbuf.h" | 29 | #include "visbuf.h" |
29 | #include "app.h" | 30 | #include "app.h" |
30 | 31 | ||
@@ -253,8 +254,10 @@ static void setHoverItem_ListWidget_(iListWidget *d, size_t index) { | |||
253 | } | 254 | } |
254 | } | 255 | } |
255 | if (d->hoverItem != index) { | 256 | if (d->hoverItem != index) { |
256 | insert_IntSet(&d->invalidItems, d->hoverItem); | 257 | if (deviceType_App() == desktop_AppDeviceType || numFingers_Touch()) { |
257 | insert_IntSet(&d->invalidItems, index); | 258 | insert_IntSet(&d->invalidItems, d->hoverItem); |
259 | insert_IntSet(&d->invalidItems, index); | ||
260 | } | ||
258 | d->hoverItem = index; | 261 | d->hoverItem = index; |
259 | refresh_Widget(as_Widget(d)); | 262 | refresh_Widget(as_Widget(d)); |
260 | } | 263 | } |
@@ -333,20 +336,6 @@ static iBool processEvent_ListWidget_(iListWidget *d, const SDL_Event *ev) { | |||
333 | return processEvent_Widget(w, ev); | 336 | return processEvent_Widget(w, ev); |
334 | } | 337 | } |
335 | 338 | ||
336 | #if 0 | ||
337 | static void drawItem_ListWidget_(const iListWidget *d, iPaint *p, size_t index, iInt2 pos) { | ||
338 | const iWidget * w = constAs_Widget(d); | ||
339 | const iRect bounds = innerBounds_Widget(w); | ||
340 | const iListItem *item = constAt_PtrArray(&d->items, index); | ||
341 | const iRect itemRect = { pos, init_I2(width_Rect(bounds), d->itemHeight) }; | ||
342 | class_ListItem(item)->draw(item, p, itemRect, d); | ||
343 | } | ||
344 | |||
345 | static const iListItem *item_ListWidget_(const iListWidget *d, size_t pos) { | ||
346 | return constAt_PtrArray(&d->items, pos); | ||
347 | } | ||
348 | #endif | ||
349 | |||
350 | static void draw_ListWidget_(const iListWidget *d) { | 339 | static void draw_ListWidget_(const iListWidget *d) { |
351 | const iWidget *w = constAs_Widget(d); | 340 | const iWidget *w = constAs_Widget(d); |
352 | const iRect bounds = innerBounds_Widget(w); | 341 | const iRect bounds = innerBounds_Widget(w); |