mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
Revert mousewheel coalescing (r34553, r34554, r34558)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@34582 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6866ad9961
commit
d84def3af7
3 changed files with 8 additions and 108 deletions
37
ChangeLog
37
ChangeLog
|
@ -1,40 +1,3 @@
|
|||
2012-01-16 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/x11/XGServerEvent.m (-processEvent:): Rewrite coalescing
|
||||
code to only combine an uninterrupted set of scroll events.
|
||||
|
||||
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
|
||||
* Source/x11/XGServerEvent.m (-receivedEvent:type:extra:forMode:):
|
||||
Only read one event from the xlib event queue, instead of all of them.
|
||||
* Source/x11/XGServerEvent.m (-getEventMatchingMask:beforeDate:inMode:):
|
||||
Remove call to -receivedEvent:type:extra:forMode:
|
||||
* Source/x11/XGServerEvent.m (-discardEventsMatchingMask:beforeEvent:):
|
||||
Remove call to -receivedEvent:type:extra:forMode:
|
||||
|
||||
These changes are an attempt to fix a bug where a steady stream
|
||||
of X events can postpone autodisplay indefinitely. To see it, open
|
||||
a long document in Ink and scroll with the mousewheel slowly but
|
||||
continuously. If you scroll steadily enough, the window will not
|
||||
update until you stop scrolling.
|
||||
|
||||
This occurs beacuse autodisplay only occurs when the AppKit event
|
||||
queue is empty and the runloop runs, and without the above changes,
|
||||
the AppKit event queue was filling up and not emptying until the
|
||||
mousewheel events stopped arriving.
|
||||
|
||||
In the long run I think we should get rid of the AppKit event queue
|
||||
and have XGServer override the default implementation of
|
||||
-[GSDisplayServer getEventMatchingMask:beforeDate:inMode:dequeue:]
|
||||
and related methods with custom ones that interact
|
||||
directly with the Xlib event queue.
|
||||
|
||||
2012-01-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/winlib/WIN32FontEnumerator.m: Add missing include.
|
||||
|
|
|
@ -475,16 +475,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
[self _initXContext];
|
||||
|
||||
[self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode];
|
||||
|
||||
// FIXME: Not sure why we were accepting X events in
|
||||
// NSConnectionReplyMode. This was causing X event processing in
|
||||
// weird places, like [NSApplication run] -> [_main_menu update] ->
|
||||
// [NSPasteboard generalPasteboard] -> [NSDistantObject forwardInvocation:] ->
|
||||
// [NSRunLoop acceptInputForMode:beforeDate:]
|
||||
// so I am disabling X event listening for NSConnectionReplyMode
|
||||
// for now.
|
||||
|
||||
//[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
|
||||
[self setupRunLoopInputSourcesForMode: NSEventTrackingRunLoopMode];
|
||||
return self;
|
||||
|
|
|
@ -294,15 +294,8 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
{
|
||||
XEvent xEvent;
|
||||
|
||||
// loop and grab ONE of the events from the X queue.
|
||||
//
|
||||
// we don't want to flood the AppKit event queue with
|
||||
// events because it will block autodisplay (which only
|
||||
// happens when the AppKit queue is empty and we try to
|
||||
// run the runloop - see:
|
||||
// [GSDisplayServer getEventMatchingMask:beforeDate:inMode:dequeue:])
|
||||
|
||||
if (XPending(dpy) > 0)
|
||||
// loop and grab all of the events from the X queue
|
||||
while (XPending(dpy) > 0)
|
||||
{
|
||||
XNextEvent(dpy, &xEvent);
|
||||
|
||||
|
@ -310,7 +303,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
if (XFilterEvent(&xEvent, None))
|
||||
{
|
||||
NSDebugLLog(@"NSKeyEvent", @"Event filtered (by XIM?)\n");
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -350,7 +343,6 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
NSGraphicsContext *gcontext;
|
||||
float deltaX;
|
||||
float deltaY;
|
||||
float scrollDelta = 1;
|
||||
int buttonNumber;
|
||||
|
||||
gcontext = GSCurrentContext();
|
||||
|
@ -364,45 +356,6 @@ 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))
|
||||
{
|
||||
while (XPending(xEvent.xbutton.display))
|
||||
{
|
||||
XEvent peek;
|
||||
XPeekEvent(xEvent.xbutton.display, &peek);
|
||||
|
||||
/*
|
||||
* A stream of scroll events seems to consist of
|
||||
* a press followed by several releases
|
||||
*/
|
||||
if ((ButtonPress == peek.type
|
||||
|| ButtonRelease == peek.type)
|
||||
&& xEvent.xbutton.window == peek.xbutton.window
|
||||
&& xEvent.xbutton.button == peek.xbutton.button
|
||||
&& xEvent.xbutton.x == peek.xbutton.x
|
||||
&& xEvent.xbutton.y == peek.xbutton.y)
|
||||
{
|
||||
scrollDelta += 1.0;
|
||||
XNextEvent(xEvent.xbutton.display, &xEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hardwired test for a double click
|
||||
*
|
||||
|
@ -473,28 +426,28 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
else if (xEvent.xbutton.button == generic.upMouse
|
||||
&& generic.upMouse != 0)
|
||||
{
|
||||
deltaY = scrollDelta;
|
||||
deltaY = 1.;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.upMouse;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.downMouse
|
||||
&& generic.downMouse != 0)
|
||||
{
|
||||
deltaY = -scrollDelta;
|
||||
deltaY = -1.;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.downMouse;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.scrollLeftMouse
|
||||
&& generic.scrollLeftMouse != 0)
|
||||
{
|
||||
deltaX = -scrollDelta;
|
||||
deltaX = -1.;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.scrollLeftMouse;
|
||||
}
|
||||
else if (xEvent.xbutton.button == generic.scrollRightMouse
|
||||
&& generic.scrollRightMouse != 0)
|
||||
{
|
||||
deltaX = scrollDelta;
|
||||
deltaX = 1.;
|
||||
eventType = NSScrollWheel;
|
||||
buttonNumber = generic.scrollRightMouse;
|
||||
}
|
||||
|
@ -2595,12 +2548,6 @@ process_modifier_flags(unsigned int state)
|
|||
return p;
|
||||
}
|
||||
|
||||
// NOTE: The calls to [self receivedEvent:type:extra:forMode:]
|
||||
// were commented out because they cause flooding of the AppKit
|
||||
// event queue and can prevent autodisplay; see comment in
|
||||
// [self receivedEvent:type:extra:forMode:]
|
||||
|
||||
/*
|
||||
- (NSEvent*) getEventMatchingMask: (unsigned)mask
|
||||
beforeDate: (NSDate*)limit
|
||||
inMode: (NSString*)mode
|
||||
|
@ -2620,7 +2567,6 @@ process_modifier_flags(unsigned int state)
|
|||
[super discardEventsMatchingMask: mask
|
||||
beforeEvent: limit];
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue