diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 9 | ||||
-rw-r--r-- | src/ui/listwidget.c | 21 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 73bd8aaa..64172a08 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -43,6 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
43 | #include "paint.h" | 43 | #include "paint.h" |
44 | #include "mediaui.h" | 44 | #include "mediaui.h" |
45 | #include "scrollwidget.h" | 45 | #include "scrollwidget.h" |
46 | #include "touch.h" | ||
46 | #include "translation.h" | 47 | #include "translation.h" |
47 | #include "util.h" | 48 | #include "util.h" |
48 | #include "visbuf.h" | 49 | #include "visbuf.h" |
@@ -3103,9 +3104,15 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3103 | } | 3104 | } |
3104 | enum iColorId fg = run->color; | 3105 | enum iColorId fg = run->color; |
3105 | const iGmDocument *doc = d->widget->doc; | 3106 | const iGmDocument *doc = d->widget->doc; |
3106 | const iBool isHover = | 3107 | iBool isHover = |
3107 | (run->linkId && d->widget->hoverLink && run->linkId == d->widget->hoverLink->linkId && | 3108 | (run->linkId && d->widget->hoverLink && run->linkId == d->widget->hoverLink->linkId && |
3108 | ~run->flags & decoration_GmRunFlag); | 3109 | ~run->flags & decoration_GmRunFlag); |
3110 | /* On mobile, links are not hovered unless a finger is touching. */ | ||
3111 | if (deviceType_App() != desktop_AppDeviceType) { | ||
3112 | if (numFingers_Touch() == 0) { | ||
3113 | isHover = iFalse; | ||
3114 | } | ||
3115 | } | ||
3109 | const iInt2 visPos = addX_I2(add_I2(run->visBounds.pos, origin), | 3116 | const iInt2 visPos = addX_I2(add_I2(run->visBounds.pos, origin), |
3110 | /* Preformatted runs can be scrolled. */ | 3117 | /* Preformatted runs can be scrolled. */ |
3111 | runOffset_DocumentWidget_(d->widget, run)); | 3118 | runOffset_DocumentWidget_(d->widget, run)); |
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); |