Archived
2
0

node -> xkeys_t, moved to .h file.

This commit is contained in:
m1k1o 2021-04-12 19:29:19 +02:00
parent b169195b69
commit 285d4b630b
2 changed files with 12 additions and 12 deletions

View File

@ -6,16 +6,10 @@ static char *NAME = ":0.0";
static int REGISTERED = 0; static int REGISTERED = 0;
static int DIRTY = 0; static int DIRTY = 0;
typedef struct linked_list { xkeys_t *head = NULL;
KeySym keysym;
KeyCode keycode;
struct linked_list *next;
} node;
node *head = NULL;
void insertItem(KeySym keysym, KeyCode keycode) { 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->keysym = keysym;
temp_node->keycode = keycode; temp_node->keycode = keycode;
@ -29,7 +23,7 @@ void insertItem(KeySym keysym, KeyCode keycode) {
} }
void deleteItem(KeySym keysym) { void deleteItem(KeySym keysym) {
node *myNode = head, *previous = NULL; xkeys_t *myNode = head, *previous = NULL;
int i = 0; int i = 0;
while (myNode) { while (myNode) {
@ -53,8 +47,8 @@ void deleteItem(KeySym keysym) {
} }
} }
node *searchItemNode(KeySym keysym) { xkeys_t *searchItemNode(KeySym keysym) {
node *searchNode = head; xkeys_t *searchNode = head;
int i = 0; int i = 0;
while (searchNode) { while (searchNode) {
@ -205,7 +199,7 @@ KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym) {
void XKey(KeySym key, int down) { void XKey(KeySym key, int down) {
Display *display = getXDisplay(); Display *display = getXDisplay();
KeyCode code = 0; KeyCode code = 0;
node *compareNode; xkeys_t *compareNode;
// Key is released. Look it up // Key is released. Look it up
if (!down) { if (!down) {

View File

@ -16,6 +16,12 @@
extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight); extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight);
extern void goSetScreenRates(int index, int rate_index, short rate); 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() /* Returns the main display, closed either on exit or when closeMainDisplay()
* is invoked. This removes a bit of the overhead of calling XOpenDisplay() & * is invoked. This removes a bit of the overhead of calling XOpenDisplay() &
* XCloseDisplay() everytime the main display needs to be used. * XCloseDisplay() everytime the main display needs to be used.