]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiApplication.cpp
Fix crash noticed by Bennett:
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
index 77ffd4c0da01e701a2a26e02d6d2f95176d89cff..6b0a78adaaa693a76bc20c5eda488552de9cd68b 100644 (file)
@@ -800,8 +800,17 @@ docstring GuiApplication::iconName(FuncRequest const & f, bool unknown)
 }
 
 
-LyXView * GuiApplication::currentWindow()
+LyXView * GuiApplication::currentWindow() 
 {
+#ifdef Q_WS_MACX
+       /* In LyX/Mac, when a dialog is open, the menus of the
+          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 or view-related.
+       */
+       if (current_view_ && activeWindow() != current_view_)
+               return 0;
+#endif
        return current_view_;
 }
 
@@ -1017,6 +1026,7 @@ void GuiApplication::resetGui()
        QHash<int, GuiView *>::iterator it;
        for (it = d->views_.begin(); it != d->views_.end(); ++it) {
                GuiView * gv = *it;
+               setCurrentView(gv);
                gv->setLayoutDirection(layoutDirection());
                gv->resetDialogs();
        }