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/space_userpref | |
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/space_userpref')
-rw-r--r-- | source/blender/editors/space_userpref/space_userpref.c | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 3efdee9cec9..52c97ed5014 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -183,46 +183,20 @@ static void userpref_execute_region_init(wmWindowManager *wm, ARegion *region) region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y; } -static void userpref_main_region_listener(wmWindow *UNUSED(win), - ScrArea *UNUSED(area), - ARegion *UNUSED(region), - wmNotifier *UNUSED(wmn), - const Scene *UNUSED(scene)) +static void userpref_main_region_listener(wmRegionListenerParams *UNUSED(params)) { - /* context changes */ } -static void userpref_header_listener(wmWindow *UNUSED(win), - ScrArea *UNUSED(area), - ARegion *UNUSED(region), - wmNotifier *UNUSED(wmn), - const Scene *UNUSED(scene)) +static void userpref_header_listener(wmRegionListenerParams *UNUSED(params)) { - /* context changes */ -#if 0 - switch (wmn->category) { - default: - break; - } -#endif } -static void userpref_navigation_region_listener(wmWindow *UNUSED(win), - ScrArea *UNUSED(area), - ARegion *UNUSED(region), - wmNotifier *UNUSED(wmn), - const Scene *UNUSED(scene)) +static void userpref_navigation_region_listener(wmRegionListenerParams *UNUSED(params)) { - /* context changes */ } -static void userpref_execute_region_listener(wmWindow *UNUSED(win), - ScrArea *UNUSED(area), - ARegion *UNUSED(region), - wmNotifier *UNUSED(wmn), - const Scene *UNUSED(scene)) +static void userpref_execute_region_listener(wmRegionListenerParams *UNUSED(params)) { - /* context changes */ } /* only called once, from space/spacetypes.c */ |