From 4ba5452012d54b805ad024b38930589aad7ff181 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 29 Jul 2008 10:25:35 +0000 Subject: [PATCH] GuiSelection: make sure the initial check is done git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25965 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiSelection.cpp | 12 ++++++++---- src/frontends/qt4/GuiSelection.h | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiSelection.cpp b/src/frontends/qt4/GuiSelection.cpp index 58c5b7b72b..77c7113c53 100644 --- a/src/frontends/qt4/GuiSelection.cpp +++ b/src/frontends/qt4/GuiSelection.cpp @@ -32,7 +32,8 @@ using support::externalLineEnding; GuiSelection::GuiSelection() - : selection_supported_(qApp->clipboard()->supportsSelection()) + : selection_supported_(qApp->clipboard()->supportsSelection()), + schedule_check_(true) { connect(qApp->clipboard(), SIGNAL(selectionChanged()), this, SLOT(on_dataChanged())); @@ -101,14 +102,17 @@ bool GuiSelection::empty() const if (!selection_supported_) return true; + // Cache which is to speed up selection-status read + // (4 calls when openi Edit menu). + static bool text_selection_empty; if (schedule_check_) { - text_selection_empty_ = qApp->clipboard()-> + text_selection_empty = qApp->clipboard()-> text(QClipboard::Selection).isEmpty(); schedule_check_ = false; } - LYXERR(Debug::SELECTION, "GuiSelection::filled: " << !text_selection_empty_); - return text_selection_empty_; + LYXERR(Debug::SELECTION, "GuiSelection::filled: " << !text_selection_empty); + return text_selection_empty; } } // namespace frontend diff --git a/src/frontends/qt4/GuiSelection.h b/src/frontends/qt4/GuiSelection.h index 9ab5b1d4fc..1567b3e697 100644 --- a/src/frontends/qt4/GuiSelection.h +++ b/src/frontends/qt4/GuiSelection.h @@ -44,9 +44,6 @@ private Q_SLOTS: void on_dataChanged(); private: - // Cache which is to speed up selection-status read - // (4 calls when openi Edit menu). - mutable bool text_selection_empty_; // Direct call clipboard()->text(QClipboard::Selection) inside onDataChanged causes // selection to be obtained. Now imagine the some LyX instance A, when making selection - // each change triggers onDataChange in all others instances for each mouse