Cleaned up a bunch of warnings, started adding Win32 event support SDL-1.3
authorSam Lantinga <slouken@libsdl.org>
Fri, 30 Jun 2006 05:42:49 +0000
branchSDL-1.3
changeset 1720a1ebb17f9c52
parent 1719 5b9f50c957ed
child 1721 1cc762cafff8
Cleaned up a bunch of warnings, started adding Win32 event support
include/SDL_config_win32.h
include/SDL_video.h
src/SDL_compat.c
src/audio/SDL_mixer_MMX_VC.c
src/events/SDL_events_c.h
src/events/SDL_keyboard.c
src/events/SDL_keyboard_c.h
src/events/SDL_mouse.c
src/events/SDL_windowevents_c.h
src/video/SDL_blit_A.c
src/video/SDL_renderer_sw.c
src/video/SDL_surface.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/dummy/SDL_nullrender.c
src/video/dummy/SDL_nullvideo.c
src/video/dummy/SDL_nullvideo.h
src/video/win32/SDL_win32keyboard.c
src/video/win32/SDL_win32keyboard.h
src/video/win32/SDL_win32mouse.c
src/video/win32/SDL_win32mouse.h
src/video/win32/SDL_win32video.c
src/video/win32/SDL_win32video.h
src/video/win32/SDL_win32window.c
src/video/win32/SDL_win32window.h
     1.1 --- a/include/SDL_config_win32.h	Wed Jun 28 08:12:07 2006 +0000
     1.2 +++ b/include/SDL_config_win32.h	Fri Jun 30 05:42:49 2006 +0000
     1.3 @@ -133,7 +133,7 @@
     1.4  #ifdef _WIN32_WCE
     1.5  #define SDL_JOYSTICK_DISABLED   1
     1.6  #else
     1.7 -#define SDL_JOYSTICK_DINPUT	1
     1.8 +#define SDL_JOYSTICK_WINMM	1
     1.9  #endif
    1.10  
    1.11  /* Enable various shared object loading systems */
    1.12 @@ -150,17 +150,8 @@
    1.13  #endif
    1.14  
    1.15  /* Enable various video drivers */
    1.16 -#ifdef _WIN32_WCE
    1.17 -#define SDL_VIDEO_DRIVER_GAPI	1
    1.18 -#endif
    1.19 -#ifndef _WIN32_WCE
    1.20 -#define SDL_VIDEO_DRIVER_DDRAW	1
    1.21 -#endif
    1.22  #define SDL_VIDEO_DRIVER_DUMMY	1
    1.23 -#ifndef _WIN32_WCE
    1.24 -#define SDL_VIDEO_DRIVER_GLSDL	1
    1.25 -#endif
    1.26 -#define SDL_VIDEO_DRIVER_WINDIB	1
    1.27 +#define SDL_VIDEO_DRIVER_WIN32	1
    1.28  
    1.29  /* Enable OpenGL support */
    1.30  #ifndef _WIN32_WCE
     2.1 --- a/include/SDL_video.h	Wed Jun 28 08:12:07 2006 +0000
     2.2 +++ b/include/SDL_video.h	Fri Jun 30 05:42:49 2006 +0000
     2.3 @@ -718,6 +718,18 @@
     2.4  extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
     2.5  
     2.6  /**
     2.7 + * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
     2.8 + *
     2.9 + * \brief Get driver specific information about a window.
    2.10 + *
    2.11 + * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
    2.12 + */
    2.13 +struct SDL_SysWMinfo;
    2.14 +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
    2.15 +                                                     struct SDL_SysWMinfo
    2.16 +                                                     *info);
    2.17 +
    2.18 +/**
    2.19   * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
    2.20   *
    2.21   * \brief Destroy a window.
     3.1 --- a/src/SDL_compat.c	Wed Jun 28 08:12:07 2006 +0000
     3.2 +++ b/src/SDL_compat.c	Fri Jun 30 05:42:49 2006 +0000
     3.3 @@ -26,6 +26,7 @@
     3.4  #include "SDL.h"
     3.5  #include "SDL_syswm.h"
     3.6  
     3.7 +#include "video/SDL_sysvideo.h"
     3.8  #include "video/SDL_pixels_c.h"
     3.9  
    3.10  
    3.11 @@ -94,7 +95,7 @@
    3.12              if (!mode->format) {
    3.13                  return bpp;
    3.14              }
    3.15 -            if (SDL_BITSPERPIXEL(mode->format) >= bpp) {
    3.16 +            if (SDL_BITSPERPIXEL(mode->format) >= (Uint32) bpp) {
    3.17                  actual_bpp = SDL_BITSPERPIXEL(mode->format);
    3.18              }
    3.19          }
    3.20 @@ -118,6 +119,7 @@
    3.21  
    3.22      /* Memory leak, but this is a compatibility function, who cares? */
    3.23      nmodes = 0;
    3.24 +    modes = NULL;
    3.25      for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
    3.26          const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
    3.27          if (!mode->w || !mode->h) {
    3.28 @@ -243,6 +245,7 @@
    3.29      if (userdata == SDL_VideoSurface) {
    3.30          return SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors);
    3.31      }
    3.32 +    return 0;
    3.33  }
    3.34  
    3.35  SDL_Surface *
    3.36 @@ -251,11 +254,9 @@
    3.37      int (*filter) (SDL_Event * event);
    3.38      const SDL_DisplayMode *desktop_mode;
    3.39      SDL_DisplayMode mode;
    3.40 -    int i;
    3.41      Uint32 window_flags;
    3.42      Uint32 desktop_format;
    3.43      Uint32 desired_format;
    3.44 -    Uint32 texture_format;
    3.45      Uint32 surface_flags;
    3.46  
    3.47      if (!SDL_GetVideoDevice()) {
    3.48 @@ -641,6 +642,7 @@
    3.49  SDL_WM_IconifyWindow(void)
    3.50  {
    3.51      SDL_MinimizeWindow(SDL_VideoWindow);
    3.52 +    return 0;
    3.53  }
    3.54  
    3.55  int
    3.56 @@ -695,7 +697,7 @@
    3.57  SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors,
    3.58                 int firstcolor, int ncolors)
    3.59  {
    3.60 -    SDL_SetColors(surface, colors, firstcolor, ncolors);
    3.61 +    return SDL_SetColors(surface, colors, firstcolor, ncolors);
    3.62  }
    3.63  
    3.64  int
    3.65 @@ -1333,6 +1335,7 @@
    3.66          return -1;
    3.67      }
    3.68      SDL_RenderPresent();
    3.69 +    return 0;
    3.70  }
    3.71  
    3.72  void
     4.1 --- a/src/audio/SDL_mixer_MMX_VC.c	Wed Jun 28 08:12:07 2006 +0000
     4.2 +++ b/src/audio/SDL_mixer_MMX_VC.c	Fri Jun 30 05:42:49 2006 +0000
     4.3 @@ -40,14 +40,19 @@
     4.4  void
     4.5  SDL_MixAudio_MMX_S16_VC(char *dst, char *src, unsigned int nSize, int volume)
     4.6  {
     4.7 +	/* *INDENT-OFF* */
     4.8      __asm {
     4.9 -
    4.10 -        push edi push esi push ebx mov edi, dst // edi = dst
    4.11 +          push edi
    4.12 +          push esi
    4.13 +		  push ebx
    4.14 +		  mov edi, dst          // edi = dst
    4.15            mov esi, src          // esi = src
    4.16            mov eax, volume       // eax = volume
    4.17            mov ebx, nSize        // ebx = size
    4.18            shr ebx, 4            // process 16 bytes per iteration = 8 samples
    4.19 -          jz endS16 pxor mm0, mm0 movd mm0, eax //%%eax,%%mm0
    4.20 +          jz endS16
    4.21 +		  pxor mm0, mm0
    4.22 +		  movd mm0, eax         //%%eax,%%mm0
    4.23            movq mm1, mm0         //%%mm0,%%mm1
    4.24            psllq mm0, 16         //$16,%%mm0
    4.25            por mm0, mm1          //%%mm1,%%mm0
    4.26 @@ -58,13 +63,14 @@
    4.27  #ifndef __WATCOMC__
    4.28            align 16
    4.29  #endif
    4.30 -          mixloopS16:movq mm1,[esi]     //(%%esi),%%mm1\n" // mm1 = a|b|c|d
    4.31 -        movq mm2, mm1           //%%mm1,%%mm2\n" // mm2 = a|b|c|d
    4.32 +      mixloopS16:
    4.33 +		  movq mm1,[esi]        //(%%esi),%%mm1\n" // mm1 = a|b|c|d
    4.34 +          movq mm2, mm1         //%%mm1,%%mm2\n" // mm2 = a|b|c|d
    4.35            movq mm4,[esi + 8]    //8(%%esi),%%mm4\n" // mm4 = e|f|g|h
    4.36              // pre charger le buffer dst dans mm7
    4.37 -        movq mm7,[edi]          //(%%edi),%%mm7\n" // mm7 = dst[0]"
    4.38 +          movq mm7,[edi]        //(%%edi),%%mm7\n" // mm7 = dst[0]"
    4.39              // multiplier par le volume
    4.40 -        pmullw mm1, mm0         //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
    4.41 +          pmullw mm1, mm0       //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
    4.42            pmulhw mm2, mm0       //%%mm0,%%mm2\n" // mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v)
    4.43            movq mm5, mm4         //%%mm4,%%mm5\n" // mm5 = e|f|g|h
    4.44            pmullw mm4, mm0       //%%mm0,%%mm4\n" // mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v)
    4.45 @@ -78,7 +84,7 @@
    4.46              // pre charger le buffer dst dans mm5
    4.47            movq mm5,[edi + 8]    //8(%%edi),%%mm5\n" // mm5 = dst[1]
    4.48              // diviser par 128
    4.49 -        psrad mm1, 7            //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
    4.50 +          psrad mm1, 7          //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
    4.51            add esi, 16           //$16,%%esi\n"
    4.52            psrad mm3, 7          //$7,%%mm3\n" // mm3 = c*v/128|d*v/128
    4.53            psrad mm4, 7          //$7,%%mm4\n" // mm4 = e*v/128|f*v/128
    4.54 @@ -93,8 +99,14 @@
    4.55            movq[edi + 8], mm6    //%%mm6,8(%%edi)\n"
    4.56            add edi, 16           //$16,%%edi\n"
    4.57            dec ebx               //%%ebx\n"
    4.58 -      jnz mixloopS16 ends16:emms pop ebx pop esi pop edi}
    4.59 -
    4.60 +          jnz mixloopS16
    4.61 +	ends16:
    4.62 +		  emms
    4.63 +          pop ebx
    4.64 +		  pop esi
    4.65 +		  pop edi
    4.66 +	}
    4.67 +	/* *INDENT-ON* */
    4.68  }
    4.69  
    4.70  ////////////////////////////////////////////////
    4.71 @@ -104,9 +116,13 @@
    4.72  void
    4.73  SDL_MixAudio_MMX_S8_VC(char *dst, char *src, unsigned int nSize, int volume)
    4.74  {
    4.75 +	/* *INDENT-OFF* */
    4.76      _asm {
    4.77  
    4.78 -        push edi push esi push ebx mov edi, dst //movl  %0,%%edi        // edi = dst
    4.79 +          push edi
    4.80 +          push esi
    4.81 +		  push ebx
    4.82 +		  mov edi, dst          //%0,%%edi      // edi = dst
    4.83            mov esi, src          //%1,%%esi      // esi = src
    4.84            mov eax, volume       //%3,%%eax      // eax = volume
    4.85            movd mm0, eax         //%%eax,%%mm0
    4.86 @@ -124,15 +140,16 @@
    4.87  #ifndef __WATCOMC__
    4.88            align 16
    4.89  #endif
    4.90 -          mixloopS8:pxor mm2, mm2       //%%mm2,%%mm2           // mm2 = 0
    4.91 +      mixloopS8:
    4.92 +		  pxor mm2, mm2         //%%mm2,%%mm2           // mm2 = 0
    4.93            movq mm1,[esi]        //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h
    4.94 -        movq mm3, mm1           //%%mm1,%%mm3   // mm3 = a|b|c|d|e|f|g|h
    4.95 +          movq mm3, mm1         //%%mm1,%%mm3   // mm3 = a|b|c|d|e|f|g|h
    4.96              // on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0
    4.97            pcmpgtb mm2, mm1      //%%mm1,%%mm2   // mm2 = 11111111|00000000|00000000....
    4.98            punpckhbw mm1, mm2    //%%mm2,%%mm1   // mm1 = 0|a|0|b|0|c|0|d
    4.99            punpcklbw mm3, mm2    //%%mm2,%%mm3   // mm3 = 0|e|0|f|0|g|0|h
   4.100            movq mm2,[edi]        //(%%edi),%%mm2 // mm2 = destination
   4.101 -        pmullw mm1, mm0         //%%mm0,%%mm1   // mm1 = v*a|v*b|v*c|v*d
   4.102 +          pmullw mm1, mm0       //%%mm0,%%mm1   // mm1 = v*a|v*b|v*c|v*d
   4.103            add esi, 8            //$8,%%esi
   4.104            pmullw mm3, mm0       //%%mm0,%%mm3   // mm3 = v*e|v*f|v*g|v*h
   4.105            psraw mm1, 7          //$7,%%mm1              // mm1 = v*a/128|v*b/128|v*c/128|v*d/128 
   4.106 @@ -142,8 +159,16 @@
   4.107            movq[edi], mm3        //%%mm3,(%%edi) // store back to ram
   4.108            add edi, 8            //$8,%%edi
   4.109            dec ebx               //%%ebx
   4.110 -      jnz mixloopS8 endS8:emms pop ebx pop esi pop edi}
   4.111 +          jnz mixloopS8
   4.112 +      endS8:
   4.113 +		  emms
   4.114 +          pop ebx
   4.115 +		  pop esi
   4.116 +		  pop edi
   4.117 +	}
   4.118 +	/* *INDENT-ON* */
   4.119  }
   4.120  
   4.121  #endif                          /* SDL_ASSEMBLY_ROUTINES */
   4.122 +
   4.123  /* vi: set ts=4 sw=4 expandtab: */
     5.1 --- a/src/events/SDL_events_c.h	Wed Jun 28 08:12:07 2006 +0000
     5.2 +++ b/src/events/SDL_events_c.h	Fri Jun 30 05:42:49 2006 +0000
     5.3 @@ -39,11 +39,6 @@
     5.4  extern int SDL_SendQuit(void);
     5.5  extern void SDL_QuitQuit(void);
     5.6  
     5.7 -extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
     5.8 -                               int data1, int data2);
     5.9 -
    5.10 -extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
    5.11 -
    5.12  /* The event filter function */
    5.13  extern SDL_EventFilter SDL_EventOK;
    5.14  
     6.1 --- a/src/events/SDL_keyboard.c	Wed Jun 28 08:12:07 2006 +0000
     6.2 +++ b/src/events/SDL_keyboard.c	Fri Jun 30 05:42:49 2006 +0000
     6.3 @@ -291,8 +291,6 @@
     6.4  SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index)
     6.5  {
     6.6      SDL_Keyboard **keyboards;
     6.7 -    SDL_Cursor *cursor;
     6.8 -    int selected_keyboard;
     6.9  
    6.10      /* Add the keyboard to the list of keyboards */
    6.11      if (index < 0 || index >= SDL_num_keyboards || SDL_keyboards[index]) {
     7.1 --- a/src/events/SDL_keyboard_c.h	Wed Jun 28 08:12:07 2006 +0000
     7.2 +++ b/src/events/SDL_keyboard_c.h	Fri Jun 30 05:42:49 2006 +0000
     7.3 @@ -24,6 +24,9 @@
     7.4  #ifndef _SDL_keyboard_c_h
     7.5  #define _SDL_keyboard_c_h
     7.6  
     7.7 +#include "SDL_keysym.h"
     7.8 +#include "SDL_events.h"
     7.9 +
    7.10  typedef struct SDL_Keyboard SDL_Keyboard;
    7.11  
    7.12  struct SDL_Keyboard
     8.1 --- a/src/events/SDL_mouse.c	Wed Jun 28 08:12:07 2006 +0000
     8.2 +++ b/src/events/SDL_mouse.c	Fri Jun 30 05:42:49 2006 +0000
     8.3 @@ -53,7 +53,6 @@
     8.4  SDL_AddMouse(const SDL_Mouse * mouse, int index)
     8.5  {
     8.6      SDL_Mouse **mice;
     8.7 -    SDL_Cursor *cursor;
     8.8      int selected_mouse;
     8.9  
    8.10      /* Add the mouse to the list of mice */
    8.11 @@ -398,9 +397,7 @@
    8.12          return NULL;
    8.13      }
    8.14      for (y = 0; y < h; ++y) {
    8.15 -        pixel =
    8.16 -            (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch +
    8.17 -                        x * 4);
    8.18 +        pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
    8.19          for (x = 0; x < w; ++x) {
    8.20              if ((x % 8) == 0) {
    8.21                  datab = *data++;
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/events/SDL_windowevents_c.h	Fri Jun 30 05:42:49 2006 +0000
     9.3 @@ -0,0 +1,34 @@
     9.4 +/*
     9.5 +    SDL - Simple DirectMedia Layer
     9.6 +    Copyright (C) 1997-2006 Sam Lantinga
     9.7 +
     9.8 +    This library is free software; you can redistribute it and/or
     9.9 +    modify it under the terms of the GNU Lesser General Public
    9.10 +    License as published by the Free Software Foundation; either
    9.11 +    version 2.1 of the License, or (at your option) any later version.
    9.12 +
    9.13 +    This library is distributed in the hope that it will be useful,
    9.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 +    Lesser General Public License for more details.
    9.17 +
    9.18 +    You should have received a copy of the GNU Lesser General Public
    9.19 +    License along with this library; if not, write to the Free Software
    9.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 +
    9.22 +    Sam Lantinga
    9.23 +    slouken@libsdl.org
    9.24 +*/
    9.25 +#include "SDL_config.h"
    9.26 +
    9.27 +#ifndef _SDL_windowevents_c_h
    9.28 +#define _SDL_windowevents_c_h
    9.29 +
    9.30 +extern int SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent,
    9.31 +                               int data1, int data2);
    9.32 +
    9.33 +extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
    9.34 +
    9.35 +#endif /* _SDL_windowevents_c_h */
    9.36 +
    9.37 +/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/SDL_blit_A.c	Wed Jun 28 08:12:07 2006 +0000
    10.2 +++ b/src/video/SDL_blit_A.c	Fri Jun 30 05:42:49 2006 +0000
    10.3 @@ -617,7 +617,9 @@
    10.4      __m64 src1, dst1, mm_alpha, mm_zero, dmask;
    10.5  
    10.6      mm_zero = _mm_setzero_si64();       /* 0 -> mm_zero */
    10.7 -    multmask = ~(0xFFFFi 64 << (ashift * 2));
    10.8 +	/* *INDENT-OFF* */
    10.9 +	multmask = ~(0xFFFFI64 << (ashift * 2));
   10.10 +	/* *INDENT-ON* */
   10.11      dmask = *(__m64 *) & multmask;      /* dst alpha mask -> dmask */
   10.12  
   10.13      while (height--) {
   10.14 @@ -1753,7 +1755,9 @@
   10.15      __m64 src1, dst1, mm_alpha, mm_zero, dmask;
   10.16  
   10.17      mm_zero = _mm_setzero_si64();       /* 0 -> mm_zero */
   10.18 -    multmask = ~(0xFFFFi 64 << (ashift * 2));
   10.19 +	/* *INDENT-OFF* */
   10.20 +    multmask = ~(0xFFFFI64 << (ashift * 2));
   10.21 +	/* *INDENT-ON* */
   10.22      dmask = *(__m64 *) & multmask;      /* dst alpha mask -> dmask */
   10.23  
   10.24      while (height--) {
    11.1 --- a/src/video/SDL_renderer_sw.c	Wed Jun 28 08:12:07 2006 +0000
    11.2 +++ b/src/video/SDL_renderer_sw.c	Fri Jun 30 05:42:49 2006 +0000
    11.3 @@ -54,8 +54,8 @@
    11.4                                  const SDL_Rect * rects);
    11.5  static void SDL_SW_SelectRenderTexture(SDL_Renderer * renderer,
    11.6                                         SDL_Texture * texture);
    11.7 -static void SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
    11.8 -                              Uint32 color);
    11.9 +static int SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
   11.10 +                             Uint32 color);
   11.11  static int SDL_SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
   11.12                               const SDL_Rect * srcrect,
   11.13                               const SDL_Rect * dstrect, int blendMode,
   11.14 @@ -355,7 +355,7 @@
   11.15      }
   11.16  }
   11.17  
   11.18 -static void
   11.19 +static int
   11.20  SDL_SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect,
   11.21                    Uint32 color)
   11.22  {
   11.23 @@ -369,7 +369,7 @@
   11.24      b = (Uint8) (color & 0xFF);
   11.25      color = SDL_MapRGBA(data->target->format, r, g, b, a);
   11.26  
   11.27 -    SDL_FillRect(data->target, &real_rect, color);
   11.28 +    return SDL_FillRect(data->target, &real_rect, color);
   11.29  }
   11.30  
   11.31  static int
    12.1 --- a/src/video/SDL_surface.c	Wed Jun 28 08:12:07 2006 +0000
    12.2 +++ b/src/video/SDL_surface.c	Fri Jun 30 05:42:49 2006 +0000
    12.3 @@ -39,7 +39,6 @@
    12.4                       int width, int height, int depth,
    12.5                       Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
    12.6  {
    12.7 -    SDL_Surface *screen;
    12.8      SDL_Surface *surface;
    12.9  
   12.10      /* FIXME!! */
    13.1 --- a/src/video/SDL_sysvideo.h	Wed Jun 28 08:12:07 2006 +0000
    13.2 +++ b/src/video/SDL_sysvideo.h	Fri Jun 30 05:42:49 2006 +0000
    13.3 @@ -25,9 +25,6 @@
    13.4  #define _SDL_sysvideo_h
    13.5  
    13.6  #include "SDL_mouse.h"
    13.7 -#define SDL_PROTOTYPES_ONLY
    13.8 -#include "SDL_syswm.h"
    13.9 -#undef SDL_PROTOTYPES_ONLY
   13.10  
   13.11  /* The SDL video driver */
   13.12  
   13.13 @@ -78,8 +75,8 @@
   13.14                            int numrects, const SDL_Rect * rects);
   13.15      void (*SelectRenderTexture) (SDL_Renderer * renderer,
   13.16                                   SDL_Texture * texture);
   13.17 -    void (*RenderFill) (SDL_Renderer * renderer, const SDL_Rect * rect,
   13.18 -                        Uint32 color);
   13.19 +    int (*RenderFill) (SDL_Renderer * renderer, const SDL_Rect * rect,
   13.20 +                       Uint32 color);
   13.21      int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
   13.22                         const SDL_Rect * srcrect, const SDL_Rect * dstrect,
   13.23                         int blendMode, int scaleMode);
   13.24 @@ -208,7 +205,7 @@
   13.25  
   13.26      /* Get some platform dependent window information */
   13.27        SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
   13.28 -                                  SDL_SysWMinfo * info);
   13.29 +                                  struct SDL_SysWMinfo * info);
   13.30  
   13.31      /* Reverse the effects VideoInit() -- called if VideoInit() fails
   13.32         or if the application is shutting down the video subsystem.
   13.33 @@ -300,7 +297,7 @@
   13.34  
   13.35      /* * * */
   13.36      /* Data private to this driver */
   13.37 -    struct SDL_PrivateVideoData *hidden;
   13.38 +    void *driverdata;
   13.39      struct SDL_PrivateGLData *gl_data;
   13.40  
   13.41      /* * * */
    14.1 --- a/src/video/SDL_video.c	Wed Jun 28 08:12:07 2006 +0000
    14.2 +++ b/src/video/SDL_video.c	Fri Jun 30 05:42:49 2006 +0000
    14.3 @@ -177,8 +177,6 @@
    14.4      SDL_VideoDevice *video;
    14.5      int index;
    14.6      int i;
    14.7 -    int bpp;
    14.8 -    Uint32 Rmask, Gmask, Bmask, Amask;
    14.9  
   14.10      /* Toggle the event thread flags, based on OS requirements */
   14.11  #if defined(MUST_THREAD_EVENTS)
   14.12 @@ -524,7 +522,7 @@
   14.13  {
   14.14      SDL_VideoDisplay *display;
   14.15      SDL_DisplayMode display_mode;
   14.16 -    int i, ncolors;
   14.17 +    int ncolors;
   14.18  
   14.19      if (!_this) {
   14.20          SDL_SetError("Video subsystem has not been initialized");
   14.21 @@ -600,14 +598,13 @@
   14.22          SDL_SetError("Video subsystem has not been initialized");
   14.23          return -1;
   14.24      }
   14.25 -    if (!SDL_CurrentDisplay.palette) {
   14.26 +    palette = SDL_CurrentDisplay.palette;
   14.27 +    if (!palette) {
   14.28          SDL_SetError("Display mode does not have a palette");
   14.29          return -1;
   14.30      }
   14.31  
   14.32 -    status =
   14.33 -        SDL_SetPaletteColors(SDL_CurrentDisplay.palette, colors, firstcolor,
   14.34 -                             ncolors);
   14.35 +    status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
   14.36  
   14.37      if (_this->SetDisplayPalette) {
   14.38          if (_this->SetDisplayPalette(_this, palette) < 0) {
   14.39 @@ -1222,7 +1219,6 @@
   14.40      SDL_TextureID textureID;
   14.41      Uint32 surface_flags = surface->flags;
   14.42      SDL_PixelFormat *fmt = surface->format;
   14.43 -    Uint32 colorkey;
   14.44      Uint8 alpha;
   14.45      SDL_Rect bounds;
   14.46      SDL_Surface dst;
   14.47 @@ -1328,10 +1324,6 @@
   14.48      SDL_LowerBlit(surface, &bounds, &dst, &bounds);
   14.49  
   14.50      /* Clean up the original surface */
   14.51 -    if ((surface_flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
   14.52 -        Uint32 cflags = surface_flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK);
   14.53 -        SDL_SetColorKey(surface, cflags, colorkey);
   14.54 -    }
   14.55      if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
   14.56          Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
   14.57          if (fmt->Amask) {
   14.58 @@ -1524,7 +1516,7 @@
   14.59      if (!renderer->UnlockTexture) {
   14.60          return;
   14.61      }
   14.62 -    return renderer->UnlockTexture(renderer, texture);
   14.63 +    renderer->UnlockTexture(renderer, texture);
   14.64  }
   14.65  
   14.66  void
   14.67 @@ -1585,7 +1577,7 @@
   14.68          rect = &full_rect;
   14.69      }
   14.70  
   14.71 -    renderer->RenderFill(renderer, rect, color);
   14.72 +    return renderer->RenderFill(renderer, rect, color);
   14.73  }
   14.74  
   14.75  int
   14.76 @@ -1598,7 +1590,7 @@
   14.77      SDL_Rect full_dstrect;
   14.78  
   14.79      if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
   14.80 -        return;
   14.81 +        return -1;
   14.82      }
   14.83  
   14.84      renderer = SDL_CurrentDisplay.current_renderer;
   14.85 @@ -2042,7 +2034,7 @@
   14.86  #endif
   14.87  
   14.88  SDL_bool
   14.89 -SDL_GetWindowWMInfo(SDL_WindowID windowID, SDL_SysWMinfo * info)
   14.90 +SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo *info)
   14.91  {
   14.92      SDL_Window *window = SDL_GetWindowFromID(windowID);
   14.93  
    15.1 --- a/src/video/dummy/SDL_nullrender.c	Wed Jun 28 08:12:07 2006 +0000
    15.2 +++ b/src/video/dummy/SDL_nullrender.c	Fri Jun 30 05:42:49 2006 +0000
    15.3 @@ -50,7 +50,7 @@
    15.4       SDL_TextureBlendMode_None,
    15.5       SDL_TextureScaleMode_None,
    15.6       0,
    15.7 -     {},
    15.8 +     {0},
    15.9       0,
   15.10       0}
   15.11  };
   15.12 @@ -67,7 +67,6 @@
   15.13      SDL_DisplayMode *displayMode = &display->current_mode;
   15.14      SDL_Renderer *renderer;
   15.15      SDL_DUMMY_RenderData *data;
   15.16 -    int i, n;
   15.17      int bpp;
   15.18      Uint32 Rmask, Gmask, Bmask, Amask;
   15.19  
    16.1 --- a/src/video/dummy/SDL_nullvideo.c	Wed Jun 28 08:12:07 2006 +0000
    16.2 +++ b/src/video/dummy/SDL_nullvideo.c	Fri Jun 30 05:42:49 2006 +0000
    16.3 @@ -69,7 +69,6 @@
    16.4  static void
    16.5  DUMMY_DeleteDevice(SDL_VideoDevice * device)
    16.6  {
    16.7 -    SDL_free(device->hidden);
    16.8      SDL_free(device);
    16.9  }
   16.10  
   16.11 @@ -79,20 +78,14 @@
   16.12      SDL_VideoDevice *device;
   16.13  
   16.14      /* Initialize all variables that we clean on shutdown */
   16.15 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   16.16 -    if (device) {
   16.17 -        SDL_memset(device, 0, (sizeof *device));
   16.18 -        device->hidden = (struct SDL_PrivateVideoData *)
   16.19 -            SDL_malloc((sizeof *device->hidden));
   16.20 -    }
   16.21 -    if ((device == NULL) || (device->hidden == NULL)) {
   16.22 +    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
   16.23 +    if (!device) {
   16.24          SDL_OutOfMemory();
   16.25          if (device) {
   16.26              SDL_free(device);
   16.27          }
   16.28          return (0);
   16.29      }
   16.30 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   16.31  
   16.32      /* Set the function pointers */
   16.33      device->VideoInit = DUMMY_VideoInit;
    17.1 --- a/src/video/dummy/SDL_nullvideo.h	Wed Jun 28 08:12:07 2006 +0000
    17.2 +++ b/src/video/dummy/SDL_nullvideo.h	Fri Jun 30 05:42:49 2006 +0000
    17.3 @@ -26,17 +26,6 @@
    17.4  
    17.5  #include "../SDL_sysvideo.h"
    17.6  
    17.7 -/* Hidden "this" pointer for the video functions */
    17.8 -#define _THIS	SDL_VideoDevice *_this
    17.9 -
   17.10 -
   17.11 -/* Private display data */
   17.12 -
   17.13 -struct SDL_PrivateVideoData
   17.14 -{
   17.15 -    int unused;
   17.16 -};
   17.17 -
   17.18  #endif /* _SDL_nullvideo_h */
   17.19  
   17.20  /* vi: set ts=4 sw=4 expandtab: */
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/video/win32/SDL_win32keyboard.c	Fri Jun 30 05:42:49 2006 +0000
    18.3 @@ -0,0 +1,38 @@
    18.4 +/*
    18.5 +    SDL - Simple DirectMedia Layer
    18.6 +    Copyright (C) 1997-2006 Sam Lantinga
    18.7 +
    18.8 +    This library is free software; you can redistribute it and/or
    18.9 +    modify it under the terms of the GNU Lesser General Public
   18.10 +    License as published by the Free Software Foundation; either
   18.11 +    version 2.1 of the License, or (at your option) any later version.
   18.12 +
   18.13 +    This library is distributed in the hope that it will be useful,
   18.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18.16 +    Lesser General Public License for more details.
   18.17 +
   18.18 +    You should have received a copy of the GNU Lesser General Public
   18.19 +    License along with this library; if not, write to the Free Software
   18.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   18.21 +
   18.22 +    Sam Lantinga
   18.23 +    slouken@libsdl.org
   18.24 +*/
   18.25 +#include "SDL_config.h"
   18.26 +
   18.27 +#include "SDL_win32video.h"
   18.28 +
   18.29 +#include "../../events/SDL_keyboard_c.h"
   18.30 +
   18.31 +void
   18.32 +WIN_AddKeyboard(_THIS)
   18.33 +{
   18.34 +    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   18.35 +    SDL_Keyboard keyboard;
   18.36 +
   18.37 +    SDL_zero(keyboard);
   18.38 +    data->keyboard = SDL_AddKeyboard(&keyboard, -1);
   18.39 +}
   18.40 +
   18.41 +/* vi: set ts=4 sw=4 expandtab: */
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/video/win32/SDL_win32keyboard.h	Fri Jun 30 05:42:49 2006 +0000
    19.3 @@ -0,0 +1,31 @@
    19.4 +/*
    19.5 +    SDL - Simple DirectMedia Layer
    19.6 +    Copyright (C) 1997-2006 Sam Lantinga
    19.7 +
    19.8 +    This library is free software; you can redistribute it and/or
    19.9 +    modify it under the terms of the GNU Lesser General Public
   19.10 +    License as published by the Free Software Foundation; either
   19.11 +    version 2.1 of the License, or (at your option) any later version.
   19.12 +
   19.13 +    This library is distributed in the hope that it will be useful,
   19.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   19.16 +    Lesser General Public License for more details.
   19.17 +
   19.18 +    You should have received a copy of the GNU Lesser General Public
   19.19 +    License along with this library; if not, write to the Free Software
   19.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   19.21 +
   19.22 +    Sam Lantinga
   19.23 +    slouken@libsdl.org
   19.24 +*/
   19.25 +#include "SDL_config.h"
   19.26 +
   19.27 +#ifndef _SDL_win32keyboard_h
   19.28 +#define _SDL_win32keyboard_h
   19.29 +
   19.30 +extern void WIN_AddKeyboard(_THIS);
   19.31 +
   19.32 +#endif /* _SDL_win32keyboard_h */
   19.33 +
   19.34 +/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/video/win32/SDL_win32mouse.c	Fri Jun 30 05:42:49 2006 +0000
    20.3 @@ -0,0 +1,38 @@
    20.4 +/*
    20.5 +    SDL - Simple DirectMedia Layer
    20.6 +    Copyright (C) 1997-2006 Sam Lantinga
    20.7 +
    20.8 +    This library is free software; you can redistribute it and/or
    20.9 +    modify it under the terms of the GNU Lesser General Public
   20.10 +    License as published by the Free Software Foundation; either
   20.11 +    version 2.1 of the License, or (at your option) any later version.
   20.12 +
   20.13 +    This library is distributed in the hope that it will be useful,
   20.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   20.16 +    Lesser General Public License for more details.
   20.17 +
   20.18 +    You should have received a copy of the GNU Lesser General Public
   20.19 +    License along with this library; if not, write to the Free Software
   20.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   20.21 +
   20.22 +    Sam Lantinga
   20.23 +    slouken@libsdl.org
   20.24 +*/
   20.25 +#include "SDL_config.h"
   20.26 +
   20.27 +#include "SDL_win32video.h"
   20.28 +
   20.29 +#include "../../events/SDL_mouse_c.h"
   20.30 +
   20.31 +void
   20.32 +WIN_AddMouse(_THIS)
   20.33 +{
   20.34 +    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   20.35 +    SDL_Mouse mouse;
   20.36 +
   20.37 +    SDL_zero(mouse);
   20.38 +    data->mouse = SDL_AddMouse(&mouse, -1);
   20.39 +}
   20.40 +
   20.41 +/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/video/win32/SDL_win32mouse.h	Fri Jun 30 05:42:49 2006 +0000
    21.3 @@ -0,0 +1,31 @@
    21.4 +/*
    21.5 +    SDL - Simple DirectMedia Layer
    21.6 +    Copyright (C) 1997-2006 Sam Lantinga
    21.7 +
    21.8 +    This library is free software; you can redistribute it and/or
    21.9 +    modify it under the terms of the GNU Lesser General Public
   21.10 +    License as published by the Free Software Foundation; either
   21.11 +    version 2.1 of the License, or (at your option) any later version.
   21.12 +
   21.13 +    This library is distributed in the hope that it will be useful,
   21.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21.16 +    Lesser General Public License for more details.
   21.17 +
   21.18 +    You should have received a copy of the GNU Lesser General Public
   21.19 +    License along with this library; if not, write to the Free Software
   21.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   21.21 +
   21.22 +    Sam Lantinga
   21.23 +    slouken@libsdl.org
   21.24 +*/
   21.25 +#include "SDL_config.h"
   21.26 +
   21.27 +#ifndef _SDL_win32mouse_h
   21.28 +#define _SDL_win32mouse_h
   21.29 +
   21.30 +extern void WIN_AddMouse(_THIS);
   21.31 +
   21.32 +#endif /* _SDL_win32mouse_h */
   21.33 +
   21.34 +/* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/video/win32/SDL_win32video.c	Wed Jun 28 08:12:07 2006 +0000
    22.2 +++ b/src/video/win32/SDL_win32video.c	Fri Jun 30 05:42:49 2006 +0000
    22.3 @@ -21,6 +21,7 @@
    22.4  */
    22.5  #include "SDL_config.h"
    22.6  
    22.7 +#include "SDL_main.h"
    22.8  #include "SDL_video.h"
    22.9  #include "SDL_mouse.h"
   22.10  #include "../SDL_sysvideo.h"
   22.11 @@ -47,7 +48,7 @@
   22.12  WIN_DeleteDevice(SDL_VideoDevice * device)
   22.13  {
   22.14      SDL_UnregisterApp();
   22.15 -    SDL_free(device->hidden);
   22.16 +    SDL_free(device->driverdata);
   22.17      SDL_free(device);
   22.18  }
   22.19  
   22.20 @@ -59,20 +60,18 @@
   22.21      SDL_RegisterApp(NULL, 0, NULL);
   22.22  
   22.23      /* Initialize all variables that we clean on shutdown */
   22.24 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   22.25 +    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
   22.26      if (device) {
   22.27 -        SDL_memset(device, 0, (sizeof *device));
   22.28 -        device->hidden = (struct SDL_PrivateVideoData *)
   22.29 -            SDL_malloc((sizeof *device->hidden));
   22.30 +        device->driverdata =
   22.31 +            (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
   22.32      }
   22.33 -    if ((device == NULL) || (device->hidden == NULL)) {
   22.34 +    if (!device || !device->driverdata) {
   22.35          SDL_OutOfMemory();
   22.36          if (device) {
   22.37              SDL_free(device);
   22.38          }
   22.39          return NULL;
   22.40      }
   22.41 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   22.42  
   22.43      /* Set the function pointers */
   22.44      device->VideoInit = WIN_VideoInit;
   22.45 @@ -118,6 +117,9 @@
   22.46      SDL_zero(mode);
   22.47      SDL_AddDisplayMode(0, &mode);
   22.48  
   22.49 +    WIN_AddKeyboard(_this);
   22.50 +    WIN_AddMouse(_this);
   22.51 +
   22.52      /* We're done! */
   22.53      return 0;
   22.54  }
    23.1 --- a/src/video/win32/SDL_win32video.h	Wed Jun 28 08:12:07 2006 +0000
    23.2 +++ b/src/video/win32/SDL_win32video.h	Fri Jun 30 05:42:49 2006 +0000
    23.3 @@ -31,6 +31,8 @@
    23.4  #include <windows.h>
    23.5  
    23.6  #include "SDL_win32events.h"
    23.7 +#include "SDL_win32keyboard.h"
    23.8 +#include "SDL_win32mouse.h"
    23.9  #include "SDL_win32window.h"
   23.10  
   23.11  #ifdef UNICODE
   23.12 @@ -43,9 +45,11 @@
   23.13  
   23.14  /* Private display data */
   23.15  
   23.16 -struct SDL_PrivateVideoData
   23.17 +typedef struct
   23.18  {
   23.19 -};
   23.20 +    int mouse;
   23.21 +    int keyboard;
   23.22 +} SDL_VideoData;
   23.23  
   23.24  #endif /* _SDL_win32video_h */
   23.25  
    24.1 --- a/src/video/win32/SDL_win32window.c	Wed Jun 28 08:12:07 2006 +0000
    24.2 +++ b/src/video/win32/SDL_win32window.c	Fri Jun 30 05:42:49 2006 +0000
    24.3 @@ -25,6 +25,9 @@
    24.4  
    24.5  #include "SDL_win32video.h"
    24.6  
    24.7 +/* This is included after SDL_win32video.h, which includes windows.h */
    24.8 +#include "SDL_syswm.h"
    24.9 +
   24.10  
   24.11  static int
   24.12  SetupWindowData(SDL_Window * window, HWND hwnd, BOOL created)
   24.13 @@ -59,6 +62,8 @@
   24.14      /* Fill in the SDL window with the window data */
   24.15      {
   24.16          POINT point;
   24.17 +        point.x = 0;
   24.18 +        point.y = 0;
   24.19          if (ClientToScreen(hwnd, &point)) {
   24.20              window->x = point.x;
   24.21              window->y = point.y;
   24.22 @@ -385,8 +390,6 @@
   24.23  WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
   24.24  {
   24.25      HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
   24.26 -/* FIXME! */
   24.27 -#if 0
   24.28      if (info->version.major <= SDL_MAJOR_VERSION) {
   24.29          info->window = hwnd;
   24.30          /* FIXME! */
   24.31 @@ -397,7 +400,6 @@
   24.32                       SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
   24.33          return SDL_FALSE;
   24.34      }
   24.35 -#endif
   24.36  }
   24.37  
   24.38  /* vi: set ts=4 sw=4 expandtab: */
    25.1 --- a/src/video/win32/SDL_win32window.h	Wed Jun 28 08:12:07 2006 +0000
    25.2 +++ b/src/video/win32/SDL_win32window.h	Fri Jun 30 05:42:49 2006 +0000
    25.3 @@ -49,7 +49,7 @@
    25.4  extern void WIN_SetWindowGrab(_THIS, SDL_Window * window);
    25.5  extern void WIN_DestroyWindow(_THIS, SDL_Window * window);
    25.6  extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window,
    25.7 -                                    SDL_SysWMinfo * info);
    25.8 +                                    struct SDL_SysWMinfo *info);
    25.9  
   25.10  #endif /* _SDL_win32window_h */
   25.11