diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-20 11:02:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-20 11:02:28 +0300 |
commit | e63eb6ed2696c5d52b35972ab7a1bbda7b5bdc90 (patch) | |
tree | 94ae2928a62f96acd8d78796dd2f900220d5aed8 /source/blender/windowmanager/intern | |
parent | 44ca116ca2aec7651e1fdab9cba6f63c244a8f93 (diff) |
Cleanup: comment line length (windowmanager)
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 81 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 58 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files_link.c | 30 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture_ops.c | 14 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 25 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_jobs.c | 29 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 51 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_type.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 29 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_stereo.c | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 14 |
13 files changed, 217 insertions, 134 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index d61f9be170d..fbe3253878f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -123,7 +123,8 @@ wmEvent *wm_event_add_ex(wmWindow *win, BLI_addtail(&win->queue, event); } else { - /* note, strictly speaking this breaks const-correctness, however we're only changing 'next' member */ + /* Note: strictly speaking this breaks const-correctness, + * however we're only changing 'next' member. */ BLI_insertlinkafter(&win->queue, (void *)event_to_add_after, event); } return event; @@ -354,7 +355,8 @@ void wm_event_do_depsgraph(bContext *C) } /** - * Was part of #wm_event_do_notifiers, split out so it can be called once before entering the #WM_main loop. + * Was part of #wm_event_do_notifiers, + * split out so it can be called once before entering the #WM_main loop. * This ensures operators don't run before the UI and depsgraph are initialized. */ void wm_event_do_refresh_wm_and_depsgraph(bContext *C) @@ -504,7 +506,12 @@ void wm_event_do_notifiers(bContext *C) /* XXX context in notifiers? */ CTX_wm_window_set(C, win); - /* printf("notifier win %d screen %s cat %x\n", win->winid, win->screen->id.name + 2, note->category); */ +# if 0 + printf("notifier win %d screen %s cat %x\n", + win->winid, + win->screen->id.name + 2, + note->category); +# endif ED_screen_do_listen(C, note); for (ar = screen->regionbase.first; ar; ar = ar->next) { @@ -1031,9 +1038,9 @@ static int wm_operator_exec(bContext *C, } } - /* XXX Disabled the repeat check to address part 2 of #31840. - * Carefully checked all calls to wm_operator_exec and WM_operator_repeat, don't see any reason - * why this was needed, but worth to note it in case something turns bad. (mont29) */ + /* XXX(mont29) Disabled the repeat check to address part 2 of T31840. + * Carefully checked all calls to wm_operator_exec and WM_operator_repeat, don't see any reason + * why this was needed, but worth to note it in case something turns bad. */ if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) /* && repeat == 0 */) { wm_operator_reports(C, op, retval, false); } @@ -1362,7 +1369,8 @@ static int wm_operator_invoke(bContext *C, { int retval = OPERATOR_PASS_THROUGH; - /* this is done because complicated setup is done to call this function that is better not duplicated */ + /* This is done because complicated setup is done to call this function + * that is better not duplicated. */ if (poll_only) { return WM_operator_poll(C, ot); } @@ -1422,8 +1430,8 @@ static int wm_operator_invoke(bContext *C, CLOG_ERROR(WM_LOG_OPERATORS, "invalid operator call '%s'", op->idname); } - /* Note, if the report is given as an argument then assume the caller will deal with displaying them - * currently python only uses this */ + /* Note, if the report is given as an argument then assume the caller will deal with displaying + * them currently Python only uses this. */ if (!(retval & OPERATOR_HANDLED) && (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED))) { /* only show the report if the report list was not given in the function */ wm_operator_reports(C, op, retval, (reports != NULL)); @@ -1992,8 +2000,9 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi) } } - /* only keymap entry with keymodifier is checked, means all keys without modifier get handled too. */ - /* that is currently needed to make overlapping events work (when you press A - G fast or so). */ + /* Only keymap entry with keymodifier is checked, + * means all keys without modifier get handled too. */ + /* That is currently needed to make overlapping events work (when you press A - G fast or so). */ if (kmi->keymodifier) { if (winevent->keymodifier != kmi->keymodifier) { return false; @@ -2274,7 +2283,8 @@ static int wm_handler_operator_call(bContext *C, return WM_HANDLER_BREAK; } -/* fileselect handlers are only in the window queue, so it's safe to switch screens or area types */ +/* Fileselect handlers are only in the window queue, + * so it's safe to switch screens or area types. */ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHandler_Op *handler, @@ -3176,7 +3186,8 @@ void wm_event_do_handlers(bContext *C) CTX_wm_area_set(C, area_event_inside(C, &event->x)); CTX_wm_region_set(C, region_event_inside(C, &event->x)); - /* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */ + /* MVC demands to not draw in event handlers... + * but we need to leave it for ogl selecting etc. */ wm_window_make_drawable(wm, win); wm_region_mouse_co(C, event); @@ -3209,7 +3220,8 @@ void wm_event_do_handlers(bContext *C) /* Note: setting subwin active should be done here, after modal handlers have been done */ if (event->type == MOUSEMOVE) { - /* state variables in screen, cursors. Also used in wm_draw.c, fails for modal handlers though */ + /* State variables in screen, cursors. + * Also used in wm_draw.c, fails for modal handlers though. */ ED_screen_set_active_region(C, win, &event->x); /* for regions having custom cursors */ wm_paintcursor_test(C, event); @@ -3276,7 +3288,8 @@ void wm_event_do_handlers(bContext *C) } CTX_wm_area_set(C, NULL); - /* NOTE: do not escape on WM_HANDLER_BREAK, mousemove needs handled for previous area */ + /* NOTE: do not escape on WM_HANDLER_BREAK, + * mousemove needs handled for previous area. */ } } @@ -3466,7 +3479,8 @@ void WM_event_modal_handler_area_replace(wmWindow *win, const ScrArea *old_area, LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { if (handler_base->type == WM_HANDLER_TYPE_OP) { wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; - /* fileselect handler is quite special... it needs to keep old area stored in handler, so don't change it */ + /* Fileselect handler is quite special... + * it needs to keep old area stored in handler, so don't change it. */ if ((handler->context.area == old_area) && (handler->is_fileselect == false)) { handler->context.area = new_area; } @@ -3485,7 +3499,8 @@ void WM_event_modal_handler_region_replace(wmWindow *win, LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { if (handler_base->type == WM_HANDLER_TYPE_OP) { wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; - /* fileselect handler is quite special... it needs to keep old region stored in handler, so don't change it */ + /* Fileselect handler is quite special... + * it needs to keep old region stored in handler, so don't change it. */ if ((handler->context.region == old_region) && (handler->is_fileselect == false)) { handler->context.region = new_region; handler->context.region_type = new_region ? new_region->regiontype : RGN_TYPE_WINDOW; @@ -4151,8 +4166,9 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi wmWindow *owin; wmEventHandler *handler; - /* let's skip windows having modal handlers now */ - /* potential XXX ugly... I wouldn't have added a modalhandlers list (introduced in rev 23331, ton) */ + /* Let's skip windows having modal handlers now */ + /* potential XXX ugly... I wouldn't have added a modalhandlers list + * (introduced in rev 23331, ton). */ for (handler = win->modalhandlers.first; handler; handler = handler->next) { if (ELEM(handler->type, WM_HANDLER_TYPE_UI, WM_HANDLER_TYPE_OP)) { return NULL; @@ -4230,11 +4246,15 @@ void wm_event_add_ghostevent( return; } - /* Having both, event and evt, can be highly confusing to work with, but is necessary for - * our current event system, so let's clear things up a bit: - * - data added to event only will be handled immediately, but will not be copied to the next event - * - data added to evt only stays, but is handled with the next event -> execution delay - * - data added to event and evt stays and is handled immediately + /** + * Having both, \a event and \a evt, can be highly confusing to work with, + * but is necessary for our current event system, so let's clear things up a bit: + * + * - Data added to event only will be handled immediately, + * but will not be copied to the next event. + * - Data added to \a evt only stays, + * but is handled with the next event -> execution delay. + * - Data added to event and \a evt stays and is handled immediately. */ wmEvent event, *evt = win->eventstate; @@ -4346,7 +4366,8 @@ void wm_event_add_ghostevent( if (win->active == 0) { int cx, cy; - /* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */ + /* Entering window, update mouse pos. + * (ghost sends win-activate *after* the mouseclick in window!) */ wm_get_cursor_position(win, &cx, &cy); event.x = evt->x = cx; @@ -4505,14 +4526,16 @@ void wm_event_add_ghostevent( event.keymodifier = 0; } - /* this case happens with an external numpad, and also when using 'dead keys' (to compose complex latin - * characters e.g.), it's not really clear why. - * Since it's impossible to map a key modifier to an unknown key, it shouldn't harm to clear it. */ + /* this case happens with an external numpad, and also when using 'dead keys' + * (to compose complex latin characters e.g.), it's not really clear why. + * Since it's impossible to map a key modifier to an unknown key, + * it shouldn't harm to clear it. */ if (event.keymodifier == UNKNOWNKEY) { evt->keymodifier = event.keymodifier = 0; } - /* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */ + /* if test_break set, it catches this. Do not set with modifier presses. + * XXX Keep global for now? */ if ((event.type == ESCKEY && event.val == KM_PRESS) && /* check other modifiers because ms-windows uses these to bring up the task manager */ (event.shift == 0 && event.ctrl == 0 && event.alt == 0)) { diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e55afeb6f4c..f9e420a987f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -20,7 +20,8 @@ /** \file * \ingroup wm * - * User level access for blend file read/write, file-history and userprefs (including relevant operators). + * User level access for blend file read/write, file-history and user-preferences + * (including relevant operators). */ /* placed up here because of crappy @@ -169,11 +170,13 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist) /* reset active window */ CTX_wm_window_set(C, active_win); - /* XXX Hack! We have to clear context menu here, because removing all modalhandlers above frees the active menu - * (at least, in the 'startup splash' case), causing use-after-free error in later handling of the button - * callbacks in UI code (see ui_apply_but_funcs_after()). - * Tried solving this by always NULL-ing context's menu when setting wm/win/etc., but it broke popups refreshing - * (see T47632), so for now just handling this specific case here. */ + /* XXX Hack! We have to clear context menu here, because removing all modalhandlers + * above frees the active menu (at least, in the 'startup splash' case), + * causing use-after-free error in later handling of the button callbacks in UI code + * (see ui_apply_but_funcs_after()). + * Tried solving this by always NULL-ing context's menu when setting wm/win/etc., + * but it broke popups refreshing (see T47632), + * so for now just handling this specific case here. */ CTX_wm_menu_set(C, NULL); ED_editors_exit(G_MAIN, true); @@ -737,12 +740,18 @@ static bool wm_app_template_has_userpref(const char *app_template) * Called on startup, (context entirely filled with NULLs) * or called for 'New File' both startup.blend and userpref.blend are checked. * - * \param use_factory_settings: Ignore on-disk startup file, use bundled ``datatoc_startup_blend`` instead. + * \param use_factory_settings: + * Ignore on-disk startup file, use bundled ``datatoc_startup_blend`` instead. * Used for "Restore Factory Settings". + * * \param use_userdef: Load factory settings as well as startup file. * Disabled for "File New" we don't want to reload preferences. - * \param filepath_startup_override: Optional path pointing to an alternative blend file (may be NULL). - * \param app_template_override: Template to use instead of the template defined in user-preferences. + * + * \param filepath_startup_override: + * Optional path pointing to an alternative blend file (may be NULL). + * + * \param app_template_override: + * Template to use instead of the template defined in user-preferences. * When not-null, this is written into the user preferences. */ void wm_homefile_read(bContext *C, @@ -762,9 +771,11 @@ void wm_homefile_read(bContext *C, char filepath_startup[FILE_MAX]; char filepath_userdef[FILE_MAX]; - /* When 'app_template' is set: '{BLENDER_USER_CONFIG}/{app_template}' */ + /* When 'app_template' is set: + * '{BLENDER_USER_CONFIG}/{app_template}' */ char app_template_system[FILE_MAX]; - /* When 'app_template' is set: '{BLENDER_SYSTEM_SCRIPTS}/startup/bl_app_templates_system/{app_template}' */ + /* When 'app_template' is set: + * '{BLENDER_SYSTEM_SCRIPTS}/startup/bl_app_templates_system/{app_template}' */ char app_template_config[FILE_MAX]; /* Indicates whether user preferences were really load from memory. @@ -779,7 +790,8 @@ void wm_homefile_read(bContext *C, bool read_userdef_from_memory = false; eBLOReadSkip skip_flags = use_userdef ? 0 : BLO_READ_SKIP_USERDEF; - /* True if we load startup.blend from memory or use app-template startup.blend which the user hasn't saved. */ + /* True if we load startup.blend from memory + * or use app-template startup.blend which the user hasn't saved. */ bool is_factory_startup = true; /* options exclude eachother */ @@ -998,8 +1010,9 @@ void wm_homefile_read(bContext *C, BLI_strncpy(U.app_template, app_template_override, sizeof(U.app_template)); } - /* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise - * can remove this eventually, only in a 2.53 and older, now its not written */ + /* Prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. + * Screws up autosaves otherwise can remove this eventually, + * only in a 2.53 and older, now its not written. */ G.fileflags &= ~G_FILE_RELATIVE_REMAP; bmain = CTX_data_main(C); @@ -1014,8 +1027,8 @@ void wm_homefile_read(bContext *C, wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm); if (use_factory_settings) { - /* Clear keymaps because the current default keymap may have been initialized from user preferences, - * which have been reset. */ + /* Clear keymaps because the current default keymap may have been initialized + * from user preferences, which have been reset. */ for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) { if (wm->defaultconf) { wm->defaultconf->flag &= ~KEYCONF_INIT_DEFAULT; @@ -1322,12 +1335,14 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo } } - /* Call pre-save callbacks befores writing preview, that way you can generate custom file thumbnail... */ + /* Call pre-save callbacks befores writing preview, + * that way you can generate custom file thumbnail. */ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE); /* blend file thumbnail */ - /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */ - /* Main now can store a .blend thumbnail, useful for background mode or thumbnail customization. */ + /* Save before exit_editmode, otherwise derivedmeshes for shared data corrupt T27765. */ + /* Main now can store a '.blend' thumbnail, useful for background mode + * or thumbnail customization. */ main_thumb = thumb = bmain->blen_thumb; if ((U.flag & USER_SAVE_PREVIEWS) && BLI_thread_is_main()) { ibuf_thumb = blend_file_thumb(C, CTX_data_scene(C), CTX_wm_screen(C), &thumb); @@ -2409,8 +2424,9 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U save_set_compress(op); save_set_filepath(C, op); - /* if we're saving for the first time and prefer relative paths - any existing paths will be absolute, - * enable the option to remap paths to avoid confusion [#37240] */ + /* if we're saving for the first time and prefer relative paths - + * any existing paths will be absolute, + * enable the option to remap paths to avoid confusion T37240. */ if ((G.relbase_valid == false) && (U.flag & USER_RELPATHS)) { PropertyRNA *prop = RNA_struct_find_property(op->ptr, "relative_remap"); if (!RNA_property_is_set(op->ptr, prop)) { diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 14c032e6ffa..0cb3e5e3088 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -152,7 +152,9 @@ typedef struct WMLinkAppendData { LinkNodePair items; int num_libraries; int num_items; - int flag; /* Combines eFileSel_Params_Flag from DNA_space_types.h and BLO_LibLinkFlags from BLO_readfile.h */ + /** Combines #eFileSel_Params_Flag from DNA_space_types.h and + * BLO_LibLinkFlags from BLO_readfile.h */ + int flag; /* Internal 'private' data */ MemArena *memarena; @@ -511,10 +513,11 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) /* TODO(sergey): Use proper flag for tagging here. */ /* TODO (dalai): Temporary solution! - * Ideally we only need to tag the new objects themselves, not the scene. This way we'll avoid flush of - * collection properties to all objects and limit update to the particular object only. - * But afraid first we need to change collection evaluation in DEG according to depsgraph manifesto. - */ + * Ideally we only need to tag the new objects themselves, not the scene. + * This way we'll avoid flush of collection properties + * to all objects and limit update to the particular object only. + * But afraid first we need to change collection evaluation in DEG + * according to depsgraph manifesto. */ DEG_id_tag_update(&scene->id, 0); /* recreate dependency graph to include new objects */ @@ -662,7 +665,8 @@ static void lib_relocate_do(Main *bmain, const short idcode = id ? GS(id->name) : 0; if (!id || !BKE_idcode_is_linkable(idcode)) { - /* No need to reload non-linkable datatypes, those will get relinked with their 'users ID'. */ + /* No need to reload non-linkable datatypes, + * those will get relinked with their 'users ID'. */ continue; } @@ -719,7 +723,8 @@ static void lib_relocate_do(Main *bmain, BLI_assert(old_id); if (do_reload) { - /* Since we asked for placeholders in case of missing IDs, we expect to always get a valid one. */ + /* Since we asked for placeholders in case of missing IDs, + * we expect to always get a valid one. */ BLI_assert(new_id); } if (new_id) { @@ -747,9 +752,10 @@ static void lib_relocate_do(Main *bmain, } if (old_id->us > 0 && new_id && old_id->lib == new_id->lib) { - /* Note that this *should* not happen - but better be safe than sorry in this area, at least until we are - * 100% sure this cannot ever happen. - * Also, we can safely assume names were unique so far, so just replacing '.' by '~' should work, + /* Note that this *should* not happen - but better be safe than sorry in this area, + * at least until we are 100% sure this cannot ever happen. + * Also, we can safely assume names were unique so far, + * so just replacing '.' by '~' should work, * but this does not totally rules out the possibility of name collision. */ size_t len = strlen(old_id->name); size_t dot_pos; @@ -800,8 +806,8 @@ static void lib_relocate_do(Main *bmain, } } - /* Some datablocks can get reloaded/replaced 'silently' because they are not linkable (shape keys e.g.), - * so we need another loop here to clear old ones if possible. */ + /* Some datablocks can get reloaded/replaced 'silently' because they are not linkable + * (shape keys e.g.), so we need another loop here to clear old ones if possible. */ lba_idx = set_listbasepointers(bmain, lbarray); while (lba_idx--) { ID *id, *id_next; diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 1b2ecf4c1ab..b12bb89ea9f 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -255,7 +255,8 @@ static void wm_gesture_draw_rect(wmGesture *gt) immUnbindProgram(); - // wm_gesture_draw_line(gt); // draws a diagonal line in the lined box to test wm_gesture_draw_line + /* draws a diagonal line in the lined box to test wm_gesture_draw_line */ + // wm_gesture_draw_line(gt); } static void wm_gesture_draw_circle(wmGesture *gt) diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c index 00f9f078f91..9161c97374c 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.c +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -267,7 +267,8 @@ void WM_gesture_box_cancel(bContext *C, wmOperator *op) /** \name Circle Gesture * * Currently only used for selection or modal paint stuff, - * calls ``exec`` while hold mouse, exits on release (with no difference between cancel and confirm). + * calls #wmOperator.exec while hold mouse, exits on release + * (with no difference between cancel and confirm). * * \{ */ @@ -286,7 +287,8 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event) gesture->wait_for_input = wait_for_input; - /* Starting with the mode starts immediately, like having 'wait_for_input' disabled (some tools use this). */ + /* Starting with the mode starts immediately, + * like having 'wait_for_input' disabled (some tools use this). */ if (gesture->wait_for_input == false) { gesture->is_active = true; gesture_circle_apply(C, op); @@ -314,8 +316,9 @@ static void gesture_circle_apply(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "y", rect->ymin); RNA_int_set(op->ptr, "radius", rect->xmax); - /* When 'wait_for_input' is false, use properties to get the selection state. - * typically tool settings. This is done so executing as a mode can select & de-select, see: T58594. */ + /* When 'wait_for_input' is false, + * use properties to get the selection state (typically tool settings). + * This is done so executing as a mode can select & de-select, see: T58594. */ if (gesture->wait_for_input) { gesture_modal_state_to_operator(op, gesture->modal_state); } @@ -476,7 +479,8 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event) wmEvent tevent; wm_event_init_from_window(window, &tevent); - /* We want to get coord from start of drag, not from point where it becomes a tweak event, see T40549 */ + /* We want to get coord from start of drag, + * not from point where it becomes a tweak event, see T40549. */ tevent.x = rect->xmin + gesture->winrct.xmin; tevent.y = rect->ymin + gesture->winrct.ymin; if (gesture->event_type == LEFTMOUSE) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index ad3cc50ea13..97ba9190351 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -237,7 +237,8 @@ void WM_init(bContext *C, int argc, const char **argv) BLF_init(); BLT_lang_init(); - /* Must call first before doing any .blend file reading, since versionning code may create new IDs... See T57066. */ + /* Must call first before doing any '.blend' file reading, + * since versionning code may create new IDs... See T57066. */ BLT_lang_set(NULL); /* Init icons before reading .blend files for preview icons, which can @@ -408,7 +409,8 @@ static int wm_exit_handler(bContext *C, const wmEvent *event, void *userdata) } /** - * Cause a delayed #WM_exit() call to avoid leaking memory when trying to exit from within operators. + * Cause a delayed #WM_exit() + * call to avoid leaking memory when trying to exit from within operators. */ void wm_exit_schedule_delayed(const bContext *C) { @@ -417,7 +419,8 @@ void wm_exit_schedule_delayed(const bContext *C) wmWindow *win = CTX_wm_window(C); - /* Use modal UI handler for now. Could add separate WM handlers or so, but probably not worth it. */ + /* Use modal UI handler for now. + * Could add separate WM handlers or so, but probably not worth it. */ WM_event_add_ui_handler(C, &win->modalhandlers, wm_exit_handler, NULL, NULL, 0); WM_event_add_mousemove(C); /* ensure handler actually gets called */ } @@ -530,7 +533,8 @@ void WM_exit_ext(bContext *C, const bool do_python) ED_gpencil_anim_copybuf_free(); ED_gpencil_strokes_copybuf_free(); - /* free gizmo-maps after freeing blender, so no deleted data get accessed during cleaning up of areas */ + /* free gizmo-maps after freeing blender, + * so no deleted data get accessed during cleaning up of areas. */ wm_gizmomaptypes_free(); wm_gizmogrouptype_free(); wm_gizmotype_free(); @@ -562,9 +566,9 @@ void WM_exit_ext(bContext *C, const bool do_python) /* before BKE_blender_free so py's gc happens while library still exists */ /* needed at least for a rare sigsegv that can happen in pydrivers */ - /* Update for blender 2.5, move after BKE_blender_free because blender now holds references to PyObject's - * so decref'ing them after python ends causes bad problems every time - * the pyDriver bug can be fixed if it happens again we can deal with it then */ + /* Update for blender 2.5, move after BKE_blender_free because Blender now holds references to + * PyObject's so decref'ing them after python ends causes bad problems every time + * the py-driver bug can be fixed if it happens again we can deal with it then. */ BPY_python_end(); } #else @@ -588,8 +592,8 @@ void WM_exit_ext(bContext *C, const bool do_python) BLI_threadapi_exit(); - /* No need to call this early, rather do it late so that other pieces of Blender using sound may exit cleanly, - * see also T50676. */ + /* No need to call this early, rather do it late so that other + * pieces of Blender using sound may exit cleanly, see also T50676. */ BKE_sound_exit(); CLG_exit(); @@ -610,7 +614,8 @@ void WM_exit_ext(bContext *C, const bool do_python) /** * \brief Main exit function to close Blender ordinarily. - * \note Use #wm_exit_schedule_delayed() to close Blender from an operator. Might leak memory otherwise. + * \note Use #wm_exit_schedule_delayed() to close Blender from an operator. + * Might leak memory otherwise. */ void WM_exit(bContext *C) { diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 6ce9dd70574..a63592f7b60 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -71,27 +71,28 @@ struct wmJob { struct wmJob *next, *prev; - /* job originating from, keep track of this when deleting windows */ + /** Job originating from, keep track of this when deleting windows */ wmWindow *win; - /* should store entire own context, for start, update, free */ + /** Should store entire own context, for start, update, free */ void *customdata; - /* to prevent cpu overhead, use this one which only gets called when job really starts, not in thread */ + /** To prevent cpu overhead, + * use this one which only gets called when job really starts, not in thread */ void (*initjob)(void *); - /* this runs inside thread, and does full job */ + /** This runs inside thread, and does full job */ void (*startjob)(void *, short *stop, short *do_update, float *progress); - /* update gets called if thread defines so, and max once per timerstep */ - /* it runs outside thread, blocking blender, no drawing! */ + /** Update gets called if thread defines so, and max once per timerstep + * it runs outside thread, blocking blender, no drawing! */ void (*update)(void *); - /* free entire customdata, doesn't run in thread */ + /** Free entire customdata, doesn't run in thread */ void (*free)(void *); - /* gets called when job is stopped, not in thread */ + /** Gets called when job is stopped, not in thread */ void (*endjob)(void *); - /* running jobs each have own timer */ + /** Running jobs each have own timer */ double timestep; wmTimer *wt; - /* the notifier event timers should send */ + /** The notifier event timers should send */ unsigned int note, endnote; /* internal */ @@ -100,19 +101,19 @@ struct wmJob { short suspended, running, ready, do_update, stop, job_type; float progress; - /* for display in header, identification */ + /** For display in header, identification */ char name[128]; - /* once running, we store this separately */ + /** Once running, we store this separately */ void *run_customdata; void (*run_free)(void *); - /* we use BLI_threads api, but per job only 1 thread runs */ + /** We use BLI_threads api, but per job only 1 thread runs */ ListBase threads; double start_time; - /* ticket mutex for main thread locking while some job accesses + /** Ticket mutex for main thread locking while some job accesses * data that the main thread might modify at the same time */ TicketMutex *main_thread_mutex; }; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 3feae3d7dfc..d67fb064dbe 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -104,7 +104,8 @@ static void wm_keymap_item_properties_set(wmKeyMapItem *kmi) } /** - * Similar to #wm_keymap_item_properties_set but checks for the wmOperatorType having changed, see [#38042] + * Similar to #wm_keymap_item_properties_set + * but checks for the #wmOperatorType having changed, see T38042. */ static void wm_keymap_item_properties_update_ot(wmKeyMapItem *kmi) { @@ -665,16 +666,21 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km) /* We seek only for exact copy here! See T42137. */ kmi_add = wm_keymap_find_item_equals(km, kmdi->add_item); - /* If kmi_add is same as kmi_remove (can happen in some cases, typically when we got kmi_remove - * from wm_keymap_find_item_equals_result()), no need to add or remove anything, see T45579. */ - /* Note: This typically happens when we apply user-defined keymap diff to a base one that was exported - * with that customized keymap already. In that case: - * - wm_keymap_find_item_equals(km, kmdi->remove_item) finds nothing (because actual shortcut of - * current base does not match kmdi->remove_item any more). - * - wm_keymap_find_item_equals_result(km, kmdi->remove_item) finds the current kmi from - * base keymap (because it does exactly the same thing). - * - wm_keymap_find_item_equals(km, kmdi->add_item) finds the same kmi, since base keymap was - * exported with that user-defined shortcut already! + /** If kmi_add is same as kmi_remove (can happen in some cases, + * typically when we got kmi_remove from #wm_keymap_find_item_equals_result()), + * no need to add or remove anything, see T45579. */ + + /** + * \note This typically happens when we apply user-defined keymap diff to a base one that + * was exported with that customized keymap already. In that case: + * + * - wm_keymap_find_item_equals(km, kmdi->remove_item) finds nothing + * (because actual shortcut of current base does not match kmdi->remove_item any more). + * - wm_keymap_find_item_equals_result(km, kmdi->remove_item) finds the current kmi from + * base keymap (because it does exactly the same thing). + * - wm_keymap_find_item_equals(km, kmdi->add_item) finds the same kmi, + * since base keymap was exported with that user-defined shortcut already! + * * Maybe we should rather keep user-defined keymaps specific to a given base one? */ if (kmi_add != NULL && kmi_add == kmi_remove) { kmi_remove = NULL; @@ -890,7 +896,8 @@ wmKeyMap *WM_keymap_find_all_spaceid_or_empty(const bContext *C, /* ****************** modal keymaps ************ */ -/* modal maps get linked to a running operator, and filter the keys before sending to modal() callback */ +/* Modal key-maps get linked to a running operator, + * and filter the keys before sending to modal() callback. */ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, @@ -1051,7 +1058,8 @@ const char *WM_key_event_string(const short type, const bool compact) } it = &rna_enum_event_type_items[i]; - /* We first try enum items' description (abused as shortname here), and fall back to usual name if empty. */ + /* We first try enum items' description (abused as shortname here), + * and fall back to usual name if empty. */ if (compact && it->description[0]) { /* XXX No context for enum descriptions... In practice shall not be an issue though. */ return IFACE_(it->description); @@ -1121,7 +1129,8 @@ int WM_keymap_item_raw_to_string(const short shift, p += BLI_strcpy_rlen(p, WM_key_event_string(type, compact)); } - /* We assume size of buf is enough to always store any possible shortcut, but let's add a debug check about it! */ + /* We assume size of buf is enough to always store any possible shortcut, + * but let's add a debug check about it! */ BLI_assert(p - buf < sizeof(buf)); /* We need utf8 here, otherwise we may 'cut' some unicode chars like arrows... */ @@ -1409,10 +1418,10 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C, { wmKeyMapItem *found; - /* XXX Hack! Macro operators in menu entry have their whole props defined, which is not the case for - * relevant keymap entries. Could be good to check and harmonize this, but for now always - * compare non-strict in this case. - */ + /* XXX Hack! Macro operators in menu entry have their whole props defined, + * which is not the case for relevant keymap entries. + * Could be good to check and harmonize this, + * but for now always compare non-strict in this case. */ wmOperatorType *ot = WM_operatortype_find(opname, true); if (ot) { is_strict = is_strict && ((ot->flag & OPTYPE_MACRO) == 0); @@ -1438,7 +1447,8 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C, RNA_pointer_create(NULL, ot->srna, properties_temp, &opptr); if (RNA_property_is_set(&opptr, ot->prop)) { - /* for operator that has enum menu, unset it so its value does not affect comparison result */ + /* For operator that has enum menu, + * unset it so its value does not affect comparison result. */ RNA_property_unset(&opptr, ot->prop); found = wm_keymap_item_find_props( @@ -1538,7 +1548,8 @@ static bool kmi_filter_is_visible_type_mask(const wmKeyMap *km, } /** - * \param include_mask, exclude_mask: Event types to include/exclude when looking up keys (#eEventType_Mask). + * \param include_mask, exclude_mask: + * Event types to include/exclude when looking up keys (#eEventType_Mask). */ wmKeyMapItem *WM_key_event_operator(const bContext *C, const char *opname, diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index 63caf6126cc..3585cffc615 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -236,9 +236,11 @@ void WM_operatortype_props_advanced_begin(wmOperatorType *ot) } /** - * Tags all operator-properties of \ot defined since the first #WM_operatortype_props_advanced_begin - * call, or the last #WM_operatortype_props_advanced_end call, with #OP_PROP_TAG_ADVANCED. - * Note that this is called for all operators during registration (see #wm_operatortype_append__end). + * Tags all operator-properties of \a ot defined since the first + * #WM_operatortype_props_advanced_begin call, + * or the last #WM_operatortype_props_advanced_end call, with #OP_PROP_TAG_ADVANCED. + * + * \note This is called for all operators during registration (see #wm_operatortype_append__end). * So it does not need to be explicitly called in operator-type definition. */ void WM_operatortype_props_advanced_end(wmOperatorType *ot) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 20f6162f9d4..9680f82fe8b 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -214,7 +214,8 @@ bool WM_operator_py_idname_ok_or_report(ReportList *reports, } /** - * Print a string representation of the operator, with the args that it runs so python can run it again. + * Print a string representation of the operator, + * with the args that it runs so python can run it again. * * When calling from an existing wmOperator, better to use simple version: * `WM_operator_pystring(C, op);` @@ -353,7 +354,8 @@ static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr * - see if the pointers ID is in the context. */ - /* don't get from the context store since this is normally set only for the UI and not usable elsewhere */ + /* Don't get from the context store since this is normally + * set only for the UI and not usable elsewhere. */ ListBase lb = CTX_data_dir_get_ex(C, false, true, true); LinkData *link; @@ -777,13 +779,14 @@ struct EnumSearchMenu { short prv_cols, prv_rows; }; -/* generic enum search invoke popup */ +/** Generic enum search invoke popup. */ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg) { struct EnumSearchMenu *search_menu = arg; wmWindow *win = CTX_wm_window(C); wmOperator *op = search_menu->op; - /* template_ID uses 4 * widget_unit for width, we use a bit more, some items may have a suffix to show */ + /* template_ID uses 4 * widget_unit for width, + * we use a bit more, some items may have a suffix to show. */ const int width = search_menu->use_previews ? 5 * U.widget_unit * search_menu->prv_cols : UI_searchbox_size_x(); const int height = search_menu->use_previews ? 5 * U.widget_unit * search_menu->prv_rows : @@ -1161,7 +1164,8 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) /* in this case, wm_operator_ui_popup_cancel wont run */ MEM_freeN(data); - /* get context data *after* WM_operator_call_ex which might have closed the current file and changed context */ + /* Get context data *after* WM_operator_call_ex + * which might have closed the current file and changed context. */ wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); @@ -3363,8 +3367,14 @@ static int previews_clear_exec(bContext *C, wmOperator *op) continue; } - // printf("%s: %d, %d, %d -> %d\n", id->name, GS(id->name), BKE_idcode_to_idfilter(GS(id->name)), - // id_filters, BKE_idcode_to_idfilter(GS(id->name)) & id_filters); +#if 0 + printf("%s: %d, %d, %d -> %d\n", + id->name, + GS(id->name), + BKE_idcode_to_idfilter(GS(id->name)), + id_filters, + BKE_idcode_to_idfilter(GS(id->name)) & id_filters); +#endif if (!id || !(BKE_idcode_to_idfilter(GS(id->name)) & id_filters)) { continue; @@ -3638,9 +3648,8 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border"); WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border"); WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_box"); - WM_modalkeymap_assign( - keymap, - "VIEW3D_OT_zoom_border"); /* XXX TODO: zoom border should perhaps map rightmouse to zoom out instead of in+cancel */ + /* XXX TODO: zoom border should perhaps map rightmouse to zoom out instead of in+cancel */ + WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border"); WM_modalkeymap_assign(keymap, "IMAGE_OT_render_border"); WM_modalkeymap_assign(keymap, "IMAGE_OT_view_zoom_border"); WM_modalkeymap_assign(keymap, "GPENCIL_OT_select_box"); diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c index 47f860e7667..41e63cc0aca 100644 --- a/source/blender/windowmanager/intern/wm_stereo.c +++ b/source/blender/windowmanager/intern/wm_stereo.c @@ -280,7 +280,8 @@ bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check) } /** - * If needed, this adjusts \a r_mouse_xy so that drawn cursor and handled mouse position are matching visually. + * If needed, adjust \a r_mouse_xy + * so that drawn cursor and handled mouse position are matching visually. */ void wm_stereo3d_mouse_offset_apply(wmWindow *win, int *r_mouse_xy) { diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index a867a17f529..0abb5678800 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -246,7 +246,8 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre } else if ((tref->space_type == SPACE_IMAGE) && (tref->mode == SI_MODE_UV)) { /* Note that switching uv-sculpt boolean is a hack at the moment. - * It would be best to make this either an operator or a higher level mode (like mesh-object sculpt mode). */ + * It would be best to make this either an operator or a higher level mode + * (like mesh-object sculpt mode). */ const EnumPropertyItem *items = rna_enum_uv_sculpt_tool_items; const int i = RNA_enum_from_identifier(items, tref_rt->data_block); if (i != -1) { @@ -602,7 +603,8 @@ bool WM_toolsystem_key_from_context(ViewLayer *view_layer, ScrArea *sa, bToolKey /** * Use to update the active tool (shown in the top bar) in the least disruptive way. * - * This is a little involved since there may be multiple valid active tools depending on the mode and space type. + * This is a little involved since there may be multiple valid active tools + * depending on the mode and space type. * * Used when undoing since the active mode may have changed. */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 89696082e7a..2fee8dde3f9 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -624,9 +624,9 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) GHOST_SetTitle(win->ghostwin, "Blender"); } - /* Informs GHOST of unsaved changes, to set window modified visual indicator (MAC OS X) - * and to give hint of unsaved changes for a user warning mechanism - * in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */ + /* Informs GHOST of unsaved changes, to set window modified visual indicator (macOS) + * and to give hint of unsaved changes for a user warning mechanism in case of OS + * application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end). */ GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8)!wm->file_saved); } } @@ -1271,8 +1271,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr GHOST_TEventDataPtr data = GHOST_GetEventData(evt); wmWindow *win; - /* Ghost now can call this function for life resizes, but it should return if WM didn't initialize yet. - * Can happen on file read (especially full size window) */ + /* Ghost now can call this function for life resizes, + * but it should return if WM didn't initialize yet. + * Can happen on file read (especially full size window). */ if ((wm->initialized & WM_WINDOW_IS_INITIALIZED) == 0) { return 1; } @@ -2197,7 +2198,8 @@ bool WM_window_is_fullscreen(wmWindow *win) /** * Some editor data may need to be synced with scene data (3D View camera and layers). - * This function ensures data is synced for editors in visible workspaces and their visible layouts. + * This function ensures data is synced for editors + * in visible workspaces and their visible layouts. */ void WM_windows_scene_data_sync(const ListBase *win_lb, Scene *scene) { |