summaryrefslogtreecommitdiff
path: root/src/ui/labelwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-18 07:04:27 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-18 07:04:27 +0300
commitfacc3abb7faafb323cb87e26ddba8dac01af02e9 (patch)
tree387aa23e03b029f516ecca6880131fd6523e1c3f /src/ui/labelwidget.c
parentced855c338b78e05c66d38618373728ef946ebaa (diff)
parent5d517c2f790a38d7fe3c3cc59a1b39fd49e20280 (diff)
Merge branch 'dev' into work/typesetter
# Conflicts: # src/ui/documentwidget.c # src/ui/inputwidget.c
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 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
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, "\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);