From: John Spray Date: Mon, 13 Feb 2006 18:01:41 +0000 (+0000) Subject: Fix event loop to no longer eat CPU X-Git-Tag: 1.6.10~13604 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=65ca7003ba47b7348610393a9a0d2d309b4e9702;p=lyx.git Fix event loop to no longer eat CPU git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13228 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 48d45301fd..e840f30c46 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -4,6 +4,8 @@ * GPreferences.C: append arbitrary size to font strings when passing to gtk font button, to prevent it from mangling some more complicated font names. + * lyx_gui.C: use Gtk::Main instead of while() loop: + fix eating CPU even when idle 2006-02-12 John Spray * GMenubar.C: assume backend strings in latin1 (bug 1954) diff --git a/src/frontends/gtk/lyx_gui.C b/src/frontends/gtk/lyx_gui.C index 5053f92aee..4a856671a6 100644 --- a/src/frontends/gtk/lyx_gui.C +++ b/src/frontends/gtk/lyx_gui.C @@ -87,10 +87,6 @@ bool lyx_gui::use_gui = true; namespace { -/// quit lyx -bool finished = false; - - /// estimate DPI from X server int getDPI() { @@ -146,11 +142,7 @@ void lyx_gui::start(string const & batch, std::vector const & files) view.getLyXFunc().dispatch(lyxaction.lookupFunc(batch)); } - // enter the event loop - while (!finished) { - while (Gtk::Main::events_pending()) - Gtk::Main::iteration(false); - } + Gtk::Main::run(); // FIXME: breaks emergencyCleanup delete lyxsocket; @@ -160,7 +152,7 @@ void lyx_gui::start(string const & batch, std::vector const & files) void lyx_gui::exit() { - finished = true; + Gtk::Main::quit(); }