keysym2scancode.c File Reference

#include "keysym2scancode.h"

Include dependency graph for keysym2scancode.c:

Go to the source code of this file.

Defines

#define MAX_EXTRA_COUNT   256
#define MAX_NORMAL_KEYCODE   512

Functions

void * init_keyboard_layout (const char *language)
int keysym2scancode (void *kbd_layout, int keysym)


Define Documentation

#define MAX_EXTRA_COUNT   256

Definition at line 36 of file keysym2scancode.c.

#define MAX_NORMAL_KEYCODE   512

Definition at line 35 of file keysym2scancode.c.

Referenced by keysym2scancode().


Function Documentation

void* init_keyboard_layout ( const char *  language  ) 

Definition at line 122 of file keysym2scancode.c.

Referenced by main().

00123 {
00124     return parse_keyboard_layout(language, 0);
00125 } // end of [init_keyboard_layout]

int keysym2scancode ( void *  kbd_layout,
int  keysym 
)

Definition at line 127 of file keysym2scancode.c.

References MAX_NORMAL_KEYCODE.

Referenced by keyevent().

00128 {
00129     kbd_layout_t *k = kbd_layout;
00130     if (keysym < MAX_NORMAL_KEYCODE) {
00131         if (k->keysym2keycode[keysym] == 0)
00132             fprintf(stderr, "Warning: no scancode found for keysym %d\n",
00133                     keysym);
00134         return k->keysym2keycode[keysym];
00135     } else {
00136         int i;
00137 #ifdef XK_ISO_Left_Tab
00138         if (keysym == XK_ISO_Left_Tab)
00139             keysym = XK_Tab;
00140 #endif
00141         for (i = 0; i < k->extra_count; i++)
00142             if (k->keysym2keycode_extra[i].keysym == keysym)
00143                 return k->keysym2keycode_extra[i].keycode;
00144     }
00145     return 0;
00146 }