mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 15:35:39 +00:00
Respond to WM_SETCURSOR messages.
Calling SetCursor on mouse moves is not enough, we need to respond to SETCURSOR messages. If we have a custom cursor we need to call SetCursor and then NOT call DefWindowProc, otherwise we just call DefWindowProc for the forms default cursor.
This commit is contained in:
parent
251a6e813e
commit
10112da976
|
@ -388,6 +388,17 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HandleSetCursor(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
|
||||||
|
{
|
||||||
|
if (cursor != MouseCursor.Default)
|
||||||
|
{
|
||||||
|
Functions.SetCursor(curson_handle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void HandleChar(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
|
void HandleChar(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
@ -486,11 +497,6 @@ namespace OpenTK.Platform.Windows
|
||||||
mouse_last_timestamp = timestamp;
|
mouse_last_timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor != MouseCursor.Default)
|
|
||||||
{
|
|
||||||
Functions.SetCursor(curson_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mouse_outside_window)
|
if (mouse_outside_window)
|
||||||
{
|
{
|
||||||
// Once we receive a mouse move event, it means that the mouse has
|
// Once we receive a mouse move event, it means that the mouse has
|
||||||
|
@ -660,6 +666,8 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
IntPtr WindowProcedure(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
|
IntPtr WindowProcedure(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)
|
||||||
{
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
#region Size / Move / Style events
|
#region Size / Move / Style events
|
||||||
|
@ -693,6 +701,10 @@ namespace OpenTK.Platform.Windows
|
||||||
HandleSize(handle, message, wParam, lParam);
|
HandleSize(handle, message, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WindowMessage.SETCURSOR:
|
||||||
|
result = HandleSetCursor(handle, message, wParam, lParam);
|
||||||
|
break;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Input events
|
#region Input events
|
||||||
|
@ -779,8 +791,16 @@ namespace OpenTK.Platform.Windows
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
// Return TRUE
|
||||||
|
return new IntPtr(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return Functions.DefWindowProc(handle, message, wParam, lParam);
|
return Functions.DefWindowProc(handle, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void EnableMouseTracking()
|
private void EnableMouseTracking()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue