Be on the safe side WRT events.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23094 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-21 13:42:49 +00:00
parent 34f93b22f7
commit 7ba37ecf53

View File

@ -571,7 +571,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
} }
void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/) void GuiWorkArea::focusInEvent(QFocusEvent * e)
{ {
lyx_view_->setCurrentWorkArea(this); lyx_view_->setCurrentWorkArea(this);
// Repaint the whole screen. // Repaint the whole screen.
@ -580,12 +580,14 @@ void GuiWorkArea::focusInEvent(QFocusEvent * /*event*/)
viewport()->repaint(); viewport()->repaint();
startBlinkingCursor(); startBlinkingCursor();
QAbstractScrollArea::focusInEvent(e);
} }
void GuiWorkArea::focusOutEvent(QFocusEvent * /*event*/) void GuiWorkArea::focusOutEvent(QFocusEvent * e)
{ {
stopBlinkingCursor(); stopBlinkingCursor();
QAbstractScrollArea::focusOutEvent(e);
} }
@ -596,6 +598,7 @@ void GuiWorkArea::mousePressEvent(QMouseEvent * e)
FuncRequest cmd(LFUN_MOUSE_TRIPLE, e->x(), e->y(), FuncRequest cmd(LFUN_MOUSE_TRIPLE, e->x(), e->y(),
q_button_state(e->button())); q_button_state(e->button()));
dispatch(cmd); dispatch(cmd);
e->accept();
return; return;
} }
@ -604,6 +607,7 @@ void GuiWorkArea::mousePressEvent(QMouseEvent * e)
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(), FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
q_button_state(e->button())); q_button_state(e->button()));
dispatch(cmd, q_key_state(e->modifiers())); dispatch(cmd, q_key_state(e->modifiers()));
e->accept();
} }
@ -615,6 +619,7 @@ void GuiWorkArea::mouseReleaseEvent(QMouseEvent * e)
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(), FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
q_button_state(e->button())); q_button_state(e->button()));
dispatch(cmd); dispatch(cmd);
e->accept();
} }
@ -625,6 +630,8 @@ void GuiWorkArea::mouseMoveEvent(QMouseEvent * e)
FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(), FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(),
q_motion_state(e->buttons())); q_motion_state(e->buttons()));
e->accept();
// If we're above or below the work area... // If we're above or below the work area...
if (e->y() <= 20 || e->y() >= viewport()->height() - 20) { if (e->y() <= 20 || e->y() >= viewport()->height() - 20) {
// Make sure only a synthetic event can cause a page scroll, // Make sure only a synthetic event can cause a page scroll,
@ -695,6 +702,7 @@ void GuiWorkArea::wheelEvent(QWheelEvent * e)
<< " lines = " << lines); << " lines = " << lines);
verticalScrollBar()->setValue(verticalScrollBar()->value() - verticalScrollBar()->setValue(verticalScrollBar()->value() -
int(lines * verticalScrollBar()->singleStep())); int(lines * verticalScrollBar()->singleStep()));
e->accept();
} }
@ -757,6 +765,7 @@ void GuiWorkArea::mouseDoubleClickEvent(QMouseEvent * ev)
ev->x(), ev->y(), ev->x(), ev->y(),
q_button_state(ev->button())); q_button_state(ev->button()));
dispatch(cmd); dispatch(cmd);
ev->accept();
} }
@ -764,6 +773,7 @@ void GuiWorkArea::resizeEvent(QResizeEvent * ev)
{ {
QAbstractScrollArea::resizeEvent(ev); QAbstractScrollArea::resizeEvent(ev);
need_resize_ = true; need_resize_ = true;
ev->accept();
} }
@ -789,6 +799,7 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
QPainter pain(viewport()); QPainter pain(viewport());
pain.drawPixmap(rc, screen_, rc); pain.drawPixmap(rc, screen_, rc);
cursor_->draw(pain); cursor_->draw(pain);
ev->accept();
} }