Cleamnup code for #2020 and use internal pointer for current tracking window
This commit is contained in:
@@ -94,7 +94,7 @@ X11::XcursorImage* CursorsImg[(int32)CursorType::MAX];
|
||||
Dictionary<StringAnsi, X11::KeyCode> KeyNameMap;
|
||||
Array<KeyboardKeys> KeyCodeMap;
|
||||
Delegate<void*> LinuxPlatform::xEventRecieved;
|
||||
const Window* mouseTrackingWindow;
|
||||
Window* MouseTrackingWindow = nullptr;
|
||||
|
||||
// Message boxes configuration
|
||||
#define LINUX_DIALOG_MIN_BUTTON_WIDTH 64
|
||||
@@ -1917,9 +1917,6 @@ bool LinuxPlatform::Init()
|
||||
{
|
||||
if (PlatformBase::Init())
|
||||
return true;
|
||||
|
||||
mouseTrackingWindow = nullptr;
|
||||
|
||||
char fileNameBuffer[1024];
|
||||
|
||||
// Init timing
|
||||
@@ -2263,17 +2260,6 @@ bool LinuxPlatform::Init()
|
||||
return false;
|
||||
}
|
||||
|
||||
void LinuxPlatform::StartTrackingMouse(const Window* window)
|
||||
{
|
||||
mouseTrackingWindow = window;
|
||||
}
|
||||
|
||||
void LinuxPlatform::EndTrackingMouse(const Window* window)
|
||||
{
|
||||
if (mouseTrackingWindow == window)
|
||||
mouseTrackingWindow = nullptr;
|
||||
}
|
||||
|
||||
void LinuxPlatform::BeforeRun()
|
||||
{
|
||||
}
|
||||
@@ -2412,7 +2398,7 @@ void LinuxPlatform::Tick()
|
||||
// Update input context focus
|
||||
X11::XSetICFocus(IC);
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xfocus.window);
|
||||
if (window && mouseTrackingWindow == nullptr)
|
||||
if (window && MouseTrackingWindow == nullptr)
|
||||
{
|
||||
window->OnGotFocus();
|
||||
}
|
||||
@@ -2421,7 +2407,7 @@ void LinuxPlatform::Tick()
|
||||
// Update input context focus
|
||||
X11::XUnsetICFocus(IC);
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xfocus.window);
|
||||
if (window && mouseTrackingWindow == nullptr)
|
||||
if (window && MouseTrackingWindow == nullptr)
|
||||
{
|
||||
window->OnLostFocus();
|
||||
}
|
||||
@@ -2528,22 +2514,22 @@ void LinuxPlatform::Tick()
|
||||
break;
|
||||
case ButtonPress:
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xbutton.window);
|
||||
if (mouseTrackingWindow)
|
||||
((LinuxWindow*)mouseTrackingWindow)->OnButtonPress(&event.xbutton);
|
||||
if (MouseTrackingWindow)
|
||||
MouseTrackingWindow->OnButtonPress(&event.xbutton);
|
||||
else if (window)
|
||||
window->OnButtonPress(&event.xbutton);
|
||||
break;
|
||||
case ButtonRelease:
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xbutton.window);
|
||||
if (mouseTrackingWindow)
|
||||
((LinuxWindow*)mouseTrackingWindow)->OnButtonRelease(&event.xbutton);
|
||||
if (MouseTrackingWindow)
|
||||
MouseTrackingWindow->OnButtonRelease(&event.xbutton);
|
||||
else if (window)
|
||||
window->OnButtonRelease(&event.xbutton);
|
||||
break;
|
||||
case MotionNotify:
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xmotion.window);
|
||||
if (mouseTrackingWindow)
|
||||
((LinuxWindow*)mouseTrackingWindow)->OnMotionNotify(&event.xmotion);
|
||||
if (MouseTrackingWindow)
|
||||
MouseTrackingWindow->OnMotionNotify(&event.xmotion);
|
||||
else if (window)
|
||||
window->OnMotionNotify(&event.xmotion);
|
||||
break;
|
||||
@@ -2552,8 +2538,8 @@ void LinuxPlatform::Tick()
|
||||
break;
|
||||
case LeaveNotify:
|
||||
window = WindowsManager::GetByNativePtr((void*)event.xcrossing.window);
|
||||
if (mouseTrackingWindow)
|
||||
((LinuxWindow*)mouseTrackingWindow)->OnLeaveNotify(&event.xcrossing);
|
||||
if (MouseTrackingWindow)
|
||||
MouseTrackingWindow->OnLeaveNotify(&event.xcrossing);
|
||||
if (window)
|
||||
window->OnLeaveNotify(&event.xcrossing);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user