more valgrind errors fixed. Plus I ran make indent which changed a few files.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402741
This commit is contained in:
Bob Pendleton 2008-03-07 17:20:37 +00:00
parent b315d5379d
commit c19af725fa
8 changed files with 64 additions and 59 deletions

View file

@ -2190,6 +2190,11 @@ SDL_VideoQuit(void)
display->windows = NULL;
}
display->num_windows = 0;
if (display->render_drivers) {
SDL_free(display->render_drivers);
display->render_drivers = NULL;
}
display->num_render_drivers = 0;
}
_this->VideoQuit(_this);

View file

@ -54,16 +54,19 @@ WIN_InitKeyboard(_THIS)
/* Make sure the alpha scancodes are correct. T isn't usually remapped */
if (MapVirtualKey('T', MAPVK_VK_TO_VSC) != alpha_scancodes['T' - 'A']) {
printf("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
printf
("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) {
alpha_scancodes[i] = MapVirtualKey('A' + i, MAPVK_VK_TO_VSC);
printf("%d = %d\n", i, alpha_scancodes[i]);
}
}
if (MapVirtualKey(VK_NUMPAD0, MAPVK_VK_TO_VSC) != keypad_scancodes[0]) {
printf("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
printf
("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list <sdl@libsdl.org>, including a description of your keyboard hardware.\n");
for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
keypad_scancodes[i] = MapVirtualKey(VK_NUMPAD0+i, MAPVK_VK_TO_VSC);
keypad_scancodes[i] =
MapVirtualKey(VK_NUMPAD0 + i, MAPVK_VK_TO_VSC);
printf("%d = %d\n", i, keypad_scancodes[i]);
}
}

View file

@ -51,8 +51,7 @@ X11_DispatchEvent(_THIS)
}
data = NULL;
if (videodata &&
videodata->windowlist) {
if (videodata && videodata->windowlist) {
for (i = 0; i < videodata->numwindows; ++i) {
if ((videodata->windowlist[i] != NULL) &&
(videodata->windowlist[i]->window == xevent.xany.window)) {

View file

@ -523,6 +523,7 @@ X11_GL_DeleteContext(_THIS, SDL_GLContext context)
GLXContext glx_context = (GLXContext) context;
_this->gl_data->glXDestroyContext(display, glx_context);
XSync(display, False);
}
#endif /* SDL_VIDEO_OPENGL_GLX */

View file

@ -101,6 +101,7 @@ X11_DeleteDevice(SDL_VideoDevice * device)
if (data->display) {
XCloseDisplay(data->display);
}
SDL_free(data->windowlist);
SDL_free(device->driverdata);
SDL_free(device);

View file

@ -67,6 +67,7 @@ typedef struct SDL_VideoData
BOOL dpms_enabled;
int numwindows;
SDL_WindowData **windowlist;
int windowlistlength;
int mouse;
int keyboard;
Atom WM_DELETE_WINDOW;

View file

@ -34,8 +34,8 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
SDL_WindowData *data;
int numwindows = videodata->numwindows;
int windowlistlength = videodata->windowlistlength;
SDL_WindowData **windowlist = videodata->windowlist;
int i;
int index;
/* Allocate the window data */
@ -59,29 +59,23 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
data->videodata = videodata;
/* Associate the data with the window */
index = -1;
if (windowlist) {
for (i = 0; i < numwindows; ++i) {
if (windowlist[i] == NULL) {
index = i;
break;
}
}
}
if (index >= 0) {
windowlist[index] = data;
if (numwindows < windowlistlength) {
windowlist[numwindows] = data;
videodata->numwindows++;
} else {
windowlist =
(SDL_WindowData **) SDL_realloc(windowlist,
(numwindows + 1) * sizeof(*windowlist));
(numwindows +
1) * sizeof(*windowlist));
if (!windowlist) {
SDL_OutOfMemory();
SDL_free(data);
return -1;
}
windowlist[numwindows++] = data;
videodata->numwindows = numwindows;
windowlist[numwindows] = data;
videodata->numwindows++;
videodata->windowlistlength++;
videodata->windowlist = windowlist;
}
@ -666,9 +660,10 @@ X11_DestroyWindow(_THIS, SDL_Window * window)
if (windowlist) {
for (i = 0; i < numwindows; ++i) {
if (windowlist[i] &&
(windowlist[i]->windowID == window->id)) {
windowlist[i] = NULL;
if (windowlist[i] && (windowlist[i]->windowID == window->id)) {
windowlist[i] = windowlist[numwindows - 1];
windowlist[numwindows - 1] = NULL;
videodata->numwindows--;
break;
}
}