From 7507b98bab01bcf3cb8a3c2f0bcd206572a04d61 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Fri, 17 Jan 2025 20:35:54 +0300 Subject: [PATCH] CUIMessageBox: hide cursor in gamepad mode when it's not needed at all --- src/xrGame/ui/UIMessageBoxEx.cpp | 17 +++++++++++++++++ src/xrGame/ui/UIMessageBoxEx.h | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/xrGame/ui/UIMessageBoxEx.cpp b/src/xrGame/ui/UIMessageBoxEx.cpp index 4f3443a4ddd..7a7cf93b2f0 100644 --- a/src/xrGame/ui/UIMessageBoxEx.cpp +++ b/src/xrGame/ui/UIMessageBoxEx.cpp @@ -50,6 +50,23 @@ void CUIMessageBoxEx::OnNOClicked(CUIWindow* w, void* d) } } +bool CUIMessageBoxEx::NeedCursor() const +{ + if (pInput->IsCurrentInputTypeKeyboardMouse()) + return true; + + switch (m_pMessageBox->GetBoxStyle()) + { + case CUIMessageBox::MESSAGEBOX_DIRECT_IP: + case CUIMessageBox::MESSAGEBOX_PASSWORD: + case CUIMessageBox::MESSAGEBOX_RA_LOGIN: + case CUIMessageBox::MESSAGEBOX_YES_NO_COPY: + return true; + } + + return false; +} + void CUIMessageBoxEx::SetText(LPCSTR text) { m_pMessageBox->SetText(text); } LPCSTR CUIMessageBoxEx::GetText() { return m_pMessageBox->GetText(); } void CUIMessageBoxEx::SendMessage(CUIWindow* pWnd, s16 msg, void* pData /* = NULL */) diff --git a/src/xrGame/ui/UIMessageBoxEx.h b/src/xrGame/ui/UIMessageBoxEx.h index 39c45b18058..40e91432219 100644 --- a/src/xrGame/ui/UIMessageBoxEx.h +++ b/src/xrGame/ui/UIMessageBoxEx.h @@ -25,7 +25,8 @@ class CUIMessageBoxEx final : public CUIDialogWnd, public CUIWndCallback void OnOKClicked(CUIWindow*, void*); void OnNOClicked(CUIWindow*, void*); - virtual bool NeedCenterCursor() const { return false; } + bool NeedCursor() const override; + bool NeedCenterCursor() const override { return false; } CUIMessageBox* m_pMessageBox; pcstr GetDebugType() override { return "CUIMessageBoxEx"; }