mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Towards bug http://bugzilla.lyx.org/show_bug.cgi?id=4830
(selection issues on more LyX instances) This fixes for me the worst cases. Still some selection problem appear from time to time and it will be tricky to get this completely right since the performance 'hacks' our code uses. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25950 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
716626c736
commit
609878cf00
@ -62,7 +62,7 @@ public:
|
||||
* This does always return true on systems that don't have a real
|
||||
* selection.
|
||||
*/
|
||||
virtual bool empty() const = 0;
|
||||
virtual bool empty() = 0;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -91,19 +91,21 @@ void GuiSelection::put(docstring const & str)
|
||||
|
||||
void GuiSelection::on_dataChanged()
|
||||
{
|
||||
text_selection_empty_ = qApp->clipboard()->
|
||||
text(QClipboard::Selection).isEmpty();
|
||||
LYXERR(Debug::SELECTION, "GuiSelection::on_dataChanged::filled: " << !text_selection_empty_);
|
||||
schedule_check_ = true;
|
||||
LYXERR(Debug::SELECTION, "GuiSelection::on_dataChanged");
|
||||
}
|
||||
|
||||
|
||||
bool GuiSelection::empty() const
|
||||
bool GuiSelection::empty()
|
||||
{
|
||||
if (!selection_supported_)
|
||||
return true;
|
||||
|
||||
LYXERR(Debug::SELECTION, "GuiSelection::filled: " << !text_selection_empty_);
|
||||
if (schedule_check_)
|
||||
text_selection_empty_ = qApp->clipboard()->
|
||||
text(QClipboard::Selection).isEmpty();
|
||||
|
||||
LYXERR(Debug::SELECTION, "GuiSelection::filled: " << !text_selection_empty_);
|
||||
return text_selection_empty_;
|
||||
}
|
||||
|
||||
|
@ -37,14 +37,24 @@ public:
|
||||
void haveSelection(bool own);
|
||||
docstring const get() const;
|
||||
void put(docstring const & str);
|
||||
bool empty() const;
|
||||
bool empty();
|
||||
//@}
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_dataChanged();
|
||||
|
||||
private:
|
||||
// Cache which is to speed up selection-status read
|
||||
// (4 calls when openi Edit menu).
|
||||
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
|
||||
// or keyboard move. This in turn causes many calls of requestSelection in A
|
||||
// which interferes with the selecting itself. As a result middle button pasting
|
||||
// for more instances don't work and debugging is a hell. So we just schedule
|
||||
// obtaining of selection on the time empty() is actually called.
|
||||
bool schedule_check_;
|
||||
bool const selection_supported_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user