Re: [AD] al_set_mouse_xy asynchronous on X |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sat, 23 Feb 2013 22:46:05 -0700, Trent Gamblin <nooskewl@xxxxxxxxxx> wrote:
> This poses a problem. In my game I have (simplified):
>
> al_set_mouse_xy(...);
> // bunch of code later
> al_get_mouse_state();
> // state.x/y are still not the same as I set them
>
> So my submarine crashes.
>
> The fix that I think should be applied (but I want to check with the X/Linux "guys") is an XFlush in the X set_mouse_xy implementation. Works like a charm.
>
That wouldn't really do it. The XFlush forces the message out of the
library's buffer to the X server, but there's no guarantee that the X
server sends back the pointer moved event, and that it is processed by
the time you call al_get_mouse_state().
Also, wouldn't your code still be susceptible to the X event thread
changing the mouse state after the [synchronous] al_set_mouse_xy call
and al_get_mouse_state?
Peter