[Bf-blender-cvs] [20a570f] pie-menus: Rename WM_HANDLER_ACCEPT_DBLPRESS -> WM_HANDLER_ACCEPT_DBL_CLICK

Campbell Barton noreply at git.blender.org
Sun Jun 15 08:54:18 CEST 2014


Commit: 20a570f6b78db14a16250922be2d3ce4833794d0
Author: Campbell Barton
Date:   Sun Jun 15 16:28:58 2014 +1000
https://developer.blender.org/rB20a570f6b78db14a16250922be2d3ce4833794d0

Rename WM_HANDLER_ACCEPT_DBLPRESS -> WM_HANDLER_ACCEPT_DBL_CLICK

also some minor changes for ui_centered_pie_bounds_block

===================================================================

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/wm_event_system.h

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index c40cd7f..5410a05 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -359,7 +359,7 @@ bool uiPupMenuInvoke(struct bContext *C, const char *idname, struct ReportList *
 typedef struct uiPieMenu uiPieMenu;
 
 void uiPieMenuInvoke(struct bContext *C, const char *idname, short event);
-struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, short event) ATTR_NONNULL();
+uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, short event) ATTR_NONNULL();
 void uiPieMenuEnd(struct bContext *C, uiPieMenu *pie);
 struct uiLayout *uiPieMenuLayout(struct uiPieMenu *pie);
 /* Popup Blocks
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 06365ac..c16abca 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -324,28 +324,25 @@ static void ui_centered_bounds_block(wmWindow *window, uiBlock *block)
 
 static void ui_centered_pie_bounds_block(uiBlock *block, const int xy[2])
 {
-	int x, y;
 	int startx;
 	int width, height;
 
 	/* note: this is used for the splash where window bounds event has not been
 	 * updated by ghost, get the window bounds from ghost directly */
 
-	x = xy[0];
-	y = xy[1];
-
 	ui_bounds_block(block);
 
 	width  = BLI_rctf_size_x(&block->rect);
 	height = BLI_rctf_size_y(&block->rect);
 
-	startx = x - (width * 0.5f);
+	startx = xy[0] - (width * 0.5f);
 
 	/* special case, 3 items means no top, make it so we are going down the full height */
-	if (block->pie_data.flags & UI_PIE_3_ITEMS)
-		ui_block_translate(block, startx - block->rect.xmin, y);
+	if (block->pie_data.flags & UI_PIE_3_ITEMS) {
+		ui_block_translate(block, startx - block->rect.xmin, xy[1]);
+	}
 	else {
-		int starty = y - (height * 0.5f);
+		int starty = xy[1] - (height * 0.5f);
 		ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
 	}
 
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b6512a0..a224a07 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -151,7 +151,7 @@ typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
 struct wmEventHandler *WM_event_add_ui_handler(
         const struct bContext *C, ListBase *handlers,
         wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
-        void *userdata,  bool accept_double_press);
+        void *userdata,  bool accept_dbl_click);
 void WM_event_remove_ui_handler(
         ListBase *handlers,
         wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 2ea827c..8528e44 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -398,7 +398,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve
 	
 	/* UI code doesn't handle return values - it just always returns break. 
 	 * to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
-	if (!(handler->flag & WM_HANDLER_ACCEPT_DBLPRESS) && event->type != LEFTMOUSE && event->val == KM_DBL_CLICK)
+	if (!(handler->flag & WM_HANDLER_ACCEPT_DBL_CLICK) && event->type != LEFTMOUSE && event->val == KM_DBL_CLICK)
 		return WM_HANDLER_CONTINUE;
 	
 	/* UI is quite aggressive with swallowing events, like scrollwheel */
@@ -2552,7 +2552,7 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
 wmEventHandler *WM_event_add_ui_handler(
         const bContext *C, ListBase *handlers,
         wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
-        void *userdata, bool accept_double_press)
+        void *userdata, bool accept_dbl_click)
 {
 	wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event ui handler");
 	handler->ui_handle = ui_handle;
@@ -2569,8 +2569,8 @@ wmEventHandler *WM_event_add_ui_handler(
 		handler->ui_menu    = NULL;
 	}
 
-	if (accept_double_press)
-		handler->flag |= WM_HANDLER_ACCEPT_DBLPRESS;
+	if (accept_dbl_click)
+		handler->flag |= WM_HANDLER_ACCEPT_DBL_CLICK;
 	
 	BLI_addhead(handlers, handler);
 	
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index b09eabd..6891b2f 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -81,9 +81,9 @@ enum {
 
 /* handler flag */
 enum {
-	WM_HANDLER_BLOCKING        = 1,  /* after this handler all others are ignored */
-	WM_HANDLER_DO_FREE         = 2,  /* handler tagged to be freed in wm_handlers_do() */
-	WM_HANDLER_ACCEPT_DBLPRESS = 4   /* handler accepts double key press events */
+	WM_HANDLER_BLOCKING         = 1,  /* after this handler all others are ignored */
+	WM_HANDLER_DO_FREE          = 2,  /* handler tagged to be freed in wm_handlers_do() */
+	WM_HANDLER_ACCEPT_DBL_CLICK = 4   /* handler accepts double key press events */
 };
 
 /* wm_event_system.c */




More information about the Bf-blender-cvs mailing list