Capturing the mouse allows GNUstep to receive mouseDragged events when the 
mouse is outside of the window. Without this, the autoscroll mechanism doesn't 
work properly when a user moves the mouse out of the window while holding the 
button down.

I'm not at all expert (in fact I'm a complete newbie) with regards to the 
Windows event API, so I'm very open to other suggestions. The call to 
SetCapture() that I added solves the problem, and I was careful to call 
ReleaseCapture() when there are no longer any mouse buttons down. Hopefully 
that's done in such a way that it will always get called when the mouse is 
released.

I didn't see anything in Microsoft's documentation about what happens if 
SetCapture() is called more than once, so I was presuming it's a simple on/off 
toggle, with extra calls being ignored, but I don't know that for sure.

Let me know if anyone has a better idea for how to do this.

--
Doug Simons
Principal Developer

 
TestPlant Inc   T    +1 720-890-0211 ext 13
4730 Walnut Street      F    +1 720-890-0209
Boulder, CO 80301       doug.sim...@testplant.com
USA
http://www.testplant.com
This email and any attachments may contain privileged / confidential 
information. If you have received this email in error
or believe that you are not the intended recipient, please delete all content 
and attached files and contact TestPlant via
the switchboard on +1 720-890-0211 or via return e-mail. You should not copy, 
forward or use any part of the
contents in any way. Any such unauthorised use or disclosure may be unlawful.

On Mar 13, 2010, at 5:15 AM, Fred Kiefer wrote:

> Am 12.03.2010 22:29, schrieb Doug Simons:
>> Author: dpsimons
>> Date: Fri Mar 12 22:29:37 2010
>> New Revision: 29912
>> 
>> URL: http://svn.gna.org/viewcvs/gnustep?rev=29912&view=rev
>> Log:
>> capture the mouse to get mouse moved events outside of window
>> 
>> Modified:
>>    libs/back/trunk/ChangeLog
>>    libs/back/trunk/Source/win32/WIN32Server.m
> 
> Hi Doug,
> 
> are you sure this is what you need to do? Capturing the mouse is a very
> dangerous operation, you have to make sure you always get to the release
> code as well. And if this code interacts with user code that actually
> tries to capture the mouse, we may get into unclear states.
> 
> If I understand your comment then this is about getting the mouse up
> event that follows a mouse down on a GNUstep window. When the mouse
> moves out of the window this event wont get send to GNUstep, so we will
> think the mouse is still up. Is this the problem you are trying to address?
> There must be a difference in the event handling of X11, as we don't
> need to capture the mouse there. Perhaps the mouse up event there is
> always send to the window where the mouse went down?
> 
> Sorry, I am no longer familiar with all that code, it has been ages
> since I last dug that deep into the difference of the event model of X11
> and Windows.
> 
> Fred
> 

_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to