diff options
author | Severin <eiseljulian@gmail.com> | 2018-06-30 01:42:19 +0300 |
---|---|---|
committer | Severin <eiseljulian@gmail.com> | 2018-06-30 01:42:19 +0300 |
commit | a55b00b53baf2e202b88cbea0f61a232ff9843d3 (patch) | |
tree | 60ec0e0b08e4aeaf7afeab08a5d281b97c2150ba /source/blender/windowmanager/intern/wm_window.c | |
parent | 48ad67ef8201f8fcd5efdf748c5fea86e2c61d7d (diff) |
Fix a number of small errors in area coordinate handling
For example collapsing the lower part of the topbar with 2x interface scale
would hide the top-bar header region. There were also more asserts when changing
window size and moving area edges afterwards (same assert as in T55298).
Fixes are similar to e626998a262ebe4f.
With all the recent fixes I've done, area geometry handling should be stable
again. Let's hope I'm right :)
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 7ca51724268..43231855162 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -2013,22 +2013,37 @@ void WM_window_rect_calc(const wmWindow *win, rcti *r_rect) */ void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect) { - rcti rect; + rcti window_rect, screen_rect; - BLI_rcti_init(&rect, 0, WM_window_pixels_x(win), 0, WM_window_pixels_y(win)); + WM_window_rect_calc(win, &window_rect); + screen_rect = window_rect; /* Substract global areas from screen rectangle. */ for (ScrArea *global_area = win->global_areas.areabase.first; global_area; global_area = global_area->next) { + int height = ED_area_global_size_y(global_area) - 1; + if (global_area->global->flag & GLOBAL_AREA_IS_HIDDEN) { continue; } switch (global_area->global->align) { case GLOBAL_AREA_ALIGN_TOP: - rect.ymax -= ED_area_global_size_y(global_area); + if ((screen_rect.ymax - height) > window_rect.ymin) { + height += U.pixelsize; + } + if (screen_rect.ymax < (window_rect.ymax - 1)) { + height += U.pixelsize; + } + screen_rect.ymax -= height; break; case GLOBAL_AREA_ALIGN_BOTTOM: - rect.ymin += ED_area_global_size_y(global_area); + if (screen_rect.ymin > window_rect.ymin) { + height += U.pixelsize; + } + if ((screen_rect.ymin + height) < (window_rect.ymax - 1)) { + height += U.pixelsize; + } + screen_rect.ymin += height; break; default: BLI_assert(0); @@ -2036,9 +2051,9 @@ void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect) } } - BLI_assert(rect.xmin < rect.xmax); - BLI_assert(rect.ymin < rect.ymax); - *r_rect = rect; + BLI_assert(screen_rect.xmin < screen_rect.xmax); + BLI_assert(screen_rect.ymin < screen_rect.ymax); + *r_rect = screen_rect; } bool WM_window_is_fullscreen(wmWindow *win) |