Archived
2
0

xorg simplifz names.

This commit is contained in:
m1k1o 2021-04-12 19:41:36 +02:00
parent 1ec8bd34a6
commit b13b1907f4

View File

@ -9,34 +9,35 @@ static int DIRTY = 0;
xkeys_t *xKeysHead = NULL; xkeys_t *xKeysHead = NULL;
void XKeysInsert(KeySym keysym, KeyCode keycode) { void XKeysInsert(KeySym keysym, KeyCode keycode) {
xkeys_t *temp_node = (xkeys_t *) malloc(sizeof(xkeys_t)); xkeys_t *node = (xkeys_t *) malloc(sizeof(xkeys_t));
temp_node->keysym = keysym; node->keysym = keysym;
temp_node->keycode = keycode; node->keycode = keycode;
temp_node->next = xKeysHead; node->next = xKeysHead;
xKeysHead = temp_node; xKeysHead = node;
} }
KeyCode XKeysPop(KeySym keysym) { KeyCode XKeysPop(KeySym keysym) {
xkeys_t *myNode = xKeysHead, *previous = NULL;
KeyCode keycode = 0; KeyCode keycode = 0;
xkeys_t *node = xKeysHead,
*previous = NULL;
int i = 0; int i = 0;
while (myNode) { while (node) {
if (myNode->keysym == keysym) { if (node->keysym == keysym) {
keycode = myNode->keycode; keycode = node->keycode;
if (!previous) if (!previous)
xKeysHead = myNode->next; xKeysHead = node->next;
else else
previous->next = myNode->next; previous->next = node->next;
free(myNode); free(node);
return keycode; return keycode;
} }
previous = myNode; previous = node;
myNode = myNode->next; node = node->next;
if (i++ > 120) { if (i++ > 120) {
// this should lead to a panic // this should lead to a panic
printf("loop over limit"); printf("loop over limit");