diff options
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index a7aa6391..a940b0cb 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 | ||
32 | struct Impl_LabelWidget { | 33 | struct Impl_LabelWidget { |
33 | iWidget widget; | 34 | iWidget widget; |
@@ -46,6 +47,15 @@ struct Impl_LabelWidget { | |||
46 | } flags; | 47 | } flags; |
47 | }; | 48 | }; |
48 | 49 | ||
50 | static 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 | |||
49 | static iInt2 padding_LabelWidget_(const iLabelWidget *d, int corner) { | 59 | static 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, "\v")) { | 209 | if (startsWith_String(&d->label, "\v")) { |
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); |