mumble/mumble_shortcut_keyboard.cpp

21 lines
1.1 KiB
C++

Index: mumble-1.1.6/src/mumble/GlobalShortcut_unix.cpp
===================================================================
--- mumble-1.1.6.orig/src/mumble/GlobalShortcut_unix.cpp
+++ mumble-1.1.6/src/mumble/GlobalShortcut_unix.cpp
@@ -264,7 +264,14 @@ void GlobalShortcutX::directoryChanged(c
char name[256];
uint8_t events[EV_MAX/8 + 1];
memset(events, 0, sizeof(events));
- if ((ioctl(fd, EVIOCGVERSION, &version) >= 0) && (ioctl(fd, EVIOCGNAME(sizeof(name)), name)>=0) && (ioctl(fd, EVIOCGBIT(0,sizeof(events)), &events) >= 0) && test_bit(EV_KEY, events) && (((version >> 16) & 0xFF) > 0)) {
+ if ((ioctl(fd, EVIOCGVERSION, &version) >= 0)
+ && (ioctl(fd, EVIOCGNAME(sizeof(name)), name)>=0)
+ && (ioctl(fd, EVIOCGBIT(0,sizeof(events)), &events) >= 0)
+ && test_bit(EV_KEY, events)
+ // we assume it's a keyboard if it has a space bar
+ && (ioctl(fd, EVIOCGBIT(EV_KEY,sizeof(events)), &events) >= 0)
+ && test_bit(KEY_SPACE, events)
+ && (((version >> 16) & 0xFF) > 0)) {
name[255]=0;
qWarning("GlobalShortcutX: %s: %s", qPrintable(f->fileName()), name);
fcntl(f->handle(), F_SETFL, O_NONBLOCK);