Extend mouse over area to edge of panel for first and last area, if full width clickable (issue #572)
o9000 mrovi9000@gmail.com
1 files changed,
61 insertions(+),
2 deletions(-)
jump to
M
src/util/area.c
→
src/util/area.c
@@ -583,6 +583,65 @@ panel_refresh = TRUE;
mouse_over_area = NULL; } +gboolean area_is_first(void *obj) +{ + Area *a = obj; + if (!a->on_screen) + return FALSE; + + Panel *panel = a->panel; + + Area *node = &panel->area; + + while (node) { + if (!node->on_screen) + return FALSE; + if (node == a) + return TRUE; + + GList *l = node->children; + node = NULL; + for (; l; l = l->next) { + Area *child = l->data; + if (!child->on_screen) + continue; + node = child; + break; + } + } + + return FALSE; +} + +gboolean area_is_last(void *obj) +{ + Area *a = obj; + if (!a->on_screen) + return FALSE; + + Panel *panel = a->panel; + + Area *node = &panel->area; + + while (node) { + if (!node->on_screen) + return FALSE; + if (node == a) + return TRUE; + + GList *l = node->children; + node = NULL; + for (; l; l = l->next) { + Area *child = l->data; + if (!child->on_screen) + continue; + node = child; + } + } + + return FALSE; +} + gboolean area_is_under_mouse(void *obj, int x, int y) { Area *a = obj;@@ -605,9 +664,9 @@ if (a->_is_under_mouse && a->_is_under_mouse != full_width_area_is_under_mouse)
return a->_is_under_mouse(a, x, y); if (panel_horizontal) - return x >= a->posx && x <= a->posx + a->width; + return (x >= a->posx || area_is_first(a)) && (x <= a->posx + a->width || area_is_last(a)); else - return y >= a->posy && y <= a->posy + a->height; + return (y >= a->posy || area_is_first(a)) && (y <= a->posy + a->height || area_is_last(a)); } Area *find_area_under_mouse(void *root, int x, int y)