From 3897718a4052af9ac4417f6aa9c1f12eda49d34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yao=20Wei=20Tjong=20=E5=A7=9A=E4=BC=9F=E5=BF=A0?= Date: Sat, 12 Apr 2014 21:47:45 +0800 Subject: [PATCH] Handle corner case: soft-cursor is invisible + OS-cursor is visible. --- Source/Engine/UI/UI.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Engine/UI/UI.cpp b/Source/Engine/UI/UI.cpp index 033f2ef13..8dff8d9dd 100644 --- a/Source/Engine/UI/UI.cpp +++ b/Source/Engine/UI/UI.cpp @@ -888,16 +888,20 @@ UIElement* UI::GetFocusableElement(UIElement* element) void UI::GetCursorPositionAndVisible(IntVector2& pos, bool& visible) { - if (cursor_) + // Prefer software cursor then OS-specific cursor + if (cursor_ && cursor_->IsVisible()) { pos = cursor_->GetPosition(); - visible = cursor_->IsVisible(); + visible = true; } else { Input* input = GetSubsystem(); pos = input->GetMousePosition(); visible = input->IsMouseVisible(); + + if (!visible && cursor_) + pos = cursor_->GetPosition(); } }