mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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:"
|
||||
|
||||
Reference in New Issue
Block a user