diff options
author | Hans Goudey <h.goudey@me.com> | 2021-01-19 02:28:47 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-01-19 02:28:47 +0300 |
commit | 09c7c638905230a608a9b0204b68c775cf71bf67 (patch) | |
tree | 4b21efd9b23283ef236e756f46e3f75f5d2e6c61 /source/blender/editors/include | |
parent | 4b4aec288458dd24721fdd61af38d3c316c2520b (diff) |
UI Code Quality: Use "params" struct for area and region callbacks
These functions with many arguments can be unwieldy. Aside from the obvious issues
with rewriting the list of arguments and the opportunities for error and frustration
that presents, the long list of arguments make these systems hard to change. So when
an argument should be added, someone might skip that and add some hack instead.
So, as proposed in T73586#1037210, this patch instead uses a "params" struct for
each of these callbacks.
- Use param argument for `ARegionType.listener`
- Remove unused window field in region listener
- Use param argument for `SpaceType.listener`
- Use params struct for `ARegionType.message_subscribe`
Differential Revision: https://developer.blender.org/D9750
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 20417634020..571f4e74c60 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -57,15 +57,14 @@ struct wmMsgSubscribeKey; struct wmMsgSubscribeValue; struct wmNotifier; struct wmOperatorType; +struct wmRegionListenerParams; +struct wmRegionMessageSubscribeParams; +struct wmSpaceTypeListenerParams; struct wmWindow; struct wmWindowManager; /* regions */ -void ED_region_do_listen(struct wmWindow *win, - struct ScrArea *area, - struct ARegion *region, - struct wmNotifier *note, - const Scene *scene); +void ED_region_do_listen(struct wmRegionListenerParams *params); void ED_region_do_layout(struct bContext *C, struct ARegion *region); void ED_region_do_draw(struct bContext *C, struct ARegion *region); void ED_region_exit(struct bContext *C, struct ARegion *region); @@ -144,29 +143,11 @@ void ED_area_do_msg_notify_tag_refresh(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); -void ED_area_do_mgs_subscribe_for_tool_header(const struct bContext *C, - struct WorkSpace *workspace, - struct Scene *scene, - struct bScreen *screen, - struct ScrArea *area, - struct ARegion *region, - struct wmMsgBus *mbus); -void ED_area_do_mgs_subscribe_for_tool_ui(const struct bContext *C, - struct WorkSpace *workspace, - struct Scene *scene, - struct bScreen *screen, - struct ScrArea *area, - struct ARegion *region, - struct wmMsgBus *mbus); +void ED_area_do_mgs_subscribe_for_tool_header(struct wmRegionMessageSubscribeParams *params); +void ED_area_do_mgs_subscribe_for_tool_ui(struct wmRegionMessageSubscribeParams *params); /* message bus */ -void ED_region_message_subscribe(struct bContext *C, - struct WorkSpace *workspace, - struct Scene *scene, - struct bScreen *screen, - struct ScrArea *area, - struct ARegion *region, - struct wmMsgBus *mbus); +void ED_region_message_subscribe(struct wmRegionMessageSubscribeParams *params); /* spaces */ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); @@ -178,7 +159,7 @@ void ED_area_exit(struct bContext *C, struct ScrArea *area); int ED_screen_area_active(const struct bContext *C); void ED_screen_global_areas_refresh(struct wmWindow *win); void ED_screen_global_areas_sync(struct wmWindow *win); -void ED_area_do_listen(struct wmWindow *win, ScrArea *area, struct wmNotifier *note, Scene *scene); +void ED_area_do_listen(struct wmSpaceTypeListenerParams *params); void ED_area_tag_redraw(ScrArea *area); void ED_area_tag_redraw_no_rebuild(ScrArea *area); void ED_area_tag_redraw_regiontype(ScrArea *area, int type); @@ -427,13 +408,8 @@ void ED_region_cache_draw_cached_segments(struct ARegion *region, const int efra); /* area_utils.c */ -void ED_region_generic_tools_region_message_subscribe(const struct bContext *C, - struct WorkSpace *workspace, - struct Scene *scene, - struct bScreen *screen, - struct ScrArea *area, - struct ARegion *region, - struct wmMsgBus *mbus); +void ED_region_generic_tools_region_message_subscribe( + struct wmRegionMessageSubscribeParams *params); int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis); /* area_query.c */ |