>>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> Me neither. Obviously both solutions have flaws. If you add a
Georg> comment to LyXFunc::sendDispatchMessage that explains why the
Georg> update is not done for INTERNAL requests I am fine with your
Georg> solution.


OK, I applied the following patch and commented in bug 1941 about the
situation.

JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2287
diff -u -p -r1.2287 ChangeLog
--- src/ChangeLog	21 Sep 2005 10:38:23 -0000	1.2287
+++ src/ChangeLog	21 Sep 2005 13:17:15 -0000
@@ -1,3 +1,8 @@
+2005-09-12  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* lyxfunc.C (sendDispatchMessage): do not update menubar/toolbar
+	when command is internal. (bug 1941)
+
 2005-09-20  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* text2.C (cursorRight): do not honor boundary when at the end of
Index: src/lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.668
diff -u -p -r1.668 lyxfunc.C
--- src/lyxfunc.C	19 Sep 2005 09:55:49 -0000	1.668
+++ src/lyxfunc.C	21 Sep 2005 13:17:15 -0000
@@ -338,6 +338,9 @@ FuncStatus LyXFunc::getStatus(FuncReques
 	   application can still be accessed without giving focus to
 	   the main window. In this case, we want to disable the menu
 	   entries that are buffer-related.
+
+	   Note that this code is not perfect, as bug 1941 attests:
+	   http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
 	*/
 	Buffer * buf;
 	if (cmd.origin == FuncRequest::UI && !owner->hasFocus())
@@ -1577,8 +1580,15 @@ void LyXFunc::dispatch(FuncRequest const
 
 void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & cmd)
 {
-	owner->updateMenubar();
-	owner->updateToolbars();
+	/* When an action did not originate from the UI/kbd, it makes
+	 * sense to avoid updating the GUI. It turns out that this
+	 * fixes bug 1941, for reasons that are described here:
+	 * http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4 
+	 */
+	if (cmd.origin != FuncRequest::INTERNAL) {
+		owner->updateMenubar();
+		owner->updateToolbars();
+	}
 
 	const bool verbose = (cmd.origin == FuncRequest::UI
 			      || cmd.origin == FuncRequest::COMMANDBUFFER);

Reply via email to