mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
avoid an infinite loop while scrolling
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9724 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7dc95c602b
commit
d996147dbb
@ -1,3 +1,9 @@
|
||||
|
||||
2005-03-20 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* GWorkArea.[Ch] (onScroll, setScrollbarParams): add an adjusting_
|
||||
flag to avoid signal reentrance.
|
||||
|
||||
2005-03-20 John Spray <spray_john@users.sf.net>
|
||||
|
||||
* ghelpers.C: use Gtk::Stock::PROPERTIES icon for document
|
||||
|
@ -172,7 +172,8 @@ void inputCommitRelay(GtkIMContext */*imcontext*/, gchar * str, GWorkArea * area
|
||||
|
||||
|
||||
GWorkArea::GWorkArea(LyXView & owner, int width, int height)
|
||||
: workAreaPixmap_(0), painter_(*this), draw_(0), colorHandler_(*this)
|
||||
: workAreaPixmap_(0), painter_(*this), draw_(0), colorHandler_(*this),
|
||||
adjusting_(false)
|
||||
{
|
||||
workArea_.set_size_request(width, height);
|
||||
workArea_.set_double_buffered(false);
|
||||
@ -337,6 +338,11 @@ bool GWorkArea::onConfigure(GdkEventConfigure * /*event*/)
|
||||
|
||||
void GWorkArea::setScrollbarParams(int height, int pos, int line_height)
|
||||
{
|
||||
if (adjusting_)
|
||||
return;
|
||||
|
||||
adjusting_ = true;
|
||||
|
||||
Gtk::Adjustment * adjustment = vscrollbar_.get_adjustment();
|
||||
adjustment->set_lower(0);
|
||||
int workAreaHeight = workHeight();
|
||||
@ -345,6 +351,7 @@ void GWorkArea::setScrollbarParams(int height, int pos, int line_height)
|
||||
adjustment->set_page_size(workAreaHeight);
|
||||
adjustment->set_value(0);
|
||||
adjustment->changed();
|
||||
adjusting_ = false;
|
||||
return;
|
||||
}
|
||||
adjustment->set_step_increment(line_height * 3);
|
||||
@ -355,13 +362,20 @@ void GWorkArea::setScrollbarParams(int height, int pos, int line_height)
|
||||
adjustment->set_page_size(workAreaHeight);
|
||||
adjustment->set_value(pos);
|
||||
adjustment->changed();
|
||||
adjusting_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GWorkArea::onScroll()
|
||||
{
|
||||
if (adjusting_)
|
||||
return;
|
||||
|
||||
adjusting_ = true;
|
||||
|
||||
double val = vscrollbar_.get_adjustment()->get_value();
|
||||
scrollDocView(static_cast<int>(val));
|
||||
adjusting_ = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,6 +109,7 @@ private:
|
||||
ColorHandler colorHandler_;
|
||||
GtkIMContext * imContext_;
|
||||
std::string inputCache_;
|
||||
bool adjusting_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
Loading…
x
Reference in New Issue
Block a user