diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-11-15 18:10:55 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-11-15 18:10:55 +0300 |
commit | ef71668ac5d951736fe51abf4529e604867d45fd (patch) | |
tree | 8b73f25d3e1a43e1fd5a834c5999648303b46a6a | |
parent | 97f3626533b42c08f8e8e85b66e412b315a39430 (diff) | |
parent | 49db3f6bf10d4b3cabe5f722ff2dd480ce438af6 (diff) |
Merge remote-tracking branch 'origin/blender-v2.81-release'
-rw-r--r-- | source/blender/editors/include/ED_fileselect.h | 8 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 32 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 5 |
5 files changed, 40 insertions, 18 deletions
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 83890c1621c..85b9cf46574 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -99,7 +99,9 @@ struct FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile); short ED_fileselect_set_params(struct SpaceFile *sfile); void ED_fileselect_set_params_from_userdef(struct SpaceFile *sfile); -void ED_fileselect_params_to_userdef(struct SpaceFile *sfile, int temp_win_size[]); +void ED_fileselect_params_to_userdef(struct SpaceFile *sfile, + int temp_win_size[], + const bool is_maximized); void ED_fileselect_reset_params(struct SpaceFile *sfile); @@ -130,6 +132,10 @@ void ED_fileselect_clear(struct wmWindowManager *wm, struct ScrArea *sa, struct void ED_fileselect_exit(struct wmWindowManager *wm, struct ScrArea *sa, struct SpaceFile *sfile); +void ED_fileselect_window_params_get(const struct wmWindow *win, + int win_size[2], + bool *is_maximized); + int ED_path_extension_type(const char *path); int ED_file_extension_icon(const char *path); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index bb3906a961b..f8adf9b707a 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -325,6 +325,17 @@ short ED_fileselect_set_params(SpaceFile *sfile) /* The subset of FileSelectParams.flag items we store into preferences. */ #define PARAMS_FLAGS_REMEMBERED (FILE_HIDE_DOT | FILE_SORT_INVERT) +void ED_fileselect_window_params_get(const wmWindow *win, int win_size[2], bool *is_maximized) +{ + /* Get DPI/pixelsize independent size to be stored in preferences. */ + WM_window_set_dpi(win); /* Ensure the DPI is taken from the right window. */ + + win_size[0] = WM_window_pixels_x(win) / UI_DPI_FAC; + win_size[1] = WM_window_pixels_y(win) / UI_DPI_FAC; + + *is_maximized = WM_window_is_maximized(win); +} + void ED_fileselect_set_params_from_userdef(SpaceFile *sfile) { wmOperator *op = sfile->op; @@ -358,7 +369,9 @@ void ED_fileselect_set_params_from_userdef(SpaceFile *sfile) * \param temp_win_size: If the browser was opened in a temporary window, * pass its size here so we can store that in the preferences. Otherwise NULL. */ -void ED_fileselect_params_to_userdef(SpaceFile *sfile, int temp_win_size[2]) +void ED_fileselect_params_to_userdef(SpaceFile *sfile, + int temp_win_size[2], + const bool is_maximized) { UserDef_FileSpaceData *sfile_udata_new = &U.file_space_data; UserDef_FileSpaceData sfile_udata_old = U.file_space_data; @@ -370,7 +383,7 @@ void ED_fileselect_params_to_userdef(SpaceFile *sfile, int temp_win_size[2]) sfile_udata_new->flag = sfile->params->flag & PARAMS_FLAGS_REMEMBERED; sfile_udata_new->filter_id = sfile->params->filter_id; - if (temp_win_size) { + if (temp_win_size && !is_maximized) { sfile_udata_new->temp_win_sizex = temp_win_size[0]; sfile_udata_new->temp_win_sizey = temp_win_size[1]; } @@ -958,15 +971,16 @@ void ED_fileselect_exit(wmWindowManager *wm, ScrArea *sa, SpaceFile *sfile) } if (sfile->op) { wmWindow *temp_win = WM_window_is_temp_screen(wm->winactive) ? wm->winactive : NULL; - int win_size[2]; - if (temp_win) { - /* Get DPI/pixelsize independent size to be stored in preferences. */ - WM_window_set_dpi(temp_win); /* Ensure the DPI is taken from the right window. */ - win_size[0] = WM_window_pixels_x(temp_win) / UI_DPI_FAC; - win_size[1] = WM_window_pixels_y(temp_win) / UI_DPI_FAC; + int win_size[2]; + bool is_maximized; + + ED_fileselect_window_params_get(temp_win, win_size, &is_maximized); + ED_fileselect_params_to_userdef(sfile, win_size, is_maximized); + } + else { + ED_fileselect_params_to_userdef(sfile, NULL, false); } - ED_fileselect_params_to_userdef(sfile, temp_win ? win_size : NULL); WM_event_fileselect_event(wm, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL); sfile->op = NULL; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f7abfaf565e..3abb3d8bfac 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -111,6 +111,7 @@ int WM_window_pixels_y(const struct wmWindow *win); void WM_window_rect_calc(const struct wmWindow *win, struct rcti *r_rect); void WM_window_screen_rect_calc(const struct wmWindow *win, struct rcti *r_rect); bool WM_window_is_fullscreen(struct wmWindow *win); +bool WM_window_is_maximized(struct wmWindow *win); void WM_windows_scene_data_sync(const ListBase *win_lb, struct Scene *scene) ATTR_NONNULL(); struct Scene *WM_windows_scene_get_from_screen(const struct wmWindowManager *wm, diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index f52e958c4ca..c63bc24d58e 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2401,13 +2401,9 @@ static int wm_handler_fileselect_do(bContext *C, if (screen->temp && (file_sa->spacetype == SPACE_FILE)) { int win_size[2]; - - /* Get DPI/pixelsize independent size to be stored in preferences. */ - WM_window_set_dpi(temp_win); /* Ensure the DPI is taken from the right window. */ - win_size[0] = WM_window_pixels_x(temp_win) / UI_DPI_FAC; - win_size[1] = WM_window_pixels_y(temp_win) / UI_DPI_FAC; - - ED_fileselect_params_to_userdef(file_sa->spacedata.first, win_size); + bool is_maximized; + ED_fileselect_window_params_get(temp_win, win_size, &is_maximized); + ED_fileselect_params_to_userdef(file_sa->spacedata.first, win_size, is_maximized); if (BLI_listbase_is_single(&file_sa->spacedata)) { BLI_assert(ctx_win != temp_win); @@ -2437,7 +2433,7 @@ static int wm_handler_fileselect_do(bContext *C, } if (!temp_win && ctx_sa->full) { - ED_fileselect_params_to_userdef(ctx_sa->spacedata.first, NULL); + ED_fileselect_params_to_userdef(ctx_sa->spacedata.first, NULL, false); ED_screen_full_prevspace(C, ctx_sa); } } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index fa2320585d7..020589dcf3d 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -2191,6 +2191,11 @@ bool WM_window_is_fullscreen(wmWindow *win) return win->windowstate == GHOST_kWindowStateFullScreen; } +bool WM_window_is_maximized(wmWindow *win) +{ + return win->windowstate == GHOST_kWindowStateMaximized; +} + /** \} */ /* -------------------------------------------------------------------- */ |