aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-08-14 09:59:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-08-14 09:59:23 +0000
commit54c1660a1e6834aaba9b86a5cca6d22eebc28a41 (patch)
treeba877ef70c20aa78b633af3c9fefff099d7bc2f1 /render.c
parentmeson: bump version to 1.18.0 (diff)
parentosc: regression: fix OSC-111 handling of alpha changes (diff)
Merge branch 'master' into releases/1.18
Diffstat (limited to 'render.c')
-rw-r--r--render.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/render.c b/render.c
index 279e51bf..d9630983 100644
--- a/render.c
+++ b/render.c
@@ -2627,6 +2627,32 @@ render_csd_button_close(struct terminal *term, struct buffer *buf)
pixman_image_unref(src);
}
+static bool
+any_pointer_is_on_button(const struct terminal *term, enum csd_surface csd_surface)
+{
+ if (unlikely(tll_length(term->wl->seats) == 0))
+ return false;
+
+ tll_foreach(term->wl->seats, it) {
+ const struct seat *seat = &it->item;
+
+ if (seat->mouse.x < 0)
+ continue;
+ if (seat->mouse.y < 0)
+ continue;
+
+ struct csd_data info = get_csd_data(term, csd_surface);
+ if (seat->mouse.x > info.width)
+ continue;
+
+ if (seat->mouse.y > info.height)
+ continue;
+ return true;
+ }
+
+ return false;
+}
+
static void
render_csd_button(struct terminal *term, enum csd_surface surf_idx,
const struct csd_data *info, struct buffer *buf)
@@ -2650,21 +2676,24 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx,
_color = term->conf->colors.table[4]; /* blue */
is_set = term->conf->csd.color.minimize_set;
conf_color = &term->conf->csd.color.minimize;
- is_active = term->active_surface == TERM_SURF_BUTTON_MINIMIZE;
+ is_active = term->active_surface == TERM_SURF_BUTTON_MINIMIZE &&
+ any_pointer_is_on_button(term, CSD_SURF_MINIMIZE);
break;
case CSD_SURF_MAXIMIZE:
_color = term->conf->colors.table[2]; /* green */
is_set = term->conf->csd.color.maximize_set;
conf_color = &term->conf->csd.color.maximize;
- is_active = term->active_surface == TERM_SURF_BUTTON_MAXIMIZE;
+ is_active = term->active_surface == TERM_SURF_BUTTON_MAXIMIZE &&
+ any_pointer_is_on_button(term, CSD_SURF_MAXIMIZE);
break;
case CSD_SURF_CLOSE:
_color = term->conf->colors.table[1]; /* red */
is_set = term->conf->csd.color.close_set;
conf_color = &term->conf->csd.color.quit;
- is_active = term->active_surface == TERM_SURF_BUTTON_CLOSE;
+ is_active = term->active_surface == TERM_SURF_BUTTON_CLOSE &&
+ any_pointer_is_on_button(term, CSD_SURF_CLOSE);
break;
default: