#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <QX11Info>
+#include <QTimer>
+
PIRApplication::PIRApplication(
int &argc,
char **argv)
- : QApplication(argc, argv)
+ : QApplication(argc, argv),
+ changingKeyset(false)
{
}
if (event->type == KeyPress)
{
- // Check for function key 7 (keycode 73) or for "Zoom Out" button:
+ // Function key 7 (keycode 73) or "Zoom Out" button will go up.
+ // Function key 8 (keycode 74) or "Zoom In" button will go down.
if (
event->xkey.keycode == 73 ||
event->xkey.keycode == QKeySequence::ZoomOut)
{
- emit decreaseRockerPressed();
+ if (!changingKeyset)
+ {
+ changingKeyset = true;
+ QTimer::singleShot(500, this, SLOT(finishChangingKeyset()));
+ emit decreaseRockerPressed();
+ }
return true;
}
else if (
event->xkey.keycode == 74 ||
event->xkey.keycode == QKeySequence::ZoomIn)
{
- emit increaseRockerPressed();
+ if (!changingKeyset)
+ {
+ changingKeyset = true;
+ QTimer::singleShot(500, this, SLOT(finishChangingKeyset()));
+ emit increaseRockerPressed();
+ }
return true;
}
}
return false;
}
+
+
+void PIRApplication::finishChangingKeyset()
+{
+ changingKeyset = false;
+}