]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Refactor and simplify hiding the mouse cursor and fix bugs caused by
authorbde <bde@FreeBSD.org>
Mon, 29 Apr 2019 14:13:53 +0000 (14:13 +0000)
committerbde <bde@FreeBSD.org>
Mon, 29 Apr 2019 14:13:53 +0000 (14:13 +0000)
commit28164a5b319ab45b7f6cf8063f6de3632920549f
tree2e0b997ca4ba59eb0a9daefacc432f93787bb8c8
parentb6758fe7e231c65eaa8f1ea0e1defff53eb890e8
Refactor and simplify hiding the mouse cursor and fix bugs caused by
complications in the previous methods.

r346761 broke showing the mouse cursor after changing its state from
off to on (including initially), since showing the cursor uses the
state to decide whether to actually show and the state variable was
not changed until after null showing.  Moving the mouse or copying
under the cursor fixed the problem.  Fix this and similar problems for
the on to off transition by changing the state variable before drawing
the cursor.

r346641 failed to turn off the mouse cursor on exit from vgl.  It hid
the cursor only temporarily for clearing.  This doesn't change the state
variable, so unhiding the cursor after clearing restored the cursor if its
state was on.  Fix this by changing its state to VGL_MOUSEHIDE using the
application API for changing the state.

Remove the VGLMouseVisible state variable and the extra states given by it.
This was an optimization that was just an obfuscation in at least the
previous version.

Staticize VGLMouseAction().  Remove VGLMousePointerShow/Hide() except as
internals in __VGLMouseMode().  __VGLMouseMouseMode() is the same as the
application API VGLMouseMouseMode() except it returns the previous mode
which callers need to know to restore it after hiding the cursor.

Use the refactoring to make minor improvements in a simpler way than was
possible:
- in VGLMouseAction(), only hide and and unhide the mouse cursor if the
  mouse moved
- in VGLClear(), only hide and and unhide the mouse cursor if the clearing
  method would otherwise clear the cursor.
lib/libvgl/main.c
lib/libvgl/mouse.c
lib/libvgl/simple.c
lib/libvgl/vgl.h