From b75ce05c3b0f44871236d75713745d8308c852d3 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 18 May 2020 11:59:02 +0200 Subject: Fix T75292: File-select events not handled while modal handler is active Reviewers: Severin Differential Revision: https://developer.blender.org/D7720 --- source/blender/windowmanager/intern/wm_event_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 2780183c041..d71b722ddb0 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -563,7 +563,7 @@ void wm_event_do_notifiers(bContext *C) static int wm_event_always_pass(const wmEvent *event) { /* some events we always pass on, to ensure proper communication */ - return ISTIMER(event->type) || (event->type == WINDEACTIVATE); + return ISTIMER(event->type) || (event->type == WINDEACTIVATE) || (event->type == EVT_FILESELECT); } /** \} */ -- cgit v1.2.3 From 6ede93bab3ba2dd1a68204eb55697bc1739a32bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 15 May 2020 14:29:27 +0200 Subject: Cleanup: Put GPU_state_init inside gpu_state.c Also put glDisable(GL_DITHER) in it since we don't even use it (but is enabled by default). Also leave GL_MULTISAMPLE on by default since it has no impact on non-MSAA framebuffers. --- source/blender/windowmanager/intern/wm_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index b1eee7509b7..70601ae5e42 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -84,11 +84,11 @@ #include "GPU_batch.h" #include "GPU_batch_presets.h" #include "GPU_context.h" -#include "GPU_draw.h" #include "GPU_framebuffer.h" #include "GPU_immediate.h" #include "GPU_init_exit.h" #include "GPU_platform.h" +#include "GPU_state.h" #include "UI_resources.h" -- cgit v1.2.3 From 54665233ebe67f838b83efa03baf74eb7ab3f882 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 May 2020 16:42:59 +0200 Subject: OpenSubdiv: Cleanup, Remove from legacy SubsurfCCG code The CPU side implementation is done on a new dedicate base ground. The GPU side must be redone anyway. --- source/blender/windowmanager/CMakeLists.txt | 4 ---- source/blender/windowmanager/intern/wm_draw.c | 4 ---- source/blender/windowmanager/intern/wm_init_exit.c | 17 ++++++----------- 3 files changed, 6 insertions(+), 19 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 22fd55cd49a..7c749c60168 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -168,10 +168,6 @@ if(WITH_BUILDINFO) add_definitions(-DWITH_BUILDINFO) endif() -if(WITH_OPENSUBDIV) - add_definitions(-DWITH_OPENSUBDIV) -endif() - if(WITH_INPUT_NDOF) add_definitions(-DWITH_INPUT_NDOF) endif() diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index a01ab1377c1..9a725880c54 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -982,10 +982,6 @@ void wm_draw_update(bContext *C) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; -#ifdef WITH_OPENSUBDIV - BKE_subsurf_free_unused_buffers(); -#endif - GPU_free_unused_buffers(bmain); for (win = wm->windows.first; win; win = win->next) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index a93d4c7bf37..fc3f0c87b69 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -125,6 +125,8 @@ #include "GPU_material.h" #include "BKE_sound.h" +#include "BKE_subdiv.h" + #include "COM_compositor.h" #include "DEG_depsgraph.h" @@ -132,10 +134,6 @@ #include "DRW_engine.h" -#ifdef WITH_OPENSUBDIV -# include "BKE_subsurf.h" -#endif - CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_OPERATORS, "wm.operator"); CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_HANDLERS, "wm.handler"); CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_EVENTS, "wm.event"); @@ -193,9 +191,8 @@ void WM_init_opengl(Main *bmain) GPU_pass_cache_init(); -#ifdef WITH_OPENSUBDIV - BKE_subsurf_osd_init(); -#endif + BKE_subdiv_init(); + opengl_is_init = true; } @@ -576,11 +573,9 @@ void WM_exit_ex(bContext *C, const bool do_python) COM_deinitialize(); #endif - if (opengl_is_init) { -#ifdef WITH_OPENSUBDIV - BKE_subsurf_osd_cleanup(); -#endif + BKE_subdiv_exit(); + if (opengl_is_init) { GPU_free_unused_buffers(G_MAIN); } -- cgit v1.2.3 From 8f10f9d5dc7657b6e35d7cb108660db19034c049 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 18 May 2020 18:51:06 +0200 Subject: Refactor: Move WindowManager and Screen foreach_id to new IDTypeInfo structure. That one was a bit more complicated, and is still only partial refactor (ultimately we want to have a foreach_id callback in SpaceType itself I think...). --- source/blender/windowmanager/intern/wm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 54e6735175d..4d0775b06fa 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -44,8 +44,10 @@ #include "BKE_idprop.h" #include "BKE_idtype.h" #include "BKE_lib_id.h" +#include "BKE_lib_query.h" #include "BKE_main.h" #include "BKE_report.h" +#include "BKE_screen.h" #include "BKE_workspace.h" #include "WM_api.h" @@ -73,6 +75,28 @@ static void window_manager_free_data(ID *id) wm_close_and_free(NULL, (wmWindowManager *)id); } +static void window_manager_foreach_id(ID *id, LibraryForeachIDData *data) +{ + wmWindowManager *wm = (wmWindowManager *)id; + + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { + BKE_LIB_FOREACHID_PROCESS(data, win->scene, IDWALK_CB_USER_ONE); + + /* This pointer can be NULL during old files reading, better be safe than sorry. */ + if (win->workspace_hook != NULL) { + ID *workspace = (ID *)BKE_workspace_active_get(win->workspace_hook); + BKE_LIB_FOREACHID_PROCESS_ID(data, workspace, IDWALK_CB_NOP); + /* allow callback to set a different workspace */ + BKE_workspace_active_set(win->workspace_hook, (WorkSpace *)workspace); + } + if (BKE_lib_query_foreachid_process_flags_get(data) & IDWALK_INCLUDE_UI) { + LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { + BKE_screen_foreach_id_screen_area(data, area); + } + } + } +} + IDTypeInfo IDType_ID_WM = { .id_code = ID_WM, .id_filter = 0, @@ -87,6 +111,7 @@ IDTypeInfo IDType_ID_WM = { .copy_data = NULL, .free_data = window_manager_free_data, .make_local = NULL, + .foreach_id = window_manager_foreach_id, }; #define MAX_OP_REGISTERED 32 -- cgit v1.2.3 From fc06c248edd1ef29e4ca0daeb9f866eb8bd95621 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 18 May 2020 16:23:33 +0200 Subject: Fix T73169: Side by Side Stereo Rendering Glitches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Side by side and top down views were rendered using an unset matrix. This fix will reset the matrix just before copying the views to the screen. Reviewed By: Clément Foucault, Dalai Felinto Differential Revision: https://developer.blender.org/D7777 --- source/blender/windowmanager/intern/wm_draw.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index a01ab1377c1..bf30d7a3328 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -848,6 +848,7 @@ static void wm_draw_window(bContext *C, wmWindow *win) glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(texture)); + wmWindowViewport(win); if (win->stereo3d_format->display_mode == S3D_DISPLAY_SIDEBYSIDE) { wm_stereo3d_draw_sidebyside(win, view); } -- cgit v1.2.3 From 5fe7605f3df5a2a0c6a77cfe082ce15f6ebc25f8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 May 2020 14:58:57 +1000 Subject: Fix the current pixelsize impacting thumbnails --- source/blender/windowmanager/intern/wm_files.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index b9f0e3686db..cc81e4f2715 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1212,6 +1212,7 @@ static ImBuf *blend_file_thumb(const bContext *C, ImBuf *ibuf; BlendThumbnail *thumb; wmWindowManager *wm = CTX_wm_manager(C); + const float pixelsize_old = U.pixelsize; wmWindow *windrawable_old = wm->windrawable; char err_out[256] = "unknown"; @@ -1246,6 +1247,10 @@ static ImBuf *blend_file_thumb(const bContext *C, /* gets scaled to BLEN_THUMB_SIZE */ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + /* Note that with scaling, this ends up being 0.5, + * as it's a thumbnail, we don't need object centers and friends to be 1:1 size. */ + U.pixelsize = 1.0f; + if (scene->camera) { ibuf = ED_view3d_draw_offscreen_imbuf_simple(depsgraph, scene, @@ -1276,6 +1281,8 @@ static ImBuf *blend_file_thumb(const bContext *C, err_out); } + U.pixelsize = pixelsize_old; + /* Reset to old drawable. */ if (windrawable_old) { wm_window_make_drawable(wm, windrawable_old); -- cgit v1.2.3 From eb57377f12123587a894582458c46aa09ef7c61d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 May 2020 22:04:59 +1000 Subject: Fix T76794: Number button cursor overrides eyedropper cursor Pressing 'E' over a number button to pick a distance was keeping left-right arrows instead of using the eye-dropper cursor. Workaround this by clearing the active button before setting the cursor. --- source/blender/windowmanager/intern/wm_event_system.c | 18 +++++++++++++----- source/blender/windowmanager/wm_event_system.h | 5 +++++ source/blender/windowmanager/wm_event_types.h | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index d71b722ddb0..136c24f8056 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -640,11 +640,11 @@ static int wm_handler_ui_call(bContext *C, return WM_HANDLER_CONTINUE; } -static void wm_handler_ui_cancel(bContext *C) +void wm_event_handler_ui_cancel_ex(bContext *C, + wmWindow *win, + ARegion *region, + bool reactivate_button) { - wmWindow *win = CTX_wm_window(C); - ARegion *region = CTX_wm_region(C); - if (!region) { return; } @@ -656,11 +656,19 @@ static void wm_handler_ui_cancel(bContext *C) wmEvent event; wm_event_init_from_window(win, &event); event.type = EVT_BUT_CANCEL; + event.val = reactivate_button ? 0 : 1; handler->handle_fn(C, &event, handler->user_data); } } } +static void wm_event_handler_ui_cancel(bContext *C) +{ + wmWindow *win = CTX_wm_window(C); + ARegion *region = CTX_wm_region(C); + wm_event_handler_ui_cancel_ex(C, win, region, true); +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -1365,7 +1373,7 @@ static int wm_operator_invoke(bContext *C, * while dragging the view or worse, that stay there permanently * after the modal operator has swallowed all events and passed * none to the UI handler */ - wm_handler_ui_cancel(C); + wm_event_handler_ui_cancel(C); } else { WM_operator_free(op); diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index ffa5baae9f1..efcf40d03eb 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -149,6 +149,11 @@ void wm_event_do_depsgraph(bContext *C, bool is_after_open_file); void wm_event_do_refresh_wm_and_depsgraph(bContext *C); void wm_event_do_notifiers(bContext *C); +void wm_event_handler_ui_cancel_ex(bContext *C, + wmWindow *win, + ARegion *region, + bool reactivate_button); + /* wm_event_query.c */ float wm_pressure_curve(float raw_pressure); void wm_tablet_data_from_ghost(const struct GHOST_TabletData *tablet_data, wmTabletData *wmtab); diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index f16056cc91e..ffed86abfe7 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -333,6 +333,7 @@ enum { EVT_BUT_OPEN = 0x5021, /* 20513 */ EVT_MODAL_MAP = 0x5022, /* 20514 */ EVT_DROP = 0x5023, /* 20515 */ + /* When value is 0, re-activate, when 1, don't re-activate the button under the cursor. */ EVT_BUT_CANCEL = 0x5024, /* 20516 */ /* could become gizmo callback */ -- cgit v1.2.3 From 796412dca0a54a0f35400ea8ebf7a99ce891080d Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 20 May 2020 17:02:36 +0200 Subject: 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. --- source/blender/windowmanager/intern/wm.c | 2 +- .../blender/windowmanager/intern/wm_event_system.c | 12 +++------- source/blender/windowmanager/intern/wm_window.c | 26 ++++++++-------------- source/blender/windowmanager/wm_window.h | 5 ++++- 4 files changed, 17 insertions(+), 28 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 4d0775b06fa..9aaaa0e2c81 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -384,7 +384,7 @@ void wm_add_default(Main *bmain, bContext *C) WorkSpaceLayout *layout = BKE_workspace_layout_find_global(bmain, screen, &workspace); CTX_wm_manager_set(C, wm); - win = wm_window_new(bmain, wm, NULL); + win = wm_window_new(bmain, wm, NULL, false); win->scene = CTX_data_scene(C); STRNCPY(win->view_layer_name, CTX_data_view_layer(C)->name); BKE_workspace_active_set(win->workspace_hook, workspace); 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 */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 70601ae5e42..fcb2be0a0bb 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -286,14 +286,15 @@ static int find_free_winid(wmWindowManager *wm) } /* don't change context itself */ -wmWindow *wm_window_new(const Main *bmain, wmWindowManager *wm, wmWindow *parent) +wmWindow *wm_window_new(const Main *bmain, wmWindowManager *wm, wmWindow *parent, bool dialog) { wmWindow *win = MEM_callocN(sizeof(wmWindow), "window"); BLI_addtail(&wm->windows, win); win->winid = find_free_winid(wm); - win->parent = (parent && parent->parent) ? parent->parent : parent; + /* Dialogs may have a child window as parent. Otherwise, a child must not be a parent too. */ + win->parent = (!dialog && parent && parent->parent) ? parent->parent : parent; win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo 3D Format (window)"); win->workspace_hook = BKE_workspace_instance_hook_create(bmain); @@ -307,8 +308,9 @@ wmWindow *wm_window_copy(Main *bmain, const bool duplicate_layout, const bool child) { + const bool is_dialog = GHOST_IsDialogWindow(win_src->ghostwin); wmWindow *win_parent = (child) ? win_src : win_src->parent; - wmWindow *win_dst = wm_window_new(bmain, wm, win_parent); + wmWindow *win_dst = wm_window_new(bmain, wm, win_parent, is_dialog); WorkSpace *workspace = WM_window_get_active_workspace(win_src); WorkSpaceLayout *layout_old = WM_window_get_active_layout(win_src); WorkSpaceLayout *layout_new; @@ -417,7 +419,6 @@ void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) { wmWindow *win_other; - const bool is_dialog = (G.background == false) ? GHOST_IsDialogWindow(win->ghostwin) : false; /* First check if there is another main window remaining. */ for (win_other = wm->windows.first; win_other; win_other = win_other->next) { @@ -431,20 +432,11 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) return; } - /* Close child windows and bring windows back to front that dialogs have pushed behind the main - * window. */ - LISTBASE_FOREACH (wmWindow *, iter_win, &wm->windows) { + /* Close child windows */ + LISTBASE_FOREACH_MUTABLE (wmWindow *, iter_win, &wm->windows) { if (iter_win->parent == win) { wm_window_close(C, wm, iter_win); } - else { - if (G.background == false) { - if (is_dialog && iter_win != win && iter_win->parent && - (GHOST_GetWindowState(iter_win->ghostwin) != GHOST_kWindowStateMinimized)) { - wm_window_raise(iter_win); - } - } - } } bScreen *screen = WM_window_get_active_screen(win); @@ -834,7 +826,7 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win_prev = CTX_wm_window(C); - wmWindow *win = wm_window_new(CTX_data_main(C), wm, win_prev); + wmWindow *win = wm_window_new(CTX_data_main(C), wm, win_prev, false); win->posx = rect->xmin; win->posy = rect->ymin; @@ -905,7 +897,7 @@ wmWindow *WM_window_open_temp(bContext *C, /* add new window? */ if (win == NULL) { - win = wm_window_new(bmain, wm, win_prev); + win = wm_window_new(bmain, wm, win_prev, dialog); win->posx = rect.xmin; win->posy = rect.ymin; diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 45cfe1431d7..5ca5711b4f2 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -33,7 +33,10 @@ void wm_ghost_exit(void); void wm_get_screensize(int *r_width, int *r_height); void wm_get_desktopsize(int *r_width, int *r_height); -wmWindow *wm_window_new(const struct Main *bmain, wmWindowManager *wm, wmWindow *parent); +wmWindow *wm_window_new(const struct Main *bmain, + wmWindowManager *wm, + wmWindow *parent, + bool dialog); wmWindow *wm_window_copy(struct Main *bmain, wmWindowManager *wm, wmWindow *win_src, -- cgit v1.2.3 From b4a6418e2bd3c350fdd87b29b9862e2e5b9b0e28 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 May 2020 12:15:32 +1000 Subject: Cleanup: add doxy sections for event queue handling The main function to handle events didn't have it's own section. --- .../blender/windowmanager/intern/wm_event_system.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 136c24f8056..32b6b8b9c4a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2669,6 +2669,12 @@ static int wm_handlers_do_gizmo_handler(bContext *C, return action; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Handle Single Event (All Handler Types) + * \{ */ + static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers) { const bool do_debug_handler = @@ -2970,6 +2976,14 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) return action; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Event Queue Utilities + * + * Utilities used by #wm_event_do_handlers. + * \{ */ + static bool wm_event_inside_rect(const wmEvent *event, const rcti *rect) { if (wm_event_always_pass(event)) { @@ -3134,6 +3148,14 @@ static void wm_event_free_and_remove_from_queue_if_valid(wmEvent *event) } } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Main Event Queue (Every Window) + * + * Handle events for all windows, run from the #WM_main event loop. + * \{ */ + /* called in main loop */ /* goes over entire hierarchy: events -> window -> screen -> area -> region */ void wm_event_do_handlers(bContext *C) -- cgit v1.2.3 From 6b8555e01cb127479286f603e3f0b772bd1f416e Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 24 May 2020 17:26:31 +0200 Subject: VR: Fix big performance bottleneck for simple scenes Blender's main loop puts the main thread to sleep for 5ms if no user input was received from the OS. We never want that to happen while the VR session is running, which runs on the main thread too. For simpler scenes, where the viewport already draws fast, this may have quite some impact. E.g. in my tests, the classroom scene went from ~55 to quite stable 90 FPS in solid mode (total render time as measured and averaged by Windows Mixed Reality utilities). With Eevee, it only went from 41 to 47 FPS. In complex files, there's barely a difference. E.g. less than 1 FPS increase in a Spring file (both Solid mode and Eevee). --- source/blender/windowmanager/xr/intern/wm_xr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/xr/intern/wm_xr.c b/source/blender/windowmanager/xr/intern/wm_xr.c index 69c9034d51f..90f30809136 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr.c +++ b/source/blender/windowmanager/xr/intern/wm_xr.c @@ -126,7 +126,12 @@ void wm_xr_exit(wmWindowManager *wm) bool wm_xr_events_handle(wmWindowManager *wm) { if (wm->xr.runtime && wm->xr.runtime->context) { - return GHOST_XrEventsHandle(wm->xr.runtime->context); + GHOST_XrEventsHandle(wm->xr.runtime->context); + + /* wm_window_process_events() uses the return value to determine if it can put the main thread + * to sleep for some milliseconds. We never want that to happen while the VR session runs on + * the main thread. So always return true. */ + return true; } return false; } -- cgit v1.2.3 From c15bb3b55faed1a8e5c9913553837539301fbe2e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 May 2020 15:35:51 +1000 Subject: Fix T77031: Blender as pymodule crashes when rendering No longer enforce WITH_HEADLESS when building as a Python module as it disables GPU access which is needed for rendering. --- source/blender/windowmanager/intern/wm_splash_screen.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index f209a2f31a3..17dc3e22984 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -164,6 +164,7 @@ static void wm_block_splash_add_labels(uiBlock *block, int x, int y) #endif /* WITH_BUILDINFO */ } +#ifndef WITH_HEADLESS static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf) { uchar *rct = (uchar *)ibuf->rect; @@ -214,6 +215,7 @@ static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf) } } } +#endif /* WITH_HEADLESS */ static ImBuf *wm_block_splash_image(int width, int *r_height) { @@ -254,6 +256,7 @@ static ImBuf *wm_block_splash_image(int width, int *r_height) return ibuf; #else + UNUSED_VARS(width, r_height); return NULL; #endif } -- cgit v1.2.3