Am 02.06.2010 um 12:08 schrieb Jean-Marc LASGOUTTES:

> José Matos <jama...@fc.up.pt> writes:
> 
>> Hi,
>>      I had this problem before but being busy I did not report it.
>> 
>>      One of the features of F-13 is 
>> http://fedoraproject.org/w/index.php?title=UnderstandingDSOLinkChange
>> 
>> This means that lyx does not compile because when linking with qt we need to 
>> pass -lX11 since qt uses symbols from X11.
> 
> This bug is also known in debian
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=555580
> 
> It is not the reason. With the new DSO thing linking against qt does
> _not_ require to link against X11, and this is actually our problem. We
> explicitely use X11 calls for some weird event ignoring in
> GuiWorkArea.cpp, which fixes AFAICS the following bug
> http://www.lyx.org/trac/ticket/3320
> 
> Before trying to add the -lX11 in autotools, let's see what we can do
> about the actual code. It reads:
> 
>       // do nothing if there are other events
>       // (the auto repeated events come too fast)
>       // \todo FIXME: remove hard coded Qt keys, process the key binding
> #ifdef Q_WS_X11
>       if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat()
>                       && (Qt::Key_PageDown || Qt::Key_PageUp)) {
>               LYXERR(Debug::KEY, "system is busy: scroll key event ignored");
>               ev->ignore();
>               return;
>       }
> #endif
> 
> 
> Firstly, there is a very amusing detail: as I read it, the test for
> Qt::Key_PageXXX does nothing :) Since nobody complained about it, and
> since explicitly testing for hardcoded keys is tasteless, I propose to
> remove this part.
> 
> Secondly, XEventQueued can be replaced with
> QApplication:hasPendingEvents, also there is a slight difference, the
> later calls XPending:
> 
>       The XPending function returns the number of events that have been
>       received from the X server but have not been removed from the event
>       queue.  XPending is identical to XEventsQueued with the mode
>       QueuedAfterFlush specified.
> 
> So what do these mysterious flags mean?
> 
>       If mode is QueuedAlready, XEventsQueued returns the number of events
>       already in the event queue (and never performs a system call).  If
>       mode is QueuedAfterFlush, XEventsQueued returns the number of events
>       already in the queue if the number is nonzero.  If there are no events
>       in the queue, XEventsQueued flushes the output buffer, attempts to
>       read more events out of the application's connection, and returns the
>       number read.  If mode is QueuedAfterReading, XEventsQueued returns the
>       number of events already in the queue if the number is nonzero.  If
>       there are no events in the queue, XEventsQueued attempts to read more
>       events out of the application's connection without flushing the output
>       buffer and returns the number read.
> 
> For information, we use mode 0, which is QueuedAlready. It seems to me
> that using QueuedAfterFlush is a better idea, so I think using
> hasPendingEvents is good enough.
> 
> This leads to the following patch. Now is looks like the code should be
> useful on other platforms too. Is this problem with page down also
> present for Mac OS or Windows? I would propose to use the code on
> all platforms.

I've tested 1. the original code, 2. the patched one, 3. with removed ifdef 
Q_WS_X11.
At the first glance there is equal behavior for all 3 versions.

When scrolling fast with page-down key pressed I see "isAutoRepeat: 1" in debug 
output.
When I release the key the scrolling stops immediately.

For MacOS your patch makes no difference, because Q_WS_MACX is defined instead 
of Q_WS_X11, right?
But I would say it should work with Q_WS_MACX too.

Stephan

Reply via email to