Fix T51969: Filebrowser "Open File" button disappear when double-click thumbnail
authorJulian Eisel <eiseljulian@gmail.com>
Wed, 19 Jul 2017 19:42:41 +0000 (21:42 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Wed, 19 Jul 2017 19:46:30 +0000 (21:46 +0200)
This reverts commit 82ba89b042e7067 (which caused T51969) and adds an
alternative fix (don't unset area stored in modal handler for fileselect
handlers).

source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/wm_event_system.h

index dad6a6ec317f2229a931014353386b76e643ec30..74f8088f377624c769dd7e95af64269a0655adfd 100644 (file)
@@ -2711,7 +2711,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
        wmWindow *win = CTX_wm_window(C);
 
        /* only allow 1 file selector open per window */
-       for (handler = win->handlers.first; handler; handler = handlernext) {
+       for (handler = win->modalhandlers.first; handler; handler = handlernext) {
                handlernext = handler->next;
                
                if (handler->type == WM_HANDLER_FILESELECT) {
@@ -2725,7 +2725,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
 
                                        if (sfile->op == handler->op) {
                                                CTX_wm_area_set(C, sa);
-                                               wm_handler_fileselect_do(C, &win->handlers, handler, EVT_FILESELECT_CANCEL);
+                                               wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_CANCEL);
                                                break;
                                        }
                                }
@@ -2733,7 +2733,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
 
                        /* if not found we stop the handler without changing the screen */
                        if (!sa)
-                               wm_handler_fileselect_do(C, &win->handlers, handler, EVT_FILESELECT_EXTERNAL_CANCEL);
+                               wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_EXTERNAL_CANCEL);
                }
        }
        
@@ -2744,7 +2744,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
        handler->op_area = CTX_wm_area(C);
        handler->op_region = CTX_wm_region(C);
        
-       BLI_addhead(&win->handlers, handler);
+       BLI_addhead(&win->modalhandlers, handler);
        
        /* check props once before invoking if check is available
         * ensures initial properties are valid */
@@ -2794,7 +2794,8 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
 void WM_event_modal_handler_area_replace(wmWindow *win, const ScrArea *old_area, ScrArea *new_area)
 {
        for (wmEventHandler *handler = win->modalhandlers.first; handler; handler = handler->next) {
-               if (handler->op_area == old_area) {
+               /* fileselect handler is quite special... it needs to keep old area stored in handler, so don't change it */
+               if ((handler->op_area == old_area) && (handler->type != WM_HANDLER_FILESELECT)) {
                        handler->op_area = new_area;
                }
        }
index 2f7ebbc1def687946617e13eb589ac8f1db32cc6..abab7c55f44da46f99949b093eaf4a67001cebc7 100644 (file)
@@ -52,7 +52,7 @@ typedef struct wmEventHandler {
        wmKeyMap *keymap;                   /* pointer to builtin/custom keymaps */
        const rcti *bblocal, *bbwin;              /* optional local and windowspace bb */
 
-       /* modal operator handler and WM_HANDLER_FILESELECT */
+       /* modal operator handler */
        wmOperator *op;                     /* for derived/modal handlers */
        struct ScrArea *op_area;            /* for derived/modal handlers */
        struct ARegion *op_region;          /* for derived/modal handlers */