fix: don't send clipboard network packets on empty text
If you lock the screen in EndeavourOS, a signal KSystemClipboard:changed is emitted with empty text and clipboard mode QClipboard::Clipboard. Upon unlock the clipboard will be re-synced. A clipboard network packet will be sent for KSystemClipboard::changed signals if: 1. the received mode is QClipboard::Clipboard 2. the new content and its type are different from the current ones. The problem here is that, before locking the screen, current content is not empty. As of condition #2, a network packet with the empty text will be sent, which clears the current clipboard selection in GBoard but the contents stay the same. Upon re-sync in unlock, a packet will be sent again due to #2. This commit aims to fix this by ignoring empty text updates since from the end-user it unnecessarily clears the current clipboard selection and results in many "Copied to clipboard" toasts.
This commit is contained in:
parent
2295f6968b
commit
16ccee7ac9
1 changed files with 1 additions and 1 deletions
|
@ -66,7 +66,7 @@ void ClipboardListener::updateClipboard(QClipboard::Mode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString content = clipboard->text(QClipboard::Clipboard);
|
const QString content = clipboard->text(QClipboard::Clipboard);
|
||||||
if (content == m_currentContent && contentType == m_currentContentType) {
|
if ((content.isEmpty() || content == m_currentContent) && contentType == m_currentContentType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
refreshContent(content, contentType);
|
refreshContent(content, contentType);
|
||||||
|
|
Loading…
Reference in a new issue