Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-01-19 02:28:47 +0300
committerHans Goudey <h.goudey@me.com>2021-01-19 02:28:47 +0300
commit09c7c638905230a608a9b0204b68c775cf71bf67 (patch)
tree4b21efd9b23283ef236e756f46e3f75f5d2e6c61 /source/blender/editors/space_nla
parent4b4aec288458dd24721fdd61af38d3c316c2520b (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_nla')
-rw-r--r--source/blender/editors/space_nla/space_nla.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index c6fe1b8539e..0d6ef279327 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -324,12 +324,11 @@ static void nla_buttons_region_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
-static void nla_region_listener(wmWindow *UNUSED(win),
- ScrArea *UNUSED(area),
- ARegion *region,
- wmNotifier *wmn,
- const Scene *UNUSED(scene))
+static void nla_region_listener(wmRegionListenerParams *params)
{
+ ARegion *region = params->region;
+ wmNotifier *wmn = params->notifier;
+
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@@ -364,12 +363,11 @@ static void nla_region_listener(wmWindow *UNUSED(win),
}
}
-static void nla_main_region_listener(wmWindow *UNUSED(win),
- ScrArea *UNUSED(area),
- ARegion *region,
- wmNotifier *wmn,
- const Scene *UNUSED(scene))
+static void nla_main_region_listener(wmRegionListenerParams *params)
{
+ ARegion *region = params->region;
+ wmNotifier *wmn = params->notifier;
+
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@@ -423,14 +421,14 @@ static void nla_main_region_listener(wmWindow *UNUSED(win),
}
}
-static void nla_main_region_message_subscribe(const struct bContext *UNUSED(C),
- struct WorkSpace *UNUSED(workspace),
- struct Scene *scene,
- struct bScreen *screen,
- struct ScrArea *area,
- struct ARegion *region,
- struct wmMsgBus *mbus)
+static void nla_main_region_message_subscribe(wmRegionMessageSubscribeParams *params)
{
+ struct wmMsgBus *mbus = params->message_bus;
+ Scene *scene = params->scene;
+ bScreen *screen = params->screen;
+ ScrArea *area = params->area;
+ ARegion *region = params->region;
+
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceNLA, area->spacedata.first, &ptr);
@@ -465,12 +463,11 @@ static void nla_main_region_message_subscribe(const struct bContext *UNUSED(C),
}
}
-static void nla_channel_region_listener(wmWindow *UNUSED(win),
- ScrArea *UNUSED(area),
- ARegion *region,
- wmNotifier *wmn,
- const Scene *UNUSED(scene))
+static void nla_channel_region_listener(wmRegionListenerParams *params)
{
+ ARegion *region = params->region;
+ wmNotifier *wmn = params->notifier;
+
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@@ -508,14 +505,13 @@ static void nla_channel_region_listener(wmWindow *UNUSED(win),
}
}
-static void nla_channel_region_message_subscribe(const struct bContext *UNUSED(C),
- struct WorkSpace *UNUSED(workspace),
- struct Scene *UNUSED(scene),
- struct bScreen *screen,
- struct ScrArea *area,
- struct ARegion *region,
- struct wmMsgBus *mbus)
+static void nla_channel_region_message_subscribe(wmRegionMessageSubscribeParams *params)
{
+ struct wmMsgBus *mbus = params->message_bus;
+ bScreen *screen = params->screen;
+ ScrArea *area = params->area;
+ ARegion *region = params->region;
+
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceNLA, area->spacedata.first, &ptr);
@@ -543,11 +539,11 @@ static void nla_channel_region_message_subscribe(const struct bContext *UNUSED(C
}
/* editor level listener */
-static void nla_listener(wmWindow *UNUSED(win),
- ScrArea *area,
- wmNotifier *wmn,
- Scene *UNUSED(scene))
+static void nla_listener(wmSpaceTypeListenerParams *params)
{
+ ScrArea *area = params->area;
+ wmNotifier *wmn = params->notifier;
+
/* context changes */
switch (wmn->category) {
case NC_ANIMATION: