Add a possibility to disable system screen keyboard
This commit is contained in:
parent
5e2f75a078
commit
98f7b45a21
@ -44,7 +44,7 @@ namespace GraphicsRestrictions
|
||||
/** The list of names used in the XML file for the graphics
|
||||
* restriction types. They must be in the same order as the types. */
|
||||
|
||||
std::array<std::string, 31> m_names_of_restrictions =
|
||||
std::array<std::string, 32> m_names_of_restrictions =
|
||||
{
|
||||
{
|
||||
"UniformBufferObject",
|
||||
@ -77,7 +77,8 @@ namespace GraphicsRestrictions
|
||||
"VertexIdWorking",
|
||||
"HardwareSkinning",
|
||||
"NpotTextures",
|
||||
"TextureBufferObject"
|
||||
"TextureBufferObject",
|
||||
"SystemScreenKeyboard"
|
||||
}
|
||||
};
|
||||
} // namespace Private
|
||||
|
@ -65,6 +65,7 @@ namespace GraphicsRestrictions
|
||||
GR_HARDWARE_SKINNING,
|
||||
GR_NPOT_TEXTURES,
|
||||
GR_TEXTURE_BUFFER_OBJECT,
|
||||
GR_SYSTEM_SCREEN_KEYBOARD,
|
||||
GR_COUNT /** MUST be last entry. */
|
||||
} ;
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/graphics_restrictions.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/screen_keyboard.hpp"
|
||||
@ -530,3 +531,14 @@ bool ScreenKeyboard::shouldUseScreenKeyboard()
|
||||
|
||||
return always_use_screen_keyboard;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns true if system screen keyboard is available
|
||||
*/
|
||||
bool ScreenKeyboard::hasSystemScreenKeyboard()
|
||||
{
|
||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_SYSTEM_SCREEN_KEYBOARD))
|
||||
return false;
|
||||
|
||||
return irr_driver->getDevice()->hasOnScreenKeyboard();
|
||||
}
|
||||
|
@ -126,6 +126,7 @@ namespace GUIEngine
|
||||
static bool isActive() {return m_screen_keyboard != NULL;}
|
||||
|
||||
static bool shouldUseScreenKeyboard();
|
||||
static bool hasSystemScreenKeyboard();
|
||||
|
||||
/** Override to be notified of updates */
|
||||
virtual void onUpdate(float dt);
|
||||
|
@ -246,7 +246,7 @@ CGUIEditBox::~CGUIEditBox()
|
||||
DestroyCaret();
|
||||
#endif
|
||||
if (GUIEngine::ScreenKeyboard::shouldUseScreenKeyboard() &&
|
||||
irr_driver->getDevice()->hasOnScreenKeyboard())
|
||||
GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard())
|
||||
irr_driver->getDevice()->toggleOnScreenKeyboard(false);
|
||||
|
||||
#endif
|
||||
@ -381,7 +381,7 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
|
||||
calculateScrollPos();
|
||||
#ifdef ANDROID
|
||||
if (GUIEngine::ScreenKeyboard::shouldUseScreenKeyboard() &&
|
||||
irr_driver->getDevice()->hasOnScreenKeyboard() &&
|
||||
GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard() &&
|
||||
irr_driver->getDevice()->getType() == irr::EIDT_ANDROID)
|
||||
{
|
||||
// If user toggle with hacker keyboard with arrows, keep
|
||||
@ -675,7 +675,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
case IRR_KEY_RETURN:
|
||||
{
|
||||
if (GUIEngine::ScreenKeyboard::shouldUseScreenKeyboard() &&
|
||||
irr_driver->getDevice()->hasOnScreenKeyboard())
|
||||
GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard())
|
||||
irr_driver->getDevice()->toggleOnScreenKeyboard(false);
|
||||
sendGuiEvent( EGET_EDITBOX_ENTER );
|
||||
}
|
||||
@ -1021,7 +1021,7 @@ void CGUIEditBox::setText(const core::stringw& text)
|
||||
calculateScrollPos();
|
||||
#ifdef ANDROID
|
||||
if (GUIEngine::ScreenKeyboard::shouldUseScreenKeyboard() &&
|
||||
irr_driver->getDevice()->hasOnScreenKeyboard() &&
|
||||
GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard() &&
|
||||
irr_driver->getDevice()->getType() == irr::EIDT_ANDROID)
|
||||
{
|
||||
CIrrDeviceAndroid* dl = dynamic_cast<CIrrDeviceAndroid*>(
|
||||
@ -1144,7 +1144,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
|
||||
|
||||
if (GUIEngine::ScreenKeyboard::shouldUseScreenKeyboard())
|
||||
{
|
||||
if (irr_driver->getDevice()->hasOnScreenKeyboard())
|
||||
if (GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard())
|
||||
irr_driver->getDevice()->toggleOnScreenKeyboard(true, m_type);
|
||||
else
|
||||
openScreenKeyboard();
|
||||
@ -1413,7 +1413,7 @@ void CGUIEditBox::setTextMarkers(s32 begin, s32 end)
|
||||
sendGuiEvent(EGET_EDITBOX_MARKING_CHANGED);
|
||||
#ifdef ANDROID
|
||||
if (GUIEngine::ScreenKeyboard::shouldUseScreenKeyboard() &&
|
||||
irr_driver->getDevice()->hasOnScreenKeyboard() &&
|
||||
GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard() &&
|
||||
irr_driver->getDevice()->getType() == irr::EIDT_ANDROID)
|
||||
{
|
||||
CIrrDeviceAndroid* dl = dynamic_cast<CIrrDeviceAndroid*>(
|
||||
@ -1485,7 +1485,7 @@ void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
|
||||
void CGUIEditBox::openScreenKeyboard()
|
||||
{
|
||||
// If the device has native on screen keyboard, always use it
|
||||
if (irr_driver->getDevice()->hasOnScreenKeyboard())
|
||||
if (GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard())
|
||||
return;
|
||||
|
||||
if (GUIEngine::ScreenKeyboard::getCurrent() != NULL)
|
||||
|
@ -209,7 +209,7 @@ EventPropagation BaseUserScreen::filterActions(PlayerAction action,
|
||||
{
|
||||
if (action == PA_MENU_SELECT &&
|
||||
(!ScreenKeyboard::shouldUseScreenKeyboard() ||
|
||||
GUIEngine::getDevice()->hasOnScreenKeyboard()))
|
||||
GUIEngine::ScreenKeyboard::hasSystemScreenKeyboard()))
|
||||
{
|
||||
if ((m_username_tb != NULL && m_username_tb->isFocusedForPlayer(PLAYER_ID_GAME_MASTER))
|
||||
|| (m_password_tb != NULL && m_password_tb->isFocusedForPlayer(PLAYER_ID_GAME_MASTER)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user