diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 15 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index c52b1ebb971..434fb58184f 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -85,6 +85,9 @@ typedef struct uiLayout uiLayout; #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 */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2fc942dab27..4a5f3acad4f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -319,6 +319,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound 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 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound 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; } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 939cb251960..9b2ed9f0984 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1532,7 +1532,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar) 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) { |