xorg ulong -> KeySym.

This commit is contained in:
m1k1o 2021-04-12 19:22:59 +02:00
parent 7f226842df
commit b169195b69
2 changed files with 10 additions and 10 deletions

View File

@ -7,17 +7,17 @@ static int REGISTERED = 0;
static int DIRTY = 0; static int DIRTY = 0;
typedef struct linked_list { typedef struct linked_list {
unsigned long number; KeySym keysym;
KeyCode keycode; KeyCode keycode;
struct linked_list *next; struct linked_list *next;
} node; } node;
node *head = NULL; node *head = NULL;
void insertItem(unsigned long value, KeyCode keycode) { void insertItem(KeySym keysym, KeyCode keycode) {
node *temp_node = (node *) malloc(sizeof(node)); node *temp_node = (node *) malloc(sizeof(node));
temp_node->number = value; temp_node->keysym = keysym;
temp_node->keycode = keycode; temp_node->keycode = keycode;
temp_node->next = NULL; temp_node->next = NULL;
@ -28,12 +28,12 @@ void insertItem(unsigned long value, KeyCode keycode) {
head = temp_node; head = temp_node;
} }
void deleteItem(unsigned long value) { void deleteItem(KeySym keysym) {
node *myNode = head, *previous = NULL; node *myNode = head, *previous = NULL;
int i = 0; int i = 0;
while (myNode) { while (myNode) {
if (myNode->number == value) { if (myNode->keysym == keysym) {
if (!previous) if (!previous)
head = myNode->next; head = myNode->next;
else else
@ -53,12 +53,12 @@ void deleteItem(unsigned long value) {
} }
} }
node *searchItemNode(unsigned long value) { node *searchItemNode(KeySym keysym) {
node *searchNode = head; node *searchNode = head;
int i = 0; int i = 0;
while (searchNode) { while (searchNode) {
if (searchNode->number == value) { if (searchNode->keysym == keysym) {
return searchNode; return searchNode;
} }
@ -202,7 +202,7 @@ KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym) {
return keycode; return keycode;
} }
void XKey(unsigned long key, int down) { void XKey(KeySym key, int down) {
Display *display = getXDisplay(); Display *display = getXDisplay();
KeyCode code = 0; KeyCode code = 0;
node *compareNode; node *compareNode;

View File

@ -75,7 +75,7 @@ func KeyDown(code uint64) error {
debounce_key[code] = time.Now() debounce_key[code] = time.Now()
C.XKey(C.ulong(code), C.int(1)) C.XKey(C.KeySym(code), C.int(1))
return nil return nil
} }
@ -103,7 +103,7 @@ func KeyUp(code uint64) error {
delete(debounce_key, code) delete(debounce_key, code)
C.XKey(C.ulong(code), C.int(0)) C.XKey(C.KeySym(code), C.int(0))
return nil return nil
} }