Archived
2
0

lint fix.

This commit is contained in:
m1k1o 2021-04-11 12:25:02 +02:00
parent c54e8327ac
commit b2effce0e7
2 changed files with 22 additions and 30 deletions

View File

@ -6,19 +6,16 @@ static char *NAME = ":0.0";
static int REGISTERED = 0; static int REGISTERED = 0;
static int DIRTY = 0; static int DIRTY = 0;
struct linked_list typedef struct linked_list {
{
unsigned long number; unsigned long number;
KeyCode keycode; KeyCode keycode;
struct linked_list *next; struct linked_list *next;
}; } node;
typedef struct linked_list node;
node *head = NULL, *last = NULL; node *head = NULL, *last = NULL;
void insertAtLast(unsigned long value, KeyCode keycode) { void insertAtLast(unsigned long value, KeyCode keycode) {
node *temp_node; node *temp_node = (node *) malloc(sizeof(node));
temp_node = (node *) malloc(sizeof(node));
temp_node->number = value; temp_node->number = value;
temp_node->keycode = keycode; temp_node->keycode = keycode;
@ -55,19 +52,14 @@ void deleteItem(unsigned long value) {
node *searchItemNode(unsigned long value) { node *searchItemNode(unsigned long value) {
node *searchNode = head; node *searchNode = head;
bool foundNode = false;
while (searchNode) { while (searchNode) {
if (searchNode->number == value) { if (searchNode->number == value) {
foundNode = true; return searchNode;
break;
} else {
searchNode = searchNode->next;
}
} }
if (foundNode) searchNode = searchNode->next;
return searchNode; }
return NULL; return NULL;
} }
@ -223,12 +215,13 @@ void XKey(unsigned long key, int down) {
for (int i=0;i<numcodes;i++) keysym_list[i] = key; for (int i=0;i<numcodes;i++) keysym_list[i] = key;
XChangeKeyboardMapping(display, code, numcodes, keysym_list, 1); XChangeKeyboardMapping(display, code, numcodes, keysym_list, 1);
} }
if (!code) if (!code)
return; return;
if (down) { if (down)
insertAtLast(key, code); insertAtLast(key, code);
}
XTestFakeKeyEvent(display, code, down, CurrentTime); XTestFakeKeyEvent(display, code, down, CurrentTime);
XSync(display, 0); XSync(display, 0);
} }

View File

@ -105,7 +105,6 @@ func KeyUp(code uint64) error {
delete(debounce_key, code) delete(debounce_key, code)
C.XKey(C.ulong(code), C.int(0)) C.XKey(C.ulong(code), C.int(0))
return nil return nil
} }