]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Refactor mouse freezing and fix some minor bugs.
authorbde <bde@FreeBSD.org>
Wed, 24 Apr 2019 15:35:29 +0000 (15:35 +0000)
committerbde <bde@FreeBSD.org>
Wed, 24 Apr 2019 15:35:29 +0000 (15:35 +0000)
commiteb23169a5250ae12e6c1eafd9453fe7af017ec21
tree298224740b9aa75056abc98113170520e745ad0b
parentc8164f08288413cad3c5f1d73cef075bcb93bd52
Refactor mouse freezing and fix some minor bugs.

VGLMouseFreeze() now only defers mouse signals and leaves it to higher
levels to hide and unhide the mouse cursor if necessary.  (It is never
necessary, but is done to simplify the implementation.  It is slow and
flashes the cursor.  It is still done for copying bitmaps and clearing.)

VGLMouseUnFreeze() now only undoes 1 level of freezing.  Its old
optimization to reduce mouse redrawing is too hard to do with unhiding
in higher levels, and its undoing of multiple levels was a historical
mistake.

VGLMouseOverlap() determines if a region overlaps the (full) mouse region.

VGLMouseFreezeXY() is the freezing and a precise overlap check combined
for the special case of writing a single pixel.  This is the single-pixel
case of the old VGLMouseFreeze() with cleanups.

Fixes:
- check in more cases that the application didn't pass an invalid VIDBUF
- check for errors from copying a bitmap to the shadow buffer
- freeze the mouse before writing to the shadow buffer in all cases.  This
  was not done for the case of writing a single pixel (there was a race)
- don't spell the #defined values for VGLMouseShown as 0, 1 or boolean.
lib/libvgl/bitmap.c
lib/libvgl/mouse.c
lib/libvgl/simple.c
lib/libvgl/vgl.h