summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/viewport.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 061a11895a..b40f244ab2 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -379,22 +379,25 @@ void viewport_set_defaults(struct viewport *vp,
379 if (sbs_area && user_setting) 379 if (sbs_area && user_setting)
380 { 380 {
381 struct viewport *a = sbs_area, *b = user_setting; 381 struct viewport *a = sbs_area, *b = user_setting;
382 /* make sure they do actually overlap, 382 /* if ui vp and info vp overlap, intersect */
383 * if they dont its user error, so use the full display
384 * and live with redraw problems */
385 if (a->x < b->x + b->width && 383 if (a->x < b->x + b->width &&
386 a->x + a->width > b->x && 384 a->x + a->width > b->x &&
387 a->y < b->y + b->height && 385 a->y < b->y + b->height &&
388 a->y + a->height > b->y) 386 a->y + a->height > b->y)
389 { 387 { /* interesect so that the ui viewport is cropped so that it
388 * is completely within the info vp */
390 vp->x = MAX(a->x, b->x); 389 vp->x = MAX(a->x, b->x);
391 vp->y = MAX(a->y, b->y); 390 vp->y = MAX(a->y, b->y);
392 vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x; 391 vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x;
393 vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y; 392 vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y;
393 return;
394 } 394 }
395 /* else take info vp below */
395 } 396 }
396 /* only one so use it */ 397 /* if only one is active use it
397 else if (sbs_area) 398 * or if the above check for overlapping failed, use info vp then, because
399 * that doesn't give redraw problems */
400 if (sbs_area)
398 *vp = *sbs_area; 401 *vp = *sbs_area;
399 else if (user_setting) 402 else if (user_setting)
400 *vp = *user_setting; 403 *vp = *user_setting;