mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
* Source/x11/XGServerEvent.m (-processEvent:): Coalesce
mousewheel events git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@34554 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
47c06f7ca2
commit
3689ee5c35
2 changed files with 42 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2012-01-15 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/x11/XGServerEvent.m (-processEvent:): Coalesce
|
||||
mousewheel events
|
||||
|
||||
2012-01-15 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/x11/XGServer.m: Don't read X events in NSConnectionReplyMode
|
||||
|
|
|
@ -350,6 +350,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
NSGraphicsContext *gcontext;
|
||||
float deltaX;
|
||||
float deltaY;
|
||||
float scrollDelta = 1;
|
||||
int buttonNumber;
|
||||
|
||||
gcontext = GSCurrentContext();
|
||||
|
@ -363,6 +364,38 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
xEvent.xbutton.time %lu timeOfLastClick %lu \n",
|
||||
xEvent.xbutton.window, xEvent.xbutton.time,
|
||||
generic.lastClick);
|
||||
|
||||
/*
|
||||
* Compress scroll events to avoid flooding
|
||||
*/
|
||||
if ((xEvent.xbutton.button == generic.scrollLeftMouse
|
||||
&& generic.scrollLeftMouse != 0) ||
|
||||
(xEvent.xbutton.button == generic.scrollRightMouse
|
||||
&& generic.scrollRightMouse != 0) ||
|
||||
(xEvent.xbutton.button == generic.upMouse
|
||||
&& generic.upMouse != 0) ||
|
||||
(xEvent.xbutton.button == generic.downMouse
|
||||
&& generic.downMouse != 0))
|
||||
{
|
||||
XEvent peek;
|
||||
while (XCheckTypedWindowEvent(xEvent.xbutton.display,
|
||||
xEvent.xbutton.window,
|
||||
ButtonPress,
|
||||
&peek))
|
||||
{
|
||||
if (xEvent.xbutton.button == peek.xbutton.button
|
||||
&& xEvent.xbutton.x == peek.xbutton.x
|
||||
&& xEvent.xbutton.y == peek.xbutton.y)
|
||||
{
|
||||
scrollDelta += 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hardwired test for a double click
|
||||
*
|
||||
|
@ -433,28 +466,28 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
else if (xEvent.xbutton.button == generic.upMouse
|
||||
&& generic.upMouse != 0)
|
||||
{
|
||||
deltaY = 1.;
|
||||
deltaY = scrollDelta;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.upMouse;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.downMouse
|
||||
&& generic.downMouse != 0)
|
||||
{
|
||||
deltaY = -1.;
|
||||
deltaY = -scrollDelta;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.downMouse;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.scrollLeftMouse
|
||||
&& generic.scrollLeftMouse != 0)
|
||||
{
|
||||
deltaX = -1.;
|
||||
deltaX = -scrollDelta;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.scrollLeftMouse;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.scrollRightMouse
|
||||
&& generic.scrollRightMouse != 0)
|
||||
{
|
||||
deltaX = 1.;
|
||||
deltaX = scrollDelta;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.scrollRightMouse;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue