Added XSync call for hotkey without window

For #3
This commit is contained in:
Skycoder42
2017-05-14 13:32:06 +02:00
parent 7c4ef6a03a
commit 3fa176a380
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -1,11 +1,20 @@
#include "hottestwidget.h"
#include <QApplication>
//#define START_BACKGROUND
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
HotTestWidget w;
#ifdef START_BACKGROUND
auto startKey = new QHotkey(QKeySequence(Qt::MetaModifier | Qt::ControlModifier | Qt::Key_S), true, &w);
QObject::connect(startKey, &QHotkey::activated,
&w, &QWidget::show);
#else
w.show();
#endif
return a.exec();
}
+2
View File
@@ -106,6 +106,7 @@ bool QHotkeyPrivateX11::registerShortcut(QHotkey::NativeShortcut shortcut)
GrabModeAsync,
GrabModeAsync);
}
XSync(display, QueuedAlready);
if(errorHandler.hasError) {
qCWarning(logQHotkey) << "Failed to register hotkey. Error:"
@@ -129,6 +130,7 @@ bool QHotkeyPrivateX11::unregisterShortcut(QHotkey::NativeShortcut shortcut)
shortcut.modifier | specialMod,
DefaultRootWindow(display));
}
XSync(display, QueuedAlready);
if(errorHandler.hasError) {
qCWarning(logQHotkey) << "Failed to unregister hotkey. Error:"