Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_events.c @ 2998:d364ee9b9c15
Date: Sun, 04 Jan 2009 20:53:30 +0100
From: Couriersud
Subject: SDL1.3 DirectFB patches
The attached contains the following directfb changes:
- Dynamic loading of libdirectfb.so. This may to turned off as well in configure
- Use linux-input by default. May be switched off by environment variable.
- Added some code which will use directfb's x11 backend when DISPLAY is set.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 04 Jan 2009 23:43:33 +0000 |
parents | 6ce28e5287e9 |
children | 8f4ed5ec2b06 |
comparison
equal
deleted
inserted
replaced
2997:e4f025078c1c | 2998:d364ee9b9c15 |
---|---|
142 SDL_keysym keysym; | 142 SDL_keysym keysym; |
143 | 143 |
144 if (evt.clazz == DFEC_WINDOW) { | 144 if (evt.clazz == DFEC_WINDOW) { |
145 switch (evt.type) { | 145 switch (evt.type) { |
146 case DWET_BUTTONDOWN: | 146 case DWET_BUTTONDOWN: |
147 if (!LINUX_INPUT_SUPPORT) { | 147 if (!devdata->use_linux_input) { |
148 SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt.cx, | 148 SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt.cx, |
149 evt.cy, 0); | 149 evt.cy, 0); |
150 SDL_SendMouseButton(devdata->mouse_id[0], SDL_PRESSED, | 150 SDL_SendMouseButton(devdata->mouse_id[0], SDL_PRESSED, |
151 DirectFB_TranslateButton(evt. | 151 DirectFB_TranslateButton(evt. |
152 button)); | 152 button)); |
153 } else { | 153 } else { |
154 MotionAllMice(_this, evt.x, evt.y); | 154 MotionAllMice(_this, evt.x, evt.y); |
155 } | 155 } |
156 break; | 156 break; |
157 case DWET_BUTTONUP: | 157 case DWET_BUTTONUP: |
158 if (!LINUX_INPUT_SUPPORT) { | 158 if (!devdata->use_linux_input) { |
159 SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt.cx, | 159 SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt.cx, |
160 evt.cy, 0); | 160 evt.cy, 0); |
161 SDL_SendMouseButton(devdata->mouse_id[0], | 161 SDL_SendMouseButton(devdata->mouse_id[0], |
162 SDL_RELEASED, | 162 SDL_RELEASED, |
163 DirectFB_TranslateButton(evt. | 163 DirectFB_TranslateButton(evt. |
165 } else { | 165 } else { |
166 MotionAllMice(_this, evt.x, evt.y); | 166 MotionAllMice(_this, evt.x, evt.y); |
167 } | 167 } |
168 break; | 168 break; |
169 case DWET_MOTION: | 169 case DWET_MOTION: |
170 if (!LINUX_INPUT_SUPPORT) { | 170 if (!devdata->use_linux_input) { |
171 if (!(w->flags & SDL_WINDOW_INPUT_GRABBED)) | 171 if (!(w->flags & SDL_WINDOW_INPUT_GRABBED)) |
172 SDL_SendMouseMotion(devdata->mouse_id[0], 0, | 172 SDL_SendMouseMotion(devdata->mouse_id[0], 0, |
173 evt.cx, evt.cy, 0); | 173 evt.cx, evt.cy, 0); |
174 } else { | 174 } else { |
175 /* relative movements are not exact! | 175 /* relative movements are not exact! |
181 cnt = 0; | 181 cnt = 0; |
182 } | 182 } |
183 } | 183 } |
184 break; | 184 break; |
185 case DWET_KEYDOWN: | 185 case DWET_KEYDOWN: |
186 if (!LINUX_INPUT_SUPPORT) { | 186 if (!devdata->use_linux_input) { |
187 DirectFB_TranslateKey(_this, &evt, &keysym); | 187 DirectFB_TranslateKey(_this, &evt, &keysym); |
188 SDL_SendKeyboardKey(0, SDL_PRESSED, keysym.scancode); | 188 SDL_SendKeyboardKey(0, SDL_PRESSED, keysym.scancode); |
189 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { | 189 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { |
190 SDL_memcpy(text, &keysym.unicode, 4); | 190 SDL_memcpy(text, &keysym.unicode, 4); |
191 text[4] = 0; | 191 text[4] = 0; |
194 } | 194 } |
195 } | 195 } |
196 } | 196 } |
197 break; | 197 break; |
198 case DWET_KEYUP: | 198 case DWET_KEYUP: |
199 if (!LINUX_INPUT_SUPPORT) { | 199 if (!devdata->use_linux_input) { |
200 DirectFB_TranslateKey(_this, &evt, &keysym); | 200 DirectFB_TranslateKey(_this, &evt, &keysym); |
201 SDL_SendKeyboardKey(0, SDL_RELEASED, keysym.scancode); | 201 SDL_SendKeyboardKey(0, SDL_RELEASED, keysym.scancode); |
202 } | 202 } |
203 break; | 203 break; |
204 case DWET_POSITION_SIZE: | 204 case DWET_POSITION_SIZE: |
258 DFB_EVENT(&ievt)) == DFB_OK) { | 258 DFB_EVENT(&ievt)) == DFB_OK) { |
259 SDL_keysym keysym; | 259 SDL_keysym keysym; |
260 | 260 |
261 switch (ievt.type) { | 261 switch (ievt.type) { |
262 case DIET_AXISMOTION: | 262 case DIET_AXISMOTION: |
263 if (!LINUX_INPUT_SUPPORT) { | 263 if (!devdata->use_linux_input) { |
264 if ((grabbed_window >= 0) && (ievt.flags & DIEF_AXISREL)) { | 264 if ((grabbed_window >= 0) && (ievt.flags & DIEF_AXISREL)) { |
265 printf("rel devid %d\n", ievt.device_id); | 265 printf("rel devid %d\n", ievt.device_id); |
266 if (ievt.axis == DIAI_X) | 266 if (ievt.axis == DIAI_X) |
267 SDL_SendMouseMotion(ievt.device_id, 1, ievt.axisrel, | 267 SDL_SendMouseMotion(ievt.device_id, 1, ievt.axisrel, |
268 0, 0); | 268 0, 0); |
271 ievt.axisrel, 0); | 271 ievt.axisrel, 0); |
272 } | 272 } |
273 } | 273 } |
274 break; | 274 break; |
275 } | 275 } |
276 if (LINUX_INPUT_SUPPORT) { | 276 if (devdata->use_linux_input) { |
277 IDirectFBInputDevice *idev; | 277 IDirectFBInputDevice *idev; |
278 static int last_x, last_y; | 278 static int last_x, last_y; |
279 | 279 |
280 switch (ievt.type) { | 280 switch (ievt.type) { |
281 case DIET_AXISMOTION: | 281 case DIET_AXISMOTION: |
598 int ret; | 598 int ret; |
599 | 599 |
600 DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap)); | 600 DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap)); |
601 | 601 |
602 devdata->num_keyboard = 0; | 602 devdata->num_keyboard = 0; |
603 if (LINUX_INPUT_SUPPORT) { | 603 if (devdata->use_linux_input) { |
604 sys_ids = 0; | 604 sys_ids = 0; |
605 SDL_DFB_CHECK(devdata->dfb-> | 605 SDL_DFB_CHECK(devdata->dfb-> |
606 EnumInputDevices(devdata->dfb, EnumKeyboards, devdata)); | 606 EnumInputDevices(devdata->dfb, EnumKeyboards, devdata)); |
607 if (devdata->num_keyboard == 0) { | 607 if (devdata->num_keyboard == 0) { |
608 sys_ids = 1; | 608 sys_ids = 1; |