summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-10 12:37:09 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-10 12:37:09 +0200
commit8670b7d2e6e4c6063bc86b24998721a3726949d6 (patch)
treef6175e9209b7ea5479e826bd2023bf3b5749e418 /src/ui/widget.c
parentd36529d053f7e4f2915e51e7cfbf01aa1c80adf9 (diff)
Edge-dragging preference panels
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c8
1 files changed, 5 insertions, 3 deletions
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) {
152} 152}
153 153
154const iString *id_Widget(const iWidget *d) { 154const iString *id_Widget(const iWidget *d) {
155 return &d->id; 155 return d ? &d->id : collectNew_String();
156} 156}
157 157
158int64_t flags_Widget(const iWidget *d) { 158int64_t flags_Widget(const iWidget *d) {
@@ -511,7 +511,7 @@ void arrange_Widget(iWidget *d) {
511} 511}
512 512
513static void applyVisualOffset_Widget_(const iWidget *d, iInt2 *pos) { 513static void applyVisualOffset_Widget_(const iWidget *d, iInt2 *pos) {
514 if (d->flags & visualOffset_WidgetFlag) { 514 if (d->flags & (visualOffset_WidgetFlag | dragged_WidgetFlag)) {
515 const int off = iRound(value_Anim(&d->visualOffset)); 515 const int off = iRound(value_Anim(&d->visualOffset));
516 if (d->flags & horizontalOffset_WidgetFlag) { 516 if (d->flags & horizontalOffset_WidgetFlag) {
517 pos->x += off; 517 pos->x += off;
@@ -544,7 +544,9 @@ iInt2 localCoord_Widget(const iWidget *d, iInt2 coord) {
544} 544}
545 545
546iBool contains_Widget(const iWidget *d, iInt2 coord) { 546iBool contains_Widget(const iWidget *d, iInt2 coord) {
547 const iRect bounds = { zero_I2(), d->rect.size }; 547 const iRect bounds = { zero_I2(), addY_I2(d->rect.size,
548 d->flags & drawBackgroundToBottom_WidgetFlag ?
549 rootSize_Window(get_Window()).y : 0) };
548 return contains_Rect(bounds, localCoord_Widget(d, coord)); 550 return contains_Rect(bounds, localCoord_Widget(d, coord));
549} 551}
550 552