*in progress*
[winnie] / src / sdl / keyboard.cc
1 #ifdef WINNIE_SDL
2 #include <SDL/SDL.h>
3
4 #include "keyboard.h"
5 #include "window.h"
6 #include "wm.h"
7
8 extern SDL_Event sdl_event;
9
10 bool init_keyboard()
11 {
12         return true;
13 }
14
15 void destroy_keyboard()
16 {
17 }
18
19 int get_keyboard_fd()
20 {
21         return -1;
22 }
23
24 void process_keyboard_event()
25 {
26         int key = sdl_event.key.keysym.sym;
27
28         Window *focused_win = wm->get_focused_window();
29         if(focused_win) {
30                 KeyboardFuncType keyb_callback = focused_win->get_keyboard_callback();
31                 if(keyb_callback) {
32                         bool pressed = sdl_event.key.state == SDL_PRESSED;
33                         keyb_callback(focused_win, key, pressed);
34                 }
35         }
36 }
37 #endif // WINNIE_SDL