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

@ -1,5 +1,9 @@
--------------------------
Changes in 1.9 (not yet released)
- ICursorControl::isVisible is now always returning the flag set in setVisible.
This changes the behaviour on Win32 somewhat when Windows returned a CURSOR_SUPPRESSED state (touch-screen input).
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.
- Improvements to B3D writer for speed, readability and handling of low framerate animations.
Thanks @JLouisB for the patch (For more info, see: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=50067&start=15)
- Add another render pass ESNRP_GUI which is drawn last and is p.E. useful for rendering gui nodes in the scenemanager.

@ -104,7 +104,7 @@ namespace gui
virtual void setVisible(bool visible) = 0;
//! Returns if the cursor is currently visible.
/** \return True if the cursor is visible, false if not. */
/** \return True if the cursor flag is set to visible, false if not. */
virtual bool isVisible() const = 0;
//! Sets the new position of the cursor.

@ -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;
}