qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fix SDL mouse events processing


From: Samuel Thibault
Subject: Re: [Qemu-devel] [PATCH] fix SDL mouse events processing
Date: Wed, 5 Mar 2008 13:51:26 +0000
User-agent: Mutt/1.5.12-2006-07-14

Johannes Schindelin, le Wed 05 Mar 2008 14:09:10 +0100, a écrit :
> What is this good for?  (I imagine that it would make sense to add a 
> comment to document why this is here, for clueless people like me.)
> 
> Maybe it is to initialise the state of the mouse buttons?

That's it.

> This means that you avoid sending (0,0) events.  Good.

Yes, that's what I said in my comments.

> >                  SDL_MouseButtonEvent *bev = &ev->button;
> > +                if (ev->type == SDL_MOUSEBUTTONDOWN)
> > +                    state |= SDL_BUTTON(bev->button);
> > +                else
> > +                    state &= ~SDL_BUTTON(ev->button.button);
> >                  if (!gui_grab && !kbd_mouse_is_absolute()) {
> >                      if (ev->type == SDL_MOUSEBUTTONDOWN &&
> > -                        (bev->state & SDL_BUTTON_LMASK)) {
> > +                        (bev->button == SDL_BUTTON_LEFT)) {
> 
> Is this change necessary?

It's actually a bug fix: state doesn't contain the button state but the
0/1 according to the event being a press or release event. Yes, that's
duplicate information from SDL.

Samuel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]