mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 20:09:59 +00:00
Lars's key input queue
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9999 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
292dea2315
commit
a85913d21a
@ -520,12 +520,8 @@ void BufferView::Pimpl::workAreaKeyPress(LyXKeySymPtr key,
|
||||
* of the cursor. Note we cannot do this inside
|
||||
* dispatch() itself, because that's called recursively.
|
||||
*/
|
||||
if (available()) {
|
||||
screen().prepareCursor();
|
||||
cursor_timeout.setTimeout(100);
|
||||
cursor_timeout.restart();
|
||||
cursor_timeout.setTimeout(400);
|
||||
}
|
||||
if (available())
|
||||
screen().showCursor(*bv_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2005-06-06 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* BufferView_pimpl.C: revert to showCursor in connection with
|
||||
Lars's front-end stack
|
||||
|
||||
2005-06-06 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* text.C (redoParagraph): move cursor right after a bibitem
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-06-06 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
(Committed Martin Vermeer <martin.vermeer@hut.fi>)
|
||||
|
||||
* QContentPane.[Ch]: implement keystroke event stack with
|
||||
repeat key "regulation". Key are not sent to LyX core faster
|
||||
than rendering can handle.
|
||||
|
||||
2005-06-03 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* QContentPane.[Ch]: Limit the QIM*Events to X11. They are not
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qpainter.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
@ -90,6 +89,8 @@ QContentPane::QContentPane(QWorkArea * parent)
|
||||
boost::bind(&QContentPane::generateSyntheticMouseEvent,
|
||||
this));
|
||||
|
||||
connect(&step_timer_, SIGNAL(timeout()), SLOT(keyeventTimeout()));
|
||||
|
||||
setFocusPolicy(QWidget::WheelFocus);
|
||||
setFocus();
|
||||
setCursor(ibeamCursor);
|
||||
@ -101,6 +102,9 @@ QContentPane::QContentPane(QWorkArea * parent)
|
||||
// stupid moc strikes again
|
||||
connect(wa_->scrollbar_, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(scrollBarChanged(int)));
|
||||
|
||||
// Start the timer, one-shot.
|
||||
step_timer_.start(25, true);
|
||||
}
|
||||
|
||||
|
||||
@ -251,9 +255,35 @@ void QContentPane::wheelEvent(QWheelEvent * e)
|
||||
|
||||
void QContentPane::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
keyeventQueue_.push(boost::shared_ptr<QKeyEvent>(new QKeyEvent(*e)));
|
||||
}
|
||||
|
||||
|
||||
void QContentPane::keyeventTimeout()
|
||||
{
|
||||
bool handle_autos = true;
|
||||
|
||||
while (!keyeventQueue_.empty()) {
|
||||
boost::shared_ptr<QKeyEvent> ev = keyeventQueue_.front();
|
||||
|
||||
// We never handle more than one auto repeated
|
||||
// char in a list of queued up events.
|
||||
if (!handle_autos && ev->isAutoRepeat()) {
|
||||
keyeventQueue_.pop();
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
|
||||
sym->set(e);
|
||||
wa_->workAreaKeyPress(sym, q_key_state(e->state()));
|
||||
sym->set(ev.get());
|
||||
|
||||
wa_->workAreaKeyPress(sym, q_key_state(ev->state()));
|
||||
keyeventQueue_.pop();
|
||||
|
||||
handle_autos = false;
|
||||
}
|
||||
|
||||
// Restart the timer.
|
||||
step_timer_.start(25, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,9 +21,12 @@
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <queue>
|
||||
|
||||
#if (defined(Q_WS_X11) && QT_VERSION >= 0x030200)
|
||||
#define USE_INPUT_METHODS 1
|
||||
#endif
|
||||
@ -115,6 +118,8 @@ public slots:
|
||||
void doubleClickTimeout();
|
||||
|
||||
void scrollBarChanged(int);
|
||||
void keyeventTimeout();
|
||||
|
||||
private:
|
||||
/// The slot connected to SyntheticMouseEvent::timeout.
|
||||
void generateSyntheticMouseEvent();
|
||||
@ -125,6 +130,9 @@ private:
|
||||
/// owning widget
|
||||
QWorkArea * wa_;
|
||||
|
||||
QTimer step_timer_;
|
||||
std::queue<boost::shared_ptr<QKeyEvent> > keyeventQueue_;
|
||||
|
||||
/// the double buffered pixmap
|
||||
boost::scoped_ptr<QPixmap> pixmap_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user