Cleanup: return specific handler types
This commit is contained in:
parent
e617e6395b
commit
eb4acd5064
|
@ -59,6 +59,7 @@ struct wmDropBox;
|
|||
struct wmEvent;
|
||||
struct wmEventHandler;
|
||||
struct wmEventHandler_Keymap;
|
||||
struct wmEventHandler_UI;
|
||||
struct wmGesture;
|
||||
struct wmJob;
|
||||
struct wmMsgSubscribeKey;
|
||||
|
@ -207,7 +208,7 @@ void WM_event_set_keymap_handler_callback(
|
|||
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(
|
||||
struct wmEventHandler_UI *WM_event_add_ui_handler(
|
||||
const struct bContext *C, ListBase *handlers,
|
||||
wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
|
||||
void *userdata, const char flag);
|
||||
|
@ -221,7 +222,7 @@ 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);
|
||||
struct wmEventHandler_Op *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
|
||||
void WM_event_modal_handler_area_replace(wmWindow *win, const struct ScrArea *old_area, struct ScrArea *new_area);
|
||||
void WM_event_modal_handler_region_replace(wmWindow *win, const struct ARegion *old_region, struct ARegion *new_region);
|
||||
|
||||
|
@ -236,7 +237,8 @@ enum {
|
|||
WM_HANDLER_DO_FREE = (1 << 7), /* handler tagged to be freed in wm_handlers_do() */
|
||||
};
|
||||
|
||||
struct wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes);
|
||||
struct wmEventHandler_Dropbox *WM_event_add_dropbox_handler(
|
||||
ListBase *handlers, ListBase *dropboxes);
|
||||
|
||||
/* mouse */
|
||||
void WM_event_add_mousemove(const struct bContext *C);
|
||||
|
|
|
@ -3307,7 +3307,7 @@ static void WM_event_set_handler_flag(wmEventHandler *handler, int flag)
|
|||
}
|
||||
#endif
|
||||
|
||||
wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
|
||||
wmEventHandler_Op *WM_event_add_modal_handler(bContext *C, wmOperator *op)
|
||||
{
|
||||
wmEventHandler_Op *handler = MEM_callocN(sizeof(*handler), __func__);
|
||||
handler->base.type = WM_HANDLER_TYPE_OP;
|
||||
|
@ -3334,7 +3334,7 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
|
|||
WM_window_status_area_tag_redraw(win);
|
||||
}
|
||||
|
||||
return &handler->base;
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3444,7 +3444,7 @@ void WM_event_set_keymap_handler_callback(
|
|||
handler->keymap_callback.user_data = user_data;
|
||||
}
|
||||
|
||||
wmEventHandler *WM_event_add_ui_handler(
|
||||
wmEventHandler_UI *WM_event_add_ui_handler(
|
||||
const bContext *C, ListBase *handlers,
|
||||
wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn,
|
||||
void *user_data, const char flag)
|
||||
|
@ -3470,7 +3470,7 @@ wmEventHandler *WM_event_add_ui_handler(
|
|||
|
||||
BLI_addhead(handlers, handler);
|
||||
|
||||
return &handler->base;
|
||||
return handler;
|
||||
}
|
||||
|
||||
/* set "postpone" for win->modalhandlers, this is in a running for () loop in wm_handlers_do() */
|
||||
|
@ -3524,14 +3524,14 @@ void WM_event_free_ui_handler_all(
|
|||
}
|
||||
}
|
||||
|
||||
wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
|
||||
wmEventHandler_Dropbox *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
|
||||
{
|
||||
/* only allow same dropbox once */
|
||||
for (wmEventHandler *handler_base = handlers->first; handler_base; handler_base = handler_base->next) {
|
||||
if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) {
|
||||
wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base;
|
||||
if (handler->dropboxes == dropboxes) {
|
||||
return &handler->base;
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3543,7 +3543,7 @@ wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropb
|
|||
handler->dropboxes = dropboxes;
|
||||
BLI_addhead(handlers, handler);
|
||||
|
||||
return &handler->base;
|
||||
return handler;
|
||||
}
|
||||
|
||||
/* XXX solution works, still better check the real cause (ton) */
|
||||
|
|
Loading…
Reference in New Issue