mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Reorganize window resizing so that no painting occurs during a resizeEvent(). This caused the crash on MacOSX because the splash image drawing was not finished before the resizeEvent() occurred because of scrollbar hiding.
* WorkArea::resizeBufferView(): delete redraw() call. * GuiWorkArea: - need_resize_: new private member. - expose(): move pixmap painting code to new private updateScreen() method. - paintEvent(): resize the backing pixmap if need be. - resizeEvent(): move the resizing code to paintEvent(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16499 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8f2243819a
commit
4d7795d4d2
@ -227,7 +227,6 @@ void WorkArea::resizeBufferView()
|
|||||||
lyx_view_.message(_("Formatting document..."));
|
lyx_view_.message(_("Formatting document..."));
|
||||||
buffer_view_->workAreaResize(width(), height());
|
buffer_view_->workAreaResize(width(), height());
|
||||||
lyx_view_.updateLayoutChoice();
|
lyx_view_.updateLayoutChoice();
|
||||||
redraw();
|
|
||||||
lyx_view_.busy(false);
|
lyx_view_.busy(false);
|
||||||
lyx_view_.clearMessage();
|
lyx_view_.clearMessage();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ SyntheticMouseEvent::SyntheticMouseEvent()
|
|||||||
|
|
||||||
|
|
||||||
GuiWorkArea::GuiWorkArea(int w, int h, int id, LyXView & lyx_view)
|
GuiWorkArea::GuiWorkArea(int w, int h, int id, LyXView & lyx_view)
|
||||||
: WorkArea(id, lyx_view)
|
: WorkArea(id, lyx_view), need_resize_(false)
|
||||||
{
|
{
|
||||||
cursor_ = new frontend::CursorWidget();
|
cursor_ = new frontend::CursorWidget();
|
||||||
cursor_->hide();
|
cursor_->hide();
|
||||||
@ -430,12 +430,9 @@ void GuiWorkArea::mouseDoubleClickEvent(QMouseEvent * e)
|
|||||||
|
|
||||||
void GuiWorkArea::resizeEvent(QResizeEvent * ev)
|
void GuiWorkArea::resizeEvent(QResizeEvent * ev)
|
||||||
{
|
{
|
||||||
stopBlinkingCursor();
|
|
||||||
screen_ = QPixmap(ev->size().width(), ev->size().height());
|
|
||||||
verticalScrollBar()->setPageStep(viewport()->height());
|
verticalScrollBar()->setPageStep(viewport()->height());
|
||||||
QAbstractScrollArea::resizeEvent(ev);
|
QAbstractScrollArea::resizeEvent(ev);
|
||||||
resizeBufferView();
|
need_resize_ = true;
|
||||||
startBlinkingCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -500,6 +497,13 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
|
|||||||
<< " h: " << rc.height() << endl;
|
<< " h: " << rc.height() << endl;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (need_resize_) {
|
||||||
|
screen_ = QPixmap(viewport()->width(), viewport()->height());
|
||||||
|
resizeBufferView();
|
||||||
|
updateScreen();
|
||||||
|
need_resize_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
QPainter pain(viewport());
|
QPainter pain(viewport());
|
||||||
pain.drawPixmap(rc, screen_, rc);
|
pain.drawPixmap(rc, screen_, rc);
|
||||||
cursor_->draw(pain);
|
cursor_->draw(pain);
|
||||||
@ -507,20 +511,25 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
|
|||||||
|
|
||||||
|
|
||||||
void GuiWorkArea::expose(int x, int y, int w, int h)
|
void GuiWorkArea::expose(int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
updateScreen();
|
||||||
|
update(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiWorkArea::updateScreen()
|
||||||
{
|
{
|
||||||
QLPainter pain(&screen_);
|
QLPainter pain(&screen_);
|
||||||
|
|
||||||
if (greyed_out_) {
|
if (greyed_out_) {
|
||||||
lyxerr[Debug::GUI] << "splash screen requested" << endl;
|
lyxerr[Debug::GUI] << "splash screen requested" << endl;
|
||||||
doGreyOut(pain);
|
|
||||||
verticalScrollBar()->hide();
|
verticalScrollBar()->hide();
|
||||||
update(0, 0, width(), height());
|
doGreyOut(pain);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
verticalScrollBar()->show();
|
verticalScrollBar()->show();
|
||||||
paintText(*buffer_view_, pain);
|
paintText(*buffer_view_, pain);
|
||||||
update(x, y, w, h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +166,11 @@ private:
|
|||||||
///
|
///
|
||||||
CursorWidget * cursor_;
|
CursorWidget * cursor_;
|
||||||
///
|
///
|
||||||
|
void updateScreen();
|
||||||
|
///
|
||||||
QPixmap screen_;
|
QPixmap screen_;
|
||||||
|
///
|
||||||
|
bool need_resize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
Loading…
Reference in New Issue
Block a user