From 61c23be799956615ceeeda10aaeccc2bb11e9c94 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 10 Sep 2021 12:58:21 +0300 Subject: Mobile: Fixed minor UI issues Overflow-scrolling should be allowed over input fields, too. Fixed placement of the URL label in the link context menu. --- src/ui/inputwidget.c | 20 ++++++++++++-------- src/ui/util.c | 5 +++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index f1b21922..6e9ef6c2 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c @@ -1553,12 +1553,15 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { lastLine_InputWidget_(d)->wrapLines.end - d->visWrapLines.end); if (!lineDelta) d->wheelAccum = 0; } - d->wheelAccum -= lineDelta * lineHeight; - d->visWrapLines.start += lineDelta; - d->visWrapLines.end += lineDelta; - d->inFlags |= needUpdateBuffer_InputWidgetFlag; - refresh_Widget(d); - return iTrue; + if (lineDelta) { + d->wheelAccum -= lineDelta * lineHeight; + d->visWrapLines.start += lineDelta; + d->visWrapLines.end += lineDelta; + d->inFlags |= needUpdateBuffer_InputWidgetFlag; + refresh_Widget(d); + return iTrue; + } + return iFalse; } switch (processEvent_Click(&d->click, ev)) { case none_ClickResult: @@ -1926,8 +1929,9 @@ static void draw_InputWidget_(const iInputWidget *d) { const iWidget *w = constAs_Widget(d); iRect bounds = adjusted_Rect(bounds_InputWidget_(d), padding_(), neg_I2(padding_())); iBool isHint = isHintVisible_InputWidget_(d); - const iBool isFocused = isFocused_Widget(w); - const iBool isHover = isHover_Widget(w) && + const iBool isFocused = isFocused_Widget(w); + const iBool isHover = deviceType_App() == desktop_AppDeviceType && + isHover_Widget(w) && contains_InputWidget_(d, mouseCoord_Window(get_Window(), 0)); if (d->inFlags & needUpdateBuffer_InputWidgetFlag) { updateBuffered_InputWidget_(iConstCast(iInputWidget *, d)); diff --git a/src/ui/util.c b/src/ui/util.c index 6df4e980..b875e260 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -725,10 +725,11 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { iClob(newKeyMods_LabelWidget(labelText, item->key, item->kmods, item->command)), noBackground_WidgetFlag | frameless_WidgetFlag | alignLeft_WidgetFlag | drawKey_WidgetFlag | itemFlags); - setWrap_LabelWidget(label, isInfo); + setWrap_LabelWidget(label, isInfo); haveIcons |= checkIcon_LabelWidget(label); updateSize_LabelWidget(label); /* drawKey was set */ if (isInfo) { + setFlags_Widget(as_Widget(label), fixedHeight_WidgetFlag, iTrue); /* wrap changes height */ setTextColor_LabelWidget(label, uiTextAction_ColorId); } } @@ -745,7 +746,7 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { iForEach(ObjectList, i, children_Widget(menu)) { if (isInstance_Object(i.object, &Class_LabelWidget)) { iLabelWidget *label = i.object; - if (icon_LabelWidget(label) == 0) { + if (!isWrapped_LabelWidget(label) && icon_LabelWidget(label) == 0) { setIcon_LabelWidget(label, ' '); } } -- cgit v1.2.3