From 3dceaedfa2e8e9d66eddecf119f00c42884ed604 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 23 Jun 2004 14:04:09 +0000 Subject: [PATCH] Qt/Mac disappearing menu syndrom, part II git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8821 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/frontends/qt2/ChangeLog | 5 +++++ src/frontends/qt2/lyx_gui.C | 12 ++++++++++++ src/lyxfunc.C | 2 ++ 4 files changed, 24 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index e50946f1d4..f9d437842e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-06-10 Jean-Marc Lasgouttes + + * lyxfunc.C (getStatus): if lyx_gui::getStatus disables the + command, return early. + 2004-06-18 Lars Gullik Bjonnes * debug.h: add DEBUG to enum and fix size of ANY. diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 7585f32fa1..eb15c360ac 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,8 @@ +2004-06-09 Jean-Marc Lasgouttes + + * lyx_gui.C (getStatus): under Mac OS X, disable the + buffer-related lfuns when the main window does not have the focus. + 2004-06-21 Jürgen Spitzmüller * QCitation.[Ch]: add validation (fix bug 1617). diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index bcd5362a49..b33ae2ecdd 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -244,6 +244,18 @@ FuncStatus getStatus(FuncRequest const & ev) default: break; } + +#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-related. + if (use_gui + && qApp->activeWindow() != qApp->mainWidget() + && !lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)) + flag.enabled(false); +#endif + return flag; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index defcbe9689..fade20901e 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -299,6 +299,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const // the default error message if we disable the command setStatusMessage(N_("Command disabled")); + if (!flag.enabled()) + return flag; // Check whether we need a buffer if (!lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !buf) { -- 2.39.2