summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpasjuste <cpasjuste@gmail.com>2020-04-26 11:21:01 +0200
committercpasjuste <cpasjuste@gmail.com>2020-04-26 11:21:01 +0200
commit4fd097015d4b38a64e0aad56720be020b1729348 (patch)
tree97f66922a28f2fcd1842b9ab7e22cb3de54324e7
parent82735cd2e2d11376fc4f2576542f0f578bb3ed7a (diff)
downloadmv-4fd097015d4b38a64e0aad56720be020b1729348.tar.gz
mv-4fd097015d4b38a64e0aad56720be020b1729348.tar.bz2
mv-4fd097015d4b38a64e0aad56720be020b1729348.tar.xz
mv-4fd097015d4b38a64e0aad56720be020b1729348.zip
switch: actually send "chatinput" action on new software keyboard text
switch: toggle software keyboard on textfield focus change
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp6
-rw-r--r--src/gui/windowmanager.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp11
4 files changed, 17 insertions, 6 deletions
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index b4fcada16..f7d8348c6 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -84,7 +84,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
mAltFpsSlider(new Slider(this, 2.0, 160.0, 1.0)),
// TRANSLATORS: video settings label
mAltFpsLabel(new Label(this, _("Alt FPS limit: "))),
-#if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__)
+#if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) && !defined(__SWITCH__)
// TRANSLATORS: video settings button
mDetectButton(new Button(this, _("Detect best mode"), "detect",
BUTTON_SKIN, this)),
@@ -195,7 +195,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
place(0, 7, mAltFpsSlider, 1, 1);
place(1, 7, mAltFpsLabel, 1, 1).setPadding(3);
-#if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__)
+#if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) && !defined(__SWITCH__)
place(0, 8, mDetectButton, 1, 1);
#else // !defined(ANDROID) && !defined(__APPLE__) &&
// !defined(__native_client__)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index c3e1f197f..776f2a8b4 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -73,7 +73,7 @@
#include "gui/gui.h"
#include "gui/skin.h"
-#ifdef ANDROID
+#if defined(ANDROID) || defined(__SWITCH__)
#include "gui/windowmanager.h"
#endif // ANDROID
@@ -766,7 +766,7 @@ void TextField::fontChanged()
void TextField::mousePressed(MouseEvent &event)
{
-#ifdef ANDROID
+#if defined(ANDROID) || defined(__SWITCH__)
if (!WindowManager::isKeyboardVisible())
inputManager.executeAction(InputAction::SHOW_KEYBOARD);
#endif // ANDROID
@@ -789,7 +789,7 @@ void TextField::mousePressed(MouseEvent &event)
void TextField::focusGained(const Event &event A_UNUSED)
{
-#ifdef ANDROID
+#if defined(ANDROID) || defined(__SWITCH__)
if (!WindowManager::isKeyboardVisible())
inputManager.executeAction(InputAction::SHOW_KEYBOARD);
#endif // ANDROID
diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp
index 5e95fa764..a65e0cd1a 100644
--- a/src/gui/windowmanager.cpp
+++ b/src/gui/windowmanager.cpp
@@ -409,7 +409,7 @@ void WindowManager::newChatMessage()
void WindowManager::setIcon()
{
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(__SWITCH__)
std::string iconFile = branding.getValue("appIcon", "icons/manaplus");
#ifdef WIN32
iconFile.append(".ico");
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index ad7fc1573..759764e48 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -84,6 +84,10 @@
#include <fstream>
#include <sstream>
+#ifdef __SWITCH__
+#include "enums/input/keyvalue.h"
+#endif
+
#include "debug.h"
ChatWindow *chatWindow = nullptr;
@@ -818,6 +822,13 @@ void ChatWindow::keyPressed(KeyEvent &event)
{
const InputActionT actionId = event.getActionId();
std::string temp;
+#ifdef __SWITCH__
+ if(event.getKey().getValue() == KeyValue::TEXTINPUT)
+ {
+ action(ActionEvent(this, "chatinput"));
+ return;
+ } else
+#endif
if (actionId == InputAction::GUI_DOWN)
{
if (mCurHist != mHistory.end())