Mercurial > sdl-ios-xcode
comparison src/video/nanox/SDL_nxevents.c @ 1895:c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 21:04:37 +0000 |
parents | d910939febfa |
children | 99210400e8b9 |
comparison
equal
deleted
inserted
replaced
1894:c69cee13dd76 | 1895:c121d94672cb |
---|---|
31 | 31 |
32 #include "SDL_nxevents_c.h" | 32 #include "SDL_nxevents_c.h" |
33 #include "SDL_nximage_c.h" | 33 #include "SDL_nximage_c.h" |
34 | 34 |
35 // The translation tables from a nanox keysym to a SDL keysym | 35 // The translation tables from a nanox keysym to a SDL keysym |
36 static SDLKey NX_NONASCII_keymap [MWKEY_LAST + 1] ; | 36 static SDLKey NX_NONASCII_keymap[MWKEY_LAST + 1]; |
37 | 37 |
38 void NX_InitOSKeymap (_THIS) | 38 void |
39 NX_InitOSKeymap(_THIS) | |
39 { | 40 { |
40 int i ; | 41 int i; |
41 | 42 |
42 Dprintf ("enter NX_InitOSKeymap\n") ; | 43 Dprintf("enter NX_InitOSKeymap\n"); |
43 | 44 |
44 // Map the nanox scancodes to SDL keysyms | 45 // Map the nanox scancodes to SDL keysyms |
45 for (i = 0; i < SDL_arraysize (NX_NONASCII_keymap); ++ i) | 46 for (i = 0; i < SDL_arraysize(NX_NONASCII_keymap); ++i) |
46 NX_NONASCII_keymap [i] = SDLK_UNKNOWN ; | 47 NX_NONASCII_keymap[i] = SDLK_UNKNOWN; |
47 | 48 |
48 NX_NONASCII_keymap [MWKEY_LEFT & 0xFF] = SDLK_LEFT ; | 49 NX_NONASCII_keymap[MWKEY_LEFT & 0xFF] = SDLK_LEFT; |
49 NX_NONASCII_keymap [MWKEY_RIGHT & 0xFF] = SDLK_RIGHT ; | 50 NX_NONASCII_keymap[MWKEY_RIGHT & 0xFF] = SDLK_RIGHT; |
50 NX_NONASCII_keymap [MWKEY_UP & 0xFF] = SDLK_UP ; | 51 NX_NONASCII_keymap[MWKEY_UP & 0xFF] = SDLK_UP; |
51 NX_NONASCII_keymap [MWKEY_DOWN & 0xFF] = SDLK_DOWN ; | 52 NX_NONASCII_keymap[MWKEY_DOWN & 0xFF] = SDLK_DOWN; |
52 NX_NONASCII_keymap [MWKEY_INSERT & 0xFF] = SDLK_INSERT ; | 53 NX_NONASCII_keymap[MWKEY_INSERT & 0xFF] = SDLK_INSERT; |
53 NX_NONASCII_keymap [MWKEY_DELETE & 0xFF] = SDLK_DELETE ; | 54 NX_NONASCII_keymap[MWKEY_DELETE & 0xFF] = SDLK_DELETE; |
54 NX_NONASCII_keymap [MWKEY_HOME & 0xFF] = SDLK_HOME ; | 55 NX_NONASCII_keymap[MWKEY_HOME & 0xFF] = SDLK_HOME; |
55 NX_NONASCII_keymap [MWKEY_END & 0xFF] = SDLK_END ; | 56 NX_NONASCII_keymap[MWKEY_END & 0xFF] = SDLK_END; |
56 NX_NONASCII_keymap [MWKEY_PAGEUP & 0xFF] = SDLK_PAGEUP ; | 57 NX_NONASCII_keymap[MWKEY_PAGEUP & 0xFF] = SDLK_PAGEUP; |
57 NX_NONASCII_keymap [MWKEY_PAGEDOWN & 0xFF] = SDLK_PAGEDOWN ; | 58 NX_NONASCII_keymap[MWKEY_PAGEDOWN & 0xFF] = SDLK_PAGEDOWN; |
58 | 59 |
59 NX_NONASCII_keymap [MWKEY_KP0 & 0xFF] = SDLK_KP0 ; | 60 NX_NONASCII_keymap[MWKEY_KP0 & 0xFF] = SDLK_KP0; |
60 NX_NONASCII_keymap [MWKEY_KP1 & 0xFF] = SDLK_KP1 ; | 61 NX_NONASCII_keymap[MWKEY_KP1 & 0xFF] = SDLK_KP1; |
61 NX_NONASCII_keymap [MWKEY_KP2 & 0xFF] = SDLK_KP2 ; | 62 NX_NONASCII_keymap[MWKEY_KP2 & 0xFF] = SDLK_KP2; |
62 NX_NONASCII_keymap [MWKEY_KP3 & 0xFF] = SDLK_KP3 ; | 63 NX_NONASCII_keymap[MWKEY_KP3 & 0xFF] = SDLK_KP3; |
63 NX_NONASCII_keymap [MWKEY_KP4 & 0xFF] = SDLK_KP4 ; | 64 NX_NONASCII_keymap[MWKEY_KP4 & 0xFF] = SDLK_KP4; |
64 NX_NONASCII_keymap [MWKEY_KP5 & 0xFF] = SDLK_KP5 ; | 65 NX_NONASCII_keymap[MWKEY_KP5 & 0xFF] = SDLK_KP5; |
65 NX_NONASCII_keymap [MWKEY_KP6 & 0xFF] = SDLK_KP6 ; | 66 NX_NONASCII_keymap[MWKEY_KP6 & 0xFF] = SDLK_KP6; |
66 NX_NONASCII_keymap [MWKEY_KP7 & 0xFF] = SDLK_KP7 ; | 67 NX_NONASCII_keymap[MWKEY_KP7 & 0xFF] = SDLK_KP7; |
67 NX_NONASCII_keymap [MWKEY_KP8 & 0xFF] = SDLK_KP8 ; | 68 NX_NONASCII_keymap[MWKEY_KP8 & 0xFF] = SDLK_KP8; |
68 NX_NONASCII_keymap [MWKEY_KP9 & 0xFF] = SDLK_KP9 ; | 69 NX_NONASCII_keymap[MWKEY_KP9 & 0xFF] = SDLK_KP9; |
69 NX_NONASCII_keymap [MWKEY_KP_PERIOD & 0xFF] = SDLK_KP_PERIOD ; | 70 NX_NONASCII_keymap[MWKEY_KP_PERIOD & 0xFF] = SDLK_KP_PERIOD; |
70 NX_NONASCII_keymap [MWKEY_KP_DIVIDE & 0xFF] = SDLK_KP_DIVIDE ; | 71 NX_NONASCII_keymap[MWKEY_KP_DIVIDE & 0xFF] = SDLK_KP_DIVIDE; |
71 NX_NONASCII_keymap [MWKEY_KP_MULTIPLY & 0xFF] = SDLK_KP_MULTIPLY ; | 72 NX_NONASCII_keymap[MWKEY_KP_MULTIPLY & 0xFF] = SDLK_KP_MULTIPLY; |
72 NX_NONASCII_keymap [MWKEY_KP_MINUS & 0xFF] = SDLK_KP_MINUS ; | 73 NX_NONASCII_keymap[MWKEY_KP_MINUS & 0xFF] = SDLK_KP_MINUS; |
73 NX_NONASCII_keymap [MWKEY_KP_PLUS & 0xFF] = SDLK_KP_PLUS ; | 74 NX_NONASCII_keymap[MWKEY_KP_PLUS & 0xFF] = SDLK_KP_PLUS; |
74 NX_NONASCII_keymap [MWKEY_KP_ENTER & 0xFF] = SDLK_KP_ENTER ; | 75 NX_NONASCII_keymap[MWKEY_KP_ENTER & 0xFF] = SDLK_KP_ENTER; |
75 NX_NONASCII_keymap [MWKEY_KP_EQUALS & 0xFF] = SDLK_KP_EQUALS ; | 76 NX_NONASCII_keymap[MWKEY_KP_EQUALS & 0xFF] = SDLK_KP_EQUALS; |
76 | 77 |
77 NX_NONASCII_keymap [MWKEY_F1 & 0xFF] = SDLK_F1 ; | 78 NX_NONASCII_keymap[MWKEY_F1 & 0xFF] = SDLK_F1; |
78 NX_NONASCII_keymap [MWKEY_F2 & 0xFF] = SDLK_F2 ; | 79 NX_NONASCII_keymap[MWKEY_F2 & 0xFF] = SDLK_F2; |
79 NX_NONASCII_keymap [MWKEY_F3 & 0xFF] = SDLK_F3 ; | 80 NX_NONASCII_keymap[MWKEY_F3 & 0xFF] = SDLK_F3; |
80 NX_NONASCII_keymap [MWKEY_F4 & 0xFF] = SDLK_F4 ; | 81 NX_NONASCII_keymap[MWKEY_F4 & 0xFF] = SDLK_F4; |
81 NX_NONASCII_keymap [MWKEY_F5 & 0xFF] = SDLK_F5 ; | 82 NX_NONASCII_keymap[MWKEY_F5 & 0xFF] = SDLK_F5; |
82 NX_NONASCII_keymap [MWKEY_F6 & 0xFF] = SDLK_F6 ; | 83 NX_NONASCII_keymap[MWKEY_F6 & 0xFF] = SDLK_F6; |
83 NX_NONASCII_keymap [MWKEY_F7 & 0xFF] = SDLK_F7 ; | 84 NX_NONASCII_keymap[MWKEY_F7 & 0xFF] = SDLK_F7; |
84 NX_NONASCII_keymap [MWKEY_F8 & 0xFF] = SDLK_F8 ; | 85 NX_NONASCII_keymap[MWKEY_F8 & 0xFF] = SDLK_F8; |
85 NX_NONASCII_keymap [MWKEY_F9 & 0xFF] = SDLK_F9 ; | 86 NX_NONASCII_keymap[MWKEY_F9 & 0xFF] = SDLK_F9; |
86 NX_NONASCII_keymap [MWKEY_F10 & 0xFF] = SDLK_F10 ; | 87 NX_NONASCII_keymap[MWKEY_F10 & 0xFF] = SDLK_F10; |
87 NX_NONASCII_keymap [MWKEY_F11 & 0xFF] = SDLK_F11 ; | 88 NX_NONASCII_keymap[MWKEY_F11 & 0xFF] = SDLK_F11; |
88 NX_NONASCII_keymap [MWKEY_F12 & 0xFF] = SDLK_F12 ; | 89 NX_NONASCII_keymap[MWKEY_F12 & 0xFF] = SDLK_F12; |
89 | 90 |
90 NX_NONASCII_keymap [MWKEY_NUMLOCK & 0xFF] = SDLK_NUMLOCK ; | 91 NX_NONASCII_keymap[MWKEY_NUMLOCK & 0xFF] = SDLK_NUMLOCK; |
91 NX_NONASCII_keymap [MWKEY_CAPSLOCK & 0xFF] = SDLK_CAPSLOCK ; | 92 NX_NONASCII_keymap[MWKEY_CAPSLOCK & 0xFF] = SDLK_CAPSLOCK; |
92 NX_NONASCII_keymap [MWKEY_SCROLLOCK & 0xFF] = SDLK_SCROLLOCK ; | 93 NX_NONASCII_keymap[MWKEY_SCROLLOCK & 0xFF] = SDLK_SCROLLOCK; |
93 NX_NONASCII_keymap [MWKEY_LSHIFT & 0xFF] = SDLK_LSHIFT ; | 94 NX_NONASCII_keymap[MWKEY_LSHIFT & 0xFF] = SDLK_LSHIFT; |
94 NX_NONASCII_keymap [MWKEY_RSHIFT & 0xFF] = SDLK_RSHIFT ; | 95 NX_NONASCII_keymap[MWKEY_RSHIFT & 0xFF] = SDLK_RSHIFT; |
95 NX_NONASCII_keymap [MWKEY_LCTRL & 0xFF] = SDLK_LCTRL ; | 96 NX_NONASCII_keymap[MWKEY_LCTRL & 0xFF] = SDLK_LCTRL; |
96 NX_NONASCII_keymap [MWKEY_RCTRL & 0xFF] = SDLK_RCTRL ; | 97 NX_NONASCII_keymap[MWKEY_RCTRL & 0xFF] = SDLK_RCTRL; |
97 NX_NONASCII_keymap [MWKEY_LALT & 0xFF] = SDLK_LALT ; | 98 NX_NONASCII_keymap[MWKEY_LALT & 0xFF] = SDLK_LALT; |
98 NX_NONASCII_keymap [MWKEY_RALT & 0xFF] = SDLK_RALT ; | 99 NX_NONASCII_keymap[MWKEY_RALT & 0xFF] = SDLK_RALT; |
99 NX_NONASCII_keymap [MWKEY_LMETA & 0xFF] = SDLK_LMETA ; | 100 NX_NONASCII_keymap[MWKEY_LMETA & 0xFF] = SDLK_LMETA; |
100 NX_NONASCII_keymap [MWKEY_RMETA & 0xFF] = SDLK_RMETA ; | 101 NX_NONASCII_keymap[MWKEY_RMETA & 0xFF] = SDLK_RMETA; |
101 NX_NONASCII_keymap [MWKEY_ALTGR & 0xFF] = SDLK_MODE ; | 102 NX_NONASCII_keymap[MWKEY_ALTGR & 0xFF] = SDLK_MODE; |
102 | 103 |
103 NX_NONASCII_keymap [MWKEY_PRINT & 0xFF] = SDLK_PRINT ; | 104 NX_NONASCII_keymap[MWKEY_PRINT & 0xFF] = SDLK_PRINT; |
104 NX_NONASCII_keymap [MWKEY_SYSREQ & 0xFF] = SDLK_SYSREQ ; | 105 NX_NONASCII_keymap[MWKEY_SYSREQ & 0xFF] = SDLK_SYSREQ; |
105 NX_NONASCII_keymap [MWKEY_PAUSE & 0xFF] = SDLK_PAUSE ; | 106 NX_NONASCII_keymap[MWKEY_PAUSE & 0xFF] = SDLK_PAUSE; |
106 NX_NONASCII_keymap [MWKEY_BREAK & 0xFF] = SDLK_BREAK ; | 107 NX_NONASCII_keymap[MWKEY_BREAK & 0xFF] = SDLK_BREAK; |
107 NX_NONASCII_keymap [MWKEY_MENU & 0xFF] = SDLK_MENU ; | 108 NX_NONASCII_keymap[MWKEY_MENU & 0xFF] = SDLK_MENU; |
108 | 109 |
109 Dprintf ("leave NX_InitOSKeymap\n") ; | 110 Dprintf("leave NX_InitOSKeymap\n"); |
110 } | 111 } |
111 | 112 |
112 SDL_keysym * NX_TranslateKey (GR_EVENT_KEYSTROKE * keystroke, SDL_keysym * keysym) | 113 SDL_keysym * |
114 NX_TranslateKey(GR_EVENT_KEYSTROKE * keystroke, SDL_keysym * keysym) | |
113 { | 115 { |
114 GR_KEY ch = keystroke -> ch ; | 116 GR_KEY ch = keystroke->ch; |
115 | 117 |
116 Dprintf ("enter NX_TranslateKey\n") ; | 118 Dprintf("enter NX_TranslateKey\n"); |
117 | 119 |
118 keysym -> scancode = keystroke -> scancode ; | 120 keysym->scancode = keystroke->scancode; |
119 keysym -> sym = SDLK_UNKNOWN ; | 121 keysym->sym = SDLK_UNKNOWN; |
120 | 122 |
121 if (ch & MWKEY_NONASCII_MASK) { | 123 if (ch & MWKEY_NONASCII_MASK) { |
122 keysym -> sym = NX_NONASCII_keymap [ch & 0xFF] ; | 124 keysym->sym = NX_NONASCII_keymap[ch & 0xFF]; |
123 } else { | 125 } else { |
124 keysym -> sym = ch & 0x7F ; | 126 keysym->sym = ch & 0x7F; |
125 } | 127 } |
126 | 128 |
127 keysym -> mod = KMOD_NONE ; | 129 keysym->mod = KMOD_NONE; |
128 | 130 |
129 #if 1 // Retrieve more mode information | 131 #if 1 // Retrieve more mode information |
130 { | 132 { |
131 GR_KEYMOD mod = keystroke -> modifiers ; | 133 GR_KEYMOD mod = keystroke->modifiers; |
132 | 134 |
133 if (mod & MWKMOD_LSHIFT) | 135 if (mod & MWKMOD_LSHIFT) |
134 keysym -> mod |= KMOD_LSHIFT ; | 136 keysym->mod |= KMOD_LSHIFT; |
135 if (mod & MWKMOD_RSHIFT) | 137 if (mod & MWKMOD_RSHIFT) |
136 keysym -> mod |= KMOD_RSHIFT ; | 138 keysym->mod |= KMOD_RSHIFT; |
137 if (mod & MWKMOD_LCTRL) | 139 if (mod & MWKMOD_LCTRL) |
138 keysym -> mod |= KMOD_LCTRL ; | 140 keysym->mod |= KMOD_LCTRL; |
139 if (mod & MWKMOD_RCTRL) | 141 if (mod & MWKMOD_RCTRL) |
140 keysym -> mod |= KMOD_RCTRL ; | 142 keysym->mod |= KMOD_RCTRL; |
141 if (mod & MWKMOD_LALT) | 143 if (mod & MWKMOD_LALT) |
142 keysym -> mod |= KMOD_LALT ; | 144 keysym->mod |= KMOD_LALT; |
143 if (mod & MWKMOD_RALT) | 145 if (mod & MWKMOD_RALT) |
144 keysym -> mod |= KMOD_RALT ; | 146 keysym->mod |= KMOD_RALT; |
145 if (mod & MWKMOD_LMETA) | 147 if (mod & MWKMOD_LMETA) |
146 keysym -> mod |= KMOD_LMETA ; | 148 keysym->mod |= KMOD_LMETA; |
147 if (mod & MWKMOD_RMETA) | 149 if (mod & MWKMOD_RMETA) |
148 keysym -> mod |= KMOD_RMETA ; | 150 keysym->mod |= KMOD_RMETA; |
149 if (mod & MWKMOD_NUM) | 151 if (mod & MWKMOD_NUM) |
150 keysym -> mod |= KMOD_NUM ; | 152 keysym->mod |= KMOD_NUM; |
151 if (mod & MWKMOD_CAPS) | 153 if (mod & MWKMOD_CAPS) |
152 keysym -> mod |= KMOD_CAPS ; | 154 keysym->mod |= KMOD_CAPS; |
153 if (mod & MWKMOD_ALTGR) | 155 if (mod & MWKMOD_ALTGR) |
154 keysym -> mod |= KMOD_MODE ; | 156 keysym->mod |= KMOD_MODE; |
155 } | 157 } |
156 #endif | 158 #endif |
157 | 159 |
158 keysym -> unicode = ch ; | 160 keysym->unicode = ch; |
159 | 161 |
160 Dprintf ("leave NX_TranslateKey\n") ; | 162 Dprintf("leave NX_TranslateKey\n"); |
161 return keysym ; | 163 return keysym; |
162 } | 164 } |
163 | 165 |
164 static int check_boundary (_THIS, int x, int y) | 166 static int |
167 check_boundary(_THIS, int x, int y) | |
165 { | 168 { |
166 if (x < OffsetX || y < OffsetY || x > OffsetX + this -> screen -> w || | 169 if (x < OffsetX || y < OffsetY || x > OffsetX + this->screen->w || |
167 y > OffsetY + this -> screen -> h) | 170 y > OffsetY + this->screen->h) |
168 return 0 ; | 171 return 0; |
169 | 172 |
170 return 1 ; | 173 return 1; |
171 } | 174 } |
172 | 175 |
173 void NX_PumpEvents (_THIS) | 176 void |
177 NX_PumpEvents(_THIS) | |
174 { | 178 { |
175 GR_EVENT event ; | 179 GR_EVENT event; |
176 static GR_BUTTON last_button_down = 0 ; | 180 static GR_BUTTON last_button_down = 0; |
177 | 181 |
178 GrCheckNextEvent (& event) ; | 182 GrCheckNextEvent(&event); |
179 while (event.type != GR_EVENT_TYPE_NONE) { | 183 while (event.type != GR_EVENT_TYPE_NONE) { |
180 | 184 |
181 // dispatch event | 185 // dispatch event |
182 switch (event.type) { | 186 switch (event.type) { |
183 case GR_EVENT_TYPE_MOUSE_ENTER : | 187 case GR_EVENT_TYPE_MOUSE_ENTER: |
184 { | 188 { |
185 Dprintf ("mouse enter\n") ; | 189 Dprintf("mouse enter\n"); |
186 SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS) ; | 190 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); |
187 break ; | 191 break; |
188 } | 192 } |
189 | 193 |
190 case GR_EVENT_TYPE_MOUSE_EXIT : | 194 case GR_EVENT_TYPE_MOUSE_EXIT: |
191 { | 195 { |
192 Dprintf ("mouse exit\n") ; | 196 Dprintf("mouse exit\n"); |
193 SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS) ; | 197 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); |
194 break ; | 198 break; |
195 } | 199 } |
196 | 200 |
197 case GR_EVENT_TYPE_FOCUS_IN : | 201 case GR_EVENT_TYPE_FOCUS_IN: |
198 { | 202 { |
199 Dprintf ("focus in\n") ; | 203 Dprintf("focus in\n"); |
200 SDL_PrivateAppActive (1, SDL_APPINPUTFOCUS) ; | 204 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); |
201 break ; | 205 break; |
202 } | 206 } |
203 | 207 |
204 case GR_EVENT_TYPE_FOCUS_OUT : | 208 case GR_EVENT_TYPE_FOCUS_OUT: |
205 { | 209 { |
206 Dprintf ("focus out\n") ; | 210 Dprintf("focus out\n"); |
207 SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS) ; | 211 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS); |
208 break ; | 212 break; |
209 } | 213 } |
210 | 214 |
211 case GR_EVENT_TYPE_MOUSE_MOTION : | 215 case GR_EVENT_TYPE_MOUSE_MOTION: |
212 { | 216 { |
213 Dprintf ("mouse motion\n") ; | 217 Dprintf("mouse motion\n"); |
214 | 218 |
215 if (SDL_VideoSurface) { | 219 if (SDL_VideoSurface) { |
216 if (currently_fullscreen) { | 220 if (currently_fullscreen) { |
217 if (check_boundary (this, event.button.x, event.button.y)) { | 221 if (check_boundary |
218 SDL_PrivateMouseMotion (0, 0, event.button.x - OffsetX, | 222 (this, event.button.x, event.button.y)) { |
219 event.button.y - OffsetY) ; | 223 SDL_PrivateMouseMotion(0, 0, |
224 event.button.x - | |
225 OffsetX, | |
226 event.button.y - OffsetY); | |
220 } | 227 } |
221 } else { | 228 } else { |
222 SDL_PrivateMouseMotion (0, 0, event.button.x, event.button.y) ; | 229 SDL_PrivateMouseMotion(0, 0, event.button.x, |
223 } | 230 event.button.y); |
224 } | 231 } |
225 break ; | 232 } |
226 } | 233 break; |
227 | 234 } |
228 case GR_EVENT_TYPE_BUTTON_DOWN : | 235 |
229 { | 236 case GR_EVENT_TYPE_BUTTON_DOWN: |
230 int button = event.button.buttons ; | 237 { |
231 | 238 int button = event.button.buttons; |
232 Dprintf ("button down\n") ; | 239 |
240 Dprintf("button down\n"); | |
233 | 241 |
234 switch (button) { | 242 switch (button) { |
235 case MWBUTTON_L : | 243 case MWBUTTON_L: |
236 button = 1 ; | 244 button = 1; |
237 break ; | 245 break; |
238 case MWBUTTON_M : | 246 case MWBUTTON_M: |
239 button = 2 ; | 247 button = 2; |
240 break ; | 248 break; |
241 case MWBUTTON_R : | 249 case MWBUTTON_R: |
242 button = 3 ; | 250 button = 3; |
243 break ; | 251 break; |
244 default : | 252 default: |
245 button = 0 ; | 253 button = 0; |
246 } | 254 } |
247 last_button_down = button ; | 255 last_button_down = button; |
248 | 256 |
249 if (currently_fullscreen) { | 257 if (currently_fullscreen) { |
250 if (check_boundary (this, event.button.x, event.button.y)) { | 258 if (check_boundary(this, event.button.x, event.button.y)) { |
251 SDL_PrivateMouseButton (SDL_PRESSED, button, | 259 SDL_PrivateMouseButton(SDL_PRESSED, button, |
252 event.button.x - OffsetX, event.button.y - OffsetY) ; | 260 event.button.x - |
261 OffsetX, | |
262 event.button.y - OffsetY); | |
253 } | 263 } |
254 } else { | 264 } else { |
255 SDL_PrivateMouseButton (SDL_PRESSED, button, | 265 SDL_PrivateMouseButton(SDL_PRESSED, button, |
256 event.button.x, event.button.y) ; | 266 event.button.x, event.button.y); |
257 } | 267 } |
258 break ; | 268 break; |
259 } | 269 } |
260 | 270 |
261 // do not konw which button is released | 271 // do not konw which button is released |
262 case GR_EVENT_TYPE_BUTTON_UP : | 272 case GR_EVENT_TYPE_BUTTON_UP: |
263 { | 273 { |
264 Dprintf ("button up\n") ; | 274 Dprintf("button up\n"); |
265 | 275 |
266 if (currently_fullscreen) { | 276 if (currently_fullscreen) { |
267 if (check_boundary (this, event.button.x, event.button.y)) { | 277 if (check_boundary(this, event.button.x, event.button.y)) { |
268 SDL_PrivateMouseButton (SDL_RELEASED, last_button_down, | 278 SDL_PrivateMouseButton(SDL_RELEASED, |
269 event.button.x - OffsetX, event.button.y - OffsetY) ; | 279 last_button_down, |
280 event.button.x - | |
281 OffsetX, | |
282 event.button.y - OffsetY); | |
270 } | 283 } |
271 } else { | 284 } else { |
272 SDL_PrivateMouseButton (SDL_RELEASED, last_button_down, | 285 SDL_PrivateMouseButton(SDL_RELEASED, |
273 event.button.x, event.button.y) ; | 286 last_button_down, |
274 } | 287 event.button.x, event.button.y); |
275 last_button_down = 0 ; | 288 } |
276 break ; | 289 last_button_down = 0; |
277 } | 290 break; |
278 | 291 } |
279 case GR_EVENT_TYPE_KEY_DOWN : | 292 |
280 { | 293 case GR_EVENT_TYPE_KEY_DOWN: |
281 SDL_keysym keysym ; | 294 { |
282 | 295 SDL_keysym keysym; |
283 Dprintf ("key down\n") ; | 296 |
284 SDL_PrivateKeyboard (SDL_PRESSED, | 297 Dprintf("key down\n"); |
285 NX_TranslateKey (& event.keystroke, & keysym)) ; | 298 SDL_PrivateKeyboard(SDL_PRESSED, |
286 break ; | 299 NX_TranslateKey(&event.keystroke, |
287 } | 300 &keysym)); |
288 | 301 break; |
289 case GR_EVENT_TYPE_KEY_UP : | 302 } |
290 { | 303 |
291 SDL_keysym keysym ; | 304 case GR_EVENT_TYPE_KEY_UP: |
292 | 305 { |
293 Dprintf ("key up\n") ; | 306 SDL_keysym keysym; |
294 SDL_PrivateKeyboard (SDL_RELEASED, | 307 |
295 NX_TranslateKey (& event.keystroke, & keysym)) ; | 308 Dprintf("key up\n"); |
296 break ; | 309 SDL_PrivateKeyboard(SDL_RELEASED, |
297 } | 310 NX_TranslateKey(&event.keystroke, |
298 | 311 &keysym)); |
299 case GR_EVENT_TYPE_CLOSE_REQ : | 312 break; |
300 { | 313 } |
301 Dprintf ("close require\n") ; | 314 |
302 SDL_PrivateQuit () ; | 315 case GR_EVENT_TYPE_CLOSE_REQ: |
303 break ; | 316 { |
304 } | 317 Dprintf("close require\n"); |
305 | 318 SDL_PrivateQuit(); |
306 case GR_EVENT_TYPE_EXPOSURE : | 319 break; |
307 { | 320 } |
308 Dprintf ("event_type_exposure\n") ; | 321 |
322 case GR_EVENT_TYPE_EXPOSURE: | |
323 { | |
324 Dprintf("event_type_exposure\n"); | |
309 if (SDL_VideoSurface) { | 325 if (SDL_VideoSurface) { |
310 NX_RefreshDisplay (this) ;//, & event.exposure) ; | 326 NX_RefreshDisplay(this); //, & event.exposure) ; |
311 } | 327 } |
312 break ; | 328 break; |
313 } | 329 } |
314 | 330 |
315 case GR_EVENT_TYPE_UPDATE : | 331 case GR_EVENT_TYPE_UPDATE: |
316 { | 332 { |
317 switch (event.update.utype) { | 333 switch (event.update.utype) { |
318 case GR_UPDATE_MAP : | 334 case GR_UPDATE_MAP: |
319 { | 335 { |
320 Dprintf ("GR_UPDATE_MAP\n") ; | 336 Dprintf("GR_UPDATE_MAP\n"); |
321 // If we're not active, make ourselves active | 337 // If we're not active, make ourselves active |
322 if (!(SDL_GetAppState () & SDL_APPACTIVE)) { | 338 if (!(SDL_GetAppState() & SDL_APPACTIVE)) { |
323 // Send an internal activate event | 339 // Send an internal activate event |
324 SDL_PrivateAppActive (1, SDL_APPACTIVE) ; | 340 SDL_PrivateAppActive(1, SDL_APPACTIVE); |
325 } | 341 } |
326 if (SDL_VideoSurface) { | 342 if (SDL_VideoSurface) { |
327 NX_RefreshDisplay (this) ; | 343 NX_RefreshDisplay(this); |
328 } | 344 } |
329 break ; | 345 break; |
330 } | 346 } |
331 | 347 |
332 case GR_UPDATE_UNMAP : | 348 case GR_UPDATE_UNMAP: |
333 case GR_UPDATE_UNMAPTEMP : | 349 case GR_UPDATE_UNMAPTEMP: |
334 { | 350 { |
335 Dprintf ("GR_UPDATE_UNMAP or GR_UPDATE_UNMAPTEMP\n") ; | 351 Dprintf("GR_UPDATE_UNMAP or GR_UPDATE_UNMAPTEMP\n"); |
336 // If we're active, make ourselves inactive | 352 // If we're active, make ourselves inactive |
337 if (SDL_GetAppState () & SDL_APPACTIVE) { | 353 if (SDL_GetAppState() & SDL_APPACTIVE) { |
338 // Send an internal deactivate event | 354 // Send an internal deactivate event |
339 SDL_PrivateAppActive (0, SDL_APPACTIVE | SDL_APPINPUTFOCUS) ; | 355 SDL_PrivateAppActive(0, |
356 SDL_APPACTIVE | | |
357 SDL_APPINPUTFOCUS); | |
340 } | 358 } |
341 break ; | 359 break; |
342 } | 360 } |
343 | 361 |
344 case GR_UPDATE_SIZE : | 362 case GR_UPDATE_SIZE: |
345 { | 363 { |
346 Dprintf ("GR_UPDATE_SIZE\n") ; | 364 Dprintf("GR_UPDATE_SIZE\n"); |
347 SDL_PrivateResize (event.update.width, event.update.height) ; | 365 SDL_PrivateResize(event.update.width, |
348 break ; | 366 event.update.height); |
349 } | 367 break; |
350 | 368 } |
351 case GR_UPDATE_MOVE : | 369 |
352 case GR_UPDATE_REPARENT : | 370 case GR_UPDATE_MOVE: |
371 case GR_UPDATE_REPARENT: | |
353 { | 372 { |
354 Dprintf ("GR_UPDATE_MOVE or GR_UPDATE_REPARENT\n") ; | 373 Dprintf("GR_UPDATE_MOVE or GR_UPDATE_REPARENT\n"); |
355 #ifdef ENABLE_NANOX_DIRECT_FB | 374 #ifdef ENABLE_NANOX_DIRECT_FB |
356 if (Clientfb) { | 375 if (Clientfb) { |
357 /* Get current window position and fb pointer*/ | 376 /* Get current window position and fb pointer */ |
358 if (currently_fullscreen) | 377 if (currently_fullscreen) |
359 GrGetWindowFBInfo(FSwindow, &fbinfo); | 378 GrGetWindowFBInfo(FSwindow, &fbinfo); |
360 else | 379 else |
361 GrGetWindowFBInfo(SDL_Window, &fbinfo); | 380 GrGetWindowFBInfo(SDL_Window, &fbinfo); |
362 } | 381 } |
363 #endif | 382 #endif |
364 break ; | 383 break; |
365 } | 384 } |
366 | 385 |
367 default : | 386 default: |
368 Dprintf ("unknown GR_EVENT_TYPE_UPDATE\n") ; | 387 Dprintf("unknown GR_EVENT_TYPE_UPDATE\n"); |
369 break ; | 388 break; |
370 } | 389 } |
371 break ; | 390 break; |
372 } | 391 } |
373 | 392 |
374 default : | 393 default: |
375 { | 394 { |
376 Dprintf ("pump event default\n") ; | 395 Dprintf("pump event default\n"); |
377 } | 396 } |
378 } | 397 } |
379 | 398 |
380 GrCheckNextEvent (& event) ; | 399 GrCheckNextEvent(&event); |
381 } | 400 } |
382 } | 401 } |
402 | |
403 /* vi: set ts=4 sw=4 expandtab: */ |