Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-05-20 18:02:36 +0300
committerJulian Eisel <julian@blender.org>2020-05-20 18:10:25 +0300
commit796412dca0a54a0f35400ea8ebf7a99ce891080d (patch)
tree5f9461b425ab26f52b146f5a71366b8c50c6dc9b /source/blender/windowmanager/intern/wm_event_system.c
parentaa0e98d7079cedbe6c536b29f1ff01474d9a3925 (diff)
UI: Allow registering File Browser as child of other child windows
E.g. when opening the File Browser from the Preferences window, it would be the child of the main window the Preferences belong to. Now it can be a child of the Preferences window itself. The File Browser always stays on top of its parent window. Which avoids some issues with OS window management, see T76418 and T72693. Also removes a now unnecessary workaround to move the child window back to the front after closing the file browser (opening the file browser would move the main window and the file browser to the front). Fixes T76418, T72693.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 8a9f9bc9334..2133ab7892d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3442,19 +3442,13 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
const bool is_temp_screen = WM_window_is_temp_screen(win);
- const bool opens_window = (U.filebrowser_display_type == USER_TEMP_SPACE_DISPLAY_WINDOW);
- /* Don't add the file handler to the temporary window if one is opened, or else it owns the
- * handlers for itself, causing dangling pointers once it's destructed through a handler. It has
- * a parent which should hold the handlers itself. */
- ListBase *modalhandlers = (is_temp_screen && opens_window) ? &win->parent->modalhandlers :
- &win->modalhandlers;
/* Close any popups, like when opening a file browser from the splash. */
- UI_popup_handlers_remove_all(C, modalhandlers);
+ UI_popup_handlers_remove_all(C, &win->modalhandlers);
if (!is_temp_screen) {
/* only allow 1 file selector open per window */
- LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, modalhandlers) {
+ LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &win->modalhandlers) {
if (handler_base->type == WM_HANDLER_TYPE_OP) {
wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
if (handler->is_fileselect == false) {
@@ -3495,7 +3489,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
handler->context.area = CTX_wm_area(C);
handler->context.region = CTX_wm_region(C);
- BLI_addhead(modalhandlers, handler);
+ BLI_addhead(&win->modalhandlers, handler);
/* check props once before invoking if check is available
* ensures initial properties are valid */