From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JWu30-0004nA-Cu for qemu-devel@nongnu.org; Wed, 05 Mar 2008 08:52:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JWu2z-0004md-In for qemu-devel@nongnu.org; Wed, 05 Mar 2008 08:52:42 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWu2z-0004mZ-GI for qemu-devel@nongnu.org; Wed, 05 Mar 2008 08:52:41 -0500 Received: from smtp02.citrix.com ([66.165.176.63]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JWu2y-0003Yr-Q9 for qemu-devel@nongnu.org; Wed, 05 Mar 2008 08:52:41 -0500 Date: Wed, 5 Mar 2008 13:51:26 +0000 From: Samuel Thibault Subject: Re: [Qemu-devel] [PATCH] fix SDL mouse events processing Message-ID: <20080305135126.GD9786@implementation.uk.xensource.com> References: <20080305114704.GC9747@implementation.uk.xensource.com> <20080305121802.GD9747@implementation.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Johannes Schindelin Cc: qemu-devel@nongnu.org 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