From 285d4b630b75cb72ba243a27a6f655b7eec62a9b Mon Sep 17 00:00:00 2001 From: m1k1o Date: Mon, 12 Apr 2021 19:29:19 +0200 Subject: [PATCH] node -> xkeys_t, moved to .h file. --- server/internal/xorg/xorg.c | 18 ++++++------------ server/internal/xorg/xorg.h | 6 ++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/internal/xorg/xorg.c b/server/internal/xorg/xorg.c index 6ee518f..e46d0ab 100644 --- a/server/internal/xorg/xorg.c +++ b/server/internal/xorg/xorg.c @@ -6,16 +6,10 @@ static char *NAME = ":0.0"; static int REGISTERED = 0; static int DIRTY = 0; -typedef struct linked_list { - KeySym keysym; - KeyCode keycode; - struct linked_list *next; -} node; - -node *head = NULL; +xkeys_t *head = NULL; void insertItem(KeySym keysym, KeyCode keycode) { - node *temp_node = (node *) malloc(sizeof(node)); + xkeys_t *temp_node = (xkeys_t *) malloc(sizeof(xkeys_t)); temp_node->keysym = keysym; temp_node->keycode = keycode; @@ -29,7 +23,7 @@ void insertItem(KeySym keysym, KeyCode keycode) { } void deleteItem(KeySym keysym) { - node *myNode = head, *previous = NULL; + xkeys_t *myNode = head, *previous = NULL; int i = 0; while (myNode) { @@ -53,8 +47,8 @@ void deleteItem(KeySym keysym) { } } -node *searchItemNode(KeySym keysym) { - node *searchNode = head; +xkeys_t *searchItemNode(KeySym keysym) { + xkeys_t *searchNode = head; int i = 0; while (searchNode) { @@ -205,7 +199,7 @@ KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym) { void XKey(KeySym key, int down) { Display *display = getXDisplay(); KeyCode code = 0; - node *compareNode; + xkeys_t *compareNode; // Key is released. Look it up if (!down) { diff --git a/server/internal/xorg/xorg.h b/server/internal/xorg/xorg.h index 5e10260..bdef5a5 100644 --- a/server/internal/xorg/xorg.h +++ b/server/internal/xorg/xorg.h @@ -16,6 +16,12 @@ extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight); extern void goSetScreenRates(int index, int rate_index, short rate); + typedef struct xkeys_t { + KeySym keysym; + KeyCode keycode; + struct xkeys_t *next; + } xkeys_t; + /* Returns the main display, closed either on exit or when closeMainDisplay() * is invoked. This removes a bit of the overhead of calling XOpenDisplay() & * XCloseDisplay() everytime the main display needs to be used.