]> git.lyx.org Git - features.git/commitdiff
Fix event loop to no longer eat CPU
authorJohn Spray <spray@lyx.org>
Mon, 13 Feb 2006 18:01:41 +0000 (18:01 +0000)
committerJohn Spray <spray@lyx.org>
Mon, 13 Feb 2006 18:01:41 +0000 (18:01 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13228 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/ChangeLog
src/frontends/gtk/lyx_gui.C

index 48d45301fd9762c1cfe89f8b4dfba0d667ff0c11..e840f30c464cfb1863c60da8684c52561b24b2ac 100644 (file)
@@ -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  <spray@lyx.org>
        * GMenubar.C: assume backend strings in latin1 (bug 1954)
index 5053f92aee5de89bc3bfc124a1ebe8ea13a013a8..4a856671a61f375d9c68ad58892222ac93133c5a 100644 (file)
@@ -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<string> 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<string> const & files)
 
 void lyx_gui::exit()
 {
-       finished = true;
+       Gtk::Main::quit();
 }