Re: [AD] Inconsistent behaviour with mouse coordinates in different windowed modes in Windows.

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


aj wrote:
Andrei Ellman wrote:
Victor wrote:
1. What is the version of your Allegro?
4.2.0 (20051015) (sometime after RC2 was released)

At last, I have upgraded to the final 4.2.0 release, and I can confirm
that this bug is still there.


2. What is the type of your Windows?
Windows 2000
i hope you have the service packs.

Yes, I do.
I just tested it under Windows 98, and the same bug in DXWN is there too.


I think you may have found a bug.

It looks like it. However, the mouse_mickey functions work fine on both
DXWN and GDIB when the mouse is outside.


In the GDIB mode, they are always the last values they were when the mouse was in the window. Is there a reason why they aren't in the DXWN mode, or have I found a bug? What about windowed modes on other platforms?

not 100% sure.. but i would think the mouse_x and mouse_y co-ords should always be the last (valid) values generated. regardless of which driver you use, that is to say all drivers should act the same.

mouse_x and mouse_y being the last values of the mouse when it was in
the window is a good solution, but I think an even better one would be
to clamp the mouse_x and mouse_y values to the screen area. For example,
if the mouse moves off the left-edge, mouse_x will be 0 until it returns
back to the window. While the mouse is off the left-edge, mouse_y will
continue to be updated. This means that if the mouse is 'orbited' around
the window, then mouse_x and mouse_y should cycle through the
coordinates of the edges of the window.

But whatever solution is used, the behaviour of mouse_x and mouse_y when
the mouse is outside the window must be consistent on all platforms.


It would be nice too if we had a
function like "is_mouse_inside_window();".

I agree.

Also, if the values of mouse_x and mouse_y are clamped, there should be
an additional set of variables that give the actual position of the
mouse in the space of the allegro-window (to maintain compatibility,
these will be separate from mouse_x and mouse_y), so if the cursor is
100 pixels off the left of the screen, mouse_x should be 0, but
big_mouse_x (or whatever it will be called) will be -100. Either that,
or there should be a function that returns a vector which is the
difference between the current mouse-position, and {mouse_x, mouse_y}. Maybe instead of getting the mouse position relative to the window, there should be a platform independent means of getting the absolute mouse-position in the desktop.




As to the is_mouse_inside_window() this can be done yourself with a little bit of code.
I can think of 99.9% of the code already in my head.
If you really need it, i can assist you in writing it, (it would be about 10 lines of code, and require 1 or 2 win32 functions).

Thanks, but I would prefer it if a platform independent version of
is_mouse_inside_window() was contributed to Allegro. In the meantime, I
can just work around the bug by testing to see if the values of mouse_x
and mouse_y are <0


AE.





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