ICursorControl::isVisible is now always returning the flag that was set in setVisible.

This changes the behaviour on Win32 somewhat when Windows returned a CURSOR_SUPPRESSED state (touch-screen input hiding cursor globally).
Previously we set IsVisible it to false when CURSOR_SUPPRESSED was set.
Also we handle the CURSOR_SUPPRESSED state slightly different now and still try to hide cursors once when requested.
Reason for the change is that the old behaviour made it harder to recover from touch-screens hiding the cursor because Irrlicht didn't
know anymore which state is _should_ have. This also unifies the behaviour on all drivers as the other drivers already returned the visible
flag independent of the system being able to actually show the cursor.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6109 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2020-05-05 13:19:42 +00:00
parent 780eec5363
commit 9062ac91af
3 changed files with 17 additions and 5 deletions

View File

@ -148,11 +148,9 @@ namespace irr
while ( gotCursorInfo )
{
#ifdef CURSOR_SUPPRESSED
// new flag for Windows 8, where cursor
// might be suppressed for touch interface
if (info.flags == CURSOR_SUPPRESSED)
// Since Windows 8 the cursor can be suppressed by a touch interface
if (visible && info.flags == CURSOR_SUPPRESSED)
{
visible=false;
break;
}
#endif
@ -173,6 +171,16 @@ namespace irr
// yes, it really must be set each time
info.cbSize = sizeof(CURSORINFO);
gotCursorInfo = GetCursorInfo(&info);
#ifdef CURSOR_SUPPRESSED
// Not sure if a cursor which we tried to hide still can be suppressed.
// I have no touch-display for testing this and MSDN doesn't describe it.
// But adding this check shouldn't hurt and might prevent an endless loop.
if (!visible && info.flags == CURSOR_SUPPRESSED)
{
break;
}
#endif
}
IsVisible = visible;
}