[Bf-blender-cvs] [c008414] temp_widgets_update_tagging: Add/use typedefs for function pointers

Julian Eisel noreply at git.blender.org
Tue May 10 22:15:40 CEST 2016


Commit: c008414d58b2474cb4e1a4a888f0931cc7db18f3
Author: Julian Eisel
Date:   Tue May 10 22:14:26 2016 +0200
Branches: temp_widgets_update_tagging
https://developer.blender.org/rBc008414d58b2474cb4e1a4a888f0931cc7db18f3

Add/use typedefs for function pointers

===================================================================

M	source/blender/windowmanager/widgets/WM_widget_api.h
M	source/blender/windowmanager/widgets/WM_widget_types.h
M	source/blender/windowmanager/widgets/intern/wm_widgetgroup.c

===================================================================

diff --git a/source/blender/windowmanager/widgets/WM_widget_api.h b/source/blender/windowmanager/widgets/WM_widget_api.h
index 0811147..9458fbe 100644
--- a/source/blender/windowmanager/widgets/WM_widget_api.h
+++ b/source/blender/windowmanager/widgets/WM_widget_api.h
@@ -82,10 +82,10 @@ struct wmWidgetGroupType *WM_widgetgrouptype_register_ptr(
         const char *name);
 struct wmWidgetGroupType *WM_widgetgrouptype_register_ptr_update(
         const struct Main *bmain, struct wmWidgetMapType *wmaptype,
-        int (*poll)(const struct bContext *, struct wmWidgetGroupType *),
-        void (*init)(const struct bContext *, struct wmWidgetGroup *),
-        void (*refresh)(const struct bContext *, struct wmWidgetGroup *),
-        void (*draw_prepare)(const struct bContext *, struct wmWidgetGroup *),
+        int (*poll)(const struct bContext *, struct wmWidgetGroupType *),      /* wmWidgetGroupPollFunc */
+        void (*init)(const struct bContext *, struct wmWidgetGroup *),         /* wmWidgetGroupInitFunc */
+        void (*refresh)(const struct bContext *, struct wmWidgetGroup *),      /* wmWidgetGroupRefreshFunc */
+        void (*draw_prepare)(const struct bContext *, struct wmWidgetGroup *), /* wmWidgetGroupDrawPrepareFunc */
         struct wmKeyMap *(*keymap_init)(const struct wmWidgetGroupType *wgrouptype, struct wmKeyConfig *config),
         const char *name);
 struct wmWidgetGroupType *WM_widgetgrouptype_register(
@@ -96,10 +96,10 @@ struct wmWidgetGroupType *WM_widgetgrouptype_register(
         const char *name);
 struct wmWidgetGroupType *WM_widgetgrouptype_register_update(
         const struct Main *bmain, const struct wmWidgetMapType_Params *wmap_params,
-        int (*poll)(const struct bContext *C, struct wmWidgetGroupType *),
-        void (*init)(const struct bContext *, struct wmWidgetGroup *),
-        void (*refresh)(const struct bContext *, struct wmWidgetGroup *),
-        void (*draw_prepare)(const struct bContext *, struct wmWidgetGroup *),
+        int (*poll)(const struct bContext *, struct wmWidgetGroupType *),      /* wmWidgetGroupPollFunc */
+        void (*init)(const struct bContext *, struct wmWidgetGroup *),         /* wmWidgetGroupInitFunc */
+        void (*refresh)(const struct bContext *, struct wmWidgetGroup *),      /* wmWidgetGroupRefreshFunc */
+        void (*draw_prepare)(const struct bContext *, struct wmWidgetGroup *), /* wmWidgetGroupDrawPrepareFunc */
         wmKeyMap *(*keymap_init)(const struct wmWidgetGroupType *wgrouptype, struct wmKeyConfig *config),
         const char *name);
 void WM_widgetgrouptype_init_runtime(
diff --git a/source/blender/windowmanager/widgets/WM_widget_types.h b/source/blender/windowmanager/widgets/WM_widget_types.h
index 1ab94c1..67e4de9 100644
--- a/source/blender/windowmanager/widgets/WM_widget_types.h
+++ b/source/blender/windowmanager/widgets/WM_widget_types.h
@@ -42,8 +42,10 @@ struct wmWidgetGroupType;
 struct wmWidgetGroup;
 struct wmKeyConfig;
 
-typedef int (*wmWidgetGroupPollFunc)(const struct bContext *, struct wmWidgetGroupType *) ATTR_WARN_UNUSED_RESULT; /* TODO use bool */
+typedef int  (*wmWidgetGroupPollFunc)(const struct bContext *, struct wmWidgetGroupType *) ATTR_WARN_UNUSED_RESULT; /* TODO use bool */
 typedef void (*wmWidgetGroupInitFunc)(const struct bContext *, struct wmWidgetGroup *);
+typedef void (*wmWidgetGroupRefreshFunc)(const struct bContext *, struct wmWidgetGroup *);
+typedef void (*wmWidgetGroupDrawPrepareFunc)(const struct bContext *, struct wmWidgetGroup *);
 
 
 /* -------------------------------------------------------------------- */
@@ -57,13 +59,12 @@ typedef struct wmWidgetGroupType {
 
 	/* poll if widgetmap should be active */
 	wmWidgetGroupPollFunc poll;
-
 	/* initially create widgets, set permanent data stuff you only need to do once */
 	wmWidgetGroupInitFunc init;
 	/* refresh data, only called if recreate flag is set (WM_widgetmap_tag_refresh) */
-	void (*refresh)(const struct bContext *C, struct wmWidgetGroup *wgroup);
+	wmWidgetGroupRefreshFunc refresh;
 	/* refresh data for drawing, called before each redraw */
-	void (*draw_prepare)(const struct bContext *C, struct wmWidgetGroup *wgroup);
+	wmWidgetGroupDrawPrepareFunc draw_prepare;
 
 	/* keymap init callback for this widgetgroup */
 	struct wmKeyMap *(*keymap_init)(const struct wmWidgetGroupType *, struct wmKeyConfig *);
diff --git a/source/blender/windowmanager/widgets/intern/wm_widgetgroup.c b/source/blender/windowmanager/widgets/intern/wm_widgetgroup.c
index 5bf8462..4e71a25 100644
--- a/source/blender/windowmanager/widgets/intern/wm_widgetgroup.c
+++ b/source/blender/windowmanager/widgets/intern/wm_widgetgroup.c
@@ -438,8 +438,7 @@ wmWidgetGroupType *WM_widgetgrouptype_register_ptr(
 wmWidgetGroupType *WM_widgetgrouptype_register_ptr_update(
         const Main *bmain, wmWidgetMapType *wmaptype,
         wmWidgetGroupPollFunc poll, wmWidgetGroupInitFunc init,
-        void (*refresh)(const bContext *, wmWidgetGroup *),
-        void (*draw_prepare)(const bContext *, wmWidgetGroup *),
+        wmWidgetGroupRefreshFunc refresh, wmWidgetGroupDrawPrepareFunc draw_prepare,
         wmKeyMap *(*keymap_init)(const wmWidgetGroupType *wgrouptype, wmKeyConfig *config),
         const char *name)
 {
@@ -473,8 +472,7 @@ wmWidgetGroupType *WM_widgetgrouptype_register(
 wmWidgetGroupType *WM_widgetgrouptype_register_update(
         const Main *bmain, const struct wmWidgetMapType_Params *wmap_params,
         wmWidgetGroupPollFunc poll, wmWidgetGroupInitFunc init,
-        void (*refresh)(const bContext *, wmWidgetGroup *),
-        void (*draw_prepare)(const bContext *, wmWidgetGroup *),
+        wmWidgetGroupRefreshFunc refresh, wmWidgetGroupDrawPrepareFunc draw_prepare,
         wmKeyMap *(*keymap_init)(const wmWidgetGroupType *wgrouptype, wmKeyConfig *config),
         const char *name)
 {




More information about the Bf-blender-cvs mailing list