[Bf-blender-cvs] [3a58e97aed9] master: Fix T62526: Can't scroll redo panel

Campbell Barton noreply at git.blender.org
Thu Mar 14 00:00:01 CET 2019


Commit: 3a58e97aed963b43984250e6ce40cd863b71e4b6
Author: Campbell Barton
Date:   Thu Mar 14 09:58:20 2019 +1100
Branches: master
https://developer.blender.org/rB3a58e97aed963b43984250e6ce40cd863b71e4b6

Fix T62526: Can't scroll redo panel

===================================================================

M	source/blender/editors/interface/interface_region_hud.c
M	source/blender/editors/screen/area.c
M	source/blender/makesdna/DNA_screen_types.h

===================================================================

diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index e874609f61e..f6a5c9611af 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -178,9 +178,19 @@ static void hud_region_layout(const bContext *C, ARegion *ar)
 	ED_region_panels_layout(C, ar);
 
 	if (ar->panels.first && (ar->sizey != size_y)) {
+		int winx_new = UI_DPI_FAC * (ar->sizex + 0.5f);
+		int winy_new = UI_DPI_FAC * (ar->sizey + 0.5f);
 		View2D *v2d = &ar->v2d;
-		ar->winx = ar->sizex * UI_DPI_FAC;
-		ar->winy = ar->sizey * UI_DPI_FAC;
+
+		if (ar->flag & RGN_FLAG_SIZE_CLAMP_X) {
+			CLAMP_MAX(winx_new, ar->winx);
+		}
+		if (ar->flag & RGN_FLAG_SIZE_CLAMP_Y) {
+			CLAMP_MAX(winy_new, ar->winy);
+		}
+
+		ar->winx = winx_new;
+		ar->winy = winy_new;
 
 		ar->winrct.xmax = (ar->winrct.xmin + ar->winx) - 1;
 		ar->winrct.ymax = (ar->winrct.ymin + ar->winy) - 1;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index ad9bcaf59cc..a430ccdc95e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1145,7 +1145,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
 	ar->overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
 
 	/* clear state flags first */
-	ar->flag &= ~RGN_FLAG_TOO_SMALL;
+	ar->flag &= ~(RGN_FLAG_TOO_SMALL | RGN_FLAG_SIZE_CLAMP_X | RGN_FLAG_SIZE_CLAMP_Y);
 	/* user errors */
 	if ((ar->next == NULL) && !ELEM(alignment, RGN_ALIGN_QSPLIT, RGN_ALIGN_FLOAT)) {
 		alignment = RGN_ALIGN_NONE;
@@ -1196,6 +1196,13 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rct
 
 		BLI_rcti_isect(&ar->winrct, &overlap_remainder_margin, &ar->winrct);
 
+		if (BLI_rcti_size_x(&ar->winrct) != prefsizex - 1) {
+			ar->flag |= RGN_FLAG_SIZE_CLAMP_X;
+		}
+		if (BLI_rcti_size_y(&ar->winrct) != prefsizey - 1) {
+			ar->flag |= RGN_FLAG_SIZE_CLAMP_Y;
+		}
+
 		/* We need to use a test that wont have been previously clamped. */
 		rcti winrct_test = {
 			.xmin = ar->winrct.xmin,
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 19e1f824ced..c62aed7402b 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -625,6 +625,9 @@ enum {
 	RGN_FLAG_TEMP_REGIONDATA    = (1 << 3),
 	/* The region must either use its prefsizex/y or be hidden. */
 	RGN_FLAG_PREFSIZE_OR_HIDDEN = (1 << 4),
+	/** Size has been clamped (floating regions only). */
+	RGN_FLAG_SIZE_CLAMP_X      = (1 << 5),
+	RGN_FLAG_SIZE_CLAMP_Y      = (1 << 6),
 };
 
 /** #ARegion.do_draw */



More information about the Bf-blender-cvs mailing list