diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-20 08:06:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-20 09:26:37 +0300 |
commit | c09f461e04baf43d06e4f95e5ba77aa1870f6981 (patch) | |
tree | 11ce88d52f76ea8f80d7476ea0f22c4f38c3cc08 /source/blender/windowmanager/WM_types.h | |
parent | 8f73559355480c732b1cc6f7dfb6db2662297313 (diff) |
WM: add wmGenericUserData utility struct
Useful to have a generic user data with an optional custom free function,
use for wmGesture.
Diffstat (limited to 'source/blender/windowmanager/WM_types.h')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index b3c36857dce..d2e71496494 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -120,6 +120,13 @@ struct wmWindowManager; /* Include external gizmo API's */ #include "gizmo/WM_gizmo_api.h" +typedef struct wmGenericUserData { + void *data; + /** When NULL, use #MEM_freeN. */ + void (*free_fn)(void *data); + bool use_free; +} wmGenericUserData; + /* ************** wmOperatorType ************************ */ /* flag */ @@ -442,8 +449,7 @@ typedef struct wmGesture { /* customdata for straight line is a recti: (xmin,ymin) is start, (xmax, ymax) is end */ /* free pointer to use for operator allocs (if set, its freed on exit)*/ - void *userdata; - bool userdata_free; + wmGenericUserData user_data; } wmGesture; /* ************** wmEvent ************************ */ |