]> git.lyx.org Git - features.git/commitdiff
fix scrolling bug: 3320 and 3652, maybe not perfect
authorPeter Kümmel <syntheticpp@gmx.net>
Sat, 2 Jun 2007 07:58:11 +0000 (07:58 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sat, 2 Jun 2007 07:58:11 +0000 (07:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18629 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiWorkArea.cpp

index 7ae001d2ec8fab23590918e2332661cb15c1edc4..4dbe5ab66c05ad76f804a8c4615e2f6f25e614f3 100644 (file)
 #include <boost/bind.hpp>
 #include <boost/current_function.hpp>
 
+#ifdef Q_WS_X11
+#include <QX11Info>
+extern "C" int XEventsQueued(Display *display, int mode);
+#endif
+
 #ifdef Q_WS_WIN
 int const CursorWidth = 2;
 #else
@@ -234,6 +239,7 @@ void GuiWorkArea::setScrollbarParams(int h, int scroll_pos, int scroll_line_step
 void GuiWorkArea::adjustViewWithScrollBar(int)
 {
        scrollBufferView(verticalScrollBar()->sliderPosition());
+       QApplication::syncX();
 }
 
 
@@ -414,6 +420,19 @@ void GuiWorkArea::generateSyntheticMouseEvent()
 
 void GuiWorkArea::keyPressEvent(QKeyEvent * e)
 {
+       // do nothing if there are other events
+       // (the auto repeated events come too fast)
+       // \todo FIXME: remove hard coded Qt keysprocess the key binding
+#ifdef Q_WS_X11
+       if (XEventsQueued(QX11Info::display(), 0) > 1   && e->isAutoRepeat() 
+                       && (Qt::Key_PageDown || Qt::Key_PageUp)) {
+               LYXERR(Debug::KEY)      
+                       << BOOST_CURRENT_FUNCTION << endl
+                       << "sysstem is busy: scroll key event ignored" << endl;
+               e->ignore();
+               return;
+       }
+#endif
 
        LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
                << " count=" << e->count()