On Mon, Jul 04, 2016 at 01:06:42PM -0700, Pavel Sanda wrote:

> Enrico Forestieri wrote:
> > commit f5f8c6fd3828285b67e43a9c16d4ac2ff2140944
> > Author: Enrico Forestieri <for...@lyx.org>
> > Date:   Mon Jul 4 20:44:13 2016 +0200
> > 
> >     Bring window to front after loading a document
> >     
> >     Fixes #7875.
> 
> Ouch. Can we restrict this to single instance mode?
> It breaks the stacking of windows when you use less
> commong focus policies in your window manager.

You mean when your wm is configured not to bring up a window when it
is clicked, such that you can load a file from menu and still have the
main window behind other windows?

If yes, curiously, this is also my arrangement and I can understand your
pain (which would have been my own pain when I would have realized what
I was doing :)

The attached patch fixes it for me.

-- 
Enrico
diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp
index 9d2f3c3..6586207 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -1680,7 +1680,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 			current_view_->openDocument(fname);
 			if (!current_view_->documentBufferView())
 				current_view_->close();
-			else {
+			else if (cmd.origin() == FuncRequest::LYXSERVER) {
 				current_view_->raise();
 				current_view_->activateWindow();
 				current_view_->showNormal();
@@ -1690,9 +1690,11 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 			// but let's make sure
 			LASSERT(current_view_, break);
 			current_view_->openDocument(fname);
-			current_view_->raise();
-			current_view_->activateWindow();
-			current_view_->showNormal();
+			if (cmd.origin() == FuncRequest::LYXSERVER) {
+				current_view_->raise();
+				current_view_->activateWindow();
+				current_view_->showNormal();
+			}
 		}
 		break;
 	}

Reply via email to