summaryrefslogtreecommitdiff
path: root/src/ui/labelwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-15 22:38:13 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-15 22:38:13 +0300
commitafce90c9f6b52db97de29824d1afd1a0742550df (patch)
treec22eeafe577995215ef6edf448a35f8d8328cb8d /src/ui/labelwidget.c
parentd268545d12db5b02ee5975acb311d5b3cd875d6a (diff)
Mobile: Various improvements and fixes
- fill the safe area with theme background - don't set button hover states if dragging/scrolling - edge-draggable widgets must be flagged as such - Preferences top panel offset matches sibling panels' offset - allow toolbar to unhide when document is not scrollable
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r--src/ui/labelwidget.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index 5d0f0041..44ed795b 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28#include "app.h" 28#include "app.h"
29#include "util.h" 29#include "util.h"
30#include "keys.h" 30#include "keys.h"
31#include "touch.h"
31 32
32struct Impl_LabelWidget { 33struct Impl_LabelWidget {
33 iWidget widget; 34 iWidget widget;
@@ -46,6 +47,15 @@ struct Impl_LabelWidget {
46 } flags; 47 } flags;
47}; 48};
48 49
50static iBool isHover_LabelWidget_(const iLabelWidget *d) {
51#if defined (iPlatformMobile)
52 if (!isHovering_Touch()) {
53 return iFalse;
54 }
55#endif
56 return isHover_Widget(d);
57}
58
49static iInt2 padding_LabelWidget_(const iLabelWidget *d, int corner) { 59static iInt2 padding_LabelWidget_(const iLabelWidget *d, int corner) {
50 const iWidget *w = constAs_Widget(d); 60 const iWidget *w = constAs_Widget(d);
51 const int64_t flags = flags_Widget(w); 61 const int64_t flags = flags_Widget(w);
@@ -199,7 +209,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int
199 if (startsWith_String(&d->label, "\r")) { 209 if (startsWith_String(&d->label, "\r")) {
200 colorEscape = cstr_String(&d->label)[1] - asciiBase_ColorEscape; /* TODO: can be two bytes long */ 210 colorEscape = cstr_String(&d->label)[1] - asciiBase_ColorEscape; /* TODO: can be two bytes long */
201 } 211 }
202 if (isHover_Widget(w)) { 212 if (isHover_LabelWidget_(d)) {
203 if (isFrameless) { 213 if (isFrameless) {
204 *bg = uiBackgroundFramelessHover_ColorId; 214 *bg = uiBackgroundFramelessHover_ColorId;
205 *fg = uiTextFramelessHover_ColorId; 215 *fg = uiTextFramelessHover_ColorId;
@@ -257,7 +267,7 @@ static void draw_LabelWidget_(const iLabelWidget *d) {
257 const int64_t flags = flags_Widget(w); 267 const int64_t flags = flags_Widget(w);
258 const iRect bounds = bounds_Widget(w); 268 const iRect bounds = bounds_Widget(w);
259 iRect rect = bounds; 269 iRect rect = bounds;
260 const iBool isHover = isHover_Widget(w); 270 const iBool isHover = isHover_LabelWidget_(d);
261 if (isButton) { 271 if (isButton) {
262 shrink_Rect(&rect, divi_I2(gap2_UI, 4)); 272 shrink_Rect(&rect, divi_I2(gap2_UI, 4));
263 adjustEdges_Rect(&rect, gap_UI / 8, 0, -gap_UI / 8, 0); 273 adjustEdges_Rect(&rect, gap_UI / 8, 0, -gap_UI / 8, 0);