Re: [AD] Mouse Locking

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Tue, 2004-10-19 at 17:50 -0700, Chris wrote:
> > >
> > 
> > I think it's a good idea. And instead of  just the window, it should
> > be combined with set_mouse_range.
> 
> Yes, though my method would be having the software mouse enabled would
> lock the mouse to the window (since we may have to do mouse warping
> anyway), which you could disable by enabling the hardware mouse (even
> if the hardware mouse isn't avialble, it'd still allow the mouse to
> leave the window then). I still don't think many Allegro programs are
> designed for windowed mode where the mouse is free to leave the
> window, and the ones that do work already contain hacks that wouldn't
> interfere (calling set_mouse_position regularly). The only apps that
> would be ok with the mouse leaving are GUI apps, and we can make some
> kind of special-case for that (or implicitly enable the hardware mouse
> there).
> 

Makes sense. If you use a hardware cursor, you probably don't want to
confine it's range. OTOH, what if you have this case:

enable_hardware_mouse ();
set_mouse_range (100, 100, 200, 200);

The user clearly doesn't want the mouse to leave the area given.. no
matter if fullscreen or windowed mode or hardware mouse or not. So I
think, (if the OS allows it), set_mouse_range should hard-lock the
mouse, also in windowed mode. The only problem is, when you set the
range to the whole screen - you either want the mouse to be able to
leave, or not. Maybe just special case set_mouse_range (-1, -1, -1, -1)
to mean, allow movement outside the window in windowed mode. Or, to
avoid problems like with set_clip, just use Dustin's original idea of
using lock_mouse/unlock_mouse. set_mouse_range implicitly would call
lock_mouse (to stay backwardscompatible) - unlock_mouse just would
disable any mouse range (even to the window border).

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/