about summary refs log tree commit diff
path: root/src/game/client/components/menus.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/components/menus.cpp')
-rw-r--r--src/game/client/components/menus.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index 2341ba5e..4a53d29b 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -449,10 +449,11 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key)
 	// process
 	static void *pGrabbedID = 0;
 	static bool MouseReleased = true;
+	static int ButtonUsed = 0;
 	int Inside = UI()->MouseInside(pRect);
 	int NewKey = Key;
 	
-	if(!UI()->MouseButton(0) && pGrabbedID == pID)
+	if(!UI()->MouseButton(0) && !UI()->MouseButton(1) && pGrabbedID == pID)
 		MouseReleased = true;
 
 	if(UI()->ActiveItem() == pID)
@@ -467,14 +468,31 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key)
 			MouseReleased = false;
 			pGrabbedID = pID;
 		}
+
+		if(ButtonUsed == 1 && !UI()->MouseButton(1))
+		{
+			if(Inside)
+				NewKey = 0;
+			UI()->SetActiveItem(0);
+		}
 	}
 	else if(UI()->HotItem() == pID)
 	{
-		if(UI()->MouseButton(0) && MouseReleased)
+		if(MouseReleased)
 		{
-			m_Binder.m_TakeKey = true;
-			m_Binder.m_GotKey = false;
-			UI()->SetActiveItem(pID);
+			if(UI()->MouseButton(0))
+			{
+				m_Binder.m_TakeKey = true;
+				m_Binder.m_GotKey = false;
+				UI()->SetActiveItem(pID);
+				ButtonUsed = 0;
+			}
+
+			if(UI()->MouseButton(1))
+			{
+				UI()->SetActiveItem(pID);
+				ButtonUsed = 1;
+			}
 		}
 	}
 	
@@ -482,7 +500,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key)
 		UI()->SetHotItem(pID);
 
 	// draw
-	if (UI()->ActiveItem() == pID)
+	if (UI()->ActiveItem() == pID && ButtonUsed == 0)
 		DoButton_KeySelect(pID, "???", 0, pRect);
 	else
 	{