commit 2311f42f4183b968ed0166c4dae1b5f0df00439b
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Fri Nov 19 10:21:55 2021 +0100
Make primary-selection unknown when not supported
This lfun will not appear in menus anymore in macOS and Windows.
Part of bug #12436.
---
src/LyXAction.cpp | 2 +-
src/Text3.cpp | 1 +
src/frontends/Selection.h | 5 +++++
src/frontends/qt/GuiSelection.h | 1 +
4 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 254060e..a4856bf 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -3417,7 +3417,7 @@ void LyXAction::init()
/*!
* \var lyx::FuncCode lyx::LFUN_PRIMARY_SELECTION_PASTE
* \li Action: Pastes the currently selected text.
- * \li Notion: Primary selection mechanism is linux-only thing.
+ * \li Notion: Primary selection mechanism is X11/Wayland-only thing.
* \li Syntax: primary-selection-paste [<ARG>]
* \li Params: <ARG>: "paragraph" will cause pasting as one paragraph, i.e.
"Join lines".
* \endvar
diff --git a/src/Text3.cpp b/src/Text3.cpp
index c8483fe..8257452 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -3437,6 +3437,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const &
cmd,
break;
case LFUN_PRIMARY_SELECTION_PASTE:
+ status.setUnknown(!theSelection().supported());
enable = cur.selection() || !theSelection().empty();
break;
diff --git a/src/frontends/Selection.h b/src/frontends/Selection.h
index 10d1698..931cb44 100644
--- a/src/frontends/Selection.h
+++ b/src/frontends/Selection.h
@@ -28,6 +28,11 @@ public:
virtual ~Selection() {}
/**
+ * Returns true if the underlying system supports mouse selection
+ * (basically X11 and Wayland).
+ */
+ virtual bool supported() const = 0;
+ /**
* Tell the window system whether we set or cleared our selection.
* This is a noop on systems that don't have a selection.
* This should be called by the kernel whenever a selection is
diff --git a/src/frontends/qt/GuiSelection.h b/src/frontends/qt/GuiSelection.h
index 57515cc..c79f4fe 100644
--- a/src/frontends/qt/GuiSelection.h
+++ b/src/frontends/qt/GuiSelection.h
@@ -34,6 +34,7 @@ public:
/** Selection overloaded methods
*/
//@{
+ bool supported() const override { return selection_supported_; }
void haveSelection(bool own) override;
docstring const get() const override;
void put(docstring const & str) override;
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs