mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Hopefully better logic for on-screen keyboard visibility
This commit is contained in:
		| @@ -263,6 +263,24 @@ void CTextInput::numberFilter(std::string & text, const std::string & oldText, i | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CTextInput::activate() | ||||
| { | ||||
| 	CFocusable::activate(); | ||||
| #if !defined(VCMI_MOBILE) | ||||
| 	if (hasFocus()) | ||||
| 		GH.startTextInput(pos); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void CTextInput::deactivate() | ||||
| { | ||||
| 	CFocusable::deactivate(); | ||||
| #if !defined(VCMI_MOBILE) | ||||
| 	if (hasFocus()) | ||||
| 		GH.stopTextInput(); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void CTextInput::onFocusGot() | ||||
| { | ||||
| 	updateLabel(); | ||||
| @@ -275,12 +293,14 @@ void CTextInput::onFocusLost() | ||||
|  | ||||
| void CFocusable::focusGot() | ||||
| { | ||||
| 	if (isActive()) | ||||
| 		GH.startTextInput(pos); | ||||
| 	onFocusGot(); | ||||
| } | ||||
|  | ||||
| void CFocusable::focusLost() | ||||
| { | ||||
| 	if (isActive()) | ||||
| 		GH.stopTextInput(); | ||||
| 	onFocusLost(); | ||||
| } | ||||
|   | ||||
| @@ -101,4 +101,6 @@ public: | ||||
|  | ||||
| 	// CIntObject interface impl | ||||
| 	void keyPressed(EShortcut key) final; | ||||
| 	void activate() final; | ||||
| 	void deactivate() final; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user