mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-05-02 02:16:32 +00:00
[Linux] Corrected values for mouse move and scroll events
This commit is contained in:
parent
3881992bf7
commit
4c6bb7a38e
|
@ -183,29 +183,31 @@ namespace OpenTK.Platform.Linux
|
||||||
{
|
{
|
||||||
OnMouseUp(i);
|
OnMouseUp(i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mouse.Position != previous_mouse.Position)
|
if (mouse.X != previous_mouse.X || mouse.Y != previous_mouse.Y)
|
||||||
{
|
{
|
||||||
OnMouseMove(mouse.X, mouse.Y);
|
OnMouseMove(mouse.X, mouse.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse.Scroll != previous_mouse.Scroll)
|
if (mouse.Scroll != previous_mouse.Scroll)
|
||||||
{
|
{
|
||||||
OnMouseWheel(mouse.Scroll.X, mouse.Scroll.Y);
|
float dx = mouse.Scroll.X - previous_mouse.Scroll.X;
|
||||||
}
|
float dy = mouse.Scroll.Y - previous_mouse.Scroll.Y;
|
||||||
|
OnMouseWheel(dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
// Note: focus follows mouse. Literally.
|
// Note: focus follows mouse. Literally.
|
||||||
bool cursor_in = Bounds.Contains(new Point(mouse.X, mouse.Y));
|
bool cursor_in = Bounds.Contains(new Point(mouse.X, mouse.Y));
|
||||||
if (!cursor_in && Focused)
|
if (!cursor_in && Focused)
|
||||||
{
|
{
|
||||||
OnMouseLeave(EventArgs.Empty);
|
OnMouseLeave(EventArgs.Empty);
|
||||||
SetFocus(false);
|
SetFocus(false);
|
||||||
}
|
}
|
||||||
else if (cursor_in && !Focused)
|
else if (cursor_in && !Focused)
|
||||||
{
|
{
|
||||||
OnMouseEnter(EventArgs.Empty);
|
OnMouseEnter(EventArgs.Empty);
|
||||||
SetFocus(true);
|
SetFocus(true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mouse;
|
return mouse;
|
||||||
|
|
Loading…
Reference in a new issue