annotate src/video/directfb/SDL_DirectFB_events.c @ 5148:2f44e6969a59

Split the rendering API out into a separate header file.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 01 Feb 2011 15:02:21 -0800
parents dc0dfdd58f27
children 164f20ba08eb
rev   line source
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
2 SDL - Simple DirectMedia Layer
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3685
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
5 This library is free software; you can redistribute it and/or
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
6 modify it under the terms of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
7 License as published by the Free Software Foundation; either
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
10 This library is distributed in the hope that it will be useful,
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
13 Lesser General Public License for more details.
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
19 Sam Lantinga
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
20 slouken@libsdl.org
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1379
diff changeset
22 #include "SDL_config.h"
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 /* Handle the event stream, converting DirectFB input events into SDL events */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include <directfb.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
28 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
29 #include "../../events/SDL_events_c.h"
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
30 #include "../../events/SDL_keyboard_c.h"
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
31 #include "../../events/scancodes_linux.h"
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_DirectFB_events.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
34 #if USE_MULTI_API
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
35 #define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(id, relative, x, y, p)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
36 #define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(id, state, button)
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
37 #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode)
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
38 #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text)
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
39 #else
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
40 #define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, relative, x, y)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
41 #define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, state, button)
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
42 #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode)
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
43 #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text)
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
44 #endif
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
45
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
46 typedef struct _cb_data cb_data;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
47 struct _cb_data
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
48 {
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
49 DFB_DeviceData *devdata;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
50 int sys_ids;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
51 int sys_kbd;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
52 };
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
53
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 /* The translation tables from a DirectFB keycode to a SDL keysym */
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
55 static SDLKey oskeymap[256];
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
56
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
57
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
58 static SDL_KeySym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt,
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
59 SDL_KeySym * keysym);
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
60 static SDL_KeySym *DirectFB_TranslateKeyInputEvent(_THIS, int index,
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
61 DFBInputEvent * evt,
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
62 SDL_KeySym * keysym);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
64 static void DirectFB_InitOSKeymap(_THIS, SDLKey * keypmap, int numkeys);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
65 static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
67 static void
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
68 DirectFB_SetContext(_THIS, SDL_Window *window)
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
69 {
3037
490f3e4fe753 Added DFB_VERSION_ATLEAST macro
Couriersud <couriersud@arcor.de>
parents: 3023
diff changeset
70 #if (DFB_VERSION_ATLEAST(1,0,0))
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
71 /* FIXME: does not work on 1.0/1.2 with radeon driver
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
72 * the approach did work with the matrox driver
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
73 * This has simply no effect.
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
74 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
75
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
76 SDL_VideoDisplay *display = window->display;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
77 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
78
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
79 /* FIXME: should we handle the error */
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
80 if (dispdata->vidIDinuse)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
81 SDL_DFB_CHECK(dispdata->vidlayer->SwitchContext(dispdata->vidlayer,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
82 DFB_TRUE));
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
83 #endif
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
84
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
85 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
86
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
87 static void
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
88 FocusAllMice(_THIS, SDL_Window *window)
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
89 {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
90 #if USE_MULTI_API
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
91 SDL_DFB_DEVICEDATA(_this);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
92 int index;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
93
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
94 for (index = 0; index < devdata->num_mice; index++)
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
95 SDL_SetMouseFocus(devdata->mouse_id[index], id);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
96 #else
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
97 SDL_SetMouseFocus(window);
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
98 #endif
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
99 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
100
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
101
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
102 static void
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3040
diff changeset
103 FocusAllKeyboards(_THIS, SDL_Window *window)
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
104 {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
105 #if USE_MULTI_API
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
106 SDL_DFB_DEVICEDATA(_this);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
107 int index;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
108
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
109 for (index = 0; index < devdata->num_keyboard; index++)
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
110 SDL_SetKeyboardFocus(index, id);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
111 #else
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
112 SDL_SetKeyboardFocus(window);
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
113 #endif
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
114 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
115
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
116 static void
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
117 MotionAllMice(_THIS, int x, int y)
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
118 {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
119 #if USE_MULTI_API
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
120 SDL_DFB_DEVICEDATA(_this);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
121 int index;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
122
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
123 for (index = 0; index < devdata->num_mice; index++) {
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
124 SDL_Mouse *mouse = SDL_GetMouse(index);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
125 mouse->x = mouse->last_x = x;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
126 mouse->y = mouse->last_y = y;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
127 //SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
128 }
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
129 #endif
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
130 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
131
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
132 static int
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
133 KbdIndex(_THIS, int id)
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
134 {
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
135 SDL_DFB_DEVICEDATA(_this);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
136 int index;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
137
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
138 for (index = 0; index < devdata->num_keyboard; index++) {
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
139 if (devdata->keyboard[index].id == id)
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
140 return index;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
141 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
142 return -1;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
143 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
144
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
145 static int
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
146 ClientXY(DFB_WindowData * p, int *x, int *y)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
147 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
148 int cx, cy;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
149
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
150 cx = *x;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
151 cy = *y;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
152
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
153 cx -= p->client.x;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
154 cy -= p->client.y;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
155
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
156 if (cx < 0 || cy < 0)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
157 return 0;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
158 if (cx >= p->client.w || cy >= p->client.h)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
159 return 0;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
160 *x = cx;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
161 *y = cy;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
162 return 1;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
163 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
164
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
165 static void
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
166 ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
167 DFBWindowEvent * evt)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
168 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
169 SDL_DFB_DEVICEDATA(_this);
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
170 SDL_KeySym keysym;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
171 char text[5];
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
172
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
173 if (evt->clazz == DFEC_WINDOW) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
174 switch (evt->type) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
175 case DWET_BUTTONDOWN:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
176 if (ClientXY(p, &evt->x, &evt->y)) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
177 if (!devdata->use_linux_input) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
178 SDL_SendMouseMotion_ex(p->sdl_window, devdata->mouse_id[0], 0, evt->x,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
179 evt->y, 0);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
180 SDL_SendMouseButton_ex(p->sdl_window, devdata->mouse_id[0],
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
181 SDL_PRESSED,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
182 DirectFB_TranslateButton
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
183 (evt->button));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
184 } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
185 MotionAllMice(_this, evt->x, evt->y);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
186 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
187 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
188 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
189 case DWET_BUTTONUP:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
190 if (ClientXY(p, &evt->x, &evt->y)) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
191 if (!devdata->use_linux_input) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
192 SDL_SendMouseMotion_ex(p->sdl_window, devdata->mouse_id[0], 0, evt->x,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
193 evt->y, 0);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
194 SDL_SendMouseButton_ex(p->sdl_window, devdata->mouse_id[0],
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
195 SDL_RELEASED,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
196 DirectFB_TranslateButton
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
197 (evt->button));
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
198 } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
199 MotionAllMice(_this, evt->x, evt->y);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
200 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
201 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
202 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
203 case DWET_MOTION:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
204 if (ClientXY(p, &evt->x, &evt->y)) {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
205 SDL_Window *window = p->sdl_window;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
206 if (!devdata->use_linux_input) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
207 if (!(flags & SDL_WINDOW_INPUT_GRABBED))
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
208 SDL_SendMouseMotion_ex(p->sdl_window, devdata->mouse_id[0], 0,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
209 evt->x, evt->y, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
210 } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
211 /* relative movements are not exact!
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
212 * This code should limit the number of events sent.
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
213 * However it kills MAME axis recognition ... */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
214 static int cnt = 0;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
215 if (1 && ++cnt > 20) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
216 MotionAllMice(_this, evt->x, evt->y);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
217 cnt = 0;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
218 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
219 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
220 if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS))
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
221 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_ENTER, 0,
3040
Sam Lantinga <slouken@libsdl.org>
parents: 3037
diff changeset
222 0);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
223 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
224 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
225 case DWET_KEYDOWN:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
226 if (!devdata->use_linux_input) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
227 DirectFB_TranslateKey(_this, evt, &keysym);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
228 SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
229 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
230 SDL_memcpy(text, &keysym.unicode, 4);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
231 text[4] = 0;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
232 if (*text) {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
233 SDL_SendKeyboardText_ex(0, text);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
234 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
235 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
236 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
237 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
238 case DWET_KEYUP:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
239 if (!devdata->use_linux_input) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
240 DirectFB_TranslateKey(_this, evt, &keysym);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
241 SDL_SendKeyboardKey_ex(0, SDL_RELEASED, keysym.scancode);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
242 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
243 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
244 case DWET_POSITION:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
245 if (ClientXY(p, &evt->x, &evt->y)) {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
246 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_MOVED,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
247 evt->x, evt->y);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
248 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
249 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
250 case DWET_POSITION_SIZE:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
251 if (ClientXY(p, &evt->x, &evt->y)) {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
252 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_MOVED,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
253 evt->x, evt->y);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
254 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
255 /* fall throught */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
256 case DWET_SIZE:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
257 // FIXME: what about < 0
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
258 evt->w -= (p->theme.right_size + p->theme.left_size);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
259 evt->h -=
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
260 (p->theme.top_size + p->theme.bottom_size +
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
261 p->theme.caption_size);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
262 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_RESIZED,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
263 evt->w, evt->h);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
264 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
265 case DWET_CLOSE:
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
266 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_CLOSE, 0, 0);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
267 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
268 case DWET_GOTFOCUS:
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
269 DirectFB_SetContext(_this, p->sdl_window);
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
270 FocusAllKeyboards(_this, p->sdl_window);
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
271 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_FOCUS_GAINED,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
272 0, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
273 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
274 case DWET_LOSTFOCUS:
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
275 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
276 FocusAllKeyboards(_this, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
277 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
278 case DWET_ENTER:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
279 /* SDL_DirectFB_ReshowCursor(_this, 0); */
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
280 FocusAllMice(_this, p->sdl_window);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
281 // FIXME: when do we really enter ?
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
282 if (ClientXY(p, &evt->x, &evt->y))
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
283 MotionAllMice(_this, evt->x, evt->y);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
284 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_ENTER, 0, 0);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
285 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
286 case DWET_LEAVE:
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
287 SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_LEAVE, 0, 0);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
288 FocusAllMice(_this, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
289 /* SDL_DirectFB_ReshowCursor(_this, 1); */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
290 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
291 default:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
292 ;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
293 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
294 } else
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
295 printf("Event Clazz %d\n", evt->clazz);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
296 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
297
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
298 static void
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
299 ProcessInputEvent(_THIS, DFBInputEvent * ievt)
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
300 {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
301 SDL_DFB_DEVICEDATA(_this);
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
302 SDL_KeySym keysym;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
303 int kbd_idx;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
304 char text[5];
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
305
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
306 if (!devdata->use_linux_input) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
307 if (ievt->type == DIET_AXISMOTION) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
308 if ((devdata->grabbed_window != NULL) && (ievt->flags & DIEF_AXISREL)) {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
309 if (ievt->axis == DIAI_X)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
310 SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
311 ievt->axisrel, 0, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
312 else if (ievt->axis == DIAI_Y)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
313 SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1, 0,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
314 ievt->axisrel, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
315 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
316 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
317 } else {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
318 static int last_x, last_y;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
319
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
320 switch (ievt->type) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
321 case DIET_AXISMOTION:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
322 if (ievt->flags & DIEF_AXISABS) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
323 if (ievt->axis == DIAI_X)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
324 last_x = ievt->axisabs;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
325 else if (ievt->axis == DIAI_Y)
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
326 last_y = ievt->axisabs;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
327 if (!(ievt->flags & DIEF_FOLLOW)) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
328 #if USE_MULTI_API
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
329 SDL_Mouse *mouse = SDL_GetMouse(ievt->device_id);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
330 SDL_Window *window = SDL_GetWindowFromID(mouse->focus);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
331 #else
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
332 SDL_Window *window = devdata->grabbed_window;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
333 #endif
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
334 if (window) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
335 DFB_WindowData *windata =
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
336 (DFB_WindowData *) window->driverdata;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
337 int x, y;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
338
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
339 windata->window->GetPosition(windata->window, &x, &y);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
340 SDL_SendMouseMotion_ex(window, ievt->device_id, 0,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
341 last_x - (x +
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
342 windata->client.x),
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
343 last_y - (y +
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
344 windata->client.y), 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
345 } else {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
346 SDL_SendMouseMotion_ex(window, ievt->device_id, 0, last_x,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
347 last_y, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
348 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
349 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
350 } else if (ievt->flags & DIEF_AXISREL) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
351 if (ievt->axis == DIAI_X)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
352 SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
353 ievt->axisrel, 0, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
354 else if (ievt->axis == DIAI_Y)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
355 SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1, 0,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
356 ievt->axisrel, 0);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
357 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
358 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
359 case DIET_KEYPRESS:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
360 kbd_idx = KbdIndex(_this, ievt->device_id);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
361 DirectFB_TranslateKeyInputEvent(_this, kbd_idx, ievt, &keysym);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
362 SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
363 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
364 SDL_memcpy(text, &keysym.unicode, 4);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
365 text[4] = 0;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
366 if (*text) {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
367 SDL_SendKeyboardText_ex(kbd_idx, text);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
368 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
369 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
370 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
371 case DIET_KEYRELEASE:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
372 kbd_idx = KbdIndex(_this, ievt->device_id);
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
373 DirectFB_TranslateKeyInputEvent(_this, kbd_idx, ievt, &keysym);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
374 SDL_SendKeyboardKey_ex(kbd_idx, SDL_RELEASED, keysym.scancode);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
375 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
376 case DIET_BUTTONPRESS:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
377 if (ievt->buttons & DIBM_LEFT)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
378 SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 1);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
379 if (ievt->buttons & DIBM_MIDDLE)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
380 SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 2);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
381 if (ievt->buttons & DIBM_RIGHT)
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
382 SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 3);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
383 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
384 case DIET_BUTTONRELEASE:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
385 if (!(ievt->buttons & DIBM_LEFT))
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
386 SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 1);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
387 if (!(ievt->buttons & DIBM_MIDDLE))
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
388 SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 2);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
389 if (!(ievt->buttons & DIBM_RIGHT))
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
390 SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 3);
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
391 break;
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
392 default:
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
393 break; /* please gcc */
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
394 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
395 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
396 }
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
397
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
398 void
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
399 DirectFB_PumpEventsWindow(_THIS)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 {
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
401 SDL_DFB_DEVICEDATA(_this);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
402 DFB_WindowData *p;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
403 DFBInputEvent ievt;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
404
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
405 for (p = devdata->firstwin; p != NULL; p = p->next) {
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
406 DFBWindowEvent evt;
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
407 SDL_Window *w = p->sdl_window;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
408
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
409 while (p->eventbuffer->GetEvent(p->eventbuffer,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
410 DFB_EVENT(&evt)) == DFB_OK) {
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
411 if (!DirectFB_WM_ProcessEvent(_this, w, &evt))
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
412 ProcessWindowEvent(_this, p, w->flags, &evt);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
413 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
414 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
415
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
416 /* Now get relative events in case we need them */
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
417 while (devdata->events->GetEvent(devdata->events,
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
418 DFB_EVENT(&ievt)) == DFB_OK) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
419 ProcessInputEvent(_this, &ievt);
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
420 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
421 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
422
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
423 void
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
424 DirectFB_InitOSKeymap(_THIS, SDLKey * keymap, int numkeys)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
425 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
426 int i;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
427
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
428 /* Initialize the DirectFB key translation table */
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
429 for (i = 0; i < numkeys; ++i)
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
430 keymap[i] = SDL_SCANCODE_UNKNOWN;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
431
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
432 keymap[DIKI_A - DIKI_UNKNOWN] = SDL_SCANCODE_A;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
433 keymap[DIKI_B - DIKI_UNKNOWN] = SDL_SCANCODE_B;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
434 keymap[DIKI_C - DIKI_UNKNOWN] = SDL_SCANCODE_C;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
435 keymap[DIKI_D - DIKI_UNKNOWN] = SDL_SCANCODE_D;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
436 keymap[DIKI_E - DIKI_UNKNOWN] = SDL_SCANCODE_E;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
437 keymap[DIKI_F - DIKI_UNKNOWN] = SDL_SCANCODE_F;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
438 keymap[DIKI_G - DIKI_UNKNOWN] = SDL_SCANCODE_G;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
439 keymap[DIKI_H - DIKI_UNKNOWN] = SDL_SCANCODE_H;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
440 keymap[DIKI_I - DIKI_UNKNOWN] = SDL_SCANCODE_I;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
441 keymap[DIKI_J - DIKI_UNKNOWN] = SDL_SCANCODE_J;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
442 keymap[DIKI_K - DIKI_UNKNOWN] = SDL_SCANCODE_K;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
443 keymap[DIKI_L - DIKI_UNKNOWN] = SDL_SCANCODE_L;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
444 keymap[DIKI_M - DIKI_UNKNOWN] = SDL_SCANCODE_M;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
445 keymap[DIKI_N - DIKI_UNKNOWN] = SDL_SCANCODE_N;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
446 keymap[DIKI_O - DIKI_UNKNOWN] = SDL_SCANCODE_O;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
447 keymap[DIKI_P - DIKI_UNKNOWN] = SDL_SCANCODE_P;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
448 keymap[DIKI_Q - DIKI_UNKNOWN] = SDL_SCANCODE_Q;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
449 keymap[DIKI_R - DIKI_UNKNOWN] = SDL_SCANCODE_R;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
450 keymap[DIKI_S - DIKI_UNKNOWN] = SDL_SCANCODE_S;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
451 keymap[DIKI_T - DIKI_UNKNOWN] = SDL_SCANCODE_T;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
452 keymap[DIKI_U - DIKI_UNKNOWN] = SDL_SCANCODE_U;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
453 keymap[DIKI_V - DIKI_UNKNOWN] = SDL_SCANCODE_V;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
454 keymap[DIKI_W - DIKI_UNKNOWN] = SDL_SCANCODE_W;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
455 keymap[DIKI_X - DIKI_UNKNOWN] = SDL_SCANCODE_X;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
456 keymap[DIKI_Y - DIKI_UNKNOWN] = SDL_SCANCODE_Y;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
457 keymap[DIKI_Z - DIKI_UNKNOWN] = SDL_SCANCODE_Z;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
458
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
459 keymap[DIKI_0 - DIKI_UNKNOWN] = SDL_SCANCODE_0;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
460 keymap[DIKI_1 - DIKI_UNKNOWN] = SDL_SCANCODE_1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
461 keymap[DIKI_2 - DIKI_UNKNOWN] = SDL_SCANCODE_2;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
462 keymap[DIKI_3 - DIKI_UNKNOWN] = SDL_SCANCODE_3;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
463 keymap[DIKI_4 - DIKI_UNKNOWN] = SDL_SCANCODE_4;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
464 keymap[DIKI_5 - DIKI_UNKNOWN] = SDL_SCANCODE_5;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
465 keymap[DIKI_6 - DIKI_UNKNOWN] = SDL_SCANCODE_6;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
466 keymap[DIKI_7 - DIKI_UNKNOWN] = SDL_SCANCODE_7;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
467 keymap[DIKI_8 - DIKI_UNKNOWN] = SDL_SCANCODE_8;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
468 keymap[DIKI_9 - DIKI_UNKNOWN] = SDL_SCANCODE_9;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
469
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
470 keymap[DIKI_F1 - DIKI_UNKNOWN] = SDL_SCANCODE_F1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
471 keymap[DIKI_F2 - DIKI_UNKNOWN] = SDL_SCANCODE_F2;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
472 keymap[DIKI_F3 - DIKI_UNKNOWN] = SDL_SCANCODE_F3;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
473 keymap[DIKI_F4 - DIKI_UNKNOWN] = SDL_SCANCODE_F4;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
474 keymap[DIKI_F5 - DIKI_UNKNOWN] = SDL_SCANCODE_F5;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
475 keymap[DIKI_F6 - DIKI_UNKNOWN] = SDL_SCANCODE_F6;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
476 keymap[DIKI_F7 - DIKI_UNKNOWN] = SDL_SCANCODE_F7;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
477 keymap[DIKI_F8 - DIKI_UNKNOWN] = SDL_SCANCODE_F8;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
478 keymap[DIKI_F9 - DIKI_UNKNOWN] = SDL_SCANCODE_F9;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
479 keymap[DIKI_F10 - DIKI_UNKNOWN] = SDL_SCANCODE_F10;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
480 keymap[DIKI_F11 - DIKI_UNKNOWN] = SDL_SCANCODE_F11;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
481 keymap[DIKI_F12 - DIKI_UNKNOWN] = SDL_SCANCODE_F12;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
482
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
483 keymap[DIKI_ESCAPE - DIKI_UNKNOWN] = SDL_SCANCODE_ESCAPE;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
484 keymap[DIKI_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_LEFT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
485 keymap[DIKI_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_RIGHT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
486 keymap[DIKI_UP - DIKI_UNKNOWN] = SDL_SCANCODE_UP;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
487 keymap[DIKI_DOWN - DIKI_UNKNOWN] = SDL_SCANCODE_DOWN;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
488 keymap[DIKI_CONTROL_L - DIKI_UNKNOWN] = SDL_SCANCODE_LCTRL;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
489 keymap[DIKI_CONTROL_R - DIKI_UNKNOWN] = SDL_SCANCODE_RCTRL;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
490 keymap[DIKI_SHIFT_L - DIKI_UNKNOWN] = SDL_SCANCODE_LSHIFT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
491 keymap[DIKI_SHIFT_R - DIKI_UNKNOWN] = SDL_SCANCODE_RSHIFT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
492 keymap[DIKI_ALT_L - DIKI_UNKNOWN] = SDL_SCANCODE_LALT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
493 keymap[DIKI_ALT_R - DIKI_UNKNOWN] = SDL_SCANCODE_RALT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
494 keymap[DIKI_META_L - DIKI_UNKNOWN] = SDL_SCANCODE_LGUI;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
495 keymap[DIKI_META_R - DIKI_UNKNOWN] = SDL_SCANCODE_RGUI;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
496 keymap[DIKI_SUPER_L - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
497 keymap[DIKI_SUPER_R - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
498 /* FIXME:Do we read hyper keys ?
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
499 * keymap[DIKI_HYPER_L - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
500 * keymap[DIKI_HYPER_R - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
501 */
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
502 keymap[DIKI_TAB - DIKI_UNKNOWN] = SDL_SCANCODE_TAB;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
503 keymap[DIKI_ENTER - DIKI_UNKNOWN] = SDL_SCANCODE_RETURN;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
504 keymap[DIKI_SPACE - DIKI_UNKNOWN] = SDL_SCANCODE_SPACE;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
505 keymap[DIKI_BACKSPACE - DIKI_UNKNOWN] = SDL_SCANCODE_BACKSPACE;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
506 keymap[DIKI_INSERT - DIKI_UNKNOWN] = SDL_SCANCODE_INSERT;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
507 keymap[DIKI_DELETE - DIKI_UNKNOWN] = SDL_SCANCODE_DELETE;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
508 keymap[DIKI_HOME - DIKI_UNKNOWN] = SDL_SCANCODE_HOME;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
509 keymap[DIKI_END - DIKI_UNKNOWN] = SDL_SCANCODE_END;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
510 keymap[DIKI_PAGE_UP - DIKI_UNKNOWN] = SDL_SCANCODE_PAGEUP;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
511 keymap[DIKI_PAGE_DOWN - DIKI_UNKNOWN] = SDL_SCANCODE_PAGEDOWN;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
512 keymap[DIKI_CAPS_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_CAPSLOCK;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
513 keymap[DIKI_NUM_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_NUMLOCKCLEAR;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
514 keymap[DIKI_SCROLL_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_SCROLLLOCK;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
515 keymap[DIKI_PRINT - DIKI_UNKNOWN] = SDL_SCANCODE_PRINTSCREEN;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
516 keymap[DIKI_PAUSE - DIKI_UNKNOWN] = SDL_SCANCODE_PAUSE;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
517
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
518 keymap[DIKI_KP_EQUAL - DIKI_UNKNOWN] = SDL_SCANCODE_KP_EQUALS;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
519 keymap[DIKI_KP_DECIMAL - DIKI_UNKNOWN] = SDL_SCANCODE_KP_PERIOD;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
520 keymap[DIKI_KP_0 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_0;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
521 keymap[DIKI_KP_1 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_1;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
522 keymap[DIKI_KP_2 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_2;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
523 keymap[DIKI_KP_3 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_3;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
524 keymap[DIKI_KP_4 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_4;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
525 keymap[DIKI_KP_5 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_5;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
526 keymap[DIKI_KP_6 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_6;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
527 keymap[DIKI_KP_7 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_7;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
528 keymap[DIKI_KP_8 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_8;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
529 keymap[DIKI_KP_9 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_9;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
530 keymap[DIKI_KP_DIV - DIKI_UNKNOWN] = SDL_SCANCODE_KP_DIVIDE;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
531 keymap[DIKI_KP_MULT - DIKI_UNKNOWN] = SDL_SCANCODE_KP_MULTIPLY;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
532 keymap[DIKI_KP_MINUS - DIKI_UNKNOWN] = SDL_SCANCODE_KP_MINUS;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
533 keymap[DIKI_KP_PLUS - DIKI_UNKNOWN] = SDL_SCANCODE_KP_PLUS;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
534 keymap[DIKI_KP_ENTER - DIKI_UNKNOWN] = SDL_SCANCODE_KP_ENTER;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
535
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
536 keymap[DIKI_QUOTE_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_GRAVE; /* TLDE */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
537 keymap[DIKI_MINUS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_MINUS; /* AE11 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
538 keymap[DIKI_EQUALS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_EQUALS; /* AE12 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
539 keymap[DIKI_BRACKET_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_RIGHTBRACKET; /* AD11 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
540 keymap[DIKI_BRACKET_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_LEFTBRACKET; /* AD12 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
541 keymap[DIKI_BACKSLASH - DIKI_UNKNOWN] = SDL_SCANCODE_BACKSLASH; /* BKSL */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
542 keymap[DIKI_SEMICOLON - DIKI_UNKNOWN] = SDL_SCANCODE_SEMICOLON; /* AC10 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
543 keymap[DIKI_QUOTE_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_APOSTROPHE; /* AC11 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
544 keymap[DIKI_COMMA - DIKI_UNKNOWN] = SDL_SCANCODE_COMMA; /* AB08 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
545 keymap[DIKI_PERIOD - DIKI_UNKNOWN] = SDL_SCANCODE_PERIOD; /* AB09 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
546 keymap[DIKI_SLASH - DIKI_UNKNOWN] = SDL_SCANCODE_SLASH; /* AB10 */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
547 keymap[DIKI_LESS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_NONUSBACKSLASH; /* 103rd */
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
548
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
549 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
550
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
551 static SDL_KeySym *
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
552 DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_KeySym * keysym)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
553 {
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
554 SDL_DFB_DEVICEDATA(_this);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
555
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
556 if (evt->key_code >= 0 &&
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
557 evt->key_code < SDL_arraysize(linux_scancode_table))
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
558 keysym->scancode = linux_scancode_table[evt->key_code];
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
559 else
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
560 keysym->scancode = SDL_SCANCODE_UNKNOWN;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
561
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
562 if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
563 devdata->keyboard[0].is_generic) {
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
564 if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
565 keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
566 else
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
567 keysym->scancode = SDL_SCANCODE_UNKNOWN;
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
568 }
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
569
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
570 keysym->unicode =
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
571 (DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
572 if (keysym->unicode == 0 &&
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
573 (evt->key_symbol > 0 && evt->key_symbol < 255))
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
574 keysym->unicode = evt->key_symbol;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
575
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
576 return keysym;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
577 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
578
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
579 static SDL_KeySym *
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
580 DirectFB_TranslateKeyInputEvent(_THIS, int index, DFBInputEvent * evt,
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
581 SDL_KeySym * keysym)
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
582 {
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
583 SDL_DFB_DEVICEDATA(_this);
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
584
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
585 if (evt->key_code >= 0 &&
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
586 evt->key_code < SDL_arraysize(linux_scancode_table))
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
587 keysym->scancode = linux_scancode_table[evt->key_code];
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
588 else
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
589 keysym->scancode = SDL_SCANCODE_UNKNOWN;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
590
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
591 if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
592 devdata->keyboard[index].is_generic) {
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
593 if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
594 keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
595 else
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
596 keysym->scancode = SDL_SCANCODE_UNKNOWN;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
597 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
598
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
599 keysym->unicode =
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
600 (DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
601 if (keysym->unicode == 0 &&
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
602 (evt->key_symbol > 0 && evt->key_symbol < 255))
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
603 keysym->unicode = evt->key_symbol;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
604
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
605 return keysym;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
606 }
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
607
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
608 static int
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
609 DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
610 {
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
611 switch (button) {
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
612 case DIBI_LEFT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
613 return 1;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
614 case DIBI_MIDDLE:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
615 return 2;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
616 case DIBI_RIGHT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
617 return 3;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
618 default:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
619 return 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
620 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
621 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1775
diff changeset
622
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
623 static DFBEnumerationResult
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
624 EnumKeyboards(DFBInputDeviceID device_id,
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
625 DFBInputDeviceDescription desc, void *callbackdata)
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
626 {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
627 cb_data *cb = callbackdata;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
628 DFB_DeviceData *devdata = cb->devdata;
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
629 #if USE_MULTI_API
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
630 SDL_Keyboard keyboard;
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
631 #endif
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
632 SDLKey keymap[SDL_NUM_SCANCODES];
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
633
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
634 if (!cb->sys_kbd) {
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
635 if (cb->sys_ids) {
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
636 if (device_id >= 0x10)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
637 return DFENUM_OK;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
638 } else {
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
639 if (device_id < 0x10)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
640 return DFENUM_OK;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
641 }
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
642 } else {
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
643 if (device_id != DIDID_KEYBOARD)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
644 return DFENUM_OK;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
645 }
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
646
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
647 if ((desc.caps & DIDTF_KEYBOARD)) {
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
648 #if USE_MULTI_API
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
649 SDL_zero(keyboard);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
650 SDL_AddKeyboard(&keyboard, devdata->num_keyboard);
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
651 #endif
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
652 devdata->keyboard[devdata->num_keyboard].id = device_id;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
653 devdata->keyboard[devdata->num_keyboard].is_generic = 0;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
654 if (!strncmp("X11", desc.name, 3))
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
655 devdata->keyboard[devdata->num_keyboard].is_generic = 1;
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
656
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
657 SDL_GetDefaultKeymap(keymap);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
658 #if USE_MULTI_API
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
659 SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
660 #else
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
661 SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
662 #endif
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
663 devdata->num_keyboard++;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
664
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
665 if (cb->sys_kbd)
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
666 return DFENUM_CANCEL;
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
667 }
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
668 return DFENUM_OK;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
669 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
670
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
671 void
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
672 DirectFB_InitKeyboard(_THIS)
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
673 {
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
674 SDL_DFB_DEVICEDATA(_this);
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
675 cb_data cb;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
676
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
677 DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
678
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
679 devdata->num_keyboard = 0;
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
680 cb.devdata = devdata;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
681
2998
d364ee9b9c15 Date: Sun, 04 Jan 2009 20:53:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2860
diff changeset
682 if (devdata->use_linux_input) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
683 cb.sys_kbd = 0;
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
684 cb.sys_ids = 0;
3013
8cc00819c8d6 Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents: 3011
diff changeset
685 SDL_DFB_CHECK(devdata->dfb->
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
686 EnumInputDevices(devdata->dfb, EnumKeyboards, &cb));
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
687 if (devdata->num_keyboard == 0) {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
688 cb.sys_ids = 1;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
689 SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
690 EnumKeyboards,
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
691 &cb));
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
692 }
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
693 } else {
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
694 cb.sys_kbd = 1;
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
695 SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
696 EnumKeyboards,
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
697 &cb));
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
698 }
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
699 }
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
700
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
701 void
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
702 DirectFB_QuitKeyboard(_THIS)
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
703 {
4636
b196d2758026 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 4568
diff changeset
704 //SDL_DFB_DEVICEDATA(_this);
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
705
2860
6ce28e5287e9 Date: Sun, 07 Dec 2008 13:35:23 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
706 SDL_KeyboardQuit();
2737
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
707
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
708 }
140a7edcf2bd Date: Sun, 31 Aug 2008 17:53:59 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
709
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
710 #if 0
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
711 /* FIXME: Remove once determined this is not needed in fullscreen mode */
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
712 void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
713 DirectFB_PumpEvents(_THIS)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
714 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
715 SDL_DFB_DEVICEDATA(_this);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
716 DFBInputEvent evt;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
717 static last_x = 0, last_y = 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
718
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
719 while (devdata->eventbuffer->GetEvent(devdata->eventbuffer,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
720 DFB_EVENT(&evt)) == DFB_OK) {
5083
25d4feb7c127 Renamed SDL_keysym to SDL_KeySym
krogoway
parents: 4636
diff changeset
721 SDL_KeySym keysym;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
722 DFBInputDeviceModifierMask mod;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
723
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
724 if (evt.clazz = DFEC_INPUT) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
725 if (evt.flags & DIEF_MODIFIERS)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
726 mod = evt.modifiers;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
727 else
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
728 mod = 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
729
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
730 switch (evt.type) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
731 case DIET_BUTTONPRESS:
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
732 posted +=
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
733 SDL_PrivateMouseButton(SDL_PRESSED,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
734 DirectFB_TranslateButton
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
735 (evt.button), 0, 0);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
736 break;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
737 case DIET_BUTTONRELEASE:
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
738 posted +=
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
739 SDL_PrivateMouseButton(SDL_RELEASED,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
740 DirectFB_TranslateButton
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
741 (evt.button), 0, 0);
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
742 break;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
743 case DIET_KEYPRESS:
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
744 posted +=
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
745 SDL_PrivateKeyboard(SDL_PRESSED,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
746 DirectFB_TranslateKey
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
747 (evt.key_id, evt.key_symbol,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
748 mod, &keysym));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
749 break;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
750 case DIET_KEYRELEASE:
3023
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
751 posted +=
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
752 SDL_PrivateKeyboard(SDL_RELEASED,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
753 DirectFB_TranslateKey
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
754 (evt.key_id, evt.key_symbol,
d72a0dd80e8b DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents: 3013
diff changeset
755 mod, &keysym));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
756 break;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
757 case DIET_AXISMOTION:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
758 if (evt.flags & DIEF_AXISREL) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
759 if (evt.axis == DIAI_X)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
760 posted +=
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
761 SDL_PrivateMouseMotion(0, 1, evt.axisrel, 0);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
762 else if (evt.axis == DIAI_Y)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
763 posted +=
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
764 SDL_PrivateMouseMotion(0, 1, 0, evt.axisrel);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
765 } else if (evt.flags & DIEF_AXISABS) {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
766 if (evt.axis == DIAI_X)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
767 last_x = evt.axisabs;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
768 else if (evt.axis == DIAI_Y)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
769 last_y = evt.axisabs;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
770 posted += SDL_PrivateMouseMotion(0, 0, last_x, last_y);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
771 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
772 break;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
773 default:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
774 ;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
775 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
776 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
777 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
778 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
779 #endif
4568
25b9cd8bdc30 Couriersud to Sam
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
780