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:
authorSybren A. Stüvel <sybren@blender.org>2020-10-02 19:56:25 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-10-02 19:56:25 +0300
commit90a27d5aa91a1b6a25ea14e11c889d47f77f4cf7 (patch)
tree3916b5139f9e48ca543a1f017f82b62101dd717a /source/blender/blenkernel/BKE_screen.h
parent0db98b214d468864630fc9bba72be4ff9b2548e5 (diff)
Cleanup: Use enum for return values in context callbacks
Define enum `eContextResult` and use its values for returns, instead of just returning 1, 0, or -1 (and always having some comment that explains what -1 means). This also cleans up the mixup between returning `0` and `false`, and `1` and `true`. An inconsistency was discovered during this cleanup, and marked with `TODO(sybren)`. It's not fixed here, as it would consititute a functional change. The enum isn't used everywhere, as enums in C and C++ can have different storage sizes. To prevent issues, callback functions are still declared as returning`int`. To at least make things easier to understand for humans, I marked those with `int /*eContextResult*/`. This is a followup of D9090, and is intended to unify how context callbacks return values. This will make it easier to extend the approach in D9090 to those functions. No functional changes. Differential Revision: https://developer.blender.org/D9095
Diffstat (limited to 'source/blender/blenkernel/BKE_screen.h')
-rw-r--r--source/blender/blenkernel/BKE_screen.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index bcc58ecf2c5..35a3d0415a8 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -26,6 +26,8 @@
#include "RNA_types.h"
+#include "BKE_context.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -106,7 +108,7 @@ typedef struct SpaceType {
void (*gizmos)(void);
/* return context data */
- int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
+ bContextDataCallback context;
/* Used when we want to replace an ID by another (or NULL). */
void (*id_remap)(struct ScrArea *area,
@@ -181,7 +183,7 @@ typedef struct ARegionType {
void (*cursor)(struct wmWindow *win, struct ScrArea *area, struct ARegion *region);
/* return context data */
- int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
+ bContextDataCallback context;
/* Is called whenever the current visible View2D's region changes.
*