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:
authorCampbell Barton <ideasman42@gmail.com>2014-06-03 02:58:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-03 03:30:08 +0400
commitbf640a6a7faff2246d6be117fa758dd69154f27f (patch)
tree13dea778bd0dbf4e21f2939423a3ec776f90a09c
parent9016d6d7a0cb41cb266c5fc1de05ee2c674db0d4 (diff)
Code cleanup: use typedefs for ui handler functions
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/windowmanager/WM_api.h25
-rw-r--r--source/blender/windowmanager/WM_types.h3
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c32
4 files changed, 36 insertions, 26 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 97d4869bb2d..16f42f048e0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2506,7 +2506,7 @@ void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opn
void uiPupBlock(bContext *C, uiBlockCreateFunc func, void *arg)
{
- uiPupBlockO(C, func, arg, NULL, 0);
+ uiPupBlockO(C, func, arg, NULL, WM_OP_INVOKE_DEFAULT);
}
void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg)
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 64cada9f005..9e50b01cd23 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -145,19 +145,22 @@ struct wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers,
void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
+typedef int (*wmUIHandlerFunc)(struct bContext *C, const struct wmEvent *event, void *userdata);
+typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
+
struct wmEventHandler *WM_event_add_ui_handler(
const struct bContext *C, ListBase *handlers,
- int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
- void (*remove)(struct bContext *C, void *userdata), void *userdata);
-
-void WM_event_remove_ui_handler(ListBase *handlers,
- int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
- void (*remove)(struct bContext *C, void *userdata),
- void *userdata, const bool postpone);
-void WM_event_remove_area_handler(struct ListBase *handlers, void *area);
-void WM_event_free_ui_handler_all(struct bContext *C, ListBase *handlers,
- int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
- void (*remove)(struct bContext *C, void *userdata));
+ wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
+ void *userdata);
+void WM_event_remove_ui_handler(
+ ListBase *handlers,
+ wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
+ void *userdata, const bool postpone);
+void WM_event_remove_area_handler(
+ struct ListBase *handlers, void *area);
+void WM_event_free_ui_handler_all(
+ struct bContext *C, ListBase *handlers,
+ wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove);
struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index e73d599a643..9ad1bc97f4d 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -190,9 +190,6 @@ enum {
#define WM_UI_HANDLER_CONTINUE 0
#define WM_UI_HANDLER_BREAK 1
-typedef int (*wmUIHandlerFunc)(struct bContext *C, const struct wmEvent *event, void *userdata);
-typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
-
/* ************** Notifiers ****************** */
typedef struct wmNotifier {
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index c9855ccaa3b..64289e04d7a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2547,12 +2547,14 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
}
}
-wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
- wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata)
+wmEventHandler *WM_event_add_ui_handler(
+ const bContext *C, ListBase *handlers,
+ wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
+ void *userdata)
{
wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event ui handler");
- handler->ui_handle = func;
- handler->ui_remove = remove;
+ handler->ui_handle = ui_handle;
+ handler->ui_remove = ui_remove;
handler->ui_userdata = userdata;
if (C) {
handler->ui_area = CTX_wm_area(C);
@@ -2572,13 +2574,18 @@ wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
}
/* set "postpone" for win->modalhandlers, this is in a running for () loop in wm_handlers_do() */
-void WM_event_remove_ui_handler(ListBase *handlers,
- wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, const bool postpone)
+void WM_event_remove_ui_handler(
+ ListBase *handlers,
+ wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
+ void *userdata, const bool postpone)
{
wmEventHandler *handler;
for (handler = handlers->first; handler; handler = handler->next) {
- if (handler->ui_handle == func && handler->ui_remove == remove && handler->ui_userdata == userdata) {
+ if ((handler->ui_handle == ui_handle) &&
+ (handler->ui_remove == ui_remove) &&
+ (handler->ui_userdata == userdata))
+ {
/* handlers will be freed in wm_handlers_do() */
if (postpone) {
handler->flag |= WM_HANDLER_DO_FREE;
@@ -2592,15 +2599,18 @@ void WM_event_remove_ui_handler(ListBase *handlers,
}
}
-void WM_event_free_ui_handler_all(bContext *C, ListBase *handlers,
- wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove)
+void WM_event_free_ui_handler_all(
+ bContext *C, ListBase *handlers,
+ wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove)
{
wmEventHandler *handler, *handler_next;
for (handler = handlers->first; handler; handler = handler_next) {
handler_next = handler->next;
- if (handler->ui_handle == func && handler->ui_remove == remove) {
- remove(C, handler->ui_userdata);
+ if ((handler->ui_handle == ui_handle) &&
+ (handler->ui_remove == ui_remove))
+ {
+ ui_remove(C, handler->ui_userdata);
BLI_remlink(handlers, handler);
wm_event_free_handler(handler);
}