diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-13 08:35:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-13 08:41:35 +0300 |
commit | 1abd120e70faddadad1b20e2b24dd5e03229806e (patch) | |
tree | ee23344f49fa42cf69a22a70db71dc80542b12d7 /source/blender/editors/interface/interface.c | |
parent | f1a65f5750d6a7ce040325af49863a15427d39b1 (diff) |
Cleanup: rename uiBlock.mx,my to bounds_offset
Use a name that related to block bounds calculation
(mx/my are typically used for mouse x,y).
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e8c63fb0224..840c68ec747 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -495,8 +495,8 @@ static void ui_block_bounds_calc_popup( /* offset block based on mouse position, user offset is scaled * along in case we resized the block in ui_block_bounds_calc_text */ - raw_x = rect.xmin = xy[0] + block->rect.xmin + (block->mx * width) / oldwidth; - raw_y = rect.ymin = xy[1] + block->rect.ymin + (block->my * height) / oldheight; + raw_x = rect.xmin = xy[0] + block->rect.xmin + (block->bounds_offset[0] * width) / oldwidth; + raw_y = rect.ymin = xy[1] + block->rect.ymin + (block->bounds_offset[1] * height) / oldheight; rect.xmax = rect.xmin + width; rect.ymax = rect.ymin + height; @@ -538,21 +538,33 @@ void UI_block_bounds_set_text(uiBlock *block, int addval) } /* used for block popups */ -void UI_block_bounds_set_popup(uiBlock *block, int addval, int mx, int my) +void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2]) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_POPUP_MOUSE; - block->mx = mx; - block->my = my; + if (bounds_offset != NULL) { + block->bounds_offset[0] = bounds_offset[0]; + block->bounds_offset[1] = bounds_offset[1]; + } + else { + block->bounds_offset[0] = 0; + block->bounds_offset[1] = 0; + } } /* used for menu popups */ -void UI_block_bounds_set_menu(uiBlock *block, int addval, int mx, int my) +void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2]) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_POPUP_MENU; - block->mx = mx; - block->my = my; + if (bounds_offset != NULL) { + block->bounds_offset[0] = bounds_offset[0]; + block->bounds_offset[1] = bounds_offset[1]; + } + else { + block->bounds_offset[0] = 0; + block->bounds_offset[1] = 0; + } } /* used for centered popups, i.e. splash */ |