Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++

On-screen keyboard only on X over a text field; the chat no longer shows at sign-in

Alan Saundersfc52393f51e9
diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp
index b1a23f8..0f2232f 100644
--- a/apps/openmw/mwgui/alchemywindow.cpp
+++ b/apps/openmw/mwgui/alchemywindow.cpp
@@ -58,6 +58,8 @@ namespace MWGui
getWidget(mIncreaseButton, "IncreaseButton");
getWidget(mDecreaseButton, "DecreaseButton");
getWidget(mNameEdit, "NameEdit");
+ // Isowind: the keyboard on the screen's Done only puts it away here (Create brews)
+ mNameEdit->setUserString("KeyboardDone", "Close");
getWidget(mItemView, "ItemView");
getWidget(mFilterValue, "FilterValue");
getWidget(mFilterType, "FilterType");
@@ -308,7 +310,25 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit);
if (Settings::gui().mControllerMenus)
+ {
mItemView->setActiveControllerWindow(true);
+ // Isowind: the selection starts on the ingredients
+ mNameSelected = false;
+ setTextFieldSelected(mNameEdit, false);
+ }
+ }
+
+ MyGUI::Widget* AlchemyWindow::getControllerTextField()
+ {
+ return mNameSelected ? mNameEdit : nullptr;
+ }
+
+ void AlchemyWindow::setNameSelected(bool selected)
+ {
+ mNameSelected = selected;
+ setTextFieldSelected(mNameEdit, selected);
+ mItemView->setActiveControllerWindow(!selected);
+ MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* sender)
@@ -586,6 +606,23 @@ namespace MWGui
return true;
}
+ // Isowind: D-pad up from the top of the ingredients selects the potion's name, for X to bring the keyboard on
+ // the screen up (ControllerManager), and down goes back; the D-pad and A do nothing else on the name
+ if (mNameSelected)
+ {
+ if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
+ setNameSelected(false);
+ if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN
+ || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT
+ || arg.button == SDL_CONTROLLER_BUTTON_A || arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
+ return true;
+ }
+ else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP && mItemView->isControllerFocusInTopRow())
+ {
+ setNameSelected(true);
+ return true;
+ }
+
if (arg.button == SDL_CONTROLLER_BUTTON_B)
{
// Remove active ingredients or close the window, starting with right-most slot.
@@ -613,7 +650,9 @@ namespace MWGui
}
else
{
- // Open the combo box to choose the a filter
+ // Open the combo box to choose the a filter (Isowind: the selection back on the ingredients)
+ if (mNameSelected)
+ setNameSelected(false);
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mFilterValue);
MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
}
diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp
index cdf0192..decd8af 100644
--- a/apps/openmw/mwgui/alchemywindow.hpp
+++ b/apps/openmw/mwgui/alchemywindow.hpp
@@ -33,6 +33,8 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Alchemy"; }
+ MyGUI::Widget* getControllerTextField() override;
+
private:
static const float sCountChangeInitialPause; // in seconds
static const float sCountChangeInterval; // in seconds
@@ -102,6 +104,11 @@ namespace MWGui
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
void filterListButtonHandler(const SDL_ControllerButtonEvent& arg);
+
+ // Isowind: the controller selection is on the potion's name (D-pad up from the top of the ingredients), for X
+ // to bring the keyboard on the screen up
+ bool mNameSelected = false;
+ void setNameSelected(bool selected);
};
}
diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp
index 2dbe890..233f3b8 100644
--- a/apps/openmw/mwgui/class.cpp
+++ b/apps/openmw/mwgui/class.cpp
@@ -562,6 +562,8 @@ namespace MWGui
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", {}));
getWidget(mEditName, "EditName");
+ // Isowind: the keyboard on the screen's Done only puts it away here (the buttons go on)
+ mEditName->setUserString("KeyboardDone", "Close");
// Make sure the edit box has focus
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mEditName);
@@ -691,8 +693,32 @@ namespace MWGui
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
}
+ MyGUI::Widget* CreateClassDialog::getControllerTextField()
+ {
+ return mNameSelected ? mEditName : nullptr;
+ }
+
bool CreateClassDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
+ // Isowind: D-pad up selects the class's name, for X to bring the keyboard on the screen up
+ // (ControllerManager), and down goes back to the buttons; A and left and right do nothing on the name
+ if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
+ {
+ const bool select = arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP;
+ if (select != mNameSelected)
+ {
+ mNameSelected = select;
+ setTextFieldSelected(mEditName, select);
+ setControllerFocus(mButtons, mControllerFocus, !select);
+ MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
+ }
+ return true;
+ }
+ if (mNameSelected
+ && (arg.button == SDL_CONTROLLER_BUTTON_A || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
+ || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT))
+ return true;
+
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (mControllerFocus == 0)
diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp
index dad4f4d..928081a 100644
--- a/apps/openmw/mwgui/class.hpp
+++ b/apps/openmw/mwgui/class.hpp
@@ -301,6 +301,8 @@ namespace MWGui
void setNextButtonShow(bool shown);
+ MyGUI::Widget* getControllerTextField() override;
+
// Events
typedef MyGUI::delegates::MultiDelegate<> EventHandle_Void;
@@ -354,6 +356,9 @@ namespace MWGui
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
size_t mControllerFocus = 2;
+ // Isowind: the controller selection is on the class's name (D-pad up from the buttons), for X to bring the
+ // keyboard on the screen up
+ bool mNameSelected = false;
};
}
#endif
diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp
index ab21783..f575de7 100644
--- a/apps/openmw/mwgui/enchantingdialog.cpp
+++ b/apps/openmw/mwgui/enchantingdialog.cpp
@@ -36,6 +36,9 @@ namespace MWGui
, EffectEditorBase(EffectEditorBase::Enchanting)
{
getWidget(mName, "NameEdit");
+ mControllerNameField = mName;
+ // Isowind: the keyboard on the screen's Done only puts it away here (Buy enchants)
+ mName->setUserString("KeyboardDone", "Close");
getWidget(mCancelButton, "CancelButton");
getWidget(mAvailableEffectsList, "AvailableEffects");
getWidget(mUsedEffectsView, "UsedEffects");
diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp
index 3cda350..3f4bb2b 100644
--- a/apps/openmw/mwgui/enchantingdialog.hpp
+++ b/apps/openmw/mwgui/enchantingdialog.hpp
@@ -35,6 +35,8 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "EnchantingDialog"; }
+ MyGUI::Widget* getControllerTextField() override { return getSelectedNameField(); }
+
protected:
void onReferenceUnavailable() override;
void notifyEffectsChanged() override;
diff --git a/apps/openmw/mwgui/itemview.hpp b/apps/openmw/mwgui/itemview.hpp
index 69d0f88..f18e056 100644
--- a/apps/openmw/mwgui/itemview.hpp
+++ b/apps/openmw/mwgui/itemview.hpp
@@ -36,6 +36,8 @@ namespace MWGui
void setActiveControllerWindow(bool active);
int getControllerFocus() { return mControllerFocus; }
int getItemCount() { return mItemCount; }
+ /// Isowind: D-pad up would leave the top row (it wraps round to the bottom of the column)
+ bool isControllerFocusInTopRow() const { return mItemCount == 0 || mControllerFocus % mRows == 0; }
void onControllerButton(const unsigned char button);
private:
diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp
index ff556bc..06ca82d 100644
--- a/apps/openmw/mwgui/mapwindow.cpp
+++ b/apps/openmw/mwgui/mapwindow.cpp
@@ -1605,6 +1605,8 @@ namespace MWGui
getWidget(mCancelButton, "CancelButton");
getWidget(mDeleteButton, "DeleteButton");
getWidget(mTextEdit, "TextEdit");
+ // Isowind: the keyboard on the screen's Done only puts it away here (no new line; OK keeps the note)
+ mTextEdit->setUserString("KeyboardDone", "Close");
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onCancelButtonClicked);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onOkButtonClicked);
@@ -1646,8 +1648,42 @@ namespace MWGui
if (Settings::gui().mControllerMenus)
{
mControllerFocus = getDeleteButtonShown() ? 1 : 0;
- mOkButton->setStateSelected(true);
- mCancelButton->setStateSelected(false);
+ // Isowind: the selection starts on the text
+ mTextSelected = true;
+ setTextFieldSelected(mTextEdit, true);
+ highlightButtons();
+ MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
+ }
+ }
+
+ MyGUI::Widget* EditNoteDialog::getControllerTextField()
+ {
+ return mTextSelected ? mTextEdit : nullptr;
+ }
+
+ void EditNoteDialog::setTextSelected(bool selected)
+ {
+ if (selected == mTextSelected)
+ return;
+ mTextSelected = selected;
+ setTextFieldSelected(mTextEdit, selected);
+ highlightButtons();
+ MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
+ }
+
+ void EditNoteDialog::highlightButtons()
+ {
+ const bool lit = !mTextSelected;
+ if (getDeleteButtonShown())
+ {
+ mDeleteButton->setStateSelected(lit && mControllerFocus == 0);
+ mOkButton->setStateSelected(lit && mControllerFocus == 1);
+ mCancelButton->setStateSelected(lit && mControllerFocus == 2);
+ }
+ else
+ {
+ mOkButton->setStateSelected(lit && mControllerFocus == 0);
+ mCancelButton->setStateSelected(lit && mControllerFocus == 1);
}
}
@@ -1677,6 +1713,22 @@ namespace MWGui
bool EditNoteDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
+ // Isowind: D-pad down goes from the text (X brings the keyboard on the screen up for it: ControllerManager) to
+ // the buttons, up back; A on the text is OK
+ if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
+ {
+ setTextSelected(arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP);
+ return true;
+ }
+ if (mTextSelected)
+ {
+ if (arg.button == SDL_CONTROLLER_BUTTON_A)
+ onOkButtonClicked(mOkButton);
+ else if (arg.button == SDL_CONTROLLER_BUTTON_B)
+ onCancelButtonClicked(mCancelButton);
+ return true;
+ }
+
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (getDeleteButtonShown())
diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp
index e7f6912..c13f507 100644
--- a/apps/openmw/mwgui/mapwindow.hpp
+++ b/apps/openmw/mwgui/mapwindow.hpp
@@ -222,6 +222,7 @@ namespace MWGui
EventHandle_Void eventOkClicked;
ControllerButtons* getControllerButtons() override;
+ MyGUI::Widget* getControllerTextField() override;
private:
void onCancelButtonClicked(MyGUI::Widget* sender);
@@ -235,6 +236,11 @@ namespace MWGui
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
size_t mControllerFocus = 0;
+ // Isowind: the controller selection is on the note's text (the buttons below it with D-pad down), for X to
+ // bring the keyboard on the screen up
+ bool mTextSelected = false;
+ void setTextSelected(bool selected);
+ void highlightButtons();
};
class MapWindow : public MWGui::WindowPinnableBase, public LocalMapBase, public NoDrop
diff --git a/apps/openmw/mwgui/onscreenkeyboard.cpp b/apps/openmw/mwgui/onscreenkeyboard.cpp
index f423107..3db4fe4 100644
--- a/apps/openmw/mwgui/onscreenkeyboard.cpp
+++ b/apps/openmw/mwgui/onscreenkeyboard.cpp
@@ -37,6 +37,13 @@ namespace MWGui
constexpr float sRepeatDelay = 0.4f;
constexpr float sRepeatInterval = 0.1f;
+ // Done (Start, or the key) sends Enter to the field, which confirms its dialog; for a field whose window has
+ // buttons of its own to do that (brew, buy, enchant: the user string set on it) it only puts the keyboard away
+ bool doneCloses(const MyGUI::Widget* target)
+ {
+ return target && target->getUserString("KeyboardDone") == "Close";
+ }
+
// MyGUI reads # in a caption as the start of a colour code
std::string escapeCaption(const std::string& text)
{
@@ -297,7 +304,10 @@ namespace MWGui
sendKey(MyGUI::KeyCode::Backspace);
break;
case Special::Done:
- sendKey(MyGUI::KeyCode::Return);
+ if (doneCloses(mTarget))
+ close();
+ else
+ sendKey(MyGUI::KeyCode::Return);
break;
}
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
@@ -427,7 +437,10 @@ namespace MWGui
sendKey(MyGUI::KeyCode::ArrowRight);
break;
case SDL_CONTROLLER_BUTTON_START:
- sendKey(MyGUI::KeyCode::Return);
+ if (doneCloses(mTarget))
+ close();
+ else
+ sendKey(MyGUI::KeyCode::Return);
break;
case SDL_CONTROLLER_BUTTON_BACK:
close();
diff --git a/apps/openmw/mwgui/onscreenkeyboard.hpp b/apps/openmw/mwgui/onscreenkeyboard.hpp
index 67989a6..bc50e18 100644
--- a/apps/openmw/mwgui/onscreenkeyboard.hpp
+++ b/apps/openmw/mwgui/onscreenkeyboard.hpp
@@ -15,13 +15,17 @@ namespace MyGUI
namespace MWGui
{
- /// Isowind: a keyboard on the screen, for typing with a controller (the multiplayer chat, a character's or
- /// server's name, a save's name, a spell's). It comes up over the text box that has the keyboard focus and types
- /// into it as a real keyboard would, so the text box and its window notice nothing.
+ /// Isowind: a keyboard on the screen, for typing with a controller (a character's name, a server's password, a
+ /// save's name, a spell's). X brings it up over the text field the controller selection is on (ControllerManager,
+ /// WindowBase::getControllerTextField); it never comes up by itself. It types into the field as a real keyboard
+ /// would, so the field and its window notice nothing.
/// D-pad / left stick pick a key A type it
/// B backspace X space
/// Y shift L1 / R1 move the text cursor
/// Start done (Enter) Back put the keyboard away
+ /// Done only puts the keyboard away, without Enter, for a field with the user string KeyboardDone = Close (one
+ /// reached by selection in a window whose own buttons brew, buy or confirm: alchemy, spellmaking, enchanting,
+ /// class creation, map notes); elsewhere Enter confirms the dialog (a name, a password, a save).
class OnScreenKeyboard : public WindowBase, public MyGUI::IUnlinkWidget
{
public:
diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp
index 78e2db8..ce25d21 100644
--- a/apps/openmw/mwgui/savegamedialog.cpp
+++ b/apps/openmw/mwgui/savegamedialog.cpp
@@ -63,6 +63,11 @@ namespace MWGui
mSaveList->eventKeyButtonPressed += MyGUI::newDelegate(this, &SaveGameDialog::onKeyButtonPressed);
mSaveNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onEditSelectAccept);
mSaveNameEdit->eventEditTextChange += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameChanged);
+ if (Settings::gui().mControllerMenus)
+ {
+ mSaveNameEdit->eventKeySetFocus += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameFocus);
+ mSaveNameEdit->eventKeyLostFocus += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameFocusLost);
+ }
// To avoid accidental deletions
mDeleteButton->setNeedKeyFocus(false);
@@ -527,6 +532,16 @@ namespace MWGui
mScreenshot->setRenderItemTexture(mScreenshotTexture.get());
}
+ void SaveGameDialog::onSaveNameFocus(MyGUI::Widget* /*sender*/, MyGUI::Widget* /*other*/)
+ {
+ setTextFieldSelected(mSaveNameEdit, true);
+ }
+
+ void SaveGameDialog::onSaveNameFocusLost(MyGUI::Widget* /*sender*/, MyGUI::Widget* /*other*/)
+ {
+ setTextFieldSelected(mSaveNameEdit, false);
+ }
+
ControllerButtons* SaveGameDialog::getControllerButtons()
{
mControllerButtons.mY = mSaving ? "" : "#{OMWEngine:LoadingSelectCharacter}";
@@ -558,8 +573,17 @@ namespace MWGui
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
{
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mSaveList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
+ // Isowind: up from the top of the list, the save's name (for X to bring the keyboard on the screen up)
+ const size_t index = mSaveList->getIndexSelected();
+ if (mSaving
+ && (MyGUI::InputManager::getInstance().getKeyFocusWidget() == mSaveNameEdit || index == 0
+ || index == MyGUI::ITEM_NONE))
+ winMgr->setKeyFocusWidget(mSaveNameEdit);
+ else
+ {
+ winMgr->setKeyFocusWidget(mSaveList);
+ winMgr->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
+ }
}
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
{
diff --git a/apps/openmw/mwgui/savegamedialog.hpp b/apps/openmw/mwgui/savegamedialog.hpp
index 7263bec..bdd8d5b 100644
--- a/apps/openmw/mwgui/savegamedialog.hpp
+++ b/apps/openmw/mwgui/savegamedialog.hpp
@@ -47,6 +47,10 @@ namespace MWGui
void onEditSelectAccept(MyGUI::EditBox* sender);
void onSaveNameChanged(MyGUI::EditBox* sender);
+ // Isowind: the save's name lit while it has the keyboard focus (the controller selection, for X to bring the
+ // keyboard on the screen up; the list below it with D-pad down)
+ void onSaveNameFocus(MyGUI::Widget* sender, MyGUI::Widget* other);
+ void onSaveNameFocusLost(MyGUI::Widget* sender, MyGUI::Widget* other);
void onConfirmationGiven();
void onConfirmationCancel();
diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp
index 70d48db..a1d16f2 100644
--- a/apps/openmw/mwgui/spellcreationdialog.cpp
+++ b/apps/openmw/mwgui/spellcreationdialog.cpp
@@ -595,6 +595,9 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onCancelButtonClicked);
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onBuyButtonClicked);
mNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SpellCreationDialog::onAccept);
+ mControllerNameField = mNameEdit;
+ // Isowind: the keyboard on the screen's Done only puts it away here (Buy buys)
+ mNameEdit->setUserString("KeyboardDone", "Close");
setWidgets(mAvailableEffectsList, mUsedEffectsView);
@@ -842,6 +845,9 @@ namespace MWGui
mAvailableFocus = 0;
mEffectFocus = 0;
mRightColumn = false;
+ mNameSelected = false;
+ if (mControllerNameField)
+ setTextFieldSelected(mControllerNameField, false);
if (!mAvailableButtons.empty())
{
MWBase::WindowManager& winMgr = *MWBase::Environment::get().getWindowManager();
@@ -1034,10 +1040,45 @@ namespace MWGui
mConstantEffect = constant;
}
+ MyGUI::Widget* EffectEditorBase::getSelectedNameField() const
+ {
+ return mNameSelected ? mControllerNameField : nullptr;
+ }
+
+ void EffectEditorBase::setNameSelected(bool selected)
+ {
+ mNameSelected = selected;
+ setTextFieldSelected(mControllerNameField, selected);
+ // The list entry is lit while the name isn't
+ if (mRightColumn && mEffectFocus < mEffectButtons.size())
+ mEffectButtons[mEffectFocus].first->setStateSelected(!selected);
+ else if (!mRightColumn && mAvailableFocus < mAvailableButtons.size())
+ mAvailableButtons[mAvailableFocus]->setStateSelected(!selected);
+ MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
+ winMgr->setControllerTooltipVisible(!selected && !mRightColumn && Settings::gui().mControllerTooltips);
+ winMgr->updateControllerButtonsOverlay();
+ }
+
bool EffectEditorBase::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
{
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
+ // Isowind: on the name, D-pad down goes back to the list; the D-pad and A do nothing else there (X brings the
+ // keyboard on the screen up: ControllerManager)
+ if (mNameSelected)
+ {
+ if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
+ setNameSelected(false);
+ return true;
+ }
+ if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP && mControllerNameField
+ && (mRightColumn ? mEffectFocus == 0 || mEffectButtons.empty()
+ : mAvailableFocus == 0 || mAvailableButtons.empty()))
+ {
+ setNameSelected(true);
+ return true;
+ }
+
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
if (!mRightColumn && mAvailableFocus < mAvailableButtons.size())
diff --git a/apps/openmw/mwgui/spellcreationdialog.hpp b/apps/openmw/mwgui/spellcreationdialog.hpp
index a54be05..836f6b2 100644
--- a/apps/openmw/mwgui/spellcreationdialog.hpp
+++ b/apps/openmw/mwgui/spellcreationdialog.hpp
@@ -150,6 +150,13 @@ namespace MWGui
virtual bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg);
+ // Isowind: the name of the spell or the enchanted item. D-pad up from the top of either list selects it, for X
+ // to bring the keyboard on the screen up; down goes back to the list.
+ MyGUI::EditBox* mControllerNameField = nullptr;
+ bool mNameSelected = false;
+ void setNameSelected(bool selected);
+ MyGUI::Widget* getSelectedNameField() const;
+
private:
Type mType;
@@ -174,6 +181,8 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "SpellCreationDialog"; }
+ MyGUI::Widget* getControllerTextField() override { return getSelectedNameField(); }
+
protected:
void onReferenceUnavailable() override;
diff --git a/apps/openmw/mwgui/windowbase.cpp b/apps/openmw/mwgui/windowbase.cpp
index 5d21b0f..cab8cbe 100644
--- a/apps/openmw/mwgui/windowbase.cpp
+++ b/apps/openmw/mwgui/windowbase.cpp
@@ -1,17 +1,22 @@
#include "windowbase.hpp"
#include <MyGUI_Button.h>
+#include <MyGUI_ComboBox.h>
+#include <MyGUI_EditBox.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_RenderManager.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
+#include <components/lua_ui/widget.hpp>
#include <components/settings/values.hpp>
#include <components/widgets/imagebutton.hpp>
+#include <components/widgets/numericeditbox.hpp>
#include "draganddrop.hpp"
#include "exposedwindow.hpp"
+#include "textcolours.hpp"
using namespace MWGui;
@@ -56,6 +61,39 @@ void MWGui::setControllerFocus(const std::vector<MyGUI::Button*>& buttons, size_
buttons[index]->setStateSelected(focused);
}
+bool MWGui::isTextField(MyGUI::Widget* widget)
+{
+ if (!widget)
+ return false;
+ if (LuaUi::WidgetExtension* luaWidget = dynamic_cast<LuaUi::WidgetExtension*>(widget))
+ return luaWidget->isTextInput();
+ MyGUI::EditBox* edit = widget->castType<MyGUI::EditBox>(false);
+ if (!edit || edit->getEditReadOnly() || edit->getEditStatic() || widget->castType<Gui::NumericEditBox>(false))
+ return false;
+ if (MyGUI::ComboBox* comboBox = widget->castType<MyGUI::ComboBox>(false))
+ return !comboBox->getComboModeDrop();
+ return true;
+}
+
+void MWGui::setTextFieldSelected(MyGUI::TextBox* field, bool selected)
+{
+ const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
+ field->setTextColour(selected ? textColours.link : textColours.normal);
+}
+
+MyGUI::Widget* WindowBase::getControllerTextField()
+{
+ MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
+ if (!isTextField(focus))
+ return nullptr;
+ for (MyGUI::Widget* widget = focus; widget; widget = widget->getParent())
+ {
+ if (widget == mMainWidget)
+ return focus;
+ }
+ return nullptr;
+}
+
WindowBase::WindowBase(std::string_view parLayout)
: Layout(parLayout)
{
diff --git a/apps/openmw/mwgui/windowbase.hpp b/apps/openmw/mwgui/windowbase.hpp
index 394fc1a..f33904b 100644
--- a/apps/openmw/mwgui/windowbase.hpp
+++ b/apps/openmw/mwgui/windowbase.hpp
@@ -10,6 +10,11 @@ namespace MWWorld
class Ptr;
}
+namespace MyGUI
+{
+ class TextBox;
+}
+
namespace MWGui
{
class DragAndDrop;
@@ -17,6 +22,12 @@ namespace MWGui
size_t wrap(size_t index, size_t max, int delta);
void setControllerFocus(const std::vector<MyGUI::Button*>& buttons, size_t index, bool selected);
+ /// Isowind: a box to type words into, which X brings the keyboard on the screen up for: not a number (the count
+ /// of items to take or buy is set with the D-pad), a drop-down list or text that can't be changed
+ bool isTextField(MyGUI::Widget* widget);
+ /// Isowind: a text field the controller has moved onto, lit as the controller's selection is elsewhere
+ void setTextFieldSelected(MyGUI::TextBox* field, bool selected);
+
struct ControllerButtons
{
std::string mA;
@@ -88,6 +99,10 @@ namespace MWGui
virtual bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) { return true; }
virtual bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) { return false; }
virtual void setActiveControllerWindow(bool active);
+ /// Isowind: the text field the controller selection is on, which X brings the keyboard on the screen up for
+ /// (nullptr if none). By default the text field in this window with the keyboard focus; windows whose text
+ /// field keeps the focus while the controller works elsewhere say when it is selected.
+ virtual MyGUI::Widget* getControllerTextField();
protected:
virtual void onTitleDoubleClicked();
diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp
index 02575ec..3977520 100644
--- a/apps/openmw/mwgui/windowmanagerimp.cpp
+++ b/apps/openmw/mwgui/windowmanagerimp.cpp
@@ -11,7 +11,6 @@
#include <osgViewer/Viewer>
#include <MyGUI_ClipboardManager.h>
-#include <MyGUI_ComboBox.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_FactoryManager.h>
#include <MyGUI_InputManager.h>
@@ -48,7 +47,6 @@
#include <components/vfs/manager.hpp>
-#include <components/widgets/numericeditbox.hpp>
#include <components/widgets/tags.hpp>
#include <components/widgets/widgets.hpp>
@@ -157,22 +155,6 @@ namespace MWGui
return nullptr;
}
}
-
- // Isowind: whether the keyboard on the screen comes up by itself for a widget given the keyboard focus. Only
- // for a box to type words into: not for a number (the count of items to take or buy is set with the D-pad), a
- // drop-down list or text that can't be changed. Y still brings it up for those.
- bool opensOnScreenKeyboard(MyGUI::Widget* widget)
- {
- if (LuaUi::WidgetExtension* luaWidget = dynamic_cast<LuaUi::WidgetExtension*>(widget))
- return luaWidget->isTextInput();
- MyGUI::EditBox* edit = widget->castType<MyGUI::EditBox>(false);
- if (!edit || edit->getEditReadOnly() || edit->getEditStatic()
- || widget->castType<Gui::NumericEditBox>(false))
- return false;
- if (MyGUI::ComboBox* comboBox = widget->castType<MyGUI::ComboBox>(false))
- return !comboBox->getComboModeDrop();
- return true;
- }
}
WindowManager::WindowManager(SDL_Window* window, osgViewer::Viewer* viewer, osg::Group* guiRoot,
@@ -2042,15 +2024,17 @@ namespace MWGui
capturesInput = widget->castType<MyGUI::EditBox>(false);
}
- // Isowind: the keyboard on the screen comes up for a text box when a controller is in use, and goes away
- // with the focus
- if (mOnScreenKeyboard)
+ // Isowind: the keyboard on the screen (brought up with X, never by itself) goes away with the focus; the
+ // button legend shows X for it when the controller selection is on a text field
+ if (mOnScreenKeyboard && !capturesInput)
+ mOnScreenKeyboard->close();
+ static bool updatingLegend = false;
+ if (Settings::gui().mControllerMenus && isGuiMode() && !updatingLegend)
{
- if (!capturesInput)
- mOnScreenKeyboard->close();
- else if (Settings::gui().mControllerMenus && isGuiMode() && mOnScreenKeyboard->getTarget() != widget
- && MWBase::Environment::get().getInputManager()->joystickLastUsed() && opensOnScreenKeyboard(widget))
- mOnScreenKeyboard->open();
+ // Not again for a focus change made while the legend is brought up to date
+ updatingLegend = true;
+ updateControllerButtonsOverlay();
+ updatingLegend = false;
}
// The SDL_IsTextInputActive() check helps to avoid duplicate calls in SDL2.
@@ -2958,9 +2942,9 @@ namespace MWGui
// setButtons will handle setting visibility based on if any buttons are defined.
ControllerButtons buttons = *topWin->getControllerButtons();
- // Isowind: Y brings up the keyboard on the screen for a text box being typed into
- if (buttons.mY.empty() && SDL_IsTextInputActive() && !isOnScreenKeyboardVisible())
- buttons.mY = "#{OMWEngine:Keyboard}";
+ // Isowind: X brings the keyboard on the screen up for the text field the controller selection is on
+ if (!isOnScreenKeyboardVisible() && topWin->getControllerTextField())
+ buttons.mX = "#{OMWEngine:Keyboard}";
mControllerButtonsOverlay->setButtons(&buttons);
if (getMode() == GM_Inventory)
{
diff --git a/apps/openmw/mwinput/controllermanager.cpp b/apps/openmw/mwinput/controllermanager.cpp
index e9f6a72..d9dd036 100644
--- a/apps/openmw/mwinput/controllermanager.cpp
+++ b/apps/openmw/mwinput/controllermanager.cpp
@@ -284,15 +284,6 @@ namespace MWInput
if (Settings::gui().mControllerMenus)
{
- // Isowind: Y brings up the keyboard on the screen for a text box being typed into
- if (arg.button == SDL_CONTROLLER_BUTTON_Y && SDL_IsTextInputActive()
- && !winMgr->isOnScreenKeyboardVisible())
- {
- winMgr->openOnScreenKeyboard();
- if (winMgr->isOnScreenKeyboardVisible())
- return true;
- }
-
// Update cursor state.
bool treatAsMouse = winMgr->getCursorVisible();
winMgr->setCursorActive(false);
@@ -321,6 +312,23 @@ namespace MWInput
return true;
}
+ // Isowind: X brings the keyboard on the screen up for the text field the selection is on (instead of
+ // what X does in that window); it never comes up by itself
+ if (arg.button == SDL_CONTROLLER_BUTTON_X && !winMgr->isOnScreenKeyboardVisible())
+ {
+ if (MyGUI::Widget* textField = topWin->getControllerTextField())
+ {
+ if (MyGUI::InputManager::getInstance().getKeyFocusWidget() != textField)
+ winMgr->setKeyFocusWidget(textField);
+ winMgr->openOnScreenKeyboard();
+ if (winMgr->isOnScreenKeyboardVisible())
+ {
+ winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
+ return true;
+ }
+ }
+ }
+
if (topWin->onControllerButtonEvent(arg))
return true;
}
diff --git a/apps/openmw/mwmp/GUI/GUIChat.cpp b/apps/openmw/mwmp/GUI/GUIChat.cpp
index ad13d2f..61d1a2d 100644
--- a/apps/openmw/mwmp/GUI/GUIChat.cpp
+++ b/apps/openmw/mwmp/GUI/GUIChat.cpp
@@ -40,15 +40,18 @@ namespace mwmp
mHistory->setNeedKeyFocus(false);
windowState = CHAT_DISABLED;
+ editState = false;
mCommandLine->setVisible(false);
delay = 3; // 3 sec.
+ curTime = 0;
}
void GUIChat::onOpen()
{
- // Give keyboard focus to the combo box whenever the console is
- // turned on
- setEditState(false);
+ // The input line opens with Enter. Isowind: only closed if it was open, or the keyboard focus would be taken
+ // from a menu's text field whenever a message brings the chat up
+ if (editState)
+ setEditState(false);
if (windowState == CHAT_DISABLED)
windowState = CHAT_ENABLED;
@@ -56,7 +59,8 @@ namespace mwmp
void GUIChat::onClose()
{
- setEditState(false);
+ if (editState)
+ setEditState(false);
}
bool GUIChat::exit()
@@ -115,9 +119,13 @@ namespace mwmp
void GUIChat::print(const std::string &msg, const std::string &color)
{
- if (windowState == CHAT_HIDDENMODE && !isVisible())
+ if (windowState == CHAT_HIDDENMODE)
{
- setVisible(true);
+ // Isowind: shown for the whole delay after the latest message (it used to go again the next frame once
+ // it had been shown and hidden once)
+ curTime = 0;
+ if (!isVisible())
+ setVisible(true);
}
if(msg.size() == 0)
@@ -261,7 +269,7 @@ namespace mwmp
curTime += dt;
if (curTime >= delay)
{
- setEditState(false);
+ curTime = 0;
setVisible(false);
}
}
diff --git a/apps/openmw/mwmp/GUIController.cpp b/apps/openmw/mwmp/GUIController.cpp
index 1987186..ba7cc29 100644
--- a/apps/openmw/mwmp/GUIController.cpp
+++ b/apps/openmw/mwmp/GUIController.cpp
@@ -110,10 +110,17 @@ void mwmp::GUIController::printChatMessage(std::string &msg)
mChat->print(msg);
}
-
+// Called as the player comes into the world (Main::updateWorld). Isowind: the chat isn't put on the screen then: it
+// starts as TES3MP's "appearing when needed", up for a few seconds when a message comes and with its input line on
+// Enter (F2 switches to always shown, or hidden)
void mwmp::GUIController::setChatVisible(bool chatVisible)
{
- mChat->setVisible(chatVisible);
+ if (!chatVisible)
+ mChat->setVisible(false);
+ else if (mChat->windowState == GUIChat::CHAT_DISABLED)
+ mChat->windowState = GUIChat::CHAT_HIDDENMODE;
+ else if (mChat->windowState == GUIChat::CHAT_ENABLED)
+ mChat->setVisible(true);
}
void mwmp::GUIController::showDialogList(const mwmp::BasePlayer::GUIMessageBox &guiMessageBox)
@@ -249,7 +256,8 @@ void mwmp::GUIController::changeChatMode()
mChat->pressedChatMode();
}
-// No controller button opens the chat for now (D-pad left did); it is opened with the keyboard
+// No controller button opens the chat for now (D-pad left did); it is opened with the keyboard. Used again, it would
+// have to bring the keyboard on the screen up itself, which no longer comes up by itself.
bool mwmp::GUIController::openChatWithController()
{
MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager();
diff --git a/isowind/README.txt b/isowind/README.txt
index a8f38cc..a8f7d04 100644
--- a/isowind/README.txt
+++ b/isowind/README.txt
@@ -74,8 +74,9 @@ server\logs. Keep the same game (co-op or MMO) for a world: an MMO world switche
what each player looted, so it's all back.
In multiplayer
-Enter Talk in the chat (with a keyboard; a controller has no button for it for now);
- F2 hides or shows the chat window.
+Enter Talk in the chat (with a keyboard; a controller has no button for it for now).
+ The chat shows for a few seconds when a message comes; F2 switches between that,
+ hidden and always shown.
The world never pauses, not even in menus. Saving and loading are off: the server keeps everything.
When you die you wake up at the nearest temple.
@@ -131,11 +132,13 @@ side by side (the inventory screen, a chest, a shop) the bumpers switch between
while the triggers switch the tabs within a window. The right stick pressed in shows an item's info, and in
the inventory and magic windows Y puts the item or spell on a quick key. In Options the bumpers switch tabs,
the D-pad steps a pointer through the settings (up / down) and adjusts the one it is on (left / right), and A
-works it. The legend along the bottom of each menu says what the buttons do there. A keyboard appears on the
-screen wherever there is something to type (your name on a server, the chat, a save's name); press Y to bring
-it up if it doesn't. Whether you get these menus or Morrowind's own is decided as the game starts, from
-whether a controller is plugged in (Isowind.exe's launcher and isowind.sh's --controller flag decide too); the
-mouse works in them as well.
+works it. The legend along the bottom of each menu says what the buttons do there. To type something (your
+name, a server's password, a save's, potion's, spell's or class's name, a map note), move onto the box with
+the D-pad - up from the top of the list or the buttons under it - and press X: a keyboard comes up on the
+screen (never by itself). Start or Back puts it away when you are done; in a box of its own (your name, a
+password, a save's name) Start also confirms it. Whether you get these menus or Morrowind's own is decided
+as the game starts, from whether a controller is plugged in (Isowind.exe's launcher and isowind.sh's
+--controller flag decide too); the mouse works in them as well.
The minimap turns so that up on it is up on the screen, and shows other players in multiplayer (as
does the map). Zoom it with the mouse wheel over it while a menu is open, or in Options > Interface,
diff --git a/isowind/mod/scripts/isowind/topdown.lua b/isowind/mod/scripts/isowind/topdown.lua
index 2c9d2cf..82f48bd 100644
--- a/isowind/mod/scripts/isowind/topdown.lua
+++ b/isowind/mod/scripts/isowind/topdown.lua
@@ -29,7 +29,8 @@
-- there the ring and label stay on what X uses (friendly people, doors, containers and their locks), but the aim
-- never locks onto those. A lockpick or probe never locks on, and looks for doors and containers first.
-- The menus are the engine's controller menus ('controller menus' in the profile's settings.cfg): D-pad and A / B,
--- the triggers switch pages, Y puts an item or spell on a quick key, and a keyboard on the screen types.
+-- the triggers switch pages, Y puts an item or spell on a quick key, and X on a text field (moved onto with the
+-- D-pad) brings up a keyboard on the screen to type with; it never comes up by itself.
--
-- The zoom picks the view: zoomed out to TOPDOWN_FROM or farther it is this top-down view; in closer, Morrowind's
-- third person view at that distance; closer than FIRST_PERSON_BELOW, first person. Zooming and the first / third
diff --git a/isowind/server/CoreScripts/scripts/config.lua b/isowind/server/CoreScripts/scripts/config.lua
index 16609cf..9105fe3 100644
--- a/isowind/server/CoreScripts/scripts/config.lua
+++ b/isowind/server/CoreScripts/scripts/config.lua
@@ -49,12 +49,11 @@ config.defaultTimeTable = { year = 427, month = 7, day = 16, hour = 9,
daysPassed = 1, dayTimeScale = 30, nightTimeScale = 40 }
-- The chat window instructions that show up when players join the server
-config.chatWindowInstructions = color.White .. "Use " .. color.Yellow .. "Y" .. color.White .. " by default to chat or change it" ..
- " from your client config.\nType in " .. color.Yellow .. "/help" .. color.White .. " to see the commands" ..
+config.chatWindowInstructions = color.White .. "Use " .. color.Yellow .. "Enter" .. color.White .. " to chat." ..
+ "\nType in " .. color.Yellow .. "/help" .. color.White .. " to see the commands" ..
" available to you.\nType in " .. color.Yellow .. "/invite <pid>" .. color.White .. " to invite a player to become " ..
"your ally so their followers don't react to your friendly fire.\nUse " .. color.Yellow .. "F2" .. color.White ..
- " by default to hide the chat window or use the " .. color.Yellow .. "Chat Window Mode" .. color.White .. " button from " ..
- "your left controller menu if you're in VR.\n"
+ " to switch the chat window between showing when a message comes, hidden and always shown.\n"
-- The startup scripts instructions that show up when the startup scripts have not been run yet
config.startupScriptsInstructions = color.Red .. "Warning: " .. color.White .. " For some actors and objects to have their correct" ..