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