From 8670b7d2e6e4c6063bc86b24998721a3726949d6 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 10 Mar 2021 12:37:09 +0200 Subject: Edge-dragging preference panels --- src/ui/widget.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/ui/widget.c') diff --git a/src/ui/widget.c b/src/ui/widget.c index 4dd545b5..c7a23c54 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c @@ -152,7 +152,7 @@ void setId_Widget(iWidget *d, const char *id) { } const iString *id_Widget(const iWidget *d) { - return &d->id; + return d ? &d->id : collectNew_String(); } int64_t flags_Widget(const iWidget *d) { @@ -511,7 +511,7 @@ void arrange_Widget(iWidget *d) { } static void applyVisualOffset_Widget_(const iWidget *d, iInt2 *pos) { - if (d->flags & visualOffset_WidgetFlag) { + if (d->flags & (visualOffset_WidgetFlag | dragged_WidgetFlag)) { const int off = iRound(value_Anim(&d->visualOffset)); if (d->flags & horizontalOffset_WidgetFlag) { pos->x += off; @@ -544,7 +544,9 @@ iInt2 localCoord_Widget(const iWidget *d, iInt2 coord) { } iBool contains_Widget(const iWidget *d, iInt2 coord) { - const iRect bounds = { zero_I2(), d->rect.size }; + const iRect bounds = { zero_I2(), addY_I2(d->rect.size, + d->flags & drawBackgroundToBottom_WidgetFlag ? + rootSize_Window(get_Window()).y : 0) }; return contains_Rect(bounds, localCoord_Widget(d, coord)); } -- cgit v1.2.3