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>2018-07-02 12:47:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-02 12:51:31 +0300
commitb88e51dd55c62bdc160f33f9b2ae1727a892560a (patch)
treec9b9e00d51be18250df443c47ad31b1341a50f01 /source/blender/windowmanager
parentbfbfb1c47e8c60732f45638513ed7e39bedc730a (diff)
Cleanup: use bool for poll functions
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h20
-rw-r--r--source/blender/windowmanager/WM_types.h6
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c5
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c11
-rw-r--r--source/blender/windowmanager/wm.h2
8 files changed, 28 insertions, 24 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index cfaef2c3f58..95d5a481385 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -129,10 +129,11 @@ void WM_cursor_grab_enable(struct wmWindow *win, bool wrap, bool hide, int boun
void WM_cursor_grab_disable(struct wmWindow *win, const int mouse_ungrab_xy[2]);
void WM_cursor_time (struct wmWindow *win, int nr);
-void *WM_paint_cursor_activate(struct wmWindowManager *wm,
- int (*poll)(struct bContext *C),
- void (*draw)(struct bContext *C, int, int, void *customdata),
- void *customdata);
+void *WM_paint_cursor_activate(
+ struct wmWindowManager *wm,
+ bool (*poll)(struct bContext *C),
+ void (*draw)(struct bContext *C, int, int, void *customdata),
+ void *customdata);
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar);
@@ -238,7 +239,7 @@ int WM_operator_confirm (struct bContext *C, struct wmOperator *op, const str
int WM_operator_filesel (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format);
/* poll callback, context checks */
-int WM_operator_winactive (struct bContext *C);
+bool WM_operator_winactive (struct bContext *C);
/* invoke callback, exec + redo popup */
int WM_operator_props_popup_confirm(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
@@ -273,8 +274,8 @@ struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const ch
struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname);
-int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot);
-int WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context);
+bool WM_operator_poll (struct bContext *C, struct wmOperatorType *ot);
+bool WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context);
int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const bool store);
int WM_operator_call (struct bContext *C, struct wmOperator *op);
int WM_operator_call_notest(struct bContext *C, struct wmOperator *op);
@@ -417,8 +418,9 @@ void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale, int sx
void WM_drag_free(struct wmDrag *drag);
void WM_drag_free_list(struct ListBase *lb);
-struct wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event),
- void (*copy)(struct wmDrag *, struct wmDropBox *));
+struct wmDropBox *WM_dropbox_add(
+ ListBase *lb, const char *idname, bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event),
+ void (*copy)(struct wmDrag *, struct wmDropBox *));
ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid);
/* Set a subwindow active in pixelspace view, with optional scissor subset */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 80f1e8e1ee1..3d4080eb600 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -569,7 +569,7 @@ typedef struct wmOperatorType {
/* verify if the operator can be executed in the current context, note
* that the operator might still fail to execute even if this return true */
- int (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
+ bool (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
/* optional panel for redo and repeat, autogenerated if not set */
void (*ui)(struct bContext *, struct wmOperator *);
@@ -591,7 +591,7 @@ typedef struct wmOperatorType {
struct wmKeyMap *modalkeymap;
/* python needs the operator type as well */
- int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT;
+ bool (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT;
/* RNA integration */
ExtensionRNA ext;
@@ -661,7 +661,7 @@ typedef struct wmDropBox {
struct wmDropBox *next, *prev;
/* test if the dropbox is active, then can print optype name */
- int (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
+ bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
/* before exec, this copies drag info to wmDrop properties */
void (*copy)(struct wmDrag *, struct wmDropBox *);
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 7a5e3e90166..8bb4bf4f304 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -95,8 +95,9 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
-wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext *, wmDrag *, const wmEvent *),
- void (*copy)(wmDrag *, wmDropBox *))
+wmDropBox *WM_dropbox_add(
+ ListBase *lb, const char *idname, bool (*poll)(bContext *, wmDrag *, const wmEvent *),
+ void (*copy)(wmDrag *, wmDropBox *))
{
wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index cd436899410..3a300877750 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -520,7 +520,7 @@ static void wm_handler_ui_cancel(bContext *C)
/* ********************* operators ******************* */
-int WM_operator_poll(bContext *C, wmOperatorType *ot)
+bool WM_operator_poll(bContext *C, wmOperatorType *ot)
{
wmOperatorTypeMacro *otmacro;
@@ -541,7 +541,7 @@ int WM_operator_poll(bContext *C, wmOperatorType *ot)
}
/* sets up the new context and calls 'wm_operator_invoke()' with poll_only */
-int WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
+bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
{
return wm_operator_call_internal(C, ot, NULL, NULL, context, true);
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index c10b6638608..cb4949d4062 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1882,7 +1882,7 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
}
}
-static int wm_revert_mainfile_poll(bContext *UNUSED(C))
+static bool wm_revert_mainfile_poll(bContext *UNUSED(C))
{
return G.relbase_valid;
}
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 8e11e548aec..72973d3de56 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -87,7 +87,7 @@
/* **************** link/append *************** */
-static int wm_link_append_poll(bContext *C)
+static bool wm_link_append_poll(bContext *C)
{
if (WM_operator_winactive(C)) {
/* linking changes active object which is pretty useful in general,
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index ed2cb1134d8..b81790abaad 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1265,7 +1265,7 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor
}
/* op->poll */
-int WM_operator_winactive(bContext *C)
+bool WM_operator_winactive(bContext *C)
{
if (CTX_wm_window(C) == NULL) return 0;
return 1;
@@ -2028,7 +2028,7 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
}
/* op->poll */
-static int wm_search_menu_poll(bContext *C)
+static bool wm_search_menu_poll(bContext *C)
{
if (CTX_wm_window(C) == NULL) {
return 0;
@@ -2115,7 +2115,7 @@ static void WM_OT_call_menu_pie(wmOperatorType *ot)
/* this poll functions is needed in place of WM_operator_winactive
* while it crashes on full screen */
-static int wm_operator_winactive_normal(bContext *C)
+static bool wm_operator_winactive_normal(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
@@ -2212,8 +2212,9 @@ static void WM_OT_console_toggle(wmOperatorType *ot)
* - draw(bContext): drawing callback for paint cursor
*/
-void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C),
- wmPaintCursorDraw draw, void *customdata)
+void *WM_paint_cursor_activate(
+ wmWindowManager *wm, bool (*poll)(bContext *C),
+ wmPaintCursorDraw draw, void *customdata)
{
wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 42b1b2a5fb4..c0b0e731f4b 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -39,7 +39,7 @@ typedef struct wmPaintCursor {
void *customdata;
- int (*poll)(struct bContext *C);
+ bool (*poll)(struct bContext *C);
void (*draw)(bContext *C, int, int, void *customdata);
} wmPaintCursor;