summaryrefslogtreecommitdiff
path: root/gui/glabel.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-19 05:22:42 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-19 05:22:42 -0300
commitece0da7474b99d0958c0d4731fda670cfb1f6831 (patch)
treebd5c37845118679d7899a229b9f1e5a47cf5bb80 /gui/glabel.c
parent8349ddc329c6779fcca7b3207dd0005d85bc0109 (diff)
downloadeeshow-ece0da7474b99d0958c0d4731fda670cfb1f6831.tar.gz
eeshow-ece0da7474b99d0958c0d4731fda670cfb1f6831.tar.bz2
eeshow-ece0da7474b99d0958c0d4731fda670cfb1f6831.zip
eeshow/gui/: use overlay_draw_all_d for glabels, due to offsets
The offsets can move the coordinates across zero, thus flipping the alignment. overlay_draw_all_d is immune to this.
Diffstat (limited to 'gui/glabel.c')
-rw-r--r--gui/glabel.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gui/glabel.c b/gui/glabel.c
index abd3e2a..0f0619e 100644
--- a/gui/glabel.c
+++ b/gui/glabel.c
@@ -220,10 +220,20 @@ static bool hover_glabel(void *user, bool on)
gtk_widget_get_allocation(ctx->da, &alloc);
mx = (sx + ex) / 2;
my = (sy + ey) / 2;
- ctx->pop_x = mx < alloc.width / 2 ?
- sx - CHEAT : -(alloc.width - ex) + CHEAT;
- ctx->pop_y = my < alloc.height / 2 ?
- sy - CHEAT : -(alloc.height - ey) + CHEAT;
+ if (mx < alloc.width / 2) {
+ ctx->pop_x = sx - CHEAT;
+ ctx->pop_dx = 1;
+ } else {
+ ctx->pop_x = ex + CHEAT;
+ ctx->pop_dx = -1;
+ }
+ if (my < alloc.height / 2) {
+ ctx->pop_y = sy - CHEAT;
+ ctx->pop_dy = 1;
+ } else {
+ ctx->pop_y = ey + CHEAT;
+ ctx->pop_dy = -1;
+ }
input_update();
redraw(ctx);