mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
#1720 disable document buffer related LFUNs in GUI view if the work area has no focus
This commit is contained in:
parent
bc8717b297
commit
da548dbe30
@ -841,6 +841,16 @@ void GuiView::setFocus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiView::hasFocus() const
|
||||||
|
{
|
||||||
|
if (currentWorkArea())
|
||||||
|
return currentWorkArea()->hasFocus();
|
||||||
|
if (currentMainWorkArea())
|
||||||
|
return currentMainWorkArea()->hasFocus();
|
||||||
|
return d.bg_widget_->hasFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::focusInEvent(QFocusEvent * e)
|
void GuiView::focusInEvent(QFocusEvent * e)
|
||||||
{
|
{
|
||||||
LYXERR(Debug::DEBUG, "GuiView::focusInEvent()" << this);
|
LYXERR(Debug::DEBUG, "GuiView::focusInEvent()" << this);
|
||||||
@ -1699,6 +1709,16 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
Buffer * doc_buffer = documentBufferView()
|
Buffer * doc_buffer = documentBufferView()
|
||||||
? &(documentBufferView()->buffer()) : 0;
|
? &(documentBufferView()->buffer()) : 0;
|
||||||
|
|
||||||
|
/* 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 (cmd.origin() == FuncRequest::MENU && !hasFocus()) {
|
||||||
|
buf = 0;
|
||||||
|
doc_buffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether we need a buffer
|
// Check whether we need a buffer
|
||||||
if (!lyxaction.funcHasFlag(cmd.action(), LyXAction::NoBuffer) && !buf) {
|
if (!lyxaction.funcHasFlag(cmd.action(), LyXAction::NoBuffer) && !buf) {
|
||||||
// no, exit directly
|
// no, exit directly
|
||||||
|
@ -123,6 +123,7 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
void setFocus();
|
void setFocus();
|
||||||
|
bool hasFocus() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void focusInEvent(QFocusEvent * e);
|
void focusInEvent(QFocusEvent * e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user