[Bf-blender-cvs] [b880199] pie-menus: Revert "X11 code that disables autorepeat."

Antony Riakiotakis noreply at git.blender.org
Fri Aug 1 12:15:46 CEST 2014


Commit: b8801997b232ed21a8d6a9e9c987344ee88a8145
Author: Antony Riakiotakis
Date:   Fri Aug 1 12:11:56 2014 +0200
Branches: pie-menus
https://developer.blender.org/rBb8801997b232ed21a8d6a9e9c987344ee88a8145

Revert "X11 code that disables autorepeat."

This reverts commit b892c8a4523357570d53d2a662ad7a4d34d80294.

It's difficult to count exit and entrance for pie menus, since it can be done
in many different ways and there are cases where defocusing from blender window
can make the system confused. This is not so serious in itself but this disables
autocomplete -everywhere- on the system and it really is troubling when
it doesn't work. Even navigation on webpages by holding directional keys
breaks. We will use dufferent code to detect autorepeats here.

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

M	intern/ghost/GHOST_C-api.h
M	intern/ghost/GHOST_ISystem.h
M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_System.h
M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_SystemX11.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_regions.c
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 52f505a..9b62307 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -890,12 +890,6 @@ extern int GHOST_UseNativePixels(void);
 extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
 
 
-/**
- * Turn auto repeat on/off.
- */
-extern void GHOST_DisableAutoRepeat(void);
-extern void GHOST_EnableAutoRepeat(void);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index ec0edbe..137926b 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -414,13 +414,6 @@ public:
 	 * in the application
 	 */
 	virtual int confirmQuit(GHOST_IWindow *window) const = 0;
-
-	/**
-	 * Disables the auto-repeat function.
-	 */
-	virtual void disableAutoRepeat(void) = 0;
-	virtual void enableAutoRepeat(void) = 0;
-
 protected:
 	/**
 	 * Initialize the system.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index bcff9cd..eaa59f0 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -914,14 +914,3 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
 	return 1.0f;
 }
 
-extern void GHOST_DisableAutoRepeat(void)
-{
-	GHOST_ISystem *system = GHOST_ISystem::getSystem();
-	system->disableAutoRepeat();
-}
-
-extern void GHOST_EnableAutoRepeat(void)
-{
-	GHOST_ISystem *system = GHOST_ISystem::getSystem();
-	system->enableAutoRepeat();
-}
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index a09ad45..57aa0a3 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -167,13 +167,6 @@ public:
 	 */
 	virtual bool getFullScreen(void);
 
-
-	/**
-	 * Disables the auto-repeat function.
-	 */
-	virtual void disableAutoRepeat(void) {}
-	virtual void enableAutoRepeat(void) {}
-
 	
 	/**
 	 * Native pixel size support (MacBook 'retina').
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 3095067..4d9fd56 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -2064,15 +2064,4 @@ void GHOST_SystemX11::initXInputDevices()
 	}
 }
 
-void GHOST_SystemX11::disableAutoRepeat(void)
-{
-	XAutoRepeatOff(m_display);
-}
-
-void GHOST_SystemX11::enableAutoRepeat(void)
-{
-	XAutoRepeatOn(m_display);
-}
-
-
 #endif /* WITH_X11_XINPUT */
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 4596138..1f95e4b 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -387,12 +387,6 @@ private:
 	bool
 	generateWindowExposeEvents(
 	    );
-
-	/**
-	 * Disables the auto-repeat function.
-	 */
-	void disableAutoRepeat(void);
-	void enableAutoRepeat(void);
 };
 
 #endif
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ab29a3e..bb5872f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8686,8 +8686,6 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 		if ((event->type == block->pie_data.event && event->val == KM_RELEASE) ||
 		     ((event->type == RIGHTMOUSE || event->type == ESCKEY) && (event->val == KM_PRESS)))
 		{
-			WM_menu_pie_enable_autorepeat(C);
-
 			menu->menuretval = UI_RETURN_OK;
 		}
 
@@ -8710,7 +8708,6 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 
 			if (len_squared_v2(seg) < PIE_CLICK_THRESHOLD) {
 				block->pie_data.flags |= UI_PIE_CLICK_STYLE;
-				WM_menu_pie_enable_autorepeat(C);
 			}
 			else if (!is_click_style) {
 				uiBut *but = ui_but_find_activated(menu->region);
@@ -8741,11 +8738,11 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 			case RIGHTMOUSE:
 				if (!is_click_style) {
 					block->pie_data.flags |= UI_PIE_FINISHED;
+					menu->menuretval = 0;
 					ED_region_tag_redraw(ar);
 				}
-				else {
+				else
 					menu->menuretval = UI_RETURN_CANCEL;
-				}
 				break;
 
 			case AKEY:
@@ -8813,9 +8810,6 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 		}
 	}
 
-	if (menu->retvalue && !is_click_style)
-		WM_menu_pie_enable_autorepeat(C);
-
 	return retval;
 }
 
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index e2e980b..ae14fb3 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2682,8 +2682,6 @@ struct uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon
 	uiPieMenu *pie = MEM_callocN(sizeof(uiPopupMenu), "pie menu");
 
 	pie->block_radial = uiBeginBlock(C, NULL, __func__, UI_EMBOSS);
-
-	WM_menu_pie_disable_autorepeat(C);
 	/* may be useful later to allow spawning pies
 	 * from old positions */
 	/* pie->block_radial->flag |= UI_BLOCK_POPUP_MEMORY; */
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index f6371a3..a17e416 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -156,8 +156,7 @@ typedef struct wmWindowManager {
 	struct wmTimer *autosavetimer;    /* timer for auto save */
 
 	char is_interface_locked;		/* indicates whether interface is locked for user interaction */
-	char par[3];
-	int active_pie_menus;           /* counts active pie menus. useful to turn auto-repeat on and off */
+	char par[7];
 } wmWindowManager;
 
 /* wmWindowManager.initialized */
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 15f01c3..62bedf6 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -281,11 +281,6 @@ struct PointerRNA *WM_operator_property_pie_macro(const char *idname, const char
 /* call operator or call pie menu from expanded enum path property */
 struct PointerRNA *WM_operator_enum_pie_macro(const char *idname, const char *name, const char *description,
                                               int flag, const char *piename, const char *opname, const char *path);
-
-
-void WM_menu_pie_enable_autorepeat(struct bContext *C);
-void WM_menu_pie_disable_autorepeat(struct bContext *C);
-
 /* MOVE THIS SOMEWHERE ELSE */
 #define	SEL_TOGGLE		0
 #define	SEL_SELECT		1
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 90f94bf..46a897a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3511,31 +3511,3 @@ struct PointerRNA *WM_operator_enum_pie_macro(const char *idname, const char *na
 	return NULL;
 }
 
-
-void WM_menu_pie_enable_autorepeat(struct bContext *C)
-{
-	wmWindowManager *manager = CTX_wm_manager(C);
-
-	manager->active_pie_menus--;
-
-	if (manager->active_pie_menus < 0) {
-		manager->active_pie_menus = 0;
-		printf("Window Manager: Pie Menus cleanup error\n");
-		fflush(stdout);
-	}
-
-	if (manager->active_pie_menus == 0)
-		GHOST_EnableAutoRepeat();
-
-}
-
-void WM_menu_pie_disable_autorepeat(struct bContext *C)
-{
-	wmWindowManager *manager = CTX_wm_manager(C);
-
-	if (manager->active_pie_menus == 0)
-		GHOST_DisableAutoRepeat();
-
-	manager->active_pie_menus++;
-}
-




More information about the Bf-blender-cvs mailing list