[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54365] trunk/blender/source/blender/ editors: fix for annoyance where header menus would get scroller arrows added because it would be clamped within the screen a few pixels .

Campbell Barton ideasman42 at gmail.com
Thu Feb 7 03:03:33 CET 2013


Revision: 54365
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54365
Author:   campbellbarton
Date:     2013-02-07 02:03:31 +0000 (Thu, 07 Feb 2013)
Log Message:
-----------
fix for annoyance where header menus would get scroller arrows added because it would be clamped within the screen a few pixels.

This was caused from using theme shadow setting to clip the popups and a hard-coded value to translate the popup within screen bounds - these values should be the same.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/UI_interface.h
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_regions.c

Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h	2013-02-07 02:00:20 UTC (rev 54364)
+++ trunk/blender/source/blender/editors/include/UI_interface.h	2013-02-07 02:03:31 UTC (rev 54365)
@@ -85,6 +85,9 @@
 #define UI_MAX_DRAW_STR 400
 #define UI_MAX_NAME_STR 128
 
+/* use for clamping popups within the screen */
+#define UI_SCREEN_MARGIN 10
+
 /* uiBlock->dt */
 #define UI_EMBOSS       0   /* use widget style for drawing */
 #define UI_EMBOSSN      1   /* Nothing, only icon and/or text */

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2013-02-07 02:00:20 UTC (rev 54364)
+++ trunk/blender/source/blender/editors/interface/interface.c	2013-02-07 02:03:31 UTC (rev 54365)
@@ -319,6 +319,7 @@
 	wmWindow *window = CTX_wm_window(C);
 	int startx, starty, endx, endy, width, height, oldwidth, oldheight;
 	int oldbounds, xmax, ymax;
+	const int margin = UI_SCREEN_MARGIN;
 
 	oldbounds = block->bounds;
 
@@ -356,20 +357,20 @@
 	startx = window->eventstate->x + block->rect.xmin + (block->mx * width) / oldwidth;
 	starty = window->eventstate->y + block->rect.ymin + (block->my * height) / oldheight;
 
-	if (startx < 10)
-		startx = 10;
-	if (starty < 10)
-		starty = 10;
+	if (startx < margin)
+		startx = margin;
+	if (starty < margin)
+		starty = margin;
 
 	endx = startx + width;
 	endy = starty + height;
 
 	if (endx > xmax) {
-		endx = xmax - 10;
+		endx = xmax - margin;
 		startx = endx - width;
 	}
-	if (endy > ymax - 20) {
-		endy = ymax - 20;
+	if (endy > ymax - margin) {
+		endy = ymax - margin;
 		starty = endy - height;
 	}
 

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2013-02-07 02:00:20 UTC (rev 54364)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2013-02-07 02:03:31 UTC (rev 54365)
@@ -1532,7 +1532,7 @@
 static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 {
 	uiBut *bt;
-	int width = UI_ThemeMenuShadowWidth();
+	int width = UI_SCREEN_MARGIN;
 	int winx, winy;
 
 	if (block->flag & UI_BLOCK_NO_WIN_CLIP) {




More information about the Bf-blender-cvs mailing list