From b169195b6962f1a20d02ebd0de6f1258b717b623 Mon Sep 17 00:00:00 2001 From: m1k1o Date: Mon, 12 Apr 2021 19:22:59 +0200 Subject: [PATCH] xorg ulong -> KeySym. --- server/internal/xorg/xorg.c | 16 ++++++++-------- server/internal/xorg/xorg.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/internal/xorg/xorg.c b/server/internal/xorg/xorg.c index 0fb3705..6ee518f 100644 --- a/server/internal/xorg/xorg.c +++ b/server/internal/xorg/xorg.c @@ -7,17 +7,17 @@ static int REGISTERED = 0; static int DIRTY = 0; typedef struct linked_list { - unsigned long number; + KeySym keysym; KeyCode keycode; struct linked_list *next; } node; node *head = NULL; -void insertItem(unsigned long value, KeyCode keycode) { +void insertItem(KeySym keysym, KeyCode keycode) { node *temp_node = (node *) malloc(sizeof(node)); - temp_node->number = value; + temp_node->keysym = keysym; temp_node->keycode = keycode; temp_node->next = NULL; @@ -28,12 +28,12 @@ void insertItem(unsigned long value, KeyCode keycode) { head = temp_node; } -void deleteItem(unsigned long value) { +void deleteItem(KeySym keysym) { node *myNode = head, *previous = NULL; int i = 0; while (myNode) { - if (myNode->number == value) { + if (myNode->keysym == keysym) { if (!previous) head = myNode->next; else @@ -53,12 +53,12 @@ void deleteItem(unsigned long value) { } } -node *searchItemNode(unsigned long value) { +node *searchItemNode(KeySym keysym) { node *searchNode = head; int i = 0; while (searchNode) { - if (searchNode->number == value) { + if (searchNode->keysym == keysym) { return searchNode; } @@ -202,7 +202,7 @@ KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym) { return keycode; } -void XKey(unsigned long key, int down) { +void XKey(KeySym key, int down) { Display *display = getXDisplay(); KeyCode code = 0; node *compareNode; diff --git a/server/internal/xorg/xorg.go b/server/internal/xorg/xorg.go index 2086e3d..015ec4a 100644 --- a/server/internal/xorg/xorg.go +++ b/server/internal/xorg/xorg.go @@ -75,7 +75,7 @@ func KeyDown(code uint64) error { debounce_key[code] = time.Now() - C.XKey(C.ulong(code), C.int(1)) + C.XKey(C.KeySym(code), C.int(1)) return nil } @@ -103,7 +103,7 @@ func KeyUp(code uint64) error { delete(debounce_key, code) - C.XKey(C.ulong(code), C.int(0)) + C.XKey(C.KeySym(code), C.int(0)) return nil }