From b30b72eee9095242f458e7e1e5c3ee65f709b286 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 2 Nov 2026 20:47:58 +0000 Subject: [PATCH] Maintenance: [forced, user-approved] Remove fabricated UIEditContext scalar fields and InputFocus wrapper (family C1-C4). focus -> UI Batch #10190 by ragnarok-clanker: forced by an admin (25 lower score(s), 87 changed function(s)); checked with 554 compiled unit(s), including every includer of Source/UI/Chat/ChatSuggestions.h, Source/UI/Edit/ItemTagRetirement.h, Source/UI/Edit/UIEditCtrl.h, Source/UI/Window/InputFocus.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIWindow.h, Source/UI/Window/UIWindowMgr.h. --- Source/Client/Mode/GameMode.cpp | 2 +- Source/Contents/CashEmotionMgr.cpp | 3 +- Source/UI/Acceptance/UIChooseSellBuyWnd.cpp | 32 +++----- Source/UI/Buttons/UITextButton.cpp | 3 +- Source/UI/Chat/ChatSuggestions.cpp | 3 +- Source/UI/Chat/ChatSuggestions.h | 2 - Source/UI/Chat/UISubChatHisWnd.cpp | 3 +- Source/UI/Dialogs/UIEditctrlWnd.cpp | 3 +- Source/UI/Dialogs/UIGraffiStrboxWnd.cpp | 3 +- Source/UI/Edit/ItemTagRetirement.h | 1 - Source/UI/Edit/UIEditBoxEx.cpp | 6 +- Source/UI/Edit/UIEditCtrl.cpp | 56 ++++++------- Source/UI/Edit/UIEditCtrl.h | 2 - Source/UI/Edit/UIEditLinks.cpp | 9 ++- Source/UI/Edit/UIEditVariants.cpp | 27 +++---- Source/UI/Emotion/UIEmotionWnd.cpp | 3 +- Source/UI/Guild/UIGuildHelperWnd.cpp | 6 +- Source/UI/Guild/UIGuildWnd.cpp | 6 +- Source/UI/Lists/UIScrollBar.cpp | 7 +- Source/UI/Party/UIRegisterPartyWnd.cpp | 3 +- Source/UI/Rodex/UIRodexComposeWnd.cpp | 3 +- Source/UI/Shortcuts/UIShortCutWnd.cpp | 4 +- Source/UI/UICaptchaPreviewWnd.cpp | 3 +- Source/UI/UIMacroUserInfoWnd.cpp | 3 +- Source/UI/Window/InputFocus.cpp | 90 ++++++++++----------- Source/UI/Window/InputFocus.h | 12 --- Source/UI/Window/UIChangeNameWnd.cpp | 3 +- Source/UI/Window/UIFrameWnd.cpp | 7 +- Source/UI/Window/UIMessageBox.cpp | 34 +++----- Source/UI/Window/UINewMakeCharWnd.cpp | 3 +- Source/UI/Window/UINewSkillListWnd.cpp | 3 +- Source/UI/Window/UIReplayRECControlWnd.h | 5 +- Source/UI/Window/UISerachStoreInfoWnd.cpp | 2 +- Source/UI/Window/UIWindow.cpp | 3 +- Source/UI/Window/UIWindow.h | 1 - Source/UI/Window/UIWindowMgr.cpp | 8 +- Source/UI/Window/UIWindowMgr.h | 7 ++ 37 files changed, 159 insertions(+), 212 deletions(-) diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index a04cc09c..8ee80599 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -4754,7 +4754,7 @@ void CGameMode::ProcessInput() { handled = this->ProcessGroundClick(this->ProcessMousePick(handled, pick)); this->UpdateHoverNameBalloon(); if (handled != 1 && g_mouse.buttons[0] == 1) { - InputFocus{g_windowMgr.hoverWindow}.Set(nullptr); + g_windowMgr.SetFocus(nullptr); } } else if (pick && handled == 0) { this->ShowActorNameBalloon(pick->accountId); diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 4f44c4a8..4d4745a3 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -2601,8 +2601,7 @@ void UICashEmotionListWnd::SetTab(char tab) { const bool basic = this->m_currentList == this->m_basicList; if (this->m_searchEdit) { if (g_windowMgr.GetHoverWindow() == this->m_searchEdit) { - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(nullptr); + g_windowMgr.SetFocus(nullptr); } this->m_searchEdit->Slot24(0); diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index a3a8aa43..c4719b08 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -434,8 +434,7 @@ void UIEmailAddressWnd::Slot15(int, int) { this->m_edit->SetText(""); this->m_edit->mask = 42; this->AddChild(this->m_edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SelectAll(); const std::string prefix("유저인터페이스\\"); @@ -2641,8 +2640,7 @@ void UIExchangeWnd::CancelInput() { } if (this->unknown_00C0) { - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(nullptr); + g_windowMgr.SetFocus(nullptr); this->unknown_00C0->Move(129, 500); this->unknown_00C0 = nullptr; if (g_windowMgr.window_01C8) { @@ -3991,8 +3989,7 @@ void UISkillNameChangeWnd::Slot15(int, int) { this->m_edit->Background(232, 232, 232); this->m_edit->SetText(""); this->AddChild(this->m_edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SelectAll(); const std::string prefix("유저인터페이스\\"); @@ -4399,7 +4396,7 @@ int UIWhisperWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::i char text[256]; std::strcpy(text, this->m_edit->Text()); this->m_edit->PushHistory(); - InputFocus{g_windowMgr.hoverWindow}.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); if (std::strlen(text) == 0) { return 0; } @@ -5426,7 +5423,7 @@ void UIExchangeWnd::Slot15(int, int) { edit->Background(0xE8, 0xE8, 0xE8); edit->SetText("0"); this->AddChild(edit); - InputFocus{g_windowMgr.hoverWindow}.Set(edit); + g_windowMgr.SetFocus(edit); edit->SelectAll(); UICheckBox* checkBox = new UICheckBox(); @@ -6612,8 +6609,7 @@ void UINpcEditDialogWnd::Slot15(int, int) { this->edit->Background(232, 232, 232); this->edit->SetText("0"); this->AddChild(this->edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); this->edit->SelectAll(); const std::string prefix("유저인터페이스\\"); @@ -6642,8 +6638,7 @@ void UINpcTextEditDialogWnd::Slot15(int, int) { this->edit->SetText(""); this->AddChild(this->edit); this->edit->SetId(492); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); this->edit->SelectAll(); const std::string prefix("유저인터페이스\\"); @@ -6766,8 +6761,7 @@ void UIPartyInvitationToWnd::Slot15(int, int) { } } - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); } // OFFSET: 0x008E60A0 @@ -7119,8 +7113,7 @@ int UISkillNameChangeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a this->m_skillId = static_cast(a); this->m_name = CSkillInfo::DisplayName(*g_session.m_hotkeyScript, static_cast(a)); this->m_edit->SetText(this->m_name.c_str()); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SelectAll(); return 0; } @@ -7225,8 +7218,7 @@ void UIPasswordWnd::Slot15(int, int) { this->m_edit->mask = 42; this->m_edit->SetText(""); this->AddChild(this->m_edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); auto* title = new UIStaticText(*this->m_context); this->unknown_00B8 = reinterpret_cast(title); @@ -8151,7 +8143,7 @@ void UIWhisperWnd::Slot15(int, int) { this->m_edit->Background(255, 0, 255); this->m_edit->TextColor(RGB(255, 255, 255), 0xFFFFFFFF); this->AddChild(this->m_edit); - InputFocus{g_windowMgr.hoverWindow}.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SetId(490); UIChatHisBox2* history = new UIChatHisBox2(); @@ -8322,7 +8314,7 @@ void UIExchangeWnd::Slot19() { if (!g_session.IsNumberWithCommas(text)) { reinterpret_cast(g_windowMgr).Confirm(LookupMessage(602), 0, true, false, 0, "Message", 280, 120, 0); edit->SetText(this->m_moneyText.c_str()); - InputFocus{g_windowMgr.hoverWindow}.Set(edit); + g_windowMgr.SetFocus(edit); return; } diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 46b84fbf..120b7a63 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -2730,8 +2730,7 @@ void UITabControl::Slot26(int, int) { } this->edit->Move(x + 2, 2); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); } // OFFSET: 0x0088C6E0 diff --git a/Source/UI/Chat/ChatSuggestions.cpp b/Source/UI/Chat/ChatSuggestions.cpp index d516b029..4318230b 100644 --- a/Source/UI/Chat/ChatSuggestions.cpp +++ b/Source/UI/Chat/ChatSuggestions.cpp @@ -1,3 +1,4 @@ +#include "UI/Window/UIWindowMgr.h" #include "UI/Chat/ChatSuggestions.h" #include "UI/Window/InputFocus.h" #include "UI/Edit/ItemTagRetirement.h" @@ -190,7 +191,7 @@ void ChatInputFocus::Toggle() { } else { this->open = 1; this->layout.Apply(); - this->focus.Set(this->primary); + g_windowMgr.SetFocus(this->primary); this->primary->SetText(""); if (this->alternate == 0) { diff --git a/Source/UI/Chat/ChatSuggestions.h b/Source/UI/Chat/ChatSuggestions.h index bed390c1..002087f4 100644 --- a/Source/UI/Chat/ChatSuggestions.h +++ b/Source/UI/Chat/ChatSuggestions.h @@ -8,7 +8,6 @@ class UIWindow; #include "UI/Window/WindowManagerWindows.h" class UIEditCtrl; -struct InputFocus; struct ItemTagRetirement; struct ChatSuggestions { @@ -74,7 +73,6 @@ struct ChatRowLayout { struct ChatInputFocus { ChatInputLayout& layout; ChatRowLayout& rows; - InputFocus& focus; std::uint8_t& open; const std::uint8_t& alternate; UIEditCtrl* const& primary; diff --git a/Source/UI/Chat/UISubChatHisWnd.cpp b/Source/UI/Chat/UISubChatHisWnd.cpp index 0a681088..364e774f 100644 --- a/Source/UI/Chat/UISubChatHisWnd.cpp +++ b/Source/UI/Chat/UISubChatHisWnd.cpp @@ -36,8 +36,7 @@ void UISubChatHisWnd::Slot26(int x, int y) { this->m_edit->SetText(""); this->m_edit->Resize(this->m_inputWidth - 10, this->m_inputHeight - 2); this->m_edit->Move(5, 2); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); } } diff --git a/Source/UI/Dialogs/UIEditctrlWnd.cpp b/Source/UI/Dialogs/UIEditctrlWnd.cpp index 45b48aa0..b11ca681 100644 --- a/Source/UI/Dialogs/UIEditctrlWnd.cpp +++ b/Source/UI/Dialogs/UIEditctrlWnd.cpp @@ -167,8 +167,7 @@ void UIEditctrlWnd::Slot15(int, int) { this->edit->tooltip = tooltip; } this->AddChild(this->edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); } // OFFSET: 0x0099C200 diff --git a/Source/UI/Dialogs/UIGraffiStrboxWnd.cpp b/Source/UI/Dialogs/UIGraffiStrboxWnd.cpp index cf1a274d..01f6b254 100644 --- a/Source/UI/Dialogs/UIGraffiStrboxWnd.cpp +++ b/Source/UI/Dialogs/UIGraffiStrboxWnd.cpp @@ -15,8 +15,7 @@ void UIGraffiStrboxWnd::Slot15(int, int) { this->edit->maximum = 20; this->edit->Background(242, 242, 242); this->AddChild(this->edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); const std::string prefix("유저인터페이스\\"); const char* names[2][3] = {{"btn_ok", "btn_ok_a", "btn_ok_b"}, {"btn_cancel", "btn_cancel_a", "btn_cancel_b"}}; diff --git a/Source/UI/Edit/ItemTagRetirement.h b/Source/UI/Edit/ItemTagRetirement.h index 00f449fd..655b48b6 100644 --- a/Source/UI/Edit/ItemTagRetirement.h +++ b/Source/UI/Edit/ItemTagRetirement.h @@ -6,7 +6,6 @@ #include class UIWindow; -struct InputFocus; struct ItemTagRecord { /* 0000 */ UIWindow* child; diff --git a/Source/UI/Edit/UIEditBoxEx.cpp b/Source/UI/Edit/UIEditBoxEx.cpp index e80b2a68..9485e578 100644 --- a/Source/UI/Edit/UIEditBoxEx.cpp +++ b/Source/UI/Edit/UIEditBoxEx.cpp @@ -304,7 +304,7 @@ void CUIEditCtrlEx::Synchronize() { } } - const int candidateCursor = this->m_edit->candidateCursor; + const int candidateCursor = g_serverLanguage->compositionCursor; if (candidateCursor != 0) { this->column += candidateCursor; int cursorX = 0; @@ -375,7 +375,6 @@ void CUIEditBoxEx::SetBackgroundColor(std::uint32_t color) { // OFFSET: 0x009E4BF0 // FUNCTION: fn_14444 void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) { - const bool password = this->m_edit->password != 0; UIWindow* const chatWindow = g_chatSuggestions ? g_chatSuggestions->window : nullptr; switch (key) { @@ -573,8 +572,7 @@ int CUIEditCtrlEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: // OFFSET: 0x009E6300 // FUNCTION: fn_14453 void CUIEditBoxEx::SetFocus() { - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); } // OFFSET: 0x009E6320 diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 7d7837d7..c4b863ed 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -453,7 +453,7 @@ void UIEditCtrl::Slot23() { g_serverLanguage->ResetInput(); g_serverLanguage->ResetInput(); g_serverLanguage->Insert(this->text.c_str()); - this->m_edit->password = this->mask != 0; + g_serverLanguage->SetPassword(this->mask != 0); this->SelectAll(); } @@ -476,7 +476,7 @@ void UIWhisperEditCtrl::Slot24(int retained) { // FUNCTION: fn_10842 void UIEditCtrl::Slot25(int, int) { if (this->disabled == 0) { - this->m_edit->focus.Set(this); + g_windowMgr.SetFocus(this); } } @@ -507,7 +507,7 @@ int UIEditCtrl::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int if (message == 153) { this->InsertLink(reinterpret_cast(a)); } else if (message == 98 && c > 0) { - UIWindow* window = this->m_edit->windows.EnsureWindow(12); + UIWindow* window = g_windowMgr.EnsureWindow(12); if (window) { window->SendMsg(nullptr, 24, c, 0, 0, 0); @@ -550,7 +550,7 @@ void UIEditCtrl::SetText(const char* value) { // OFFSET: 0x0085A590 void UIEditCtrl::SelectAll() { - const bool focused = this->m_edit->focus.window == this; + const bool focused = g_windowMgr.hoverWindow == this; EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage}; state.SelectAll(); } @@ -563,7 +563,7 @@ void UIEditCtrl::PaintText() { // INLINED void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placeholder, std::uint32_t placeholderColor, bool placeholderEnabled) { - const bool focused = this->m_edit->focus.window == this; + const bool focused = g_windowMgr.hoverWindow == this; EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage}; EditViewport viewport{ this->text, @@ -602,11 +602,11 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol chat, reinterpret_cast(g_windowMgr.unknown_0024), tick, - this->m_edit->candidateCursor, + g_serverLanguage->compositionCursor, this->geometry.width, this->geometry.height, - this->m_edit->screenWidth, - this->m_edit->screenHeight, + g_renderer->viewport.width, + g_renderer->viewport.height, this->m_edit->charset, viewport, *this->geometry.surface, @@ -614,8 +614,8 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol this->m_context->locale, this->m_edit->colorChip, parent, - this->m_edit->candidateWindow, - this->m_edit->readingWindow, + g_windowMgr.window_03A4, + g_windowMgr.window_03AC, left, top, this->links, @@ -631,7 +631,7 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol // OFFSET: 0x00862FB0 void UIEditCtrl::Synchronize() { - const bool focused = this->m_edit->focus.window == this; + const bool focused = g_windowMgr.hoverWindow == this; EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage}; EditViewport viewport{ this->text, @@ -650,7 +650,7 @@ void UIEditCtrl::Synchronize() { // OFFSET: 0x00868450 void UIEditCtrl::Trim() { - const bool focused = this->m_edit->focus.window == this; + const bool focused = g_windowMgr.hoverWindow == this; EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage}; state.Trim(); } @@ -658,13 +658,13 @@ void UIEditCtrl::Trim() { // OFFSET: 0x00858D50 // FUNCTION: fn_10768 int UIEditCtrl::Length() const { - return static_cast(this->m_edit->focus.window == this ? g_serverLanguage->text.size() : this->text.size()); + return static_cast(g_windowMgr.hoverWindow == this ? g_serverLanguage->text.size() : this->text.size()); } // OFFSET: 0x00858D20 // FUNCTION: fn_10767 const char* UIEditCtrl::Text() { - if (this->m_edit->focus.window == this) { + if (g_windowMgr.hoverWindow == this) { this->Synchronize(); } @@ -1561,8 +1561,7 @@ void UIMerchantShopMakeWnd::Slot32(int x, int y) { ItemDescriptions descriptions{g_itemDescriptions}; gameMode->drag.BeginItem(g_windowMgr, descriptions, 10, item, item.quantity, -1); reinterpret_cast(g_windowMgr.unknown_02F8)->SendMsg(nullptr, 38, 0, 0, 0, 0); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(nullptr); + g_windowMgr.SetFocus(nullptr); } else if (g_windowMgr.unknown_0410) { item = g_session.FindItem1768(item.unknown_0000[1]); ItemDescriptions descriptions{g_itemDescriptions}; @@ -2169,13 +2168,12 @@ void UIMerchantShopMakeWnd::Slot19() { } UIEditCtrl* edit = this->priceEdits[index]; - InputFocus focus{g_windowMgr.hoverWindow}; char text[24]; std::sprintf(text, "%s ", edit->Text()); if (!g_session.IsNumberWithCommas(text)) { reinterpret_cast(g_windowMgr).Confirm(LookupMessage(602), 0, true, false, 0, "Message", 280, 120, 0); edit->SetText(this->unknown_0170.c_str()); - focus.Set(edit); + g_windowMgr.SetFocus(edit); return; } @@ -2189,7 +2187,7 @@ void UIMerchantShopMakeWnd::Slot19() { edit->SetText(_itoa(1000000000, text, 10)); } else { edit->SetText(_itoa(1000000000, text, 10)); - focus.Set(edit); + g_windowMgr.SetFocus(edit); } } @@ -3045,13 +3043,12 @@ int UIMerchantShopMakeWnd::CommitPrice(int next) { UIEditCtrl* edit = this->priceEdits[this->editIndex]; WindowDialogs& dialogs = reinterpret_cast(g_windowMgr); - InputFocus focus{g_windowMgr.hoverWindow}; char text[24]; std::sprintf(text, "%s ", edit->Text()); if (!g_session.IsNumberWithCommas(text)) { dialogs.Confirm(LookupMessage(602), 0, true, false, 0, "Message", 280, 120, 0); edit->SetText("0"); - focus.Set(edit); + g_windowMgr.SetFocus(edit); edit->SelectAll(); return 0; } @@ -3062,7 +3059,7 @@ int UIMerchantShopMakeWnd::CommitPrice(int next) { } else if (price > 0x7FFFFFFF || price > 1000000000) { if (dialogs.Confirm(LookupMessage(2467), 2, true, false, 0, "Message", 280, 120, 0) != 187) { edit->SetText("0"); - focus.Set(edit); + g_windowMgr.SetFocus(edit); edit->SelectAll(); return 0; } @@ -3093,7 +3090,7 @@ int UIMerchantShopMakeWnd::CommitPrice(int next) { message += std::string(LookupMessage(2478)); if (dialogs.Confirm(message.c_str(), 2, true, false, 0, "Message", 280, 120, 0) != 187) { edit->SetText("0"); - focus.Set(edit); + g_windowMgr.SetFocus(edit); edit->SelectAll(); return 0; } @@ -3106,12 +3103,12 @@ int UIMerchantShopMakeWnd::CommitPrice(int next) { this->editIndex = next; if (next == -1) { - focus.Set(nullptr); + g_windowMgr.SetFocus(nullptr); return 1; } this->priceEdits[next]->TextColor(0, 0xFFFFFFFF); - focus.Set(this->priceEdits[next]); + g_windowMgr.SetFocus(this->priceEdits[next]); this->priceEdits[next]->SelectAll(); return 1; } @@ -9350,8 +9347,7 @@ void UIItemDropCntWnd::Slot15(int, int) { char text[40]; std::sprintf(text, "%d", gameMode->drag.quantity); this->m_edit->SetText(text); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SelectAll(); const char* dragName = gameMode->DragItemName(); @@ -9396,8 +9392,7 @@ void UIItemPurchaseWnd::Slot15(int width, int height) { this->quantityEdit->Background(232, 232, 232); this->quantityEdit->SetText("0"); this->AddChild(this->quantityEdit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->quantityEdit); + g_windowMgr.SetFocus(this->quantityEdit); this->m_message0 = 271; this->title = new UIStaticText(); @@ -9580,8 +9575,7 @@ void UIItemDropCntWnd::Show(int visible) { char text[40]; std::sprintf(text, "%d", gameMode->drag.quantity); this->m_edit->SetText(text); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SelectAll(); const char* dragName = gameMode->DragItemName(); diff --git a/Source/UI/Edit/UIEditCtrl.h b/Source/UI/Edit/UIEditCtrl.h index c9c3e18c..dad4a2a9 100644 --- a/Source/UI/Edit/UIEditCtrl.h +++ b/Source/UI/Edit/UIEditCtrl.h @@ -7,7 +7,6 @@ #include #include -struct InputFocus; struct CLanguageBase; struct CLanguageBase; using InputCharset = CLanguageBase; @@ -19,7 +18,6 @@ struct ITEM_INFO; class UIItemTagOnChat; struct UIEditContext { - InputFocus& focus; unsigned char& password; const InputCharset& charset; WindowManagerWindows& windows; diff --git a/Source/UI/Edit/UIEditLinks.cpp b/Source/UI/Edit/UIEditLinks.cpp index b7f2b277..8f849289 100644 --- a/Source/UI/Edit/UIEditLinks.cpp +++ b/Source/UI/Edit/UIEditLinks.cpp @@ -1,3 +1,5 @@ +#include "UI/Rodex/UIRodexComposeWnd.h" +#include "UI/Window/UIWindowMgr.h" #include "Client/Input/InputCharset.h" #include "Client/Input/Language.h" #include "UI/Window/InputFocus.h" @@ -45,7 +47,8 @@ bool UIEditCtrl::RemoveInvalidLink(std::list::iterator& entry) { } if (left != right) { - const bool allowed = !this->m_edit->linkInputRestricted || this->m_edit->permittedLinkInput == this->m_edit->focus.window; + const bool allowed = !g_windowMgr.unknown_0458 || + reinterpret_cast(g_windowMgr.unknown_0458)->m_contents == g_windowMgr.hoverWindow; const auto boundary = left ? absolute + bytes : absolute; if (allowed && boundary == static_cast(g_serverLanguage->cursor)) { @@ -84,7 +87,7 @@ void UIEditCtrl::SetCursor(std::size_t position) { // OFFSET: 0x00855150 // FUNCTION: fn_10751 void UIEditCtrl::MoveCursorToEnd() { - if (this->m_edit->focus.window == this) { + if (g_windowMgr.hoverWindow == this) { g_serverLanguage->Select(static_cast(g_serverLanguage->text.size()), static_cast(g_serverLanguage->text.size())); return; } @@ -95,7 +98,7 @@ void UIEditCtrl::MoveCursorToEnd() { // OFFSET: 0x008550E0 // FUNCTION: fn_10750 void UIEditCtrl::SnapLinkSelection(std::size_t prefix, std::size_t bytes) { - if (this->m_edit->linkInputRestricted && this->m_edit->permittedLinkInput != this->m_edit->focus.window) { + if (g_windowMgr.unknown_0458 && reinterpret_cast(g_windowMgr.unknown_0458)->m_contents != g_windowMgr.hoverWindow) { return; } diff --git a/Source/UI/Edit/UIEditVariants.cpp b/Source/UI/Edit/UIEditVariants.cpp index 629e7cc8..c0050b3c 100644 --- a/Source/UI/Edit/UIEditVariants.cpp +++ b/Source/UI/Edit/UIEditVariants.cpp @@ -37,11 +37,10 @@ int UIEditCtrl2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in if (message != 0) { this->UIEditCtrl::SendMsg(sender, message, a, b, c, d); } else { - InputFocus& focus = this->m_edit->focus; - if (focus.IsLast(focus.window)) { - focus.First(); + if (g_windowMgr.IsLastFocus(g_windowMgr.hoverWindow)) { + g_windowMgr.FocusFirst(); } else { - focus.Next(); + g_windowMgr.FocusNext(); } this->UIWindow::SendMsg(sender, message, a, b, c, d); @@ -216,7 +215,6 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in // OFFSET: 0x0085E420 // FUNCTION: fn_10829 void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) { - const bool password = this->m_edit->password != 0; UIWindow* const chatWindow = g_chatSuggestions ? g_chatSuggestions->window : nullptr; this->unknown_0150 = 0; @@ -590,7 +588,7 @@ void UIEditCtrl3::PaintText() { const int prefixLength = static_cast(std::strlen(prefix)); int column = prefixLength + this->cursor; - int reading = prefixLength + (this->anchor < this->cursor ? this->cursor : this->anchor) + this->m_edit->candidateCursor; + int reading = prefixLength + (this->anchor < this->cursor ? this->cursor : this->anchor) + g_serverLanguage->compositionCursor; int remaining = column; for (std::size_t index = 0; index < lines.size(); ++index) { @@ -648,7 +646,7 @@ void UIEditCtrl3::PaintText() { const int readingX = readingLength != 0 ? this->TextWidth(lines[caretLine].c_str(), readingLength, 0, 12, 0, 0) : 0; - if (this->m_edit->candidateCursor != 0) { + if (g_serverLanguage->compositionCursor != 0) { int gap = readingX - caretX; if (gap < 2) { gap = 2; @@ -768,7 +766,7 @@ void UIEditCtrl4::Slot23() { g_serverLanguage->ResetInput(); g_serverLanguage->ResetInput(); g_serverLanguage->Insert(this->text.c_str()); - this->m_edit->password = this->mask != 0; + g_serverLanguage->SetPassword(this->mask != 0); this->SelectAll(); } @@ -790,7 +788,7 @@ void UIEditCtrl4::SetPlaceholder(const char* value) { this->placeholder.assign(value, std::strlen(value)); this->Trim(); - if (this->m_edit->focus.window == this) { + if (g_windowMgr.hoverWindow == this) { g_serverLanguage->ResetInput(); g_serverLanguage->ResetInput(); g_serverLanguage->Insert(this->placeholder.c_str()); @@ -823,11 +821,10 @@ int UIEditCtrl5::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in if (message != 0) { this->UIEditCtrl::SendMsg(sender, message, a, b, c, d); } else { - InputFocus& focus = this->m_edit->focus; - if (focus.IsLast(focus.window)) { - focus.First(); + if (g_windowMgr.IsLastFocus(g_windowMgr.hoverWindow)) { + g_windowMgr.FocusFirst(); } else { - focus.Next(); + g_windowMgr.FocusNext(); } this->UIWindow::SendMsg(sender, message, a, b, c, d); @@ -927,7 +924,7 @@ UIChatEditCtrl::UIChatEditCtrl(UIWindowContext& windows, UIEditContext& edit) : // FUNCTION: fn_10840 void UIChatEditCtrl::Slot25(int x, int y) { if (this->disabled == 0) { - this->m_edit->focus.Set(this); + g_windowMgr.SetFocus(this); } this->parent->Slot25(x + this->geometry.x, y + this->geometry.y); @@ -1026,7 +1023,7 @@ void UIWhisperEditCtrl::Slot23() { g_serverLanguage->ResetInput(); g_serverLanguage->ResetInput(); g_serverLanguage->Insert(this->text.c_str()); - this->m_edit->password = this->mask != 0; + g_serverLanguage->SetPassword(this->mask != 0); this->SelectAll(); this->SelectAll(); } diff --git a/Source/UI/Emotion/UIEmotionWnd.cpp b/Source/UI/Emotion/UIEmotionWnd.cpp index 1978558f..08ccde64 100644 --- a/Source/UI/Emotion/UIEmotionWnd.cpp +++ b/Source/UI/Emotion/UIEmotionWnd.cpp @@ -82,8 +82,7 @@ void UIEmotionWnd::Slot15(int, int) { this->viewButton->SetId(283); this->AddChild(this->viewButton); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edits[0]); + g_windowMgr.SetFocus(this->m_edits[0]); this->m_edits[0]->SetCursor(0xff); for (int i = 0; i < 10; ++i) { diff --git a/Source/UI/Guild/UIGuildHelperWnd.cpp b/Source/UI/Guild/UIGuildHelperWnd.cpp index 990237d0..6bf0407e 100644 --- a/Source/UI/Guild/UIGuildHelperWnd.cpp +++ b/Source/UI/Guild/UIGuildHelperWnd.cpp @@ -296,8 +296,7 @@ void UICreateGuildWnd::Slot15(int, int) { } } - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_nameEdit); + g_windowMgr.SetFocus(this->m_nameEdit); this->m_message0 = 184; } @@ -343,8 +342,7 @@ void UIGuildLeaveReasonDescWnd::Slot15(int, int) { this->m_reasonEdit->SetText(""); this->AddChild(this->m_reasonEdit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_reasonEdit); + g_windowMgr.SetFocus(this->m_reasonEdit); this->m_reasonText = new UIStaticText(); this->m_reasonText->SetSize(this->geometry.width - 30, 15); diff --git a/Source/UI/Guild/UIGuildWnd.cpp b/Source/UI/Guild/UIGuildWnd.cpp index 07b80095..f5e4f6dd 100644 --- a/Source/UI/Guild/UIGuildWnd.cpp +++ b/Source/UI/Guild/UIGuildWnd.cpp @@ -178,8 +178,7 @@ void UIGuildPositionManageWnd::Slot19() { // FUNCTION: fn_13054 void UIGuildPositionManageWnd::Invalidate() { this->UIWindow::Invalidate(); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(nullptr); + g_windowMgr.SetFocus(nullptr); } // OFFSET: 0x009603C0 @@ -2016,8 +2015,7 @@ void UIGuildNoticeWnd::Slot15(int, int) { this->m_titleEdit->Background(242, 242, 242); this->m_titleEdit->SetId(281); this->AddChild(this->m_titleEdit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_titleEdit); + g_windowMgr.SetFocus(this->m_titleEdit); this->m_titleEdit->SetText(g_guildInfo.unknown_0030.c_str()); this->m_bodyEdit = new UIEditCtrl3(*this->m_context, *reinterpret_cast(nullptr)); diff --git a/Source/UI/Lists/UIScrollBar.cpp b/Source/UI/Lists/UIScrollBar.cpp index 401ee9ca..2e19828e 100644 --- a/Source/UI/Lists/UIScrollBar.cpp +++ b/Source/UI/Lists/UIScrollBar.cpp @@ -678,7 +678,7 @@ void UIEditCtrl_Custom::PaintText() { const char* prefix = g_serverLanguage->Prefix(false); display = prefix + this->text; begin = std::min(this->anchor, this->cursor) + static_cast(std::strlen(prefix)); - end = std::max(this->anchor, this->cursor) + this->m_edit->candidateCursor + static_cast(std::strlen(prefix)); + end = std::max(this->anchor, this->cursor) + g_serverLanguage->compositionCursor + static_cast(std::strlen(prefix)); } align(); @@ -688,7 +688,7 @@ void UIEditCtrl_Custom::PaintText() { if (std::abs(g_serverLanguage->cursor - g_serverLanguage->anchor) != 0) { this->DrawSelection(x + left, right - left); this->DrawLabel(x, y, display.c_str()); - } else if (this->m_edit->candidateCursor != 0) { + } else if (g_serverLanguage->compositionCursor != 0) { this->MoveCandidateWindow(left); this->MoveReadingWindow(right); if ((timeGetTime() / 500 & 1) == 0) { @@ -1534,8 +1534,7 @@ int UITreeView::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int this->editNode = reinterpret_cast(a); this->edit->maximum = c > 361 ? 361 : static_cast(c); this->edit->SetText(this->editNode->name); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); this->Invalidate(); } else if (b == 1) { if (g_windowMgr.GetHoverWindow() == this->edit) { diff --git a/Source/UI/Party/UIRegisterPartyWnd.cpp b/Source/UI/Party/UIRegisterPartyWnd.cpp index cf04cc4e..943acf9f 100644 --- a/Source/UI/Party/UIRegisterPartyWnd.cpp +++ b/Source/UI/Party/UIRegisterPartyWnd.cpp @@ -1,3 +1,4 @@ +#include "UI/Window/UIWindowMgr.h" #include "Client/Input/InputCharset.h" #include "Contents/MessageTable.h" #include "Client/Input/Language.h" @@ -220,7 +221,7 @@ void UIRegisterPartyWnd::SetInfo(CAdvenPartyInfo value) { // INLINED const char* UIRegisterPartyWnd::Text(UIEditCtrl& control) const { const auto& edit = this->m_registration->edits; - return edit.focus.window == &control ? g_serverLanguage->text.c_str() : control.text.c_str(); + return g_windowMgr.hoverWindow == &control ? g_serverLanguage->text.c_str() : control.text.c_str(); } // OFFSET: 0x007BBA80 diff --git a/Source/UI/Rodex/UIRodexComposeWnd.cpp b/Source/UI/Rodex/UIRodexComposeWnd.cpp index 45a603d5..a0e6e8f8 100644 --- a/Source/UI/Rodex/UIRodexComposeWnd.cpp +++ b/Source/UI/Rodex/UIRodexComposeWnd.cpp @@ -653,8 +653,7 @@ void UIRodexComposeWnd::Slot15(int, int) { this->m_contents->Background(color & 0xFF, (color & 0xFFFF) >> 8, (color >> 16) & 0xFF); this->m_contents->TextColor(0x313131, 0xFFFFFFFF); this->AddChild(this->m_contents); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_contents); + g_windowMgr.SetFocus(this->m_contents); this->m_contents->SetId(0x1EB); this->m_zeny = new UIEditCtrl_Currency(); diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index e894722c..2a4f5eb0 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -588,7 +588,7 @@ void UINewChatWnd::Slot27(int x, int y) { // FUNCTION: fn_12695 void UINewChatWnd::Slot25(int x, int y) { if (static_cast(y - 1) > 19) { - InputFocus{g_windowMgr.hoverWindow}.Set(this->m_inputEdit); + g_windowMgr.SetFocus(this->m_inputEdit); this->UIFrameWnd::Slot25(x, y); return; } @@ -1251,7 +1251,7 @@ int UISubChatHisWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume this->m_edit->SetText(""); this->Invalidate(); reinterpret_cast(this)->Apply(); - reinterpret_cast(&g_windowMgr)->Set(reinterpret_cast(g_chatSuggestions)); + g_windowMgr.SetFocus(reinterpret_cast(g_chatSuggestions)); RECT rectangle; rectangle.left = 0; rectangle.top = 0; diff --git a/Source/UI/UICaptchaPreviewWnd.cpp b/Source/UI/UICaptchaPreviewWnd.cpp index ea8aa77a..8ce48b31 100644 --- a/Source/UI/UICaptchaPreviewWnd.cpp +++ b/Source/UI/UICaptchaPreviewWnd.cpp @@ -93,8 +93,7 @@ void UIMacroDetectorWnd::Slot15(int, int) { this->m_editCtrl->preserveInput = 1; this->AddChild(this->m_editCtrl); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_editCtrl); + g_windowMgr.SetFocus(this->m_editCtrl); UIBitmapButton* button = new UIBitmapButton(); this->m_button = button; diff --git a/Source/UI/UIMacroUserInfoWnd.cpp b/Source/UI/UIMacroUserInfoWnd.cpp index 2ad2610e..e148487a 100644 --- a/Source/UI/UIMacroUserInfoWnd.cpp +++ b/Source/UI/UIMacroUserInfoWnd.cpp @@ -693,8 +693,7 @@ int UIMacroReporterWnd::SendMsg( edit->Invalidate(); if (sender == this->m_tabs[0] || sender == this->m_tabs[1]) { - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(nullptr); + g_windowMgr.SetFocus(nullptr); for (int index = 0; index < this->m_visibleRows; ++index) { UIEditCtrl* field = static_cast(this->m_fields[index]); field->disabled = 1; diff --git a/Source/UI/Window/InputFocus.cpp b/Source/UI/Window/InputFocus.cpp index 6b2af2fa..bd814b27 100644 --- a/Source/UI/Window/InputFocus.cpp +++ b/Source/UI/Window/InputFocus.cpp @@ -1,134 +1,134 @@ -#include "UI/Window/InputFocus.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/UIWindow.h" // OFFSET: 0x00AA9B40 // FUNCTION: fn_17256 -void InputFocus::Set(UIWindow* value) { - if (this->window) { - const bool retained = value && value->Slot06() == this->window; - this->window->Slot24(retained); +void UIWindowMgr::SetFocus(UIWindow* value) { + if (this->hoverWindow) { + const bool retained = value && value->Slot06() == this->hoverWindow; + this->hoverWindow->Slot24(retained); } if (value) { - this->window = value->Slot06(); + this->hoverWindow = value->Slot06(); - if (this->window) { - this->window->Slot23(); + if (this->hoverWindow) { + this->hoverWindow->Slot23(); } } else { - this->window = nullptr; + this->hoverWindow = nullptr; } } // OFFSET: 0x00AA9BC0 // FUNCTION: fn_17257 -void InputFocus::First() { - if (this->window) { - UIWindow* parent = this->window->parent; +void UIWindowMgr::FocusFirst() { + if (this->hoverWindow) { + UIWindow* parent = this->hoverWindow->parent; for (UIWindow* child : parent->m_children) { if (!child->Slot05()) { continue; } - this->window->Slot24(child->Slot06() == this->window); - this->window = child->Slot06(); + this->hoverWindow->Slot24(child->Slot06() == this->hoverWindow); + this->hoverWindow = child->Slot06(); - if (this->window) { - this->window->Slot23(); + if (this->hoverWindow) { + this->hoverWindow->Slot23(); } return; } - this->window->Slot24(0); + this->hoverWindow->Slot24(0); } - this->window = nullptr; + this->hoverWindow = nullptr; } // OFFSET: 0x00AA9C70 // FUNCTION: fn_17258 -void InputFocus::Last() { - if (this->window) { - UIWindow* parent = this->window->parent; +void UIWindowMgr::FocusLast() { + if (this->hoverWindow) { + UIWindow* parent = this->hoverWindow->parent; for (auto it = parent->m_children.rbegin(); it != parent->m_children.rend(); ++it) { UIWindow* child = *it; if (child->Slot05()) { - this->Set(child); + this->SetFocus(child); return; } } - if (this->window) { - this->window->Slot24(0); + if (this->hoverWindow) { + this->hoverWindow->Slot24(0); } } - this->window = nullptr; + this->hoverWindow = nullptr; } // OFFSET: 0x00AA9D20 // FUNCTION: fn_17259 -void InputFocus::Next() { - if (!this->window) { +void UIWindowMgr::FocusNext() { + if (!this->hoverWindow) { return; } - UIWindow* parent = this->window->parent; + UIWindow* parent = this->hoverWindow->parent; bool found = false; for (UIWindow* child : parent->m_children) { if (found && child->Slot05()) { - this->window->Slot24(child->Slot06() == this->window); - this->window = child->Slot06(); + this->hoverWindow->Slot24(child->Slot06() == this->hoverWindow); + this->hoverWindow = child->Slot06(); - if (this->window) { - this->window->Slot23(); + if (this->hoverWindow) { + this->hoverWindow->Slot23(); } return; } - if (child == this->window && child->Slot05()) { + if (child == this->hoverWindow && child->Slot05()) { found = true; } } - this->window->Slot24(0); - this->window = nullptr; + this->hoverWindow->Slot24(0); + this->hoverWindow = nullptr; } // OFFSET: 0x00A96F60 // FUNCTION: fn_17197 -bool InputFocus::IsLast(UIWindow* value) { +bool UIWindowMgr::IsLastFocus(UIWindow* value) { return value && value->parent->NextFocusable(value) == nullptr; } // OFFSET: 0x00AA9DC0 // FUNCTION: fn_17260 -void InputFocus::Previous() { - if (!this->window) { +void UIWindowMgr::FocusPrevious() { + if (!this->hoverWindow) { return; } - UIWindow* previous = this->window->parent->PreviousFocusable(this->window); + UIWindow* previous = this->hoverWindow->parent->PreviousFocusable(this->hoverWindow); if (!previous) { - this->Set(nullptr); + this->SetFocus(nullptr); return; } if (previous->Slot05()) { - this->Set(previous); + this->SetFocus(previous); } } // INLINED -void InputFocus::Refresh(UIWindow* const& excludedRoot) { - if (this->window) { - this->window->Invalidate(); - UIWindow* root = this->window->Root(); +void UIWindowMgr::RefreshFocus(UIWindow* const& excludedRoot) { + if (this->hoverWindow) { + this->hoverWindow->Invalidate(); + UIWindow* root = this->hoverWindow->Root(); if (root && root != excludedRoot) { root->Invalidate(); } diff --git a/Source/UI/Window/InputFocus.h b/Source/UI/Window/InputFocus.h index 5a7c3043..7c2f536d 100644 --- a/Source/UI/Window/InputFocus.h +++ b/Source/UI/Window/InputFocus.h @@ -3,18 +3,6 @@ class UIWindow; -struct InputFocus { - UIWindow*& window; - void Set(UIWindow* value); - void First(); - void Last(); - void Next(); - bool IsLast(UIWindow* value); - void Previous(); - - void Refresh(UIWindow* const& excludedRoot); -}; - void SetPressedWindowRoot(UIWindow*& pressedRoot, UIWindow* window); #endif diff --git a/Source/UI/Window/UIChangeNameWnd.cpp b/Source/UI/Window/UIChangeNameWnd.cpp index 4ea37f6b..bfed233c 100644 --- a/Source/UI/Window/UIChangeNameWnd.cpp +++ b/Source/UI/Window/UIChangeNameWnd.cpp @@ -80,8 +80,7 @@ void UIChangeNameWnd::Slot15(int, int) { this->m_edit->maximum = 24; this->m_edit->SetId(184); this->AddChild(this->m_edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_message0 = 184; } diff --git a/Source/UI/Window/UIFrameWnd.cpp b/Source/UI/Window/UIFrameWnd.cpp index 17184e36..4226f42e 100644 --- a/Source/UI/Window/UIFrameWnd.cpp +++ b/Source/UI/Window/UIFrameWnd.cpp @@ -515,7 +515,7 @@ int UIBank_NewWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: return 0; } this->m_amountEdit->SetText(LookupMessage(0xADA)); - InputFocus{g_windowMgr.hoverWindow}.Set(this->m_amountEdit); + g_windowMgr.SetFocus(this->m_amountEdit); return 0; case 0x186: step = 10000000; @@ -576,7 +576,7 @@ int UIBank_NewWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: _i64toa(amount, text, 10); if (this->m_amountEdit) { this->m_amountEdit->SetText(text); - InputFocus{g_windowMgr.hoverWindow}.Set(this->m_amountEdit); + g_windowMgr.SetFocus(this->m_amountEdit); } return 0; } @@ -703,8 +703,7 @@ int UIChatRoomWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: this->edit->PushHistory(); this->edit->SetText(""); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); return 0; } case 201: diff --git a/Source/UI/Window/UIMessageBox.cpp b/Source/UI/Window/UIMessageBox.cpp index 77738cc7..9ddfc41c 100644 --- a/Source/UI/Window/UIMessageBox.cpp +++ b/Source/UI/Window/UIMessageBox.cpp @@ -1030,8 +1030,7 @@ void UILoginOTPWnd::Slot15(int, int) { this->unknown_00B4->Background(243, 243, 243); this->AddChild(this->unknown_00B4); this->unknown_00B4->SetText(""); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->unknown_00B4); + g_windowMgr.SetFocus(this->unknown_00B4); UIStaticText* label = new UIStaticText(*this->m_context); label->SetSize(80, 20); @@ -1267,7 +1266,7 @@ void UIReplayRECControlWnd::ApplyMode() { this->window_012C->Move(-100, -100); this->window_00C4->Move(162, 5); this->window_0134->Move(7, 8); - this->m_focus->Set(this->window_0134); + g_windowMgr.SetFocus(this->window_0134); } this->SendMsg(nullptr, 60, 0, 0, 0, 0); @@ -1597,8 +1596,7 @@ void UIMakeCharWnd::Slot15(int, int) { this->m_nameEdit->SetId(184); this->AddChild(this->m_nameEdit); this->InitHairControls(); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_nameEdit); + g_windowMgr.SetFocus(this->m_nameEdit); this->m_message0 = 184; } @@ -1628,8 +1626,7 @@ void UIChatRoomWnd::Slot15(int, int) { this->edit->maximum = 70; this->edit->Background(242, 242, 242); this->AddChild(this->edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); this->edit->SetId(494); UIChatHisBox2* history = new UIChatHisBox2(*this->m_context); @@ -1982,8 +1979,7 @@ void UITalkboxTrapInputWnd::Slot15(int, int) { this->edit->maximum = 78; this->edit->Background(242, 242, 242); this->AddChild(this->edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->edit); + g_windowMgr.SetFocus(this->edit); const std::string prefix("유저인터페이스\\"); const char* names[2][3] = {{"btn_ok", "btn_ok_a", "btn_ok_b"}, {"btn_cancel", "btn_cancel_a", "btn_cancel_b"}}; @@ -2295,7 +2291,7 @@ int UIReplayRECControlWnd::SendMsg(UIWindow* sender, int message, std::intptr_t error = 2812; } else { ReplayFileList::Instance().SetPath(edit->Text()); - this->m_focus->Set(nullptr); + g_windowMgr.SetFocus(nullptr); edit->SetText(""); static_cast(g_charViewMode)->SendMsg(274, 0, 0, 0, 0); @@ -2612,8 +2608,7 @@ UINoticeWnd::UINoticeWnd(UIWindowContext& windows) : UIFrameWnd(windows, 0) { this->m_scrollPositions[0] = 0; this->m_bottomPositions[0] = 0; this->m_scroll = 0; - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this); + g_windowMgr.SetFocus(this); } // OFFSET: 0x008AD190 @@ -2638,8 +2633,7 @@ void UIBank_NewWnd::Slot15(int, int) { this->m_amountEdit->flat = 0; this->m_amountEdit->topPadding = 1; this->AddChild(this->m_amountEdit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_amountEdit); + g_windowMgr.SetFocus(this->m_amountEdit); } // OFFSET: 0x008AD770 @@ -2651,8 +2645,7 @@ void UICntWnd::Slot15(int, int) { this->m_edit->maximum = 6; this->m_edit->Background(232, 232, 232); this->AddChild(this->m_edit); - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_edit); + g_windowMgr.SetFocus(this->m_edit); this->m_edit->SelectAll(); this->m_text = new UIStaticText(*this->m_context); @@ -3174,8 +3167,8 @@ UIReplayControlWnd::UIReplayControlWnd(UIWindowContext& windows) : UIFrameWnd(wi // OFFSET: 0x008A4500 // FUNCTION: fn_11670 -UIReplayRECControlWnd::UIReplayRECControlWnd(UIWindowContext& windows, InputFocus& focus, int mode) - : UIFrameWnd(windows, 0), mode(mode), recordStart(0), m_focus(&focus) { +UIReplayRECControlWnd::UIReplayRECControlWnd(UIWindowContext& windows, int mode) + : UIFrameWnd(windows, 0), mode(mode), recordStart(0) { for (int i = 0; i < 10; ++i) { this->options[i] = nullptr; this->recordOptions[i] = 0; @@ -4480,10 +4473,9 @@ void UILoginWnd::Slot15(int, int) { this->idEdit->maximum = 24; this->passwordEdit->maximum = 24; - InputFocus focus{g_windowMgr.hoverWindow}; if (std::strcmp(this->idEdit->Text(), "") != 0 && std::strcmp(this->idEdit->Text(), "ID") != 0) { - focus.Set(this->passwordEdit); + g_windowMgr.SetFocus(this->passwordEdit); } else { - focus.Set(this->idEdit); + g_windowMgr.SetFocus(this->idEdit); } } diff --git a/Source/UI/Window/UINewMakeCharWnd.cpp b/Source/UI/Window/UINewMakeCharWnd.cpp index b4ab0087..359df122 100644 --- a/Source/UI/Window/UINewMakeCharWnd.cpp +++ b/Source/UI/Window/UINewMakeCharWnd.cpp @@ -508,8 +508,7 @@ void UINewMakeCharWnd::Slot15(int width, int height) { this->AddChild(button); } - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(this->m_nameEdit); + g_windowMgr.SetFocus(this->m_nameEdit); this->m_message0 = 0xB8; } diff --git a/Source/UI/Window/UINewSkillListWnd.cpp b/Source/UI/Window/UINewSkillListWnd.cpp index 11095eb7..c7373ca8 100644 --- a/Source/UI/Window/UINewSkillListWnd.cpp +++ b/Source/UI/Window/UINewSkillListWnd.cpp @@ -1346,8 +1346,7 @@ int UINewSkillListWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s this->sub_9AE730(); this->SendMsg(nullptr, 23, 0, 0, 0, 0); if (g_chatSuggestions) { - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(g_chatSuggestions->window); + g_windowMgr.SetFocus(g_chatSuggestions->window); return 0; } } diff --git a/Source/UI/Window/UIReplayRECControlWnd.h b/Source/UI/Window/UIReplayRECControlWnd.h index 12bbd0f2..96795b5d 100644 --- a/Source/UI/Window/UIReplayRECControlWnd.h +++ b/Source/UI/Window/UIReplayRECControlWnd.h @@ -12,12 +12,11 @@ class UICheckBox; class UIEditCtrl; class UIStaticBitmap; class UIStaticText; -struct InputFocus; struct UIEditContext; class UIReplayRECControlWnd : public UIFrameWnd { public: - UIReplayRECControlWnd(UIWindowContext& windows, InputFocus& focus, int mode); + UIReplayRECControlWnd(UIWindowContext& windows, int mode); ~UIReplayRECControlWnd() override; bool Slot03() override; @@ -67,7 +66,7 @@ public: /* 0138 */ ReplayRECControlWndInfo* saved; protected: - InputFocus* m_focus; + void* unknown_focus; void* unknown_controls; UIEditContext* m_editContext; }; diff --git a/Source/UI/Window/UISerachStoreInfoWnd.cpp b/Source/UI/Window/UISerachStoreInfoWnd.cpp index fd0f2253..17e54bd9 100644 --- a/Source/UI/Window/UISerachStoreInfoWnd.cpp +++ b/Source/UI/Window/UISerachStoreInfoWnd.cpp @@ -184,7 +184,7 @@ void UISerachStoreInfoWnd::Slot15(int width, int height) { this->AddBaseButton(); this->AddCloseButton("", 0); this->SendMsg(this, 0x3C, 0, 0, 0, 0); - InputFocus{g_windowMgr.hoverWindow}.Set(this->m_edits[1]); + g_windowMgr.SetFocus(this->m_edits[1]); this->m_message0 = 0x16D; } diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 1c0e66a7..7952e970 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -3468,8 +3468,7 @@ void UINavigationV4Wnd::InsertNavigationLink(std::string name, int x, int y) { } else if (!g_windowMgr.unknown_0024) { reinterpret_cast(g_chatSuggestions)->Toggle(); } else { - InputFocus focus{g_windowMgr.hoverWindow}; - focus.Set(g_chatSuggestions->window); + g_windowMgr.SetFocus(g_chatSuggestions->window); } g_windowMgr.GetHoverWindow()->SendMsg(nullptr, 153, reinterpret_cast(link.c_str()), 0, 0, 0); diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index 8c2b1c48..54c1b77e 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -56,7 +56,6 @@ struct UIWindowContext { class UIWindow : public UIRPData { friend struct WindowDialogs; - friend struct InputFocus; friend class UIWindowMgr; friend class CUIDropDownBox; friend class CUIGameSettingsUI; diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index d44389e1..a0621832 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -2269,14 +2269,14 @@ bool UIWindowMgr::ProcessHotkeyAction(int action, int pressed) { if (GetAsyncKeyState(VK_SHIFT)) { if (this->hoverWindow && this->hoverWindow->parent->PreviousFocusable(this->hoverWindow) == nullptr) { - InputFocus{this->hoverWindow}.Last(); + this->FocusLast(); } else { - InputFocus{this->hoverWindow}.Previous(); + this->FocusPrevious(); } } else if (this->hoverWindow && this->hoverWindow->parent->NextFocusable(this->hoverWindow) == nullptr) { - InputFocus{this->hoverWindow}.First(); + this->FocusFirst(); } else { - InputFocus{this->hoverWindow}.Next(); + this->FocusNext(); } return false; diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index a80e671f..1b093370 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -538,6 +538,13 @@ public: void HideWindow01C8(); bool DropAt(int x, int y, ModeDragState* drag); void FocusWindow01C8Edit(); + void SetFocus(UIWindow* value); + void FocusFirst(); + void FocusLast(); + void FocusNext(); + bool IsLastFocus(UIWindow* value); + void FocusPrevious(); + void RefreshFocus(UIWindow* const& excludedRoot); bool IsHoverOnWindow01C8Button(); void SelectWhisperName(const char* name); void AddWhisperName(const char* name);