summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/src/video/vgl
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-02-07 20:04:46 -0500
committerFranklin Wei <git@fwei.tk>2018-03-12 20:52:01 -0400
commit6039eb05ba6d82ef56f2868c96654c552d117bf9 (patch)
tree9db7016bcbf66cfdf7b9bc998d84c6eaff9c8378 /apps/plugins/sdl/src/video/vgl
parentef373c03b96b0be08babca581d9f10bccfd4931f (diff)
downloadrockbox-6039eb05ba6d82ef56f2868c96654c552d117bf9.tar.gz
rockbox-6039eb05ba6d82ef56f2868c96654c552d117bf9.zip
sdl: remove non-rockbox drivers
We never use any of these other drivers, so having them around just takes up space. Change-Id: Iced812162df1fef3fd55522b7e700acb6c3bcd41
Diffstat (limited to 'apps/plugins/sdl/src/video/vgl')
-rw-r--r--apps/plugins/sdl/src/video/vgl/SDL_vglevents.c299
-rw-r--r--apps/plugins/sdl/src/video/vgl/SDL_vglevents_c.h155
-rw-r--r--apps/plugins/sdl/src/video/vgl/SDL_vglmouse.c56
-rw-r--r--apps/plugins/sdl/src/video/vgl/SDL_vglmouse_c.h32
-rw-r--r--apps/plugins/sdl/src/video/vgl/SDL_vglvideo.c624
-rw-r--r--apps/plugins/sdl/src/video/vgl/SDL_vglvideo.h65
6 files changed, 0 insertions, 1231 deletions
diff --git a/apps/plugins/sdl/src/video/vgl/SDL_vglevents.c b/apps/plugins/sdl/src/video/vgl/SDL_vglevents.c
deleted file mode 100644
index fa6c9e7b8c..0000000000
--- a/apps/plugins/sdl/src/video/vgl/SDL_vglevents.c
+++ /dev/null
@@ -1,299 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24/* Handle the event stream, converting X11 events into SDL events */
25
26#include <stdio.h>
27
28#include <sys/fbio.h>
29#include <sys/consio.h>
30#include <sys/kbio.h>
31#include <vgl.h>
32
33#include "SDL.h"
34#include "SDL_thread.h"
35#include "../../events/SDL_sysevents.h"
36#include "../../events/SDL_events_c.h"
37#include "SDL_vglvideo.h"
38#include "SDL_vglevents_c.h"
39
40/* The translation tables from a console scancode to a SDL keysym */
41/* FIXME: Free the keymap when we shut down the video mode */
42static keymap_t *vga_keymap = NULL;
43static SDLKey keymap[128];
44static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym);
45
46static int posted = 0;
47static int oldx = -1;
48static int oldy = -1;
49static struct mouse_info mouseinfo;
50
51/* Ugh, we have to duplicate the kernel's keysym mapping code...
52 Oh, it's not so bad. :-)
53
54 FIXME: Add keyboard LED handling code
55 */
56int VGL_initkeymaps(int fd)
57{
58 vga_keymap = SDL_malloc(sizeof(keymap_t));
59 if ( ! vga_keymap ) {
60 SDL_OutOfMemory();
61 return(-1);
62 }
63 if (ioctl(fd, GIO_KEYMAP, vga_keymap) == -1) {
64 SDL_free(vga_keymap);
65 vga_keymap = NULL;
66 SDL_SetError("Unable to get keyboard map");
67 return(-1);
68 }
69 return(0);
70}
71
72static void handle_keyboard(_THIS)
73{
74 SDL_keysym keysym;
75 int c, pressed, scancode;
76
77 while ((c = VGLKeyboardGetCh()) != 0) {
78 scancode = c & 0x7F;
79 if (c & 0x80) {
80 pressed = SDL_RELEASED;
81 } else {
82 pressed = SDL_PRESSED;
83 }
84
85 posted += SDL_PrivateKeyboard(pressed,
86 TranslateKey(scancode, &keysym));
87 }
88}
89
90int VGL_initmouse(int fd)
91{
92 mouseinfo.operation = MOUSE_GETINFO;
93 if (ioctl(fd, CONS_MOUSECTL, &mouseinfo) != 0)
94 return -1;
95
96 return 0;
97}
98
99static void handle_mouse(_THIS)
100{
101 char buttons;
102 int x, y;
103 int button_state, state_changed, state;
104 int i;
105
106 ioctl(0, CONS_MOUSECTL, &mouseinfo);
107 x = mouseinfo.u.data.x;
108 y = mouseinfo.u.data.y;
109 buttons = mouseinfo.u.data.buttons;
110
111 if ((x != oldx) || (y != oldy)) {
112 posted += SDL_PrivateMouseMotion(0, 0, x, y);
113 oldx = x;
114 oldy = y;
115 }
116
117 /* See what's changed */
118 button_state = SDL_GetMouseState(NULL, NULL);
119 state_changed = button_state ^ buttons;
120 for (i = 0; i < 8; i++) {
121 if (state_changed & (1<<i)) {
122 if (buttons & (1<<i)) {
123 state = SDL_PRESSED;
124 } else {
125 state = SDL_RELEASED;
126 }
127 posted += SDL_PrivateMouseButton(state, i + 1, 0, 0);
128 }
129 }
130}
131
132
133void VGL_PumpEvents(_THIS)
134{
135 do {
136 posted = 0;
137 handle_keyboard(this);
138 handle_mouse(this);
139 } while (posted != 0);
140}
141
142void VGL_InitOSKeymap(_THIS)
143{
144 int i;
145
146 /* Initialize the BeOS key translation table */
147 for ( i=0; i<SDL_arraysize(keymap); ++i )
148 keymap[i] = SDLK_UNKNOWN;
149
150 keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE;
151 keymap[SCANCODE_1] = SDLK_1;
152 keymap[SCANCODE_2] = SDLK_2;
153 keymap[SCANCODE_3] = SDLK_3;
154 keymap[SCANCODE_4] = SDLK_4;
155 keymap[SCANCODE_5] = SDLK_5;
156 keymap[SCANCODE_6] = SDLK_6;
157 keymap[SCANCODE_7] = SDLK_7;
158 keymap[SCANCODE_8] = SDLK_8;
159 keymap[SCANCODE_9] = SDLK_9;
160 keymap[SCANCODE_0] = SDLK_0;
161 keymap[SCANCODE_MINUS] = SDLK_MINUS;
162 keymap[SCANCODE_EQUAL] = SDLK_EQUALS;
163 keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE;
164 keymap[SCANCODE_TAB] = SDLK_TAB;
165 keymap[SCANCODE_Q] = SDLK_q;
166 keymap[SCANCODE_W] = SDLK_w;
167 keymap[SCANCODE_E] = SDLK_e;
168 keymap[SCANCODE_R] = SDLK_r;
169 keymap[SCANCODE_T] = SDLK_t;
170 keymap[SCANCODE_Y] = SDLK_y;
171 keymap[SCANCODE_U] = SDLK_u;
172 keymap[SCANCODE_I] = SDLK_i;
173 keymap[SCANCODE_O] = SDLK_o;
174 keymap[SCANCODE_P] = SDLK_p;
175 keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET;
176 keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET;
177 keymap[SCANCODE_ENTER] = SDLK_RETURN;
178 keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL;
179 keymap[SCANCODE_A] = SDLK_a;
180 keymap[SCANCODE_S] = SDLK_s;
181 keymap[SCANCODE_D] = SDLK_d;
182 keymap[SCANCODE_F] = SDLK_f;
183 keymap[SCANCODE_G] = SDLK_g;
184 keymap[SCANCODE_H] = SDLK_h;
185 keymap[SCANCODE_J] = SDLK_j;
186 keymap[SCANCODE_K] = SDLK_k;
187 keymap[SCANCODE_L] = SDLK_l;
188 keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON;
189 keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE;
190 keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE;
191 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
192 keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH;
193 keymap[SCANCODE_Z] = SDLK_z;
194 keymap[SCANCODE_X] = SDLK_x;
195 keymap[SCANCODE_C] = SDLK_c;
196 keymap[SCANCODE_V] = SDLK_v;
197 keymap[SCANCODE_B] = SDLK_b;
198 keymap[SCANCODE_N] = SDLK_n;
199 keymap[SCANCODE_M] = SDLK_m;
200 keymap[SCANCODE_COMMA] = SDLK_COMMA;
201 keymap[SCANCODE_PERIOD] = SDLK_PERIOD;
202 keymap[SCANCODE_SLASH] = SDLK_SLASH;
203 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
204 keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY;
205 keymap[SCANCODE_LEFTALT] = SDLK_LALT;
206 keymap[SCANCODE_SPACE] = SDLK_SPACE;
207 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
208 keymap[SCANCODE_F1] = SDLK_F1;
209 keymap[SCANCODE_F2] = SDLK_F2;
210 keymap[SCANCODE_F3] = SDLK_F3;
211 keymap[SCANCODE_F4] = SDLK_F4;
212 keymap[SCANCODE_F5] = SDLK_F5;
213 keymap[SCANCODE_F6] = SDLK_F6;
214 keymap[SCANCODE_F7] = SDLK_F7;
215 keymap[SCANCODE_F8] = SDLK_F8;
216 keymap[SCANCODE_F9] = SDLK_F9;
217 keymap[SCANCODE_F10] = SDLK_F10;
218 keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK;
219 keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK;
220 keymap[SCANCODE_KEYPAD7] = SDLK_KP7;
221 keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7;
222 keymap[SCANCODE_KEYPAD8] = SDLK_KP8;
223 keymap[SCANCODE_CURSORUP] = SDLK_KP8;
224 keymap[SCANCODE_KEYPAD9] = SDLK_KP9;
225 keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9;
226 keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS;
227 keymap[SCANCODE_KEYPAD4] = SDLK_KP4;
228 keymap[SCANCODE_CURSORLEFT] = SDLK_KP4;
229 keymap[SCANCODE_KEYPAD5] = SDLK_KP5;
230 keymap[SCANCODE_KEYPAD6] = SDLK_KP6;
231 keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6;
232 keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS;
233 keymap[SCANCODE_KEYPAD1] = SDLK_KP1;
234 keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1;
235 keymap[SCANCODE_KEYPAD2] = SDLK_KP2;
236 keymap[SCANCODE_CURSORDOWN] = SDLK_KP2;
237 keymap[SCANCODE_KEYPAD3] = SDLK_KP3;
238 keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3;
239 keymap[SCANCODE_KEYPAD0] = SDLK_KP0;
240 keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD;
241 keymap[SCANCODE_LESS] = SDLK_LESS;
242 keymap[SCANCODE_F11] = SDLK_F11;
243 keymap[SCANCODE_F12] = SDLK_F12;
244 keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER;
245 keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL;
246 keymap[SCANCODE_CONTROL] = SDLK_RCTRL;
247 keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE;
248 keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT;
249 keymap[SCANCODE_RIGHTALT] = SDLK_RALT;
250 keymap[SCANCODE_BREAK] = SDLK_BREAK;
251 keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN;
252 keymap[SCANCODE_HOME] = SDLK_HOME;
253 keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP;
254 keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP;
255 keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT;
256 keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT;
257 keymap[SCANCODE_END] = SDLK_END;
258 keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN;
259 keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN;
260 keymap[SCANCODE_INSERT] = SDLK_INSERT;
261 keymap[SCANCODE_REMOVE] = SDLK_DELETE;
262 keymap[119] = SDLK_PAUSE;
263 keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER;
264 keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER;
265 keymap[127] = SDLK_MENU;
266}
267
268static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
269{
270 /* Set the keysym information */
271 keysym->scancode = scancode;
272 keysym->sym = keymap[scancode];
273 keysym->mod = KMOD_NONE;
274
275 /* If UNICODE is on, get the UNICODE value for the key */
276 keysym->unicode = 0;
277 if ( SDL_TranslateUNICODE && vga_keymap ) {
278 int map;
279 SDLMod modstate;
280
281 modstate = SDL_GetModState();
282 map = 0;
283 if ( modstate & KMOD_SHIFT ) {
284 map += 1;
285 }
286 if ( modstate & KMOD_CTRL ) {
287 map += 2;
288 }
289 if ( modstate & KMOD_ALT ) {
290 map += 4;
291 }
292 if ( !(vga_keymap->key[scancode].spcl & (0x80 >> map)) ) {
293 keysym->unicode = vga_keymap->key[scancode].map[map];
294 }
295
296 }
297 return(keysym);
298}
299
diff --git a/apps/plugins/sdl/src/video/vgl/SDL_vglevents_c.h b/apps/plugins/sdl/src/video/vgl/SDL_vglevents_c.h
deleted file mode 100644
index 614cab55a4..0000000000
--- a/apps/plugins/sdl/src/video/vgl/SDL_vglevents_c.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24#include "SDL_vglvideo.h"
25
26/* Variables and functions exported by SDL_sysevents.c to other parts
27 of the native video subsystem (SDL_sysvideo.c)
28*/
29extern int VGL_initkeymaps(int fd);
30extern int VGL_initmouse(int fd);
31extern void VGL_keyboardcallback(int scancode, int pressed);
32
33extern void VGL_InitOSKeymap(_THIS);
34extern void VGL_PumpEvents(_THIS);
35
36/* Mouse buttons */
37#define MOUSE_LEFTBUTTON 0x01
38#define MOUSE_MIDDLEBUTTON 0x02
39#define MOUSE_RIGHTBUTTON 0x04
40
41/* Scancodes */
42#define SCANCODE_ESCAPE 1
43#define SCANCODE_1 2
44#define SCANCODE_2 3
45#define SCANCODE_3 4
46#define SCANCODE_4 5
47#define SCANCODE_5 6
48#define SCANCODE_6 7
49#define SCANCODE_7 8
50#define SCANCODE_8 9
51#define SCANCODE_9 10
52#define SCANCODE_0 11
53#define SCANCODE_MINUS 12
54#define SCANCODE_EQUAL 13
55#define SCANCODE_BACKSPACE 14
56#define SCANCODE_TAB 15
57#define SCANCODE_Q 16
58#define SCANCODE_W 17
59#define SCANCODE_E 18
60#define SCANCODE_R 19
61#define SCANCODE_T 20
62#define SCANCODE_Y 21
63#define SCANCODE_U 22
64#define SCANCODE_I 23
65#define SCANCODE_O 24
66#define SCANCODE_P 25
67#define SCANCODE_BRACKET_LEFT 26
68#define SCANCODE_BRACKET_RIGHT 27
69#define SCANCODE_ENTER 28
70#define SCANCODE_LEFTCONTROL 29
71#define SCANCODE_A 30
72#define SCANCODE_S 31
73#define SCANCODE_D 32
74#define SCANCODE_F 33
75#define SCANCODE_G 34
76#define SCANCODE_H 35
77#define SCANCODE_J 36
78#define SCANCODE_K 37
79#define SCANCODE_L 38
80#define SCANCODE_SEMICOLON 39
81#define SCANCODE_APOSTROPHE 40
82#define SCANCODE_GRAVE 41
83#define SCANCODE_LEFTSHIFT 42
84#define SCANCODE_BACKSLASH 43
85#define SCANCODE_Z 44
86#define SCANCODE_X 45
87#define SCANCODE_C 46
88#define SCANCODE_V 47
89#define SCANCODE_B 48
90#define SCANCODE_N 49
91#define SCANCODE_M 50
92#define SCANCODE_COMMA 51
93#define SCANCODE_PERIOD 52
94#define SCANCODE_SLASH 53
95#define SCANCODE_RIGHTSHIFT 54
96#define SCANCODE_KEYPADMULTIPLY 55
97#define SCANCODE_LEFTALT 56
98#define SCANCODE_SPACE 57
99#define SCANCODE_CAPSLOCK 58
100#define SCANCODE_F1 59
101#define SCANCODE_F2 60
102#define SCANCODE_F3 61
103#define SCANCODE_F4 62
104#define SCANCODE_F5 63
105#define SCANCODE_F6 64
106#define SCANCODE_F7 65
107#define SCANCODE_F8 66
108#define SCANCODE_F9 67
109#define SCANCODE_F10 68
110#define SCANCODE_NUMLOCK 69
111#define SCANCODE_SCROLLLOCK 70
112#define SCANCODE_KEYPAD7 71
113#define SCANCODE_CURSORUPLEFT 71
114#define SCANCODE_KEYPAD8 72
115#define SCANCODE_CURSORUP 72
116#define SCANCODE_KEYPAD9 73
117#define SCANCODE_CURSORUPRIGHT 73
118#define SCANCODE_KEYPADMINUS 74
119#define SCANCODE_KEYPAD4 75
120#define SCANCODE_CURSORLEFT 75
121#define SCANCODE_KEYPAD5 76
122#define SCANCODE_KEYPAD6 77
123#define SCANCODE_CURSORRIGHT 77
124#define SCANCODE_KEYPADPLUS 78
125#define SCANCODE_KEYPAD1 79
126#define SCANCODE_CURSORDOWNLEFT 79
127#define SCANCODE_KEYPAD2 80
128#define SCANCODE_CURSORDOWN 80
129#define SCANCODE_KEYPAD3 81
130#define SCANCODE_CURSORDOWNRIGHT 81
131#define SCANCODE_KEYPAD0 82
132#define SCANCODE_KEYPADPERIOD 83
133#define SCANCODE_LESS 86
134#define SCANCODE_F11 87
135#define SCANCODE_F12 88
136#define SCANCODE_KEYPADENTER 89
137#define SCANCODE_RIGHTCONTROL 90
138#define SCANCODE_CONTROL 107
139#define SCANCODE_KEYPADDIVIDE 91
140#define SCANCODE_PRINTSCREEN 92
141#define SCANCODE_RIGHTALT 93
142#define SCANCODE_BREAK 104 /* Beware: is 119 */
143#define SCANCODE_BREAK_ALTERNATIVE 104 /* on some keyboards! */
144#define SCANCODE_HOME 94
145#define SCANCODE_CURSORBLOCKUP 95 /* Cursor key block */
146#define SCANCODE_PAGEUP 96
147#define SCANCODE_CURSORBLOCKLEFT 97 /* Cursor key block */
148#define SCANCODE_CURSORBLOCKRIGHT 98 /* Cursor key block */
149#define SCANCODE_END 99
150#define SCANCODE_CURSORBLOCKDOWN 100 /* Cursor key block */
151#define SCANCODE_PAGEDOWN 101
152#define SCANCODE_INSERT 102
153#define SCANCODE_REMOVE 103
154#define SCANCODE_RIGHTWIN 106
155#define SCANCODE_LEFTWIN 105
diff --git a/apps/plugins/sdl/src/video/vgl/SDL_vglmouse.c b/apps/plugins/sdl/src/video/vgl/SDL_vglmouse.c
deleted file mode 100644
index 466f1c51d3..0000000000
--- a/apps/plugins/sdl/src/video/vgl/SDL_vglmouse.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24#include "SDL_mouse.h"
25#include "../../events/SDL_events_c.h"
26#include "SDL_vglvideo.h"
27#include "SDL_vglmouse_c.h"
28
29
30/* The implementation dependent data for the window manager cursor */
31struct WMcursor {
32 int unused;
33};
34
35
36void VGL_FreeWMCursor(_THIS, WMcursor *cursor)
37{
38 return;
39}
40
41WMcursor *VGL_CreateWMCursor(_THIS,
42 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
43{
44 return(NULL);
45}
46
47int VGL_ShowWMCursor(_THIS, WMcursor *cursor)
48{
49 return(0);
50}
51
52void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
53{
54 SDL_PrivateMouseMotion(0, 0, x, y);
55}
56
diff --git a/apps/plugins/sdl/src/video/vgl/SDL_vglmouse_c.h b/apps/plugins/sdl/src/video/vgl/SDL_vglmouse_c.h
deleted file mode 100644
index f579d654d7..0000000000
--- a/apps/plugins/sdl/src/video/vgl/SDL_vglmouse_c.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24#include "SDL_vglvideo.h"
25
26/* Functions to be exported */
27extern void VGL_FreeWMCursor(_THIS, WMcursor *cursor);
28extern WMcursor *VGL_CreateWMCursor(_THIS,
29 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
30extern int VGL_ShowWMCursor(_THIS, WMcursor *cursor);
31extern void VGL_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
32
diff --git a/apps/plugins/sdl/src/video/vgl/SDL_vglvideo.c b/apps/plugins/sdl/src/video/vgl/SDL_vglvideo.c
deleted file mode 100644
index 0b61615593..0000000000
--- a/apps/plugins/sdl/src/video/vgl/SDL_vglvideo.c
+++ /dev/null
@@ -1,624 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24/* libvga based SDL video driver implementation.
25*/
26
27#include <err.h>
28#include <osreldate.h>
29#include <unistd.h>
30#include <sys/stat.h>
31
32#include <sys/fbio.h>
33#include <sys/consio.h>
34#include <sys/kbio.h>
35#include <vgl.h>
36
37#include "SDL_video.h"
38#include "SDL_mouse.h"
39#include "../SDL_sysvideo.h"
40#include "../SDL_pixels_c.h"
41#include "../../events/SDL_events_c.h"
42#include "SDL_vglvideo.h"
43#include "SDL_vglevents_c.h"
44#include "SDL_vglmouse_c.h"
45
46
47/* Initialization/Query functions */
48static int VGL_VideoInit(_THIS, SDL_PixelFormat *vformat);
49static SDL_Rect **VGL_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
50static SDL_Surface *VGL_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
51static int VGL_SetColors(_THIS, int firstcolor, int ncolors,
52 SDL_Color *colors);
53static void VGL_VideoQuit(_THIS);
54
55/* Hardware surface functions */
56static int VGL_AllocHWSurface(_THIS, SDL_Surface *surface);
57static int VGL_LockHWSurface(_THIS, SDL_Surface *surface);
58static int VGL_FlipHWSurface(_THIS, SDL_Surface *surface);
59static void VGL_UnlockHWSurface(_THIS, SDL_Surface *surface);
60static void VGL_FreeHWSurface(_THIS, SDL_Surface *surface);
61
62/* Misc function */
63static VGLMode ** VGLListModes(int depth, int mem_model);
64
65/* VGL driver bootstrap functions */
66
67static int VGL_Available(void)
68{
69 /*
70 * Check to see if we are root and stdin is a
71 * virtual console. Also try to ensure that
72 * modes other than 320x200 are available
73 */
74 int console, hires_available, i;
75 VGLMode **modes;
76
77 console = STDIN_FILENO;
78 if ( console >= 0 ) {
79 struct stat sb;
80 struct vt_mode dummy;
81
82 if ( (fstat(console, &sb) < 0) ||
83 (ioctl(console, VT_GETMODE, &dummy) < 0) ) {
84 console = -1;
85 }
86 }
87 if (geteuid() != 0 && console == -1)
88 return 0;
89
90 modes = VGLListModes(8, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
91 hires_available = 0;
92 for (i = 0; modes[i] != NULL; i++) {
93 if ((modes[i]->ModeInfo.Xsize > 320) &&
94 (modes[i]->ModeInfo.Ysize > 200) &&
95 ((modes[i]->ModeInfo.Type == VIDBUF8) ||
96 (modes[i]->ModeInfo.Type == VIDBUF16) ||
97 (modes[i]->ModeInfo.Type == VIDBUF32))) {
98 hires_available = 1;
99 break;
100 }
101 }
102 return hires_available;
103}
104
105static void VGL_DeleteDevice(SDL_VideoDevice *device)
106{
107 SDL_free(device->hidden);
108 SDL_free(device);
109}
110
111static SDL_VideoDevice *VGL_CreateDevice(int devindex)
112{
113 SDL_VideoDevice *device;
114
115 /* Initialize all variables that we clean on shutdown */
116 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
117 if ( device ) {
118 SDL_memset(device, 0, (sizeof *device));
119 device->hidden = (struct SDL_PrivateVideoData *)
120 SDL_malloc((sizeof *device->hidden));
121 }
122 if ( (device == NULL) || (device->hidden == NULL) ) {
123 SDL_OutOfMemory();
124 if ( device ) {
125 SDL_free(device);
126 }
127 return(0);
128 }
129 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
130
131 /* Set the function pointers */
132 device->VideoInit = VGL_VideoInit;
133 device->ListModes = VGL_ListModes;
134 device->SetVideoMode = VGL_SetVideoMode;
135 device->SetColors = VGL_SetColors;
136 device->UpdateRects = NULL;
137 device->VideoQuit = VGL_VideoQuit;
138 device->AllocHWSurface = VGL_AllocHWSurface;
139 device->CheckHWBlit = NULL;
140 device->FillHWRect = NULL;
141 device->SetHWColorKey = NULL;
142 device->SetHWAlpha = NULL;
143 device->LockHWSurface = VGL_LockHWSurface;
144 device->UnlockHWSurface = VGL_UnlockHWSurface;
145 device->FlipHWSurface = VGL_FlipHWSurface;
146 device->FreeHWSurface = VGL_FreeHWSurface;
147 device->SetIcon = NULL;
148 device->SetCaption = NULL;
149 device->GetWMInfo = NULL;
150 device->FreeWMCursor = VGL_FreeWMCursor;
151 device->CreateWMCursor = VGL_CreateWMCursor;
152 device->ShowWMCursor = VGL_ShowWMCursor;
153 device->WarpWMCursor = VGL_WarpWMCursor;
154 device->InitOSKeymap = VGL_InitOSKeymap;
155 device->PumpEvents = VGL_PumpEvents;
156
157 device->free = VGL_DeleteDevice;
158
159 return device;
160}
161
162VideoBootStrap VGL_bootstrap = {
163 "vgl", "FreeBSD libVGL",
164 VGL_Available, VGL_CreateDevice
165};
166
167static int VGL_AddMode(_THIS, VGLMode *inmode)
168{
169 SDL_Rect *mode;
170
171 int i, index;
172 int next_mode;
173
174 /* Check to see if we already have this mode */
175 if (inmode->Depth < 8) { /* Not supported */
176 return 0;
177 }
178 index = ((inmode->Depth + 7) / 8) - 1;
179 for (i=0; i<SDL_nummodes[index]; ++i) {
180 mode = SDL_modelist[index][i];
181 if ((mode->w == inmode->ModeInfo.Xsize) &&
182 (mode->h == inmode->ModeInfo.Ysize))
183 return 0;
184 }
185
186 /* Set up the new video mode rectangle */
187 mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
188 if (mode == NULL) {
189 SDL_OutOfMemory();
190 return -1;
191 }
192 mode->x = 0;
193 mode->y = 0;
194 mode->w = inmode->ModeInfo.Xsize;
195 mode->h = inmode->ModeInfo.Ysize;
196
197 /* Allocate the new list of modes, and fill in the new mode */
198 next_mode = SDL_nummodes[index];
199 SDL_modelist[index] = (SDL_Rect **)
200 SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
201 if (SDL_modelist[index] == NULL) {
202 SDL_OutOfMemory();
203 SDL_nummodes[index] = 0;
204 SDL_free(mode);
205 return -1;
206 }
207 SDL_modelist[index][next_mode] = mode;
208 SDL_modelist[index][next_mode+1] = NULL;
209 SDL_nummodes[index]++;
210
211 return 0;
212}
213
214static void VGL_UpdateVideoInfo(_THIS)
215{
216 this->info.wm_available = 0;
217 this->info.hw_available = 1;
218 this->info.video_mem = 0;
219 if (VGLCurMode == NULL) {
220 return;
221 }
222 if (VGLCurMode->ModeInfo.PixelBytes > 0) {
223 this->info.video_mem = VGLCurMode->ModeInfo.PixelBytes *
224 VGLCurMode->ModeInfo.Xsize *
225 VGLCurMode->ModeInfo.Ysize;
226 }
227}
228
229int VGL_VideoInit(_THIS, SDL_PixelFormat *vformat)
230{
231 int i;
232 int total_modes;
233 VGLMode **modes;
234
235 /* Initialize all variables that we clean on shutdown */
236 for ( i=0; i<NUM_MODELISTS; ++i ) {
237 SDL_nummodes[i] = 0;
238 SDL_modelist[i] = NULL;
239 }
240
241 /* Enable mouse and keyboard support */
242 if (SDL_getenv("SDL_NO_RAWKBD") == NULL) {
243 if (VGLKeyboardInit(VGL_CODEKEYS) != 0) {
244 SDL_SetError("Unable to initialize keyboard");
245 return -1;
246 }
247 } else {
248 warnx("Requiest to put keyboard into a raw mode ignored");
249 }
250 if (VGL_initkeymaps(STDIN_FILENO) != 0) {
251 SDL_SetError("Unable to initialize keymap");
252 return -1;
253 }
254 if (VGL_initmouse(STDIN_FILENO) != 0) {
255 SDL_SetError("Unable to initialize mouse");
256 return -1;
257 }
258
259 /* Determine the current screen size */
260 if (VGLCurMode != NULL) {
261 this->info.current_w = VGLCurMode->ModeInfo.Xsize;
262 this->info.current_h = VGLCurMode->ModeInfo.Ysize;
263 }
264
265 /* Determine the screen depth */
266 if (VGLCurMode != NULL)
267 vformat->BitsPerPixel = VGLCurMode->Depth;
268 else
269 vformat->BitsPerPixel = 16; /* Good default */
270
271 /* Query for the list of available video modes */
272 total_modes = 0;
273 modes = VGLListModes(-1, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
274 for (i = 0; modes[i] != NULL; i++) {
275 if ((modes[i]->ModeInfo.Type == VIDBUF8) ||
276 (modes[i]->ModeInfo.Type == VIDBUF16) ||
277 (modes[i]->ModeInfo.Type == VIDBUF32)) {
278 VGL_AddMode(this, modes[i]);
279 total_modes++;
280 }
281 }
282 if (total_modes == 0) {
283 SDL_SetError("No linear video modes available");
284 return -1;
285 }
286
287 /* Fill in our hardware acceleration capabilities */
288 VGL_UpdateVideoInfo(this);
289
290 /* Create the hardware surface lock mutex */
291 hw_lock = SDL_CreateMutex();
292 if (hw_lock == NULL) {
293 SDL_SetError("Unable to create lock mutex");
294 VGL_VideoQuit(this);
295 return -1;
296 }
297
298 /* We're done! */
299 return 0;
300}
301
302SDL_Rect **VGL_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
303{
304 return SDL_modelist[((format->BitsPerPixel+7)/8)-1];
305}
306
307/* Various screen update functions available */
308static void VGL_DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
309
310SDL_Surface *VGL_SetVideoMode(_THIS, SDL_Surface *current,
311 int width, int height, int bpp, Uint32 flags)
312{
313 int mode_found;
314 int i;
315 VGLMode **modes;
316
317 modes = VGLListModes(bpp, V_INFO_MM_DIRECT | V_INFO_MM_PACKED);
318 mode_found = 0;
319 for (i = 0; modes[i] != NULL; i++) {
320 if ((modes[i]->ModeInfo.Xsize == width) &&
321 (modes[i]->ModeInfo.Ysize == height) &&
322 ((modes[i]->ModeInfo.Type == VIDBUF8) ||
323 (modes[i]->ModeInfo.Type == VIDBUF16) ||
324 (modes[i]->ModeInfo.Type == VIDBUF32))) {
325 mode_found = 1;
326 break;
327 }
328 }
329 if (mode_found == 0) {
330 SDL_SetError("No matching video mode found");
331 return NULL;
332 }
333
334 /* Shutdown previous videomode (if any) */
335 if (VGLCurMode != NULL)
336 VGLEnd();
337
338 /* Try to set the requested linear video mode */
339 if (VGLInit(modes[i]->ModeId) != 0) {
340 SDL_SetError("Unable to switch to requested mode");
341 return NULL;
342 }
343
344 VGLCurMode = SDL_realloc(VGLCurMode, sizeof(VGLMode));
345 VGLCurMode->ModeInfo = *VGLDisplay;
346 VGLCurMode->Depth = modes[i]->Depth;
347 VGLCurMode->ModeId = modes[i]->ModeId;
348 VGLCurMode->Rmask = modes[i]->Rmask;
349 VGLCurMode->Gmask = modes[i]->Gmask;
350 VGLCurMode->Bmask = modes[i]->Bmask;
351
352 /* Workaround a bug in libvgl */
353 if (VGLCurMode->ModeInfo.PixelBytes == 0)
354 (VGLCurMode->ModeInfo.PixelBytes = 1);
355
356 current->w = VGLCurMode->ModeInfo.Xsize;
357 current->h = VGLCurMode->ModeInfo.Ysize;
358 current->pixels = VGLCurMode->ModeInfo.Bitmap;
359 current->pitch = VGLCurMode->ModeInfo.Xsize *
360 VGLCurMode->ModeInfo.PixelBytes;
361 current->flags = (SDL_FULLSCREEN | SDL_HWSURFACE);
362
363 /* Check if we are in a pseudo-color mode */
364 if (VGLCurMode->ModeInfo.Type == VIDBUF8)
365 current->flags |= SDL_HWPALETTE;
366
367 /* Check if we can do doublebuffering */
368 if (flags & SDL_DOUBLEBUF) {
369 if (VGLCurMode->ModeInfo.Xsize * 2 <=
370 VGLCurMode->ModeInfo.VYsize) {
371 current->flags |= SDL_DOUBLEBUF;
372 flip_page = 0;
373 flip_address[0] = (byte *)current->pixels;
374 flip_address[1] = (byte *)current->pixels +
375 current->h * current->pitch;
376 VGL_FlipHWSurface(this, current);
377 }
378 }
379
380 if (! SDL_ReallocFormat(current, modes[i]->Depth, VGLCurMode->Rmask,
381 VGLCurMode->Gmask, VGLCurMode->Bmask, 0)) {
382 return NULL;
383 }
384
385 /* Update hardware acceleration info */
386 VGL_UpdateVideoInfo(this);
387
388 /* Set the blit function */
389 this->UpdateRects = VGL_DirectUpdate;
390
391 /* We're done */
392 return current;
393}
394
395/* We don't actually allow hardware surfaces other than the main one */
396static int VGL_AllocHWSurface(_THIS, SDL_Surface *surface)
397{
398 return -1;
399}
400static void VGL_FreeHWSurface(_THIS, SDL_Surface *surface)
401{
402 return;
403}
404
405/* We need to wait for vertical retrace on page flipped displays */
406static int VGL_LockHWSurface(_THIS, SDL_Surface *surface)
407{
408 if (surface == SDL_VideoSurface) {
409 SDL_mutexP(hw_lock);
410 }
411 return 0;
412}
413static void VGL_UnlockHWSurface(_THIS, SDL_Surface *surface)
414{
415 if (surface == SDL_VideoSurface) {
416 SDL_mutexV(hw_lock);
417 }
418}
419
420static int VGL_FlipHWSurface(_THIS, SDL_Surface *surface)
421{
422 if (VGLPanScreen(VGLDisplay, 0, flip_page * surface->h) < 0) {
423 SDL_SetError("VGLPanSreen() failed");
424 return -1;
425 }
426
427 flip_page = !flip_page;
428 surface->pixels = flip_address[flip_page];
429
430 return 0;
431}
432
433static void VGL_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
434{
435 return;
436}
437
438int VGL_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
439{
440 int i;
441
442 for(i = 0; i < ncolors; i++) {
443 VGLSetPaletteIndex(firstcolor + i,
444 colors[i].r>>2,
445 colors[i].g>>2,
446 colors[i].b>>2);
447 }
448 return 1;
449}
450
451/* Note: If we are terminated, this could be called in the middle of
452 another SDL video routine -- notably UpdateRects.
453*/
454void VGL_VideoQuit(_THIS)
455{
456 int i, j;
457
458 /* Return the keyboard to the normal state */
459 VGLKeyboardEnd();
460
461 /* Reset the console video mode if we actually initialised one */
462 if (VGLCurMode != NULL) {
463 VGLEnd();
464 SDL_free(VGLCurMode);
465 VGLCurMode = NULL;
466 }
467
468 /* Clear the lock mutex */
469 if (hw_lock != NULL) {
470 SDL_DestroyMutex(hw_lock);
471 hw_lock = NULL;
472 }
473
474 /* Free video mode lists */
475 for (i = 0; i < NUM_MODELISTS; i++) {
476 if (SDL_modelist[i] != NULL) {
477 for (j = 0; SDL_modelist[i][j] != NULL; ++j) {
478 SDL_free(SDL_modelist[i][j]);
479 }
480 SDL_free(SDL_modelist[i]);
481 SDL_modelist[i] = NULL;
482 }
483 }
484
485 if ( this->screen && (this->screen->flags & SDL_HWSURFACE) ) {
486 /* Direct screen access, not a memory buffer */
487 this->screen->pixels = NULL;
488 }
489}
490
491#define VGL_RED_INDEX 0
492#define VGL_GREEN_INDEX 1
493#define VGL_BLUE_INDEX 2
494
495static VGLMode **
496VGLListModes(int depth, int mem_model)
497{
498 static VGLMode **modes = NULL;
499
500 VGLBitmap *vminfop;
501 VGLMode **modesp, *modescp;
502 video_info_t minfo;
503 int adptype, i, modenum;
504
505 if (modes == NULL) {
506 modes = SDL_malloc(sizeof(VGLMode *) * M_VESA_MODE_MAX);
507 bzero(modes, sizeof(VGLMode *) * M_VESA_MODE_MAX);
508 }
509 modesp = modes;
510
511 for (modenum = 0; modenum < M_VESA_MODE_MAX; modenum++) {
512 minfo.vi_mode = modenum;
513 if (ioctl(0, CONS_MODEINFO, &minfo) || ioctl(0, CONS_CURRENT, &adptype))
514 continue;
515 if (minfo.vi_mode != modenum)
516 continue;
517 if ((minfo.vi_flags & V_INFO_GRAPHICS) == 0)
518 continue;
519 if ((mem_model != -1) && ((minfo.vi_mem_model & mem_model) == 0))
520 continue;
521 if ((depth > 1) && (minfo.vi_depth != depth))
522 continue;
523
524 /* reallocf can fail */
525 if ((*modesp = reallocf(*modesp, sizeof(VGLMode))) == NULL)
526 return NULL;
527 modescp = *modesp;
528
529 vminfop = &(modescp->ModeInfo);
530 bzero(vminfop, sizeof(VGLBitmap));
531
532 vminfop->Type = NOBUF;
533
534 vminfop->PixelBytes = 1; /* Good default value */
535 switch (minfo.vi_mem_model) {
536 case V_INFO_MM_PLANAR:
537 /* we can handle EGA/VGA planar modes only */
538 if (!(minfo.vi_depth != 4 || minfo.vi_planes != 4
539 || (adptype != KD_EGA && adptype != KD_VGA)))
540 vminfop->Type = VIDBUF4;
541 break;
542 case V_INFO_MM_PACKED:
543 /* we can do only 256 color packed modes */
544 if (minfo.vi_depth == 8)
545 vminfop->Type = VIDBUF8;
546 break;
547 case V_INFO_MM_VGAX:
548 vminfop->Type = VIDBUF8X;
549 break;
550#if defined(__FREEBSD__) && (defined(__DragonFly__) || __FreeBSD_version >= 500000)
551 case V_INFO_MM_DIRECT:
552 vminfop->PixelBytes = minfo.vi_pixel_size;
553 switch (vminfop->PixelBytes) {
554 case 2:
555 vminfop->Type = VIDBUF16;
556 break;
557#if notyet
558 case 3:
559 vminfop->Type = VIDBUF24;
560 break;
561#endif
562 case 4:
563 vminfop->Type = VIDBUF32;
564 break;
565 default:
566 break;
567 }
568#endif
569 default:
570 break;
571 }
572 if (vminfop->Type == NOBUF)
573 continue;
574
575 switch (vminfop->Type) {
576 case VIDBUF16:
577 case VIDBUF32:
578 modescp->Rmask = ((1 << minfo.vi_pixel_fsizes[VGL_RED_INDEX]) - 1) <<
579 minfo.vi_pixel_fields[VGL_RED_INDEX];
580 modescp->Gmask = ((1 << minfo.vi_pixel_fsizes[VGL_GREEN_INDEX]) - 1) <<
581 minfo.vi_pixel_fields[VGL_GREEN_INDEX];
582 modescp->Bmask = ((1 << minfo.vi_pixel_fsizes[VGL_BLUE_INDEX]) - 1) <<
583 minfo.vi_pixel_fields[VGL_BLUE_INDEX];
584 break;
585
586 default:
587 break;
588 }
589
590 vminfop->Xsize = minfo.vi_width;
591 vminfop->Ysize = minfo.vi_height;
592 modescp->Depth = minfo.vi_depth;
593
594 /* XXX */
595 if (minfo.vi_mode >= M_VESA_BASE)
596 modescp->ModeId = _IO('V', minfo.vi_mode - M_VESA_BASE);
597 else
598 modescp->ModeId = _IO('S', minfo.vi_mode);
599
600 /* Sort list */
601 for (i = 0; modes + i < modesp ; i++) {
602 if (modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize >
603 vminfop->Xsize * modes[i]->ModeInfo.Ysize)
604 continue;
605 if ((modes[i]->ModeInfo.Xsize * modes[i]->ModeInfo.Ysize ==
606 vminfop->Xsize * vminfop->Ysize) &&
607 (modes[i]->Depth >= modescp->Depth))
608 continue;
609 *modesp = modes[i];
610 modes[i] = modescp;
611 modescp = *modesp;
612 vminfop = &(modescp->ModeInfo);
613 }
614
615 modesp++;
616 }
617
618 if (*modesp != NULL) {
619 SDL_free(*modesp);
620 *modesp = NULL;
621 }
622
623 return modes;
624}
diff --git a/apps/plugins/sdl/src/video/vgl/SDL_vglvideo.h b/apps/plugins/sdl/src/video/vgl/SDL_vglvideo.h
deleted file mode 100644
index 9fc3569679..0000000000
--- a/apps/plugins/sdl/src/video/vgl/SDL_vglvideo.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24#ifndef _SDL_vglvideo_h
25#define _SDL_vglvideo_h
26
27#include <sys/fbio.h>
28#include <sys/consio.h>
29#include <vgl.h>
30
31#include "SDL_mouse.h"
32#include "SDL_mutex.h"
33#include "../SDL_sysvideo.h"
34
35/* Hidden "this" pointer for the video functions */
36#define _THIS SDL_VideoDevice *this
37
38typedef struct {
39 int ModeId;
40 int Depth;
41 int Rmask;
42 int Gmask;
43 int Bmask;
44 VGLBitmap ModeInfo;
45} VGLMode;
46
47/* Private display data */
48struct SDL_PrivateVideoData {
49#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
50 int SDL_nummodes[NUM_MODELISTS];
51 SDL_Rect **SDL_modelist[NUM_MODELISTS];
52 SDL_mutex *hw_lock;
53 VGLMode *VGLCurMode;
54 int flip_page;
55 byte *flip_address[2];
56};
57/* Old variable names */
58#define SDL_nummodes (this->hidden->SDL_nummodes)
59#define SDL_modelist (this->hidden->SDL_modelist)
60#define hw_lock (this->hidden->hw_lock)
61#define VGLCurMode (this->hidden->VGLCurMode)
62#define flip_page (this->hidden->flip_page)
63#define flip_address (this->hidden->flip_address)
64
65#endif /* _SDL_vglvideo_h */