diff --git a/server/internal/xorg/xorg.c b/server/internal/xorg/xorg.c index 1952a30a..b076f47b 100644 --- a/server/internal/xorg/xorg.c +++ b/server/internal/xorg/xorg.c @@ -6,67 +6,6 @@ static char *NAME = ":0.0"; static int REGISTERED = 0; static int DIRTY = 0; -struct linked_list -{ - unsigned long number; - KeyCode keycode; - struct linked_list *next; -}; - -typedef struct linked_list node; -node *head = NULL, *last = NULL; - -void insertAtLast(unsigned long value, KeyCode keycode) { - node *temp_node; - temp_node = (node *) malloc(sizeof(node)); - - temp_node->number = value; - temp_node->keycode = keycode; - temp_node->next = NULL; - - //For the 1st element - if(!head) { - head = temp_node; - last = temp_node; - } else { - last->next = temp_node; - last = temp_node; - } -} - -void deleteItem(unsigned long value) { - node *myNode = head, *previous = NULL; - - while(myNode) { - if(myNode->number == value) { - if(!previous) - head = myNode->next; - else - previous->next = myNode->next; - - free(myNode); - break; - } - - previous = myNode; - myNode = myNode->next; - } -} - -node *searchItemNode(unsigned long value) { - node *searchNode = head; - - while(searchNode) { - if(searchNode->number == value) { - break; - } else { - searchNode = searchNode->next; - } - } - - return searchNode; -} - Display *getXDisplay(void) { /* Close the display if displayName has changed */ if (DIRTY) { @@ -190,55 +129,41 @@ KeyCode XkbKeysymToKeycode(KeySym keysym) { int XKey(unsigned long key, int down) { Display *display = getXDisplay(); KeyCode code = -2; -// node *compareNode; -// compareNode = searchItemNode(key); if (down) { -// if (compareNode && compareNode != last) { -// code = compareNode->keycode; -// } else { - code = XkbKeysymToKeycode(key); - if (!code) { - int min, max, numcodes; - XDisplayKeycodes(display, &min, &max); - XGetKeyboardMapping(display, min, max-min, &numcodes); + code = XkbKeysymToKeycode(key); + if (!code) { + int min, max, numcodes; + XDisplayKeycodes(display, &min, &max); + XGetKeyboardMapping(display, min, max-min, &numcodes); - code = (max-min+1)*numcodes; - KeySym keysym_list[numcodes]; - for(int i=0;ikeycode; + code = XkbKeysymToKeycode(key); + if (!code) { + int min, max, numcodes; + XDisplayKeycodes(display, &min, &max); + XGetKeyboardMapping(display, min, max-min, &numcodes); - code = XkbKeysymToKeycode(key); - if (!code) { - int min, max, numcodes; - XDisplayKeycodes(display, &min, &max); - XGetKeyboardMapping(display, min, max-min, &numcodes); + code = (max-min+1)*numcodes; + KeySym keysym_list[numcodes]; + for(int i=0;i