Fix adressing wrong pipe and g-key + modifiers

When adressing a command pipe for the mouse
with a macro cmd, the daemon got a null-ptr,
because no macro functions are defined yet.
This fixes that effect.

Using "macro [<modifier>\+]+[<keyname>]+:<def>"
is now usable, when sending the macro definition
"manually" via echo to the command pipe for the keyboard.
This commit is contained in:
Lutz Eichler
2016-02-21 00:12:08 +01:00
parent f48cf8bfa7
commit 6cc62bcb6e
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -298,7 +298,8 @@ int readcmd(usbdevice* kb, const char* line){
// Macros and DPI have a separate left-side handler
if(command == MACRO || command == DPI){
word[left] = 0;
vt->do_macro[command](kb, mode, notifynumber, word, right);
if (vt->do_macro[command]) vt->do_macro[command](kb, mode, notifynumber, word, right);
else fprintf (stderr, "Got null-ptr in vt->do_cmd[MACRO]. Did you try to send a macro to mouse (maybe wrong cmd-pipe)?\n");
continue;
}
// Scan the left side for key names and run the requested command
+3 -2
View File
@@ -5,7 +5,8 @@
int macromask(const uchar* key1, const uchar* key2){
// Scan a macro against key input. Return 0 if any of them don't match
for(int i = 0; i < N_KEYBYTES_INPUT; i++){
if((key1[i] & key2[i]) != key2[i])
// if((key1[i] & key2[i]) != key2[i])
if(key1[i] != key2[i]) // Changed to detect G-keys + modifiers
return 0;
}
return 1;
@@ -38,7 +39,7 @@ static void inputupdate_keys(usbdevice* kb){
if (a > 200) usleep (100);
else if (a > 20) usleep(30);
}
}
}
}
}
} else {