diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 12ccd2134cf..f25044b5df7 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -20,9 +20,9 @@ /** \file * \ingroup wm * - * Internal functions for managing UI registrable types (operator, UI and menu types) + * Internal functions for managing UI registrable types (operator, UI and menu types). * - * Also Blenders main event loop (WM_main) + * Also Blender's main event loop (WM_main). */ #include <stddef.h> @@ -87,7 +87,7 @@ static void window_manager_foreach_id(ID *id, LibraryForeachIDData *data) 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 */ + /* 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) { @@ -129,8 +129,7 @@ void WM_operator_free(wmOperator *op) #ifdef WITH_PYTHON if (op->py_instance) { - /* do this first in case there are any __del__ functions or - * similar that use properties */ + /* Do this first in case there are any __del__ functions or similar that use properties. */ BPY_DECREF_RNA_INVALIDATE(op->py_instance); } #endif @@ -180,13 +179,13 @@ void WM_operator_free_all_after(wmWindowManager *wm, struct wmOperator *op) */ void WM_operator_type_set(wmOperator *op, wmOperatorType *ot) { - /* not supported for Python */ + /* Not supported for Python. */ BLI_assert(op->py_instance == NULL); op->type = ot; op->ptr->type = ot->srna; - /* ensure compatible properties */ + /* Ensure compatible properties. */ if (op->properties) { PointerRNA ptr; @@ -208,8 +207,8 @@ static void wm_reports_free(wmWindowManager *wm) WM_event_remove_timer(wm, NULL, wm->reports.reporttimer); } -/* all operations get registered in the windowmanager here */ -/* called on event handling by event_system.c */ +/* All operations get registered in the windowmanager here. */ +/* Called on event handling by event_system.c. */ void wm_operator_register(bContext *C, wmOperator *op) { wmWindowManager *wm = CTX_wm_manager(C); @@ -217,7 +216,7 @@ void wm_operator_register(bContext *C, wmOperator *op) BLI_addtail(&wm->operators, op); - /* only count registered operators */ + /* Only count registered operators. */ while (op) { wmOperator *op_prev = op->prev; if (op->type->flag & OPTYPE_REGISTER) { @@ -230,7 +229,7 @@ void wm_operator_register(bContext *C, wmOperator *op) op = op_prev; } - /* so the console is redrawn */ + /* So the console is redrawn. */ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO_REPORT, NULL); WM_event_add_notifier(C, NC_WM | ND_HISTORY, NULL); } @@ -287,7 +286,7 @@ void WM_keyconfig_init(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); - /* create standard key configs */ + /* Create standard key configs. */ if (wm->defaultconf == NULL) { /* Keep lowercase to match the preset filename. */ wm->defaultconf = WM_keyconfig_new(wm, WM_KEYCONFIG_STR_DEFAULT, false); @@ -299,8 +298,7 @@ void WM_keyconfig_init(bContext *C) wm->userconf = WM_keyconfig_new(wm, WM_KEYCONFIG_STR_DEFAULT " user", false); } - /* initialize only after python init is done, for keymaps that - * use python operators */ + /* Initialize only after python init is done, for keymaps that use python operators. */ if (CTX_py_init_get(C) && (wm->initialized & WM_KEYCONFIG_IS_INIT) == 0) { /* create default key config, only initialize once, * it's persistent across sessions */ @@ -325,7 +323,7 @@ void WM_check(bContext *C) Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); - /* wm context */ + /* WM context. */ if (wm == NULL) { wm = bmain->wm.first; CTX_wm_manager_set(C, wm); @@ -341,18 +339,18 @@ void WM_check(bContext *C) } if (!G.background) { - /* case: fileread */ + /* Case: fileread. */ if ((wm->initialized & WM_WINDOW_IS_INIT) == 0) { WM_keyconfig_init(C); WM_autosave_init(wm); } - /* case: no open windows at all, for old file reads */ + /* Case: no open windows at all, for old file reads. */ wm_window_ghostwindows_ensure(wm); } - /* case: fileread */ - /* note: this runs in bg mode to set the screen context cb */ + /* Case: fileread. */ + /* Note: this runs in background mode to set the screen context cb. */ if ((wm->initialized & WM_WINDOW_IS_INIT) == 0) { ED_screens_init(bmain, wm); wm->initialized |= WM_WINDOW_IS_INIT; @@ -364,7 +362,7 @@ void wm_clear_default_size(bContext *C) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; - /* wm context */ + /* WM context. */ if (wm == NULL) { wm = CTX_data_main(C)->wm.first; CTX_wm_manager_set(C, wm); @@ -382,7 +380,7 @@ void wm_clear_default_size(bContext *C) } } -/* on startup, it adds all data, for matching */ +/* On startup, it adds all data, for matching. */ void wm_add_default(Main *bmain, bContext *C) { wmWindowManager *wm = BKE_libblock_alloc(bmain, ID_WM, "WinMan", 0); @@ -404,7 +402,7 @@ void wm_add_default(Main *bmain, bContext *C) wm_window_make_drawable(wm, win); } -/* context is allowed to be NULL, do not free wm itself (lib_id.c) */ +/* Context is allowed to be NULL, do not free wm itself (lib_id.c). */ void wm_close_and_free(bContext *C, wmWindowManager *wm) { wmWindow *win; @@ -421,7 +419,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm) #endif while ((win = BLI_pophead(&wm->windows))) { - /* prevent draw clear to use screen */ + /* Prevent draw clear to use screen. */ BKE_workspace_active_set(win->workspace_hook, NULL); wm_window_free(C, wm, win); } @@ -476,16 +474,16 @@ void WM_main(bContext *C) while (1) { - /* get events from ghost, handle window events, add to window queues */ + /* Get events from ghost, handle window events, add to window queues. */ wm_window_process_events(C); - /* per window, all events to the window, screen, area and region handlers */ + /* Per window, all events to the window, screen, area and region handlers. */ wm_event_do_handlers(C); - /* events have left notes about changes, we handle and cache it */ + /* Wvents have left notes about changes, we handle and cache it. */ wm_event_do_notifiers(C); - /* execute cached changes draw */ + /* Wxecute cached changes draw. */ wm_draw_update(C); } } |