diff options
-rw-r--r-- | build_files/build_environment/cmake/bzip2.cmake | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 13 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 64 |
3 files changed, 54 insertions, 25 deletions
diff --git a/build_files/build_environment/cmake/bzip2.cmake b/build_files/build_environment/cmake/bzip2.cmake index fbf5551e719..bb2be7c634a 100644 --- a/build_files/build_environment/cmake/bzip2.cmake +++ b/build_files/build_environment/cmake/bzip2.cmake @@ -25,6 +25,8 @@ if(UNIX AND NOT APPLE) set(BZIP2_CFLAGS "-fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64") set(BZIP2_CONFIGURE_ENV ${BZIP2_CONFIGURE_ENV} && export LDFLAGS=${BZIP2_LDFLAGS} && export CFLAGS=${BZIP2_CFLAGS} && export PREFIX=${BZIP2_PREFIX}) +else() + set(BZIP2_CONFIGURE_ENV ${CONFIGURE_ENV}) endif() ExternalProject_Add(external_bzip2 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ac1d315434d..c8428ac7fb3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9715,7 +9715,9 @@ static bool read_libblock_undo_restore( /* Do not add LIB_TAG_NEW here, this should not be needed/used in undo case anyway (as * this is only for do_version-like code), but for sake of consistency, and also because * it will tell us which ID is re-used from old Main, and which one is actually new. */ - const int id_tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_UNDO_OLD_ID_REUSED; + /* Also do not add LIB_TAG_NEED_LINK, those IDs will never be re-liblinked, hence that tag will + * never be cleared, leading to critical issue in link/appemd code. */ + const int id_tag = tag | LIB_TAG_UNDO_OLD_ID_REUSED; read_libblock_undo_restore_identical(fd, main, id, id_old, id_tag); /* Insert into library map for lookup by newly read datablocks (with pointer value bhead->old). @@ -10195,6 +10197,15 @@ static void lib_link_all(FileData *fd, Main *bmain) * 'permanently' in our data structures... */ BKE_main_collections_parent_relations_rebuild(bmain); } + +#ifndef NDEBUG + /* Double check we do not have any 'need link' tag remaining, this should never be the case once + * this function has run. */ + FOREACH_MAIN_ID_BEGIN (bmain, id) { + BLI_assert((id->tag & LIB_TAG_NEED_LINK) == 0); + } + FOREACH_MAIN_ID_END; +#endif } /** \} */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 1e25d73a86d..2a5fdc0ab74 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -807,6 +807,36 @@ void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm) } } +/* Update window size and position based on data from GHOST window. */ +static bool wm_window_update_size_position(wmWindow *win) +{ + GHOST_RectangleHandle client_rect; + int l, t, r, b, scr_w, scr_h; + int sizex, sizey, posx, posy; + + client_rect = GHOST_GetClientBounds(win->ghostwin); + GHOST_GetRectangle(client_rect, &l, &t, &r, &b); + + GHOST_DisposeRectangle(client_rect); + + wm_get_desktopsize(&scr_w, &scr_h); + sizex = r - l; + sizey = b - t; + posx = l; + posy = scr_h - t - win->sizey; + + if (win->sizex != sizex || win->sizey != sizey || win->posx != posx || win->posy != posy) { + win->sizex = sizex; + win->sizey = sizey; + win->posx = posx; + win->posy = posy; + return true; + } + else { + return false; + } +} + /** * new window, no screen yet, but we open ghostwindow for it, * also gets the window level handlers @@ -941,12 +971,19 @@ wmWindow *WM_window_open_temp(bContext *C, ED_area_newspace(C, area, space_type, false); ED_screen_change(C, screen); - ED_screen_refresh(wm, win); /* test scale */ if (win->ghostwin) { + /* Set size in GHOST window and then update size and position from GHOST, + * in case they where changed by GHOST to fit the monitor/screen. */ wm_window_set_size(win, win->sizex, win->sizey); - wm_window_raise(win); + wm_window_update_size_position(win); + } + + /* Refresh screen dimensions, after the effective window size is known. */ + ED_screen_refresh(wm, win); + if (win->ghostwin) { + wm_window_raise(win); GHOST_SetTitle(win->ghostwin, title); return win; } @@ -1354,21 +1391,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr /* win32: gives undefined window size when minimized */ if (state != GHOST_kWindowStateMinimized) { - GHOST_RectangleHandle client_rect; - int l, t, r, b, scr_w, scr_h; - int sizex, sizey, posx, posy; - - client_rect = GHOST_GetClientBounds(win->ghostwin); - GHOST_GetRectangle(client_rect, &l, &t, &r, &b); - - GHOST_DisposeRectangle(client_rect); - - wm_get_desktopsize(&scr_w, &scr_h); - sizex = r - l; - sizey = b - t; - posx = l; - posy = scr_h - t - win->sizey; - /* * Ghost sometimes send size or move events when the window hasn't changed. * One case of this is using compiz on linux. To alleviate the problem @@ -1377,15 +1399,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr * It might be good to eventually do that at Ghost level, but that is for * another time. */ - if (win->sizex != sizex || win->sizey != sizey || win->posx != posx || - win->posy != posy) { + if (wm_window_update_size_position(win)) { const bScreen *screen = WM_window_get_active_screen(win); - win->sizex = sizex; - win->sizey = sizey; - win->posx = posx; - win->posy = posy; - /* debug prints */ if (G.debug & G_DEBUG_EVENTS) { const char *state_str; |