Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
authorSam Lantinga <slouken@libsdl.org>
Sun, 09 May 2010 20:47:22 -0700
changeset 44653e69e077cb95
parent 4464 fa77a6429698
child 4467 0baef09fe702
Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.

Plus, this lets me start implementing cursor support.
Makefile.in
include/SDL_events.h
include/SDL_input.h
include/SDL_keyboard.h
include/SDL_mouse.h
include/SDL_video.h
src/SDL_compat.c
src/events/SDL_keyboard.c
src/events/SDL_keyboard_c.h
src/events/SDL_mouse.c
src/events/SDL_mouse_c.h
src/video/cocoa/SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoavideo.h
src/video/cocoa/SDL_cocoawindow.m
src/video/uikit/SDL_uikitview.h
src/video/uikit/SDL_uikitview.m
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32keyboard.c
src/video/win32/SDL_win32keyboard.h
src/video/win32/SDL_win32modes.c
src/video/win32/SDL_win32mouse.c
src/video/win32/SDL_win32video.c
src/video/win32/SDL_win32video.h
src/video/win32/SDL_win32window.c
src/video/win32/wactab/pktdef.h
src/video/win32/wactab/wintab.h
src/video/win32/wactab/wintabx.h
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11keyboard.c
src/video/x11/SDL_x11mouse.c
src/video/x11/SDL_x11video.h
src/video/x11/SDL_x11window.c
test/common.c
test/testime.c
test/testintersections.c
     1.1 --- a/Makefile.in	Sun May 09 19:55:28 2010 -0700
     1.2 +++ b/Makefile.in	Sun May 09 20:47:22 2010 -0700
     1.3 @@ -44,7 +44,7 @@
     1.4  
     1.5  DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-Win32.zip WhatsNew Xcode Xcode-iPhoneOS
     1.6  
     1.7 -HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
     1.8 +HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_input.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
     1.9  
    1.10  LT_AGE      = @LT_AGE@
    1.11  LT_CURRENT  = @LT_CURRENT@
     2.1 --- a/include/SDL_events.h	Sun May 09 19:55:28 2010 -0700
     2.2 +++ b/include/SDL_events.h	Sun May 09 20:47:22 2010 -0700
     2.3 @@ -75,9 +75,13 @@
     2.4      SDL_MOUSEBUTTONUP,          /**< Mouse button released */
     2.5      SDL_MOUSEWHEEL,             /**< Mouse wheel motion */
     2.6  
     2.7 -    /* Tablet events */
     2.8 -    SDL_PROXIMITYIN    = 0x500, /**< Proximity In event */
     2.9 -    SDL_PROXIMITYOUT,           /**< Proximity Out event */
    2.10 +    /* Tablet or multiple mice input device events */
    2.11 +    SDL_INPUTMOTION    = 0x500, /**< Input moved */
    2.12 +    SDL_INPUTBUTTONDOWN,        /**< Input button pressed */
    2.13 +    SDL_INPUTBUTTONUP,          /**< Input button released */
    2.14 +    SDL_INPUTWHEEL,             /**< Input wheel motion */
    2.15 +    SDL_INPUTPROXIMITYIN,       /**< Input pen entered proximity */
    2.16 +    SDL_INPUTPROXIMITYOUT,      /**< Input pen left proximity */
    2.17  
    2.18      /* Joystick events */
    2.19      SDL_JOYAXISMOTION  = 0x600, /**< Joystick axis motion */
    2.20 @@ -124,10 +128,10 @@
    2.21  {
    2.22      Uint32 type;        /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
    2.23      Uint32 windowID;    /**< The window with keyboard focus, if any */
    2.24 -    Uint8 which;        /**< The keyboard device index */
    2.25      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    2.26      Uint8 padding1;
    2.27      Uint8 padding2;
    2.28 +    Uint8 padding3;
    2.29      SDL_keysym keysym;  /**< The key that was pressed or released */
    2.30  } SDL_KeyboardEvent;
    2.31  
    2.32 @@ -139,7 +143,6 @@
    2.33  {
    2.34      Uint32 type;                                /**< ::SDL_TEXTEDITING */
    2.35      Uint32 windowID;                            /**< The window with keyboard focus, if any */
    2.36 -    Uint8 which;                                /**< The keyboard device index */
    2.37      char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE];  /**< The editing text */
    2.38      int start;                                  /**< The start cursor of selected editing text */
    2.39      int length;                                 /**< The length of selected editing text */
    2.40 @@ -154,10 +157,6 @@
    2.41  {
    2.42      Uint32 type;                              /**< ::SDL_TEXTINPUT */
    2.43      Uint32 windowID;                          /**< The window with keyboard focus, if any */
    2.44 -    Uint8 which;                              /**< The keyboard device index */
    2.45 -    Uint8 padding1;
    2.46 -    Uint8 padding2;
    2.47 -    Uint8 padding3;
    2.48      char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];  /**< The input text */
    2.49  } SDL_TextInputEvent;
    2.50  
    2.51 @@ -168,20 +167,12 @@
    2.52  {
    2.53      Uint32 type;        /**< ::SDL_MOUSEMOTION */
    2.54      Uint32 windowID;    /**< The window with mouse focus, if any */
    2.55 -    Uint8 which;        /**< The mouse device index */
    2.56      Uint8 state;        /**< The current button state */
    2.57      Uint8 padding1;
    2.58      Uint8 padding2;
    2.59 +    Uint8 padding3;
    2.60      int x;              /**< X coordinate, relative to window */
    2.61      int y;              /**< Y coordinate, relative to window */
    2.62 -    int z;              /**< Z coordinate, for future use */
    2.63 -    int pressure;       /**< Pressure reported by tablets */
    2.64 -    int pressure_max;   /**< Maximum value of the pressure reported by the device */
    2.65 -    int pressure_min;   /**< Minimum value of the pressure reported by the device */
    2.66 -    int rotation;       /**< For future use */
    2.67 -    int tilt_x;         /**< For future use */
    2.68 -    int tilt_y;         /**< For future use */
    2.69 -    int cursor;         /**< The cursor being used in the event */
    2.70      int xrel;           /**< The relative motion in the X direction */
    2.71      int yrel;           /**< The relative motion in the Y direction */
    2.72  } SDL_MouseMotionEvent;
    2.73 @@ -193,10 +184,10 @@
    2.74  {
    2.75      Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
    2.76      Uint32 windowID;    /**< The window with mouse focus, if any */
    2.77 -    Uint8 which;        /**< The mouse device index */
    2.78      Uint8 button;       /**< The mouse button index */
    2.79      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    2.80      Uint8 padding1;
    2.81 +    Uint8 padding2;
    2.82      int x;              /**< X coordinate, relative to window */
    2.83      int y;              /**< Y coordinate, relative to window */
    2.84  } SDL_MouseButtonEvent;
    2.85 @@ -208,31 +199,11 @@
    2.86  {
    2.87      Uint32 type;        /**< ::SDL_MOUSEWHEEL */
    2.88      Uint32 windowID;    /**< The window with mouse focus, if any */
    2.89 -    Uint8 which;        /**< The mouse device index */
    2.90 -    Uint8 padding1;
    2.91 -    Uint8 padding2;
    2.92 -    Uint8 padding3;
    2.93      int x;              /**< The amount scrolled horizontally */
    2.94      int y;              /**< The amount scrolled vertically */
    2.95  } SDL_MouseWheelEvent;
    2.96  
    2.97  /**
    2.98 - * \brief Tablet pen proximity event
    2.99 - */
   2.100 -typedef struct SDL_ProximityEvent
   2.101 -{
   2.102 -    Uint32 type;        /**< ::SDL_PROXIMITYIN or ::SDL_PROXIMITYOUT */
   2.103 -    Uint32 windowID;    /**< The associated window */
   2.104 -    Uint8 which;
   2.105 -    Uint8 padding1;
   2.106 -    Uint8 padding2;
   2.107 -    Uint8 padding3;
   2.108 -    int cursor;
   2.109 -    int x;
   2.110 -    int y;
   2.111 -} SDL_ProximityEvent;
   2.112 -
   2.113 -/**
   2.114   *  \brief Joystick axis motion event structure (event.jaxis.*)
   2.115   */
   2.116  typedef struct SDL_JoyAxisEvent
   2.117 @@ -371,7 +342,6 @@
   2.118      SDL_QuitEvent quit;             /**< Quit request event data */
   2.119      SDL_UserEvent user;             /**< Custom event data */
   2.120      SDL_SysWMEvent syswm;           /**< System dependent window event data */
   2.121 -    SDL_ProximityEvent proximity;   /**< Proximity In or Out event */
   2.122  
   2.123      /** Temporarily here for backwards compatibility */
   2.124      /*@{*/
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/include/SDL_input.h	Sun May 09 20:47:22 2010 -0700
     3.3 @@ -0,0 +1,88 @@
     3.4 +/*
     3.5 +    SDL - Simple DirectMedia Layer
     3.6 +    Copyright (C) 1997-2010 Sam Lantinga
     3.7 +
     3.8 +    This library is free software; you can redistribute it and/or
     3.9 +    modify it under the terms of the GNU Lesser General Public
    3.10 +    License as published by the Free Software Foundation; either
    3.11 +    version 2.1 of the License, or (at your option) any later version.
    3.12 +
    3.13 +    This library is distributed in the hope that it will be useful,
    3.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 +    Lesser General Public License for more details.
    3.17 +
    3.18 +    You should have received a copy of the GNU Lesser General Public
    3.19 +    License along with this library; if not, write to the Free Software
    3.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    3.21 +
    3.22 +    Sam Lantinga
    3.23 +    slouken@libsdl.org
    3.24 +*/
    3.25 +
    3.26 +/**
    3.27 + *  \file SDL_input.h
    3.28 + *  
    3.29 + *  Include file for lowlevel SDL input device handling.
    3.30 + *
    3.31 + *  This talks about individual devices, and not the system cursor. If you
    3.32 + *  just want to know when the user moves the pointer somewhere in your
    3.33 + *  window, this is NOT the API you want. This one handles things like
    3.34 + *  multi-touch, drawing tablets, and multiple, separate mice.
    3.35 + *
    3.36 + *  The other API is in SDL_mouse.h
    3.37 + */
    3.38 +
    3.39 +#ifndef _SDL_input_h
    3.40 +#define _SDL_input_h
    3.41 +
    3.42 +#include "SDL_stdinc.h"
    3.43 +#include "SDL_error.h"
    3.44 +#include "SDL_video.h"
    3.45 +
    3.46 +#include "begin_code.h"
    3.47 +/* Set up for C function definitions, even when using C++ */
    3.48 +#ifdef __cplusplus
    3.49 +/* *INDENT-OFF* */
    3.50 +extern "C" {
    3.51 +/* *INDENT-ON* */
    3.52 +#endif
    3.53 +
    3.54 +
    3.55 +/* Function prototypes */
    3.56 +
    3.57 +/* !!! FIXME: real documentation
    3.58 + * - Redetect devices
    3.59 + * - This invalidates all existing device information from previous queries!
    3.60 + * - There is an implicit (re)detect upon SDL_Init().
    3.61 + */
    3.62 +extern DECLSPEC int SDLCALL SDL_RedetectInputDevices(void);
    3.63 +
    3.64 +/**
    3.65 + *  \brief Get the number of mouse input devices available.
    3.66 + */
    3.67 +extern DECLSPEC int SDLCALL SDL_GetNumInputDevices(void);
    3.68 +
    3.69 +/**
    3.70 + *  \brief Gets the name of a device with the given index.
    3.71 + *  
    3.72 + *  \param index is the index of the device, whose name is to be returned.
    3.73 + *  
    3.74 + *  \return the name of the device with the specified index
    3.75 + */
    3.76 +extern DECLSPEC const char *SDLCALL SDL_GetInputDeviceName(int index);
    3.77 +
    3.78 +
    3.79 +extern DECLSPEC int SDLCALL SDL_IsDeviceDisconnected(int index);
    3.80 +
    3.81 +/* Ends C function definitions when using C++ */
    3.82 +#ifdef __cplusplus
    3.83 +/* *INDENT-OFF* */
    3.84 +}
    3.85 +/* *INDENT-ON* */
    3.86 +#endif
    3.87 +#include "close_code.h"
    3.88 +
    3.89 +#endif /* _SDL_mouse_h */
    3.90 +
    3.91 +/* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/include/SDL_keyboard.h	Sun May 09 19:55:28 2010 -0700
     4.2 +++ b/include/SDL_keyboard.h	Sun May 09 20:47:22 2010 -0700
     4.3 @@ -32,6 +32,7 @@
     4.4  #include "SDL_stdinc.h"
     4.5  #include "SDL_error.h"
     4.6  #include "SDL_keysym.h"
     4.7 +#include "SDL_video.h"
     4.8  
     4.9  #include "begin_code.h"
    4.10  /* Set up for C function definitions, even when using C++ */
    4.11 @@ -55,25 +56,12 @@
    4.12  /* Function prototypes */
    4.13  
    4.14  /**
    4.15 - *  \brief Get the number of keyboard input devices available.
    4.16 - *  
    4.17 - *  \sa SDL_SelectKeyboard()
    4.18 + *  \brief Get the window which currently has keyboard focus.
    4.19   */
    4.20 -extern DECLSPEC int SDLCALL SDL_GetNumKeyboards(void);
    4.21 +extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
    4.22  
    4.23  /**
    4.24 - *  \brief Set the index of the currently selected keyboard.
    4.25 - *  
    4.26 - *  \return The index of the previously selected keyboard.
    4.27 - *  
    4.28 - *  \note You can query the currently selected keyboard by passing an index of -1.
    4.29 - *  
    4.30 - *  \sa SDL_GetNumKeyboards()
    4.31 - */
    4.32 -extern DECLSPEC int SDLCALL SDL_SelectKeyboard(int index);
    4.33 -
    4.34 -/**
    4.35 - *  \brief Get a snapshot of the current state of the selected keyboard.
    4.36 + *  \brief Get a snapshot of the current state of the keyboard.
    4.37   *  
    4.38   *  \param numkeys if non-NULL, receives the length of the returned array.
    4.39   *  
    4.40 @@ -90,20 +78,20 @@
    4.41  extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
    4.42  
    4.43  /**
    4.44 - *  \brief Get the current key modifier state for the selected keyboard.
    4.45 + *  \brief Get the current key modifier state for the keyboard.
    4.46   */
    4.47  extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
    4.48  
    4.49  /**
    4.50 - *  \brief Set the current key modifier state for the selected keyboard.
    4.51 + *  \brief Set the current key modifier state for the keyboard.
    4.52   *  
    4.53   *  \note This does not change the keyboard state, only the key modifier flags.
    4.54   */
    4.55  extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
    4.56  
    4.57  /**
    4.58 - *  \brief Get the key code corresponding to the given scancode according to the
    4.59 - *         current keyboard layout.
    4.60 + *  \brief Get the key code corresponding to the given scancode according
    4.61 + *         to the current keyboard layout.
    4.62   *  
    4.63   *  See ::SDLKey for details.
    4.64   *  
     5.1 --- a/include/SDL_mouse.h	Sun May 09 19:55:28 2010 -0700
     5.2 +++ b/include/SDL_mouse.h	Sun May 09 20:47:22 2010 -0700
     5.3 @@ -24,6 +24,22 @@
     5.4   *  \file SDL_mouse.h
     5.5   *  
     5.6   *  Include file for SDL mouse event handling.
     5.7 + *
     5.8 + *  Please note that this ONLY discusses "mice" with the notion of the
     5.9 + *  desktop GUI. You (usually) have one system cursor, and the OS hides
    5.10 + *  the hardware details from you. If you plug in 10 mice, all ten move that
    5.11 + *  one cursor. For many applications and games, this is perfect, and this
    5.12 + *  API has served hundreds of SDL programs well since its birth.
    5.13 + *
    5.14 + *  It's not the whole picture, though. If you want more lowlevel control,
    5.15 + *  SDL offers a different API, that gives you visibility into each input
    5.16 + *  device, multi-touch interfaces, etc.
    5.17 + *
    5.18 + *  Those two APIs are incompatible, and you usually should not use both
    5.19 + *  at the same time. But for legacy purposes, this API refers to a "mouse"
    5.20 + *  when it actually means the system pointer and not a physical mouse.
    5.21 + *
    5.22 + *  The other API is in SDL_input.h
    5.23   */
    5.24  
    5.25  #ifndef _SDL_mouse_h
    5.26 @@ -43,45 +59,50 @@
    5.27  
    5.28  typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
    5.29  
    5.30 +
    5.31  /* Function prototypes */
    5.32  
    5.33  /**
    5.34 - *  \brief Get the number of mouse input devices available.
    5.35 - *  
    5.36 - *  \sa SDL_SelectMouse()
    5.37 + *  \brief Get the window which currently has mouse focus.
    5.38   */
    5.39 -extern DECLSPEC int SDLCALL SDL_GetNumMice(void);
    5.40 +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
    5.41  
    5.42  /**
    5.43 - *  \brief Gets the name of a mouse with the given index.
    5.44 + *  \brief Retrieve the current state of the mouse.
    5.45   *  
    5.46 - *  \param index is the index of the mouse, which name is to be returned.
    5.47 - *  
    5.48 - *  \return the name of the mouse with the specified index
    5.49 + *  The current button state is returned as a button bitmask, which can
    5.50 + *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    5.51 + *  mouse cursor position relative to the focus window for the currently
    5.52 + *  selected mouse.  You can pass NULL for either x or y.
    5.53   */
    5.54 -extern DECLSPEC char *SDLCALL SDL_GetMouseName(int index);
    5.55 +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
    5.56  
    5.57  /**
    5.58 - *  \brief Set the index of the currently selected mouse.
    5.59 - *  
    5.60 - *  \return The index of the previously selected mouse.
    5.61 - *  
    5.62 - *  \note You can query the currently selected mouse by passing an index of -1.
    5.63 - *  
    5.64 - *  \sa SDL_GetNumMice()
    5.65 + *  \brief Retrieve the relative state of the mouse.
    5.66 + *
    5.67 + *  The current button state is returned as a button bitmask, which can
    5.68 + *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    5.69 + *  mouse deltas since the last call to SDL_GetRelativeMouseState().
    5.70   */
    5.71 -extern DECLSPEC int SDLCALL SDL_SelectMouse(int index);
    5.72 +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
    5.73  
    5.74  /**
    5.75 - *  \brief Get the window which currently has focus for the specified mouse.
    5.76 + *  \brief Moves the mouse to the given position within the window.
    5.77 + *  
    5.78 + *  \param window The window to move the mouse into, or NULL for the current mouse focus
    5.79 + *  \param x The x coordinate within the window
    5.80 + *  \param y The y coordinate within the window
    5.81 + *  
    5.82 + *  \note This function generates a mouse motion event
    5.83   */
    5.84 -extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocusWindow(int index);
    5.85 +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
    5.86 +                                                   int x, int y);
    5.87  
    5.88  /**
    5.89 - *  \brief Set relative mouse mode for the specified mouse.
    5.90 + *  \brief Set relative mouse mode.
    5.91   *  
    5.92   *  \param enabled Whether or not to enable relative mode
    5.93 - *  
    5.94 + *
    5.95   *  \return 0 on success, or -1 if relative mode is not supported.
    5.96   *  
    5.97   *  While the mouse is in relative mode, the cursor is hidden, and the
    5.98 @@ -93,51 +114,18 @@
    5.99   *  
   5.100   *  \sa SDL_GetRelativeMouseMode()
   5.101   */
   5.102 -extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index,
   5.103 -                                                     SDL_bool enabled);
   5.104 +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
   5.105  
   5.106  /**
   5.107 - *  \brief Query whether relative mouse mode is enabled for the specified mouse.
   5.108 + *  \brief Query whether relative mouse mode is enabled.
   5.109   *  
   5.110   *  \sa SDL_SetRelativeMouseMode()
   5.111   */
   5.112 -extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index);
   5.113 +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
   5.114  
   5.115  /**
   5.116 - *  \brief Retrieve the current state of the specified mouse.
   5.117 - *  
   5.118 - *  The current button state is returned as a button bitmask, which can
   5.119 - *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   5.120 - *  mouse cursor position relative to the focus window for the currently
   5.121 - *  selected mouse.  You can pass NULL for either x or y.
   5.122 - */
   5.123 -extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
   5.124 -
   5.125 -/**
   5.126 - *  \brief Retrieve the state of the specified mouse.
   5.127 - *
   5.128 - *  The current button state is returned as a button bitmask, which can
   5.129 - *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   5.130 - *  mouse deltas since the last call to SDL_GetRelativeMouseState().
   5.131 - */
   5.132 -extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x,
   5.133 -                                                        int *y);
   5.134 -
   5.135 -/**
   5.136 - *  \brief Moves the currently selected mouse to the given position within the window.
   5.137 - *  
   5.138 - *  \param window The window to move the mouse into, or NULL for the current mouse focus
   5.139 - *  \param x The x coordinate within the window
   5.140 - *  \param y The y coordinate within the window
   5.141 - *  
   5.142 - *  \note This function generates a mouse motion event
   5.143 - */
   5.144 -extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
   5.145 -                                                   int x, int y);
   5.146 -
   5.147 -/**
   5.148 - *  \brief Create a cursor for the currently selected mouse, using the
   5.149 - *         specified bitmap data and mask (in MSB format).
   5.150 + *  \brief Create a cursor, using the specified bitmap data and
   5.151 + *         mask (in MSB format).
   5.152   *  
   5.153   *  The cursor width must be a multiple of 8 bits.
   5.154   *  
   5.155 @@ -148,7 +136,7 @@
   5.156   *  <tr><td>  1   </td><td>  1   </td><td> Black </td></tr>
   5.157   *  <tr><td>  0   </td><td>  0   </td><td> Transparent </td></tr>
   5.158   *  <tr><td>  1   </td><td>  0   </td><td> Inverted color if possible, black 
   5.159 -                                           if not. </td></tr>
   5.160 + *                                         if not. </td></tr>
   5.161   *  </table>
   5.162   *  
   5.163   *  \sa SDL_FreeCursor()
   5.164 @@ -159,14 +147,12 @@
   5.165                                                       int hot_y);
   5.166  
   5.167  /**
   5.168 - *  \brief Set the active cursor for the currently selected mouse.
   5.169 - *  
   5.170 - *  \note The cursor must have been created for the selected mouse.
   5.171 + *  \brief Set the active cursor.
   5.172   */
   5.173  extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
   5.174  
   5.175  /**
   5.176 - *  \brief Return the active cursor for the currently selected mouse.
   5.177 + *  \brief Return the active cursor.
   5.178   */
   5.179  extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
   5.180  
   5.181 @@ -178,8 +164,7 @@
   5.182  extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
   5.183  
   5.184  /**
   5.185 - *  \brief Toggle whether or not the cursor is shown for the currently selected 
   5.186 - *         mouse.
   5.187 + *  \brief Toggle whether or not the cursor is shown.
   5.188   *  
   5.189   *  \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current 
   5.190   *                state.
   5.191 @@ -189,38 +174,6 @@
   5.192  extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
   5.193  
   5.194  /**
   5.195 - *  \brief Gets the number of cursors a pointing device supports.
   5.196 - *  
   5.197 - *  Useful for tablet users. Useful only under Windows.
   5.198 - *  
   5.199 - *  \param index is the index of the pointing device, which number of cursors we
   5.200 - *               want to receive.
   5.201 - *  
   5.202 - *  \return the number of cursors supported by the pointing device. On Windows
   5.203 - *          if a device is a tablet it returns a number >=1. Normal mice always 
   5.204 - *          return 1.
   5.205 - *  
   5.206 - *  On Linux every device reports one cursor.
   5.207 - */
   5.208 -extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index);
   5.209 -
   5.210 -/**
   5.211 - *  \brief Returns the index of the current cursor used by a specific pointing
   5.212 - *         device.
   5.213 - *  
   5.214 - *  Useful only under Windows.
   5.215 - *  
   5.216 - *  \param index is the index of the pointing device, which cursor index we want
   5.217 - *               to receive.
   5.218 - *  
   5.219 - *  \return the index of the cursor currently used by a specific pointing 
   5.220 - *          device.  Always 0 under Linux. On Windows if the device isn't a 
   5.221 - *          tablet it returns 0.  If the device is the tablet it returns the 
   5.222 - *          cursor index.  0 - stylus, 1 - eraser, 2 - cursor.
   5.223 - */
   5.224 -extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index);
   5.225 -
   5.226 -/**
   5.227   *  Used as a mask when testing buttons in buttonstate.
   5.228   *   - Button 1:  Left mouse button
   5.229   *   - Button 2:  Middle mouse button
     6.1 --- a/include/SDL_video.h	Sun May 09 19:55:28 2010 -0700
     6.2 +++ b/include/SDL_video.h	Sun May 09 20:47:22 2010 -0700
     6.3 @@ -88,7 +88,6 @@
     6.4   *  \sa SDL_SetWindowTitle()
     6.5   *  \sa SDL_ShowWindow()
     6.6   */
     6.7 -struct SDL_Window;
     6.8  typedef struct SDL_Window SDL_Window;
     6.9  
    6.10  /**
     7.1 --- a/src/SDL_compat.c	Sun May 09 19:55:28 2010 -0700
     7.2 +++ b/src/SDL_compat.c	Sun May 09 20:47:22 2010 -0700
     7.3 @@ -277,16 +277,13 @@
     7.4      case SDL_MOUSEWHEEL:
     7.5          {
     7.6              Uint8 button;
     7.7 -            int selected;
     7.8              int x, y;
     7.9  
    7.10              if (event->wheel.y == 0) {
    7.11                  break;
    7.12              }
    7.13  
    7.14 -            selected = SDL_SelectMouse(event->wheel.which);
    7.15              SDL_GetMouseState(&x, &y);
    7.16 -            SDL_SelectMouse(selected);
    7.17  
    7.18              if (event->wheel.y > 0) {
    7.19                  button = SDL_BUTTON_WHEELUP;
    7.20 @@ -294,7 +291,6 @@
    7.21                  button = SDL_BUTTON_WHEELDOWN;
    7.22              }
    7.23  
    7.24 -            fake.button.which = event->wheel.which;
    7.25              fake.button.button = button;
    7.26              fake.button.x = x;
    7.27              fake.button.y = y;
     8.1 --- a/src/events/SDL_keyboard.c	Sun May 09 19:55:28 2010 -0700
     8.2 +++ b/src/events/SDL_keyboard.c	Sun May 09 20:47:22 2010 -0700
     8.3 @@ -30,9 +30,19 @@
     8.4  
     8.5  
     8.6  /* Global keyboard information */
     8.7 -static int SDL_num_keyboards;
     8.8 -static int SDL_current_keyboard;
     8.9 -static SDL_Keyboard **SDL_keyboards;
    8.10 +
    8.11 +typedef struct SDL_Keyboard SDL_Keyboard;
    8.12 +
    8.13 +struct SDL_Keyboard
    8.14 +{
    8.15 +    /* Data common to all keyboards */
    8.16 +    SDL_Window *focus;
    8.17 +    Uint16 modstate;
    8.18 +    Uint8 keystate[SDL_NUM_SCANCODES];
    8.19 +    SDLKey keymap[SDL_NUM_SCANCODES];
    8.20 +};
    8.21 +
    8.22 +static SDL_Keyboard SDL_keyboard;
    8.23  
    8.24  static const SDLKey SDL_default_keymap[SDL_NUM_SCANCODES] = {
    8.25      0, 0, 0, 0,
    8.26 @@ -544,75 +554,15 @@
    8.27      return (0);
    8.28  }
    8.29  
    8.30 -SDL_Keyboard *
    8.31 -SDL_GetKeyboard(int index)
    8.32 +void
    8.33 +SDL_ResetKeyboard(void)
    8.34  {
    8.35 -    if (index < 0 || index >= SDL_num_keyboards) {
    8.36 -        return NULL;
    8.37 -    }
    8.38 -    return SDL_keyboards[index];
    8.39 -}
    8.40 -
    8.41 -int
    8.42 -SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index)
    8.43 -{
    8.44 -    SDL_Keyboard **keyboards;
    8.45 -
    8.46 -    /* Add the keyboard to the list of keyboards */
    8.47 -    if (index < 0 || index >= SDL_num_keyboards || SDL_keyboards[index]) {
    8.48 -        keyboards =
    8.49 -            (SDL_Keyboard **) SDL_realloc(SDL_keyboards,
    8.50 -                                          (SDL_num_keyboards +
    8.51 -                                           1) * sizeof(*keyboards));
    8.52 -        if (!keyboards) {
    8.53 -            SDL_OutOfMemory();
    8.54 -            return -1;
    8.55 -        }
    8.56 -
    8.57 -        SDL_keyboards = keyboards;
    8.58 -        index = SDL_num_keyboards++;
    8.59 -    }
    8.60 -    SDL_keyboards[index] =
    8.61 -        (SDL_Keyboard *) SDL_malloc(sizeof(*SDL_keyboards[index]));
    8.62 -    if (!SDL_keyboards[index]) {
    8.63 -        SDL_OutOfMemory();
    8.64 -        return -1;
    8.65 -    }
    8.66 -    *SDL_keyboards[index] = *keyboard;
    8.67 -
    8.68 -    return index;
    8.69 -}
    8.70 -
    8.71 -void
    8.72 -SDL_DelKeyboard(int index)
    8.73 -{
    8.74 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
    8.75 -
    8.76 -    if (!keyboard) {
    8.77 -        return;
    8.78 -    }
    8.79 -
    8.80 -    if (keyboard->FreeKeyboard) {
    8.81 -        keyboard->FreeKeyboard(keyboard);
    8.82 -    }
    8.83 -    SDL_free(keyboard);
    8.84 -
    8.85 -    SDL_keyboards[index] = NULL;
    8.86 -}
    8.87 -
    8.88 -void
    8.89 -SDL_ResetKeyboard(int index)
    8.90 -{
    8.91 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
    8.92 +    SDL_Keyboard *keyboard = &SDL_keyboard;
    8.93      SDL_scancode scancode;
    8.94  
    8.95 -    if (!keyboard) {
    8.96 -        return;
    8.97 -    }
    8.98 -
    8.99      for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
   8.100          if (keyboard->keystate[scancode] == SDL_PRESSED) {
   8.101 -            SDL_SendKeyboardKey(index, SDL_RELEASED, scancode);
   8.102 +            SDL_SendKeyboardKey(SDL_RELEASED, scancode);
   8.103          }
   8.104      }
   8.105  }
   8.106 @@ -624,13 +574,9 @@
   8.107  }
   8.108  
   8.109  void
   8.110 -SDL_SetKeymap(int index, int start, SDLKey * keys, int length)
   8.111 +SDL_SetKeymap(int start, SDLKey * keys, int length)
   8.112  {
   8.113 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
   8.114 -
   8.115 -    if (!keyboard) {
   8.116 -        return;
   8.117 -    }
   8.118 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.119  
   8.120      if (start < 0 || start + length > SDL_NUM_SCANCODES) {
   8.121          return;
   8.122 @@ -645,33 +591,23 @@
   8.123      SDL_scancode_names[scancode] = name;
   8.124  }
   8.125  
   8.126 +SDL_Window *
   8.127 +SDL_GetKeyboardFocus(void)
   8.128 +{
   8.129 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.130 +
   8.131 +    return keyboard->focus;
   8.132 +}
   8.133 +
   8.134  void
   8.135 -SDL_SetKeyboardFocus(int index, SDL_Window * window)
   8.136 +SDL_SetKeyboardFocus(SDL_Window * window)
   8.137  {
   8.138 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
   8.139 -    int i;
   8.140 -    SDL_bool focus;
   8.141 -
   8.142 -    if (!keyboard) {
   8.143 -        return;
   8.144 -    }
   8.145 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.146  
   8.147      /* See if the current window has lost focus */
   8.148      if (keyboard->focus && keyboard->focus != window) {
   8.149 -        focus = SDL_FALSE;
   8.150 -        for (i = 0; i < SDL_num_keyboards; ++i) {
   8.151 -            if (i != index) {
   8.152 -                SDL_Keyboard *check = SDL_GetKeyboard(i);
   8.153 -                if (check && check->focus == keyboard->focus) {
   8.154 -                    focus = SDL_TRUE;
   8.155 -                    break;
   8.156 -                }
   8.157 -            }
   8.158 -        }
   8.159 -        if (!focus) {
   8.160 -            SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
   8.161 -                                0, 0);
   8.162 -        }
   8.163 +        SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
   8.164 +                            0, 0);
   8.165      }
   8.166  
   8.167      keyboard->focus = window;
   8.168 @@ -687,14 +623,14 @@
   8.169  }
   8.170  
   8.171  int
   8.172 -SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode)
   8.173 +SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode)
   8.174  {
   8.175 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
   8.176 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.177      int posted;
   8.178      Uint16 modstate;
   8.179      Uint32 type;
   8.180  
   8.181 -    if (!keyboard || !scancode) {
   8.182 +    if (!scancode) {
   8.183          return 0;
   8.184      }
   8.185  #if 0
   8.186 @@ -807,7 +743,6 @@
   8.187      if (SDL_GetEventState(type) == SDL_ENABLE) {
   8.188          SDL_Event event;
   8.189          event.key.type = type;
   8.190 -        event.key.which = (Uint8) index;
   8.191          event.key.state = state;
   8.192          event.key.keysym.scancode = scancode;
   8.193          event.key.keysym.sym = keyboard->keymap[scancode];
   8.194 @@ -820,22 +755,17 @@
   8.195  }
   8.196  
   8.197  int
   8.198 -SDL_SendKeyboardText(int index, const char *text)
   8.199 +SDL_SendKeyboardText(const char *text)
   8.200  {
   8.201 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
   8.202 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.203      int posted;
   8.204  
   8.205 -    if (!keyboard) {
   8.206 -        return 0;
   8.207 -    }
   8.208 -
   8.209      /* Post the event, if desired */
   8.210      posted = 0;
   8.211      if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
   8.212          SDL_Event event;
   8.213          event.text.type = SDL_TEXTINPUT;
   8.214          event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
   8.215 -        event.text.which = (Uint8) index;
   8.216          SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
   8.217          event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
   8.218          posted = (SDL_PushEvent(&event) > 0);
   8.219 @@ -844,22 +774,17 @@
   8.220  }
   8.221  
   8.222  int
   8.223 -SDL_SendEditingText(int index, const char *text, int start, int length)
   8.224 +SDL_SendEditingText(const char *text, int start, int length)
   8.225  {
   8.226 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
   8.227 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.228      int posted;
   8.229  
   8.230 -    if (!keyboard) {
   8.231 -        return 0;
   8.232 -    }
   8.233 -
   8.234      /* Post the event, if desired */
   8.235      posted = 0;
   8.236      if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) {
   8.237          SDL_Event event;
   8.238          event.edit.type = SDL_TEXTEDITING;
   8.239          event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
   8.240 -        event.text.which = (Uint8) index;
   8.241          event.edit.start = start;
   8.242          event.edit.length = length;
   8.243          SDL_strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
   8.244 @@ -871,93 +796,49 @@
   8.245  void
   8.246  SDL_KeyboardQuit(void)
   8.247  {
   8.248 -    int i;
   8.249 -
   8.250 -    for (i = 0; i < SDL_num_keyboards; ++i) {
   8.251 -        SDL_DelKeyboard(i);
   8.252 -    }
   8.253 -    SDL_num_keyboards = 0;
   8.254 -    SDL_current_keyboard = 0;
   8.255 -
   8.256 -    if (SDL_keyboards) {
   8.257 -        SDL_free(SDL_keyboards);
   8.258 -        SDL_keyboards = NULL;
   8.259 -    }
   8.260 -}
   8.261 -
   8.262 -int
   8.263 -SDL_GetNumKeyboards(void)
   8.264 -{
   8.265 -    return SDL_num_keyboards;
   8.266 -}
   8.267 -
   8.268 -int
   8.269 -SDL_SelectKeyboard(int index)
   8.270 -{
   8.271 -    if (index >= 0 && index < SDL_num_keyboards) {
   8.272 -        SDL_current_keyboard = index;
   8.273 -    }
   8.274 -    return SDL_current_keyboard;
   8.275  }
   8.276  
   8.277  Uint8 *
   8.278  SDL_GetKeyboardState(int *numkeys)
   8.279  {
   8.280 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard);
   8.281 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.282  
   8.283      if (numkeys != (int *) 0) {
   8.284          *numkeys = SDL_NUM_SCANCODES;
   8.285      }
   8.286 -
   8.287 -    if (!keyboard) {
   8.288 -        return NULL;
   8.289 -    }
   8.290      return keyboard->keystate;
   8.291  }
   8.292  
   8.293  SDLMod
   8.294  SDL_GetModState(void)
   8.295  {
   8.296 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard);
   8.297 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.298  
   8.299 -    if (!keyboard) {
   8.300 -        return KMOD_NONE;
   8.301 -    }
   8.302      return keyboard->modstate;
   8.303  }
   8.304  
   8.305  void
   8.306  SDL_SetModState(SDLMod modstate)
   8.307  {
   8.308 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard);
   8.309 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.310  
   8.311 -    if (!keyboard) {
   8.312 -        return;
   8.313 -    }
   8.314      keyboard->modstate = modstate;
   8.315  }
   8.316  
   8.317  SDLKey
   8.318  SDL_GetKeyFromScancode(SDL_scancode scancode)
   8.319  {
   8.320 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard);
   8.321 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.322  
   8.323 -    if (!keyboard) {
   8.324 -        return SDLK_UNKNOWN;
   8.325 -    }
   8.326      return keyboard->keymap[scancode];
   8.327  }
   8.328  
   8.329  SDL_scancode
   8.330  SDL_GetScancodeFromKey(SDLKey key)
   8.331  {
   8.332 -    SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard);
   8.333 +    SDL_Keyboard *keyboard = &SDL_keyboard;
   8.334      SDL_scancode scancode;
   8.335  
   8.336 -    if (!keyboard) {
   8.337 -        return SDL_SCANCODE_UNKNOWN;
   8.338 -    }
   8.339 -
   8.340      for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES;
   8.341           ++scancode) {
   8.342          if (keyboard->keymap[scancode] == key) {
     9.1 --- a/src/events/SDL_keyboard_c.h	Sun May 09 19:55:28 2010 -0700
     9.2 +++ b/src/events/SDL_keyboard_c.h	Sun May 09 20:47:22 2010 -0700
     9.3 @@ -27,44 +27,17 @@
     9.4  #include "SDL_keysym.h"
     9.5  #include "SDL_events.h"
     9.6  
     9.7 -typedef struct SDL_Keyboard SDL_Keyboard;
     9.8 -
     9.9 -struct SDL_Keyboard
    9.10 -{
    9.11 -    /* Free the keyboard when it's time */
    9.12 -    void (*FreeKeyboard) (SDL_Keyboard * keyboard);
    9.13 -
    9.14 -    /* Data common to all keyboards */
    9.15 -    SDL_Window *focus;
    9.16 -    Uint16 modstate;
    9.17 -    Uint8 keystate[SDL_NUM_SCANCODES];
    9.18 -    SDLKey keymap[SDL_NUM_SCANCODES];
    9.19 -
    9.20 -    void *driverdata;
    9.21 -};
    9.22 -
    9.23  /* Initialize the keyboard subsystem */
    9.24  extern int SDL_KeyboardInit(void);
    9.25  
    9.26 -/* Get the keyboard at an index */
    9.27 -extern SDL_Keyboard *SDL_GetKeyboard(int index);
    9.28 -
    9.29 -/* Add a keyboard, possibly reattaching at a particular index (or -1),
    9.30 -   returning the index of the keyboard, or -1 if there was an error.
    9.31 - */
    9.32 -extern int SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index);
    9.33 -
    9.34 -/* Remove a keyboard at an index, clearing the slot for later */
    9.35 -extern void SDL_DelKeyboard(int index);
    9.36 -
    9.37 -/* Clear the state of a keyboard at an index */
    9.38 -extern void SDL_ResetKeyboard(int index);
    9.39 +/* Clear the state of the keyboard */
    9.40 +extern void SDL_ResetKeyboard(void);
    9.41  
    9.42  /* Get the default keymap */
    9.43  extern void SDL_GetDefaultKeymap(SDLKey * keymap);
    9.44  
    9.45 -/* Set the mapping of scancode to key codes for this keyboard */
    9.46 -extern void SDL_SetKeymap(int index, int start, SDLKey * keys, int length);
    9.47 +/* Set the mapping of scancode to key codes */
    9.48 +extern void SDL_SetKeymap(int start, SDLKey * keys, int length);
    9.49  
    9.50  /* Set a platform-dependent key name, overriding the default platform-agnostic
    9.51     name. Encoded as UTF-8. The string is not copied, thus the pointer given to
    9.52 @@ -73,16 +46,16 @@
    9.53  extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name);
    9.54  
    9.55  /* Set the keyboard focus window */
    9.56 -extern void SDL_SetKeyboardFocus(int index, SDL_Window * window);
    9.57 +extern void SDL_SetKeyboardFocus(SDL_Window * window);
    9.58  
    9.59 -/* Send a keyboard event for a keyboard at an index */
    9.60 -extern int SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode);
    9.61 +/* Send a keyboard key event */
    9.62 +extern int SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode);
    9.63  
    9.64 -/* Send keyboard text input for a keyboard at an index */
    9.65 -extern int SDL_SendKeyboardText(int index, const char *text);
    9.66 +/* Send keyboard text input */
    9.67 +extern int SDL_SendKeyboardText(const char *text);
    9.68  
    9.69  /* Send editing text for selected range from start to end */
    9.70 -extern int SDL_SendEditingText(int index, const char *text, int start, int end);
    9.71 +extern int SDL_SendEditingText(const char *text, int start, int end);
    9.72  
    9.73  /* Shutdown the keyboard subsystem */
    9.74  extern void SDL_KeyboardQuit(void);
    10.1 --- a/src/events/SDL_mouse.c	Sun May 09 19:55:28 2010 -0700
    10.2 +++ b/src/events/SDL_mouse.c	Sun May 09 20:47:22 2010 -0700
    10.3 @@ -29,9 +29,44 @@
    10.4  #include "../video/SDL_sysvideo.h"
    10.5  
    10.6  
    10.7 -static int SDL_num_mice = 0;
    10.8 -static int SDL_current_mouse = -1;
    10.9 -static SDL_Mouse **SDL_mice = NULL;
   10.10 +/* Global mouse information */
   10.11 +
   10.12 +typedef struct SDL_Mouse SDL_Mouse;
   10.13 +
   10.14 +struct SDL_Mouse
   10.15 +{
   10.16 +    /* Create a cursor from a surface */
   10.17 +    SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
   10.18 +
   10.19 +    /* Show the specified cursor, or hide if cursor is NULL */
   10.20 +    int (*ShowCursor) (SDL_Cursor * cursor);
   10.21 +
   10.22 +    /* This is called when a mouse motion event occurs */
   10.23 +    void (*MoveCursor) (SDL_Cursor * cursor);
   10.24 +
   10.25 +    /* Free a window manager cursor */
   10.26 +    void (*FreeCursor) (SDL_Cursor * cursor);
   10.27 +
   10.28 +    /* Warp the mouse to (x,y) */
   10.29 +    void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x, int y);
   10.30 +
   10.31 +    /* Data common to all mice */
   10.32 +    SDL_Window *focus;
   10.33 +    int x;
   10.34 +    int y;
   10.35 +    int xdelta;
   10.36 +    int ydelta;
   10.37 +    int last_x, last_y;         /* the last reported x and y coordinates */
   10.38 +    Uint8 buttonstate;
   10.39 +    SDL_bool relative_mode;
   10.40 +
   10.41 +    SDL_Cursor *cursors;
   10.42 +    SDL_Cursor *def_cursor;
   10.43 +    SDL_Cursor *cur_cursor;
   10.44 +    SDL_bool cursor_shown;
   10.45 +};
   10.46 +
   10.47 +static SDL_Mouse SDL_mouse;
   10.48  
   10.49  
   10.50  /* Public functions */
   10.51 @@ -41,370 +76,50 @@
   10.52      return (0);
   10.53  }
   10.54  
   10.55 -SDL_Mouse *
   10.56 -SDL_GetMouse(int index)
   10.57 +void
   10.58 +SDL_ResetMouse(void)
   10.59  {
   10.60 -    if (index < 0 || index >= SDL_num_mice) {
   10.61 -        return NULL;
   10.62 -    }
   10.63 -    return SDL_mice[index];
   10.64 +    /* FIXME */
   10.65  }
   10.66  
   10.67 -static int
   10.68 -SDL_GetMouseIndexId(int id)
   10.69 +SDL_Window *
   10.70 +SDL_GetMouseFocus(void)
   10.71  {
   10.72 -    int index;
   10.73 -    SDL_Mouse *mouse;
   10.74 +    SDL_Mouse *mouse = &SDL_mouse;
   10.75  
   10.76 -    for (index = 0; index < SDL_num_mice; ++index) {
   10.77 -        mouse = SDL_GetMouse(index);
   10.78 -        if (mouse->id == id) {
   10.79 -            return index;
   10.80 -        }
   10.81 -    }
   10.82 -    return -1;
   10.83 -}
   10.84 -
   10.85 -int
   10.86 -SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max,
   10.87 -             int pressure_min, int ends)
   10.88 -{
   10.89 -    SDL_Mouse **mice;
   10.90 -    int selected_mouse;
   10.91 -    int index;
   10.92 -    size_t length;
   10.93 -
   10.94 -    if (SDL_GetMouseIndexId(mouse->id) != -1) {
   10.95 -        SDL_SetError("Mouse ID already in use");
   10.96 -    }
   10.97 -
   10.98 -    /* Add the mouse to the list of mice */
   10.99 -    mice = (SDL_Mouse **) SDL_realloc(SDL_mice,
  10.100 -                                      (SDL_num_mice + 1) * sizeof(*mice));
  10.101 -    if (!mice) {
  10.102 -        SDL_OutOfMemory();
  10.103 -        return -1;
  10.104 -    }
  10.105 -
  10.106 -    SDL_mice = mice;
  10.107 -    index = SDL_num_mice++;
  10.108 -
  10.109 -    SDL_mice[index] = (SDL_Mouse *) SDL_malloc(sizeof(*SDL_mice[index]));
  10.110 -    if (!SDL_mice[index]) {
  10.111 -        SDL_OutOfMemory();
  10.112 -        return -1;
  10.113 -    }
  10.114 -    *SDL_mice[index] = *mouse;
  10.115 -
  10.116 -    /* we're setting the mouse properties */
  10.117 -    length = 0;
  10.118 -    length = SDL_strlen(name);
  10.119 -    SDL_mice[index]->focus = 0;
  10.120 -    SDL_mice[index]->name = SDL_malloc((length + 2) * sizeof(char));
  10.121 -    SDL_strlcpy(SDL_mice[index]->name, name, length + 1);
  10.122 -    SDL_mice[index]->pressure_max = pressure_max;
  10.123 -    SDL_mice[index]->pressure_min = pressure_min;
  10.124 -    SDL_mice[index]->cursor_shown = SDL_TRUE;
  10.125 -    selected_mouse = SDL_SelectMouse(index);
  10.126 -    SDL_mice[index]->cur_cursor = NULL;
  10.127 -    SDL_mice[index]->def_cursor =
  10.128 -        SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH,
  10.129 -                         DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY);
  10.130 -    SDL_SetCursor(SDL_mice[index]->def_cursor);
  10.131 -    /* we're assuming that all mice are in the computer sensing zone */
  10.132 -    SDL_mice[index]->proximity = SDL_TRUE;
  10.133 -    /* we're assuming that all mice are working in the absolute position mode
  10.134 -       thanx to that, the users that don't want to use many mice don't have to
  10.135 -       worry about anything */
  10.136 -    SDL_mice[index]->relative_mode = SDL_FALSE;
  10.137 -    SDL_mice[index]->current_end = 0;
  10.138 -    SDL_mice[index]->total_ends = ends;
  10.139 -    SDL_SelectMouse(selected_mouse);
  10.140 -
  10.141 -    return index;
  10.142 +    return mouse->focus;
  10.143  }
  10.144  
  10.145  void
  10.146 -SDL_DelMouse(int index)
  10.147 +SDL_SetMouseFocus(SDL_Window * window)
  10.148  {
  10.149 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.150 +    SDL_Mouse *mouse = &SDL_mouse;
  10.151  
  10.152 -    if (!mouse) {
  10.153 -        return;
  10.154 -    }
  10.155 -
  10.156 -    mouse->def_cursor = NULL;
  10.157 -    SDL_free(mouse->name);
  10.158 -    while (mouse->cursors) {
  10.159 -        SDL_FreeCursor(mouse->cursors);
  10.160 -    }
  10.161 -
  10.162 -    if (mouse->FreeMouse) {
  10.163 -        mouse->FreeMouse(mouse);
  10.164 -    }
  10.165 -    SDL_free(mouse);
  10.166 -
  10.167 -    SDL_mice[index] = NULL;
  10.168 -}
  10.169 -
  10.170 -void
  10.171 -SDL_ResetMouse(int index)
  10.172 -{
  10.173 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.174 -
  10.175 -    if (!mouse) {
  10.176 -        return;
  10.177 -    }
  10.178 -
  10.179 -    /* FIXME */
  10.180 -}
  10.181 -
  10.182 -void
  10.183 -SDL_MouseQuit(void)
  10.184 -{
  10.185 -    int i;
  10.186 -
  10.187 -    for (i = 0; i < SDL_num_mice; ++i) {
  10.188 -        SDL_DelMouse(i);
  10.189 -    }
  10.190 -    SDL_num_mice = 0;
  10.191 -    SDL_current_mouse = -1;
  10.192 -
  10.193 -    if (SDL_mice) {
  10.194 -        SDL_free(SDL_mice);
  10.195 -        SDL_mice = NULL;
  10.196 -    }
  10.197 -}
  10.198 -
  10.199 -int
  10.200 -SDL_GetNumMice(void)
  10.201 -{
  10.202 -    return SDL_num_mice;
  10.203 -}
  10.204 -
  10.205 -int
  10.206 -SDL_SelectMouse(int index)
  10.207 -{
  10.208 -    if (index >= 0 && index < SDL_num_mice) {
  10.209 -        SDL_current_mouse = index;
  10.210 -    }
  10.211 -    return SDL_current_mouse;
  10.212 -}
  10.213 -
  10.214 -SDL_Window *
  10.215 -SDL_GetMouseFocusWindow(int index)
  10.216 -{
  10.217 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.218 -
  10.219 -    if (!mouse) {
  10.220 -        return 0;
  10.221 -    }
  10.222 -    return mouse->focus;
  10.223 -}
  10.224 -
  10.225 -static int SDLCALL
  10.226 -FlushMouseMotion(void *param, SDL_Event * event)
  10.227 -{
  10.228 -    if (event->type == SDL_MOUSEMOTION
  10.229 -        && event->motion.which == (Uint8) SDL_current_mouse) {
  10.230 -        return 0;
  10.231 -    } else {
  10.232 -        return 1;
  10.233 -    }
  10.234 -}
  10.235 -
  10.236 -int
  10.237 -SDL_SetRelativeMouseMode(int index, SDL_bool enabled)
  10.238 -{
  10.239 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.240 -
  10.241 -    if (!mouse) {
  10.242 -        return -1;
  10.243 -    }
  10.244 -
  10.245 -    /* Flush pending mouse motion */
  10.246 -    mouse->flush_motion = SDL_TRUE;
  10.247 -    SDL_PumpEvents();
  10.248 -    mouse->flush_motion = SDL_FALSE;
  10.249 -    SDL_FilterEvents(FlushMouseMotion, mouse);
  10.250 -
  10.251 -    /* Set the relative mode */
  10.252 -    mouse->relative_mode = enabled;
  10.253 -
  10.254 -    /* Update cursor visibility */
  10.255 -    SDL_SetCursor(NULL);
  10.256 -
  10.257 -    if (!enabled) {
  10.258 -        /* Restore the expected mouse position */
  10.259 -        SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y);
  10.260 -    }
  10.261 -    return 0;
  10.262 -}
  10.263 -
  10.264 -SDL_bool
  10.265 -SDL_GetRelativeMouseMode(int index)
  10.266 -{
  10.267 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.268 -
  10.269 -    if (!mouse) {
  10.270 -        return SDL_FALSE;
  10.271 -    }
  10.272 -    return mouse->relative_mode;
  10.273 -}
  10.274 -
  10.275 -Uint8
  10.276 -SDL_GetMouseState(int *x, int *y)
  10.277 -{
  10.278 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
  10.279 -
  10.280 -    if (!mouse) {
  10.281 -        if (x) {
  10.282 -            *x = 0;
  10.283 -        }
  10.284 -        if (y) {
  10.285 -            *y = 0;
  10.286 -        }
  10.287 -        return 0;
  10.288 -    }
  10.289 -
  10.290 -    if (x) {
  10.291 -        *x = mouse->x;
  10.292 -    }
  10.293 -    if (y) {
  10.294 -        *y = mouse->y;
  10.295 -    }
  10.296 -    return mouse->buttonstate;
  10.297 -}
  10.298 -
  10.299 -Uint8
  10.300 -SDL_GetRelativeMouseState(int index, int *x, int *y)
  10.301 -{
  10.302 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.303 -
  10.304 -    if (!mouse) {
  10.305 -        if (x) {
  10.306 -            *x = 0;
  10.307 -        }
  10.308 -        if (y) {
  10.309 -            *y = 0;
  10.310 -        }
  10.311 -        return 0;
  10.312 -    }
  10.313 -
  10.314 -    if (x) {
  10.315 -        *x = mouse->xdelta;
  10.316 -    }
  10.317 -    if (y) {
  10.318 -        *y = mouse->ydelta;
  10.319 -    }
  10.320 -    mouse->xdelta = 0;
  10.321 -    mouse->ydelta = 0;
  10.322 -    return mouse->buttonstate;
  10.323 -}
  10.324 -
  10.325 -void
  10.326 -SDL_SetMouseFocus(int id, SDL_Window * window)
  10.327 -{
  10.328 -    int index = SDL_GetMouseIndexId(id);
  10.329 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.330 -    int i;
  10.331 -    SDL_bool focus;
  10.332 -
  10.333 -    if (!mouse || (mouse->focus == window)) {
  10.334 +    if (mouse->focus == window) {
  10.335          return;
  10.336      }
  10.337  
  10.338      /* See if the current window has lost focus */
  10.339      if (mouse->focus) {
  10.340 -        focus = SDL_FALSE;
  10.341 -        for (i = 0; i < SDL_num_mice; ++i) {
  10.342 -            SDL_Mouse *check;
  10.343 -            if (i != index) {
  10.344 -                check = SDL_GetMouse(i);
  10.345 -                if (check && check->focus == mouse->focus) {
  10.346 -                    focus = SDL_TRUE;
  10.347 -                    break;
  10.348 -                }
  10.349 -            }
  10.350 -        }
  10.351 -        if (!focus) {
  10.352 -            SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
  10.353 -        }
  10.354 +        SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
  10.355      }
  10.356  
  10.357      mouse->focus = window;
  10.358  
  10.359      if (mouse->focus) {
  10.360 -        focus = SDL_FALSE;
  10.361 -        for (i = 0; i < SDL_num_mice; ++i) {
  10.362 -            SDL_Mouse *check;
  10.363 -            if (i != index) {
  10.364 -                check = SDL_GetMouse(i);
  10.365 -                if (check && check->focus == mouse->focus) {
  10.366 -                    focus = SDL_TRUE;
  10.367 -                    break;
  10.368 -                }
  10.369 -            }
  10.370 -        }
  10.371 -        if (!focus) {
  10.372 -            SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
  10.373 -        }
  10.374 +        SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
  10.375      }
  10.376  }
  10.377  
  10.378  int
  10.379 -SDL_SendProximity(int id, int x, int y, int type)
  10.380 +SDL_SendMouseMotion(int relative, int x, int y)
  10.381  {
  10.382 -    int index = SDL_GetMouseIndexId(id);
  10.383 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.384 -    int posted = 0;
  10.385 -
  10.386 -    if (!mouse) {
  10.387 -        return 0;
  10.388 -    }
  10.389 -
  10.390 -    mouse->last_x = x;
  10.391 -    mouse->last_y = y;
  10.392 -    if (SDL_GetEventState(type) == SDL_ENABLE) {
  10.393 -        SDL_Event event;
  10.394 -        event.proximity.which = (Uint8) index;
  10.395 -        event.proximity.x = x;
  10.396 -        event.proximity.y = y;
  10.397 -        event.proximity.cursor = mouse->current_end;
  10.398 -        event.proximity.type = type;
  10.399 -        /* FIXME: is this right? */
  10.400 -        event.proximity.windowID = mouse->focus ? mouse->focus->id : 0;
  10.401 -        posted = (SDL_PushEvent(&event) > 0);
  10.402 -        if (type == SDL_PROXIMITYIN) {
  10.403 -            mouse->proximity = SDL_TRUE;
  10.404 -        } else {
  10.405 -            mouse->proximity = SDL_FALSE;
  10.406 -        }
  10.407 -    }
  10.408 -    return posted;
  10.409 -}
  10.410 -
  10.411 -int
  10.412 -SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure)
  10.413 -{
  10.414 -    int index = SDL_GetMouseIndexId(id);
  10.415 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.416 +    SDL_Mouse *mouse = &SDL_mouse;
  10.417      int posted;
  10.418      int xrel;
  10.419      int yrel;
  10.420      int x_max = 0, y_max = 0;
  10.421  
  10.422 -    if (!mouse || mouse->flush_motion) {
  10.423 -        return 0;
  10.424 -    }
  10.425 -
  10.426 -    /* if the mouse is out of proximity we don't to want to have any motion from it */
  10.427 -    if (mouse->proximity == SDL_FALSE) {
  10.428 -        mouse->last_x = x;
  10.429 -        mouse->last_y = y;
  10.430 -        return 0;
  10.431 -    }
  10.432 -
  10.433      /* the relative motion is calculated regarding the system cursor last position */
  10.434      if (relative) {
  10.435          xrel = x;
  10.436 @@ -451,35 +166,26 @@
  10.437  
  10.438      mouse->xdelta += xrel;
  10.439      mouse->ydelta += yrel;
  10.440 -    mouse->pressure = pressure;
  10.441  
  10.442 +#if 0 /* FIXME */
  10.443      /* Move the mouse cursor, if needed */
  10.444      if (mouse->cursor_shown && !mouse->relative_mode &&
  10.445          mouse->MoveCursor && mouse->cur_cursor) {
  10.446          mouse->MoveCursor(mouse->cur_cursor);
  10.447      }
  10.448 +#endif
  10.449  
  10.450      /* Post the event, if desired */
  10.451      posted = 0;
  10.452 -    if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE &&
  10.453 -        mouse->proximity == SDL_TRUE) {
  10.454 +    if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE) {
  10.455          SDL_Event event;
  10.456          event.motion.type = SDL_MOUSEMOTION;
  10.457 -        event.motion.which = (Uint8) index;
  10.458 +        event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
  10.459          event.motion.state = mouse->buttonstate;
  10.460          event.motion.x = mouse->x;
  10.461          event.motion.y = mouse->y;
  10.462 -        event.motion.z = mouse->z;
  10.463 -        event.motion.pressure = mouse->pressure;
  10.464 -        event.motion.pressure_max = mouse->pressure_max;
  10.465 -        event.motion.pressure_min = mouse->pressure_min;
  10.466 -        event.motion.rotation = 0;
  10.467 -        event.motion.tilt_x = 0;
  10.468 -        event.motion.tilt_y = 0;
  10.469 -        event.motion.cursor = mouse->current_end;
  10.470          event.motion.xrel = xrel;
  10.471          event.motion.yrel = yrel;
  10.472 -        event.motion.windowID = mouse->focus ? mouse->focus->id : 0;
  10.473          posted = (SDL_PushEvent(&event) > 0);
  10.474      }
  10.475      mouse->last_x = mouse->x;
  10.476 @@ -488,17 +194,12 @@
  10.477  }
  10.478  
  10.479  int
  10.480 -SDL_SendMouseButton(int id, Uint8 state, Uint8 button)
  10.481 +SDL_SendMouseButton(Uint8 state, Uint8 button)
  10.482  {
  10.483 -    int index = SDL_GetMouseIndexId(id);
  10.484 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.485 +    SDL_Mouse *mouse = &SDL_mouse;
  10.486      int posted;
  10.487      Uint32 type;
  10.488  
  10.489 -    if (!mouse) {
  10.490 -        return 0;
  10.491 -    }
  10.492 -
  10.493      /* Figure out which event to perform */
  10.494      switch (state) {
  10.495      case SDL_PRESSED:
  10.496 @@ -527,7 +228,6 @@
  10.497      if (SDL_GetEventState(type) == SDL_ENABLE) {
  10.498          SDL_Event event;
  10.499          event.type = type;
  10.500 -        event.button.which = (Uint8) index;
  10.501          event.button.state = state;
  10.502          event.button.button = button;
  10.503          event.button.x = mouse->x;
  10.504 @@ -539,12 +239,12 @@
  10.505  }
  10.506  
  10.507  int
  10.508 -SDL_SendMouseWheel(int index, int x, int y)
  10.509 +SDL_SendMouseWheel(int x, int y)
  10.510  {
  10.511 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.512 +    SDL_Mouse *mouse = &SDL_mouse;
  10.513      int posted;
  10.514  
  10.515 -    if (!mouse || (!x && !y)) {
  10.516 +    if (!x && !y) {
  10.517          return 0;
  10.518      }
  10.519  
  10.520 @@ -553,53 +253,108 @@
  10.521      if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) {
  10.522          SDL_Event event;
  10.523          event.type = SDL_MOUSEWHEEL;
  10.524 -        event.wheel.which = (Uint8) index;
  10.525 +        event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
  10.526          event.wheel.x = x;
  10.527          event.wheel.y = y;
  10.528 -        event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
  10.529          posted = (SDL_PushEvent(&event) > 0);
  10.530      }
  10.531      return posted;
  10.532  }
  10.533  
  10.534  void
  10.535 +SDL_MouseQuit(void)
  10.536 +{
  10.537 +}
  10.538 +
  10.539 +Uint8
  10.540 +SDL_GetMouseState(int *x, int *y)
  10.541 +{
  10.542 +    SDL_Mouse *mouse = &SDL_mouse;
  10.543 +
  10.544 +    if (x) {
  10.545 +        *x = mouse->x;
  10.546 +    }
  10.547 +    if (y) {
  10.548 +        *y = mouse->y;
  10.549 +    }
  10.550 +    return mouse->buttonstate;
  10.551 +}
  10.552 +
  10.553 +Uint8
  10.554 +SDL_GetRelativeMouseState(int *x, int *y)
  10.555 +{
  10.556 +    SDL_Mouse *mouse = &SDL_mouse;
  10.557 +
  10.558 +    if (x) {
  10.559 +        *x = mouse->xdelta;
  10.560 +    }
  10.561 +    if (y) {
  10.562 +        *y = mouse->ydelta;
  10.563 +    }
  10.564 +    mouse->xdelta = 0;
  10.565 +    mouse->ydelta = 0;
  10.566 +    return mouse->buttonstate;
  10.567 +}
  10.568 +
  10.569 +void
  10.570  SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
  10.571  {
  10.572 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
  10.573 -
  10.574 -    if (!mouse) {
  10.575 -        return;
  10.576 -    }
  10.577 +    SDL_Mouse *mouse = &SDL_mouse;
  10.578  
  10.579      if (mouse->WarpMouse) {
  10.580          mouse->WarpMouse(mouse, window, x, y);
  10.581      } else {
  10.582 -        SDL_SetMouseFocus(SDL_current_mouse, window);
  10.583 -        SDL_SendMouseMotion(SDL_current_mouse, 0, x, y, 0);
  10.584 +        SDL_SetMouseFocus(window);
  10.585 +        SDL_SendMouseMotion(0, x, y);
  10.586      }
  10.587  }
  10.588  
  10.589 +int
  10.590 +SDL_SetRelativeMouseMode(SDL_bool enabled)
  10.591 +{
  10.592 +    SDL_Mouse *mouse = &SDL_mouse;
  10.593 +
  10.594 +    /* Flush pending mouse motion */
  10.595 +    SDL_FlushEvent(SDL_MOUSEMOTION);
  10.596 +
  10.597 +    /* Set the relative mode */
  10.598 +    mouse->relative_mode = enabled;
  10.599 +
  10.600 +    if (!enabled) {
  10.601 +        /* Restore the expected mouse position */
  10.602 +        SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y);
  10.603 +    }
  10.604 +
  10.605 +    /* Update cursor visibility */
  10.606 +    SDL_SetCursor(NULL);
  10.607 +
  10.608 +    return 0;
  10.609 +}
  10.610 +
  10.611 +SDL_bool
  10.612 +SDL_GetRelativeMouseMode()
  10.613 +{
  10.614 +    SDL_Mouse *mouse = &SDL_mouse;
  10.615 +
  10.616 +    return mouse->relative_mode;
  10.617 +}
  10.618 +
  10.619  SDL_Cursor *
  10.620  SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
  10.621                   int w, int h, int hot_x, int hot_y)
  10.622  {
  10.623 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
  10.624 +    SDL_Mouse *mouse = &SDL_mouse;
  10.625      SDL_Surface *surface;
  10.626      SDL_Cursor *cursor;
  10.627      int x, y;
  10.628      Uint32 *pixel;
  10.629 -    Uint8 datab, maskb;
  10.630 +    Uint8 datab = 0, maskb = 0;
  10.631      const Uint32 black = 0xFF000000;
  10.632      const Uint32 white = 0xFFFFFFFF;
  10.633      const Uint32 transparent = 0x00000000;
  10.634  
  10.635 -    if (!mouse) {
  10.636 -        SDL_SetError("No mice are initialized");
  10.637 -        return NULL;
  10.638 -    }
  10.639 -
  10.640      if (!mouse->CreateCursor) {
  10.641 -        SDL_SetError("Current mouse doesn't have cursor support");
  10.642 +        SDL_SetError("Cursors are not currently supported");
  10.643          return NULL;
  10.644      }
  10.645  
  10.646 @@ -638,7 +393,6 @@
  10.647  
  10.648      cursor = mouse->CreateCursor(surface, hot_x, hot_y);
  10.649      if (cursor) {
  10.650 -        cursor->mouse = mouse;
  10.651          cursor->next = mouse->cursors;
  10.652          mouse->cursors = cursor;
  10.653      }
  10.654 @@ -655,12 +409,7 @@
  10.655  void
  10.656  SDL_SetCursor(SDL_Cursor * cursor)
  10.657  {
  10.658 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
  10.659 -
  10.660 -    if (!mouse) {
  10.661 -        SDL_SetError("No mice are initialized");
  10.662 -        return;
  10.663 -    }
  10.664 +    SDL_Mouse *mouse = &SDL_mouse;
  10.665  
  10.666      /* Set the new cursor */
  10.667      if (cursor) {
  10.668 @@ -694,7 +443,7 @@
  10.669  SDL_Cursor *
  10.670  SDL_GetCursor(void)
  10.671  {
  10.672 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
  10.673 +    SDL_Mouse *mouse = &SDL_mouse;
  10.674  
  10.675      if (!mouse) {
  10.676          return NULL;
  10.677 @@ -705,13 +454,12 @@
  10.678  void
  10.679  SDL_FreeCursor(SDL_Cursor * cursor)
  10.680  {
  10.681 -    SDL_Mouse *mouse;
  10.682 +    SDL_Mouse *mouse = &SDL_mouse;
  10.683      SDL_Cursor *curr, *prev;
  10.684  
  10.685      if (!cursor) {
  10.686          return;
  10.687      }
  10.688 -    mouse = cursor->mouse;
  10.689  
  10.690      if (cursor == mouse->def_cursor) {
  10.691          return;
  10.692 @@ -740,7 +488,7 @@
  10.693  int
  10.694  SDL_ShowCursor(int toggle)
  10.695  {
  10.696 -    SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
  10.697 +    SDL_Mouse *mouse = &SDL_mouse;
  10.698      SDL_bool shown;
  10.699  
  10.700      if (!mouse) {
  10.701 @@ -761,47 +509,4 @@
  10.702      return shown;
  10.703  }
  10.704  
  10.705 -char *
  10.706 -SDL_GetMouseName(int index)
  10.707 -{
  10.708 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.709 -    if (!mouse) {
  10.710 -        return NULL;
  10.711 -    }
  10.712 -    return mouse->name;
  10.713 -}
  10.714 -
  10.715 -void
  10.716 -SDL_ChangeEnd(int id, int end)
  10.717 -{
  10.718 -    int index = SDL_GetMouseIndexId(id);
  10.719 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.720 -
  10.721 -    if (mouse) {
  10.722 -        mouse->current_end = end;
  10.723 -    }
  10.724 -}
  10.725 -
  10.726 -int
  10.727 -SDL_GetCursorsNumber(int index)
  10.728 -{
  10.729 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.730 -
  10.731 -    if (!mouse) {
  10.732 -        return -1;
  10.733 -    }
  10.734 -    return mouse->total_ends;
  10.735 -}
  10.736 -
  10.737 -int
  10.738 -SDL_GetCurrentCursor(int index)
  10.739 -{
  10.740 -    SDL_Mouse *mouse = SDL_GetMouse(index);
  10.741 -
  10.742 -    if (!mouse) {
  10.743 -        return -1;
  10.744 -    }
  10.745 -    return mouse->current_end;
  10.746 -}
  10.747 -
  10.748  /* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/events/SDL_mouse_c.h	Sun May 09 19:55:28 2010 -0700
    11.2 +++ b/src/events/SDL_mouse_c.h	Sun May 09 20:47:22 2010 -0700
    11.3 @@ -24,108 +24,33 @@
    11.4  #ifndef _SDL_mouse_c_h
    11.5  #define _SDL_mouse_c_h
    11.6  
    11.7 -typedef struct SDL_Mouse SDL_Mouse;
    11.8 -
    11.9  struct SDL_Cursor
   11.10  {
   11.11 -    SDL_Mouse *mouse;
   11.12      SDL_Cursor *next;
   11.13      void *driverdata;
   11.14  };
   11.15  
   11.16 -struct SDL_Mouse
   11.17 -{
   11.18 -    /* Create a cursor from a surface */
   11.19 -    SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
   11.20 -
   11.21 -    /* Show the specified cursor, or hide if cursor is NULL */
   11.22 -    int (*ShowCursor) (SDL_Cursor * cursor);
   11.23 -
   11.24 -    /* This is called when a mouse motion event occurs */
   11.25 -    void (*MoveCursor) (SDL_Cursor * cursor);
   11.26 -
   11.27 -    /* Free a window manager cursor */
   11.28 -    void (*FreeCursor) (SDL_Cursor * cursor);
   11.29 -
   11.30 -    /* Warp the mouse to (x,y) */
   11.31 -    void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x,
   11.32 -                       int y);
   11.33 -
   11.34 -    /* Free the mouse when it's time */
   11.35 -    void (*FreeMouse) (SDL_Mouse * mouse);
   11.36 -
   11.37 -    /* data common for tablets */
   11.38 -    int pressure;
   11.39 -    int pressure_max;
   11.40 -    int pressure_min;
   11.41 -    int tilt;                   /* for future use */
   11.42 -    int rotation;               /* for future use */
   11.43 -    int total_ends;
   11.44 -    int current_end;
   11.45 -
   11.46 -    /* Data common to all mice */
   11.47 -    int id;
   11.48 -    SDL_Window *focus;
   11.49 -    int which;
   11.50 -    int x;
   11.51 -    int y;
   11.52 -    int z;                      /* for future use */
   11.53 -    int xdelta;
   11.54 -    int ydelta;
   11.55 -    int last_x, last_y;         /* the last reported x and y coordinates */
   11.56 -    char *name;
   11.57 -    Uint8 buttonstate;
   11.58 -    SDL_bool relative_mode;
   11.59 -    SDL_bool proximity;
   11.60 -    SDL_bool flush_motion;
   11.61 -
   11.62 -    SDL_Cursor *cursors;
   11.63 -    SDL_Cursor *def_cursor;
   11.64 -    SDL_Cursor *cur_cursor;
   11.65 -    SDL_bool cursor_shown;
   11.66 -
   11.67 -    void *driverdata;
   11.68 -};
   11.69 -
   11.70  /* Initialize the mouse subsystem */
   11.71  extern int SDL_MouseInit(void);
   11.72  
   11.73 -/* Get the mouse at an index */
   11.74 -extern SDL_Mouse *SDL_GetMouse(int index);
   11.75 -
   11.76 -/* Add a mouse, possibly reattaching at a particular index (or -1),
   11.77 -   returning the index of the mouse, or -1 if there was an error.
   11.78 - */
   11.79 -extern int SDL_AddMouse(const SDL_Mouse * mouse, char *name,
   11.80 -                        int pressure_max, int pressure_min, int ends);
   11.81 -
   11.82 -/* Remove a mouse at an index, clearing the slot for later */
   11.83 -extern void SDL_DelMouse(int index);
   11.84 -
   11.85 -/* Clear the button state of a mouse at an index */
   11.86 -extern void SDL_ResetMouse(int index);
   11.87 +/* Clear the mouse state */
   11.88 +extern void SDL_ResetMouse(void);
   11.89  
   11.90  /* Set the mouse focus window */
   11.91 -extern void SDL_SetMouseFocus(int id, SDL_Window * window);
   11.92 +extern void SDL_SetMouseFocus(SDL_Window * window);
   11.93  
   11.94 -/* Send a mouse motion event for a mouse */
   11.95 -extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
   11.96 +/* Send a mouse motion event */
   11.97 +extern int SDL_SendMouseMotion(int relative, int x, int y);
   11.98  
   11.99 -/* Send a mouse button event for a mouse */
  11.100 -extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
  11.101 +/* Send a mouse button event */
  11.102 +extern int SDL_SendMouseButton(Uint8 state, Uint8 button);
  11.103  
  11.104 -/* Send a mouse wheel event for a mouse */
  11.105 -extern int SDL_SendMouseWheel(int id, int x, int y);
  11.106 -
  11.107 -/* Send a proximity event for a mouse */
  11.108 -extern int SDL_SendProximity(int id, int x, int y, int type);
  11.109 +/* Send a mouse wheel event */
  11.110 +extern int SDL_SendMouseWheel(int x, int y);
  11.111  
  11.112  /* Shutdown the mouse subsystem */
  11.113  extern void SDL_MouseQuit(void);
  11.114  
  11.115 -/* FIXME: Where do these functions go in this header? */
  11.116 -extern void SDL_ChangeEnd(int id, int end);
  11.117 -
  11.118  #endif /* _SDL_mouse_c_h */
  11.119  
  11.120  /* vi: set ts=4 sw=4 expandtab: */
    12.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Sun May 09 19:55:28 2010 -0700
    12.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Sun May 09 20:47:22 2010 -0700
    12.3 @@ -62,20 +62,13 @@
    12.4      NSRange   _markedRange;
    12.5      NSRange   _selectedRange;
    12.6      SDL_Rect  _inputRect;
    12.7 -    int       _keyboard;
    12.8  }
    12.9  - (void) doCommandBySelector:(SEL)myselector;
   12.10  - (void) setInputRect:(SDL_Rect *) rect;
   12.11 -- (void) setKeyboard:(int) keyboard;
   12.12  @end
   12.13  
   12.14  @implementation SDLTranslatorResponder
   12.15  
   12.16 -- (void) setKeyboard:(int) keyboard
   12.17 -{
   12.18 -    _keyboard = keyboard;
   12.19 -}
   12.20 -
   12.21  - (void) setInputRect:(SDL_Rect *) rect
   12.22  {
   12.23      _inputRect = *rect;
   12.24 @@ -94,7 +87,7 @@
   12.25      else
   12.26          str = [aString UTF8String];
   12.27  
   12.28 -    SDL_SendKeyboardText(_keyboard, str);
   12.29 +    SDL_SendKeyboardText(str);
   12.30  }
   12.31  
   12.32  - (void) doCommandBySelector:(SEL) myselector
   12.33 @@ -140,7 +133,7 @@
   12.34      _selectedRange = selRange;
   12.35      _markedRange = NSMakeRange(0, [aString length]);
   12.36  
   12.37 -    SDL_SendEditingText(_keyboard, [aString UTF8String],
   12.38 +    SDL_SendEditingText([aString UTF8String],
   12.39                          selRange.location, selRange.length);
   12.40  
   12.41      DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
   12.42 @@ -204,7 +197,7 @@
   12.43   * differentiating between left and right versions of the keys.
   12.44   */
   12.45  static void
   12.46 -DoUnsidedModifiers(int keyboard, unsigned short scancode,
   12.47 +DoUnsidedModifiers(unsigned short scancode,
   12.48                     unsigned int oldMods, unsigned int newMods)
   12.49  {
   12.50      const int mapping[] = {
   12.51 @@ -226,14 +219,14 @@
   12.52          if (oldMask && oldMask != newMask) {        /* modifier up event */
   12.53              /* If this was Caps Lock, we need some additional voodoo to make SDL happy */
   12.54              if (bit == NSAlphaShiftKeyMask) {
   12.55 -                SDL_SendKeyboardKey(keyboard, SDL_PRESSED, mapping[i]);
   12.56 +                SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]);
   12.57              }
   12.58 -            SDL_SendKeyboardKey(keyboard, SDL_RELEASED, mapping[i]);
   12.59 +            SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]);
   12.60          } else if (newMask && oldMask != newMask) { /* modifier down event */
   12.61 -            SDL_SendKeyboardKey(keyboard, SDL_PRESSED, mapping[i]);
   12.62 +            SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]);
   12.63              /* If this was Caps Lock, we need some additional voodoo to make SDL happy */
   12.64              if (bit == NSAlphaShiftKeyMask) {
   12.65 -                SDL_SendKeyboardKey(keyboard, SDL_RELEASED, mapping[i]);
   12.66 +                SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]);
   12.67              }
   12.68          }
   12.69      }
   12.70 @@ -244,8 +237,7 @@
   12.71   * sides was made.
   12.72   */
   12.73  static void
   12.74 -HandleNonDeviceModifier(int keyboard,
   12.75 -                        unsigned int device_independent_mask,
   12.76 +HandleNonDeviceModifier(unsigned int device_independent_mask,
   12.77                          unsigned int oldMods,
   12.78                          unsigned int newMods,
   12.79                          SDL_scancode scancode)
   12.80 @@ -259,9 +251,9 @@
   12.81      newMask = newMods & device_independent_mask;
   12.82      
   12.83      if (oldMask && oldMask != newMask) {
   12.84 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, scancode);
   12.85 +        SDL_SendKeyboardKey(SDL_RELEASED, scancode);
   12.86      } else if (newMask && oldMask != newMask) {
   12.87 -        SDL_SendKeyboardKey(keyboard, SDL_PRESSED, scancode);
   12.88 +        SDL_SendKeyboardKey(SDL_PRESSED, scancode);
   12.89      }
   12.90  }
   12.91  
   12.92 @@ -269,8 +261,7 @@
   12.93   * This function sets the actual SDL_PrivateKeyboard event.
   12.94   */
   12.95  static void
   12.96 -HandleModifierOneSide(int keyboard,
   12.97 -                      unsigned int oldMods, unsigned int newMods,
   12.98 +HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
   12.99                        SDL_scancode scancode, 
  12.100                        unsigned int sided_device_dependent_mask)
  12.101  {
  12.102 @@ -287,9 +278,9 @@
  12.103       * find out which it is.
  12.104       */
  12.105      if (new_dep_mask && old_dep_mask != new_dep_mask) {
  12.106 -        SDL_SendKeyboardKey(keyboard, SDL_PRESSED, scancode);
  12.107 +        SDL_SendKeyboardKey(SDL_PRESSED, scancode);
  12.108      } else {
  12.109 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, scancode);
  12.110 +        SDL_SendKeyboardKey(SDL_RELEASED, scancode);
  12.111      }
  12.112  }
  12.113  
  12.114 @@ -298,8 +289,7 @@
  12.115   * e.g. left-shift vs right-shift. 
  12.116   */
  12.117  static void
  12.118 -HandleModifierSide(int keyboard,
  12.119 -                   int device_independent_mask, 
  12.120 +HandleModifierSide(int device_independent_mask, 
  12.121                     unsigned int oldMods, unsigned int newMods, 
  12.122                     SDL_scancode left_scancode, 
  12.123                     SDL_scancode right_scancode,
  12.124 @@ -316,7 +306,7 @@
  12.125       */
  12.126      if ((device_dependent_mask & newMods) == 0) {
  12.127          /* Revert to the old behavior */
  12.128 -        HandleNonDeviceModifier(keyboard, device_independent_mask, oldMods, newMods, left_scancode);
  12.129 +        HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode);
  12.130          return;
  12.131      }
  12.132  
  12.133 @@ -329,10 +319,10 @@
  12.134           * change or if the bits don't both exist.
  12.135           */
  12.136          if (left_device_dependent_mask & diff_mod) {
  12.137 -            HandleModifierOneSide(keyboard, oldMods, newMods, left_scancode, left_device_dependent_mask);
  12.138 +            HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask);
  12.139          }
  12.140          if (right_device_dependent_mask & diff_mod) {
  12.141 -            HandleModifierOneSide(keyboard, oldMods, newMods, right_scancode, right_device_dependent_mask);
  12.142 +            HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask);
  12.143          }
  12.144      }
  12.145  }
  12.146 @@ -343,8 +333,7 @@
  12.147   * can't still be down).
  12.148   */
  12.149  static void
  12.150 -ReleaseModifierSide(int keyboard,
  12.151 -                    unsigned int device_independent_mask, 
  12.152 +ReleaseModifierSide(unsigned int device_independent_mask, 
  12.153                      unsigned int oldMods, unsigned int newMods,
  12.154                      SDL_scancode left_scancode, 
  12.155                      SDL_scancode right_scancode,
  12.156 @@ -362,7 +351,7 @@
  12.157          /* In this case, we can't detect the keyboard, so use the left side 
  12.158           * to represent both, and release it. 
  12.159           */
  12.160 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, left_scancode);
  12.161 +        SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
  12.162          return;
  12.163      }
  12.164  
  12.165 @@ -373,10 +362,10 @@
  12.166       * so I hope this doesn't cause other problems.
  12.167       */
  12.168      if ( left_device_dependent_mask & oldMods ) {
  12.169 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, left_scancode);
  12.170 +        SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
  12.171      }
  12.172      if ( right_device_dependent_mask & oldMods ) {
  12.173 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, right_scancode);
  12.174 +        SDL_SendKeyboardKey(SDL_RELEASED, right_scancode);
  12.175      }
  12.176  }
  12.177  
  12.178 @@ -384,7 +373,7 @@
  12.179   * This function handles the CapsLock case.
  12.180   */
  12.181  static void
  12.182 -HandleCapsLock(int keyboard, unsigned short scancode,
  12.183 +HandleCapsLock(unsigned short scancode,
  12.184                 unsigned int oldMods, unsigned int newMods)
  12.185  {
  12.186      unsigned int oldMask, newMask;
  12.187 @@ -393,16 +382,16 @@
  12.188      newMask = newMods & NSAlphaShiftKeyMask;
  12.189  
  12.190      if (oldMask != newMask) {
  12.191 -        SDL_SendKeyboardKey(keyboard, SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
  12.192 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
  12.193 +        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
  12.194 +        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
  12.195      }
  12.196  
  12.197      oldMask = oldMods & NSNumericPadKeyMask;
  12.198      newMask = newMods & NSNumericPadKeyMask;
  12.199  
  12.200      if (oldMask != newMask) {
  12.201 -        SDL_SendKeyboardKey(keyboard, SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
  12.202 -        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
  12.203 +        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
  12.204 +        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
  12.205      }
  12.206  }
  12.207  
  12.208 @@ -410,7 +399,7 @@
  12.209   * correct side of the key.
  12.210   */
  12.211  static void
  12.212 -DoSidedModifiers(int keyboard, unsigned short scancode,
  12.213 +DoSidedModifiers(unsigned short scancode,
  12.214                   unsigned int oldMods, unsigned int newMods)
  12.215  {
  12.216  	/* Set up arrays for the key syms for the left and right side. */
  12.217 @@ -435,7 +424,7 @@
  12.218      unsigned int i, bit;
  12.219  
  12.220      /* Handle CAPSLOCK separately because it doesn't have a left/right side */
  12.221 -    HandleCapsLock(keyboard, scancode, oldMods, newMods);
  12.222 +    HandleCapsLock(scancode, oldMods, newMods);
  12.223  
  12.224      /* Iterate through the bits, testing each against the old modifiers */
  12.225      for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) {
  12.226 @@ -448,7 +437,7 @@
  12.227           * and right side keys may alternate or both may be pressed.
  12.228           */
  12.229          if (newMask) {
  12.230 -            HandleModifierSide(keyboard, bit, oldMods, newMods,
  12.231 +            HandleModifierSide(bit, oldMods, newMods,
  12.232                                 left_mapping[i], right_mapping[i],
  12.233                                 left_device_mapping[i], right_device_mapping[i]);
  12.234          }
  12.235 @@ -456,7 +445,7 @@
  12.236              * the device dependent bits to release the correct keys.
  12.237              */
  12.238          else if (oldMask && oldMask != newMask) {
  12.239 -            ReleaseModifierSide(keyboard, bit, oldMods, newMods,
  12.240 +            ReleaseModifierSide(bit, oldMods, newMods,
  12.241                                left_mapping[i], right_mapping[i],
  12.242                                left_device_mapping[i], right_device_mapping[i]);
  12.243          }
  12.244 @@ -477,9 +466,9 @@
  12.245       * left side and right side modifiers is available.
  12.246       */
  12.247      if (data->osversion >= 0x1030) {
  12.248 -        DoSidedModifiers(data->keyboard, scancode, data->modifierFlags, modifierFlags);
  12.249 +        DoSidedModifiers(scancode, data->modifierFlags, modifierFlags);
  12.250      } else {
  12.251 -        DoUnsidedModifiers(data->keyboard, scancode, data->modifierFlags, modifierFlags);
  12.252 +        DoUnsidedModifiers(scancode, data->modifierFlags, modifierFlags);
  12.253      }
  12.254      data->modifierFlags = modifierFlags;
  12.255  }
  12.256 @@ -549,7 +538,7 @@
  12.257                  keymap[scancode] = s[0];
  12.258              }
  12.259          }
  12.260 -        SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
  12.261 +        SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
  12.262          return;
  12.263      }
  12.264  
  12.265 @@ -603,7 +592,7 @@
  12.266                  keymap[scancode] = c;
  12.267              }
  12.268          }
  12.269 -        SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
  12.270 +        SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
  12.271          return;
  12.272      }
  12.273  #endif
  12.274 @@ -613,10 +602,7 @@
  12.275  Cocoa_InitKeyboard(_THIS)
  12.276  {
  12.277      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
  12.278 -    SDL_Keyboard keyboard;
  12.279  
  12.280 -    SDL_zero(keyboard);
  12.281 -    data->keyboard = SDL_AddKeyboard(&keyboard, -1);
  12.282      UpdateKeymap(data);
  12.283      
  12.284      /* Set our own names for the platform-dependent but layout-independent keys */
  12.285 @@ -645,8 +631,6 @@
  12.286              [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)];
  12.287      }
  12.288  
  12.289 -    [data->fieldEdit setKeyboard: data->keyboard];
  12.290 -
  12.291      if (![[data->fieldEdit superview] isEqual: parentView])
  12.292      {
  12.293          // DEBUG_IME(@"add fieldEdit to window contentView");
  12.294 @@ -686,7 +670,9 @@
  12.295      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
  12.296      unsigned short scancode = [event keyCode];
  12.297      SDL_scancode code;
  12.298 +#if 0
  12.299      const char *text;
  12.300 +#endif
  12.301  
  12.302      if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) {
  12.303          /* see comments in SDL_cocoakeys.h */
  12.304 @@ -706,7 +692,7 @@
  12.305              /* See if we need to rebuild the keyboard layout */
  12.306              UpdateKeymap(data);
  12.307  
  12.308 -            SDL_SendKeyboardKey(data->keyboard, SDL_PRESSED, code);
  12.309 +            SDL_SendKeyboardKey(SDL_PRESSED, code);
  12.310  #if 1
  12.311              if (code == SDL_SCANCODE_UNKNOWN) {
  12.312                  fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL mailing list <sdl@libsdl.org> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode);
  12.313 @@ -719,14 +705,14 @@
  12.314  #if 0
  12.315              text = [[event characters] UTF8String];
  12.316              if(text && *text) {
  12.317 -                SDL_SendKeyboardText(data->keyboard, text);
  12.318 +                SDL_SendKeyboardText(text);
  12.319                  [data->fieldEdit setString:@""];
  12.320              }
  12.321  #endif
  12.322          }
  12.323          break;
  12.324      case NSKeyUp:
  12.325 -        SDL_SendKeyboardKey(data->keyboard, SDL_RELEASED, code);
  12.326 +        SDL_SendKeyboardKey(SDL_RELEASED, code);
  12.327          break;
  12.328      case NSFlagsChanged:
  12.329          /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */
  12.330 @@ -740,10 +726,6 @@
  12.331  void
  12.332  Cocoa_QuitKeyboard(_THIS)
  12.333  {
  12.334 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
  12.335 -    NSAutoreleasePool *pool;
  12.336 -
  12.337 -    SDL_DelKeyboard(data->keyboard);
  12.338  }
  12.339  
  12.340  /* vi: set ts=4 sw=4 expandtab: */
    13.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Sun May 09 19:55:28 2010 -0700
    13.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Sun May 09 20:47:22 2010 -0700
    13.3 @@ -29,11 +29,6 @@
    13.4  void
    13.5  Cocoa_InitMouse(_THIS)
    13.6  {
    13.7 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    13.8 -    SDL_Mouse mouse;
    13.9 -
   13.10 -    SDL_zero(mouse);
   13.11 -    data->mouse = SDL_AddMouse(&mouse, "Mouse", 0, 0, 1);
   13.12  }
   13.13  
   13.14  static int
   13.15 @@ -54,10 +49,8 @@
   13.16  void
   13.17  Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
   13.18  {
   13.19 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   13.20 -    SDL_Mouse *mouse = SDL_GetMouse(data->mouse);
   13.21      int i;
   13.22 -    NSPoint point;
   13.23 +    NSPoint point = { 0, 0 };
   13.24      SDL_Window *window;
   13.25  
   13.26      /* See if there are any fullscreen windows that might handle this event */
   13.27 @@ -73,44 +66,38 @@
   13.28              point = [NSEvent mouseLocation];
   13.29              point.x = point.x - bounds.x;
   13.30              point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - bounds.y;
   13.31 -            if (point.x < 0 || point.x >= candidate->w ||
   13.32 -                point.y < 0 || point.y >= candidate->h) {
   13.33 -                /* The mouse is out of this fullscreen display */
   13.34 -                if (mouse->focus == candidate) {
   13.35 -                    SDL_SetMouseFocus(data->mouse, 0);
   13.36 -                }
   13.37 -            } else {
   13.38 +            if ((point.x >= 0 && point.x < candidate->w) ||
   13.39 +                (point.y >= 0 && point.y < candidate->h)) {
   13.40                  /* This is it! */
   13.41                  window = candidate;
   13.42                  break;
   13.43              }
   13.44          }
   13.45      }
   13.46 -    if (!window) {
   13.47 -        return;
   13.48 -    }
   13.49  
   13.50      /* Set the focus appropriately */
   13.51 -    if (mouse->focus != window) {
   13.52 -        SDL_SetMouseFocus(data->mouse, window);
   13.53 +    SDL_SetMouseFocus(window);
   13.54 +
   13.55 +    if (window) {
   13.56 +        return;
   13.57      }
   13.58  
   13.59      switch ([event type]) {
   13.60      case NSLeftMouseDown:
   13.61      case NSOtherMouseDown:
   13.62      case NSRightMouseDown:
   13.63 -        SDL_SendMouseButton(data->mouse, SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber]));
   13.64 +        SDL_SendMouseButton(SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber]));
   13.65          break;
   13.66      case NSLeftMouseUp:
   13.67      case NSOtherMouseUp:
   13.68      case NSRightMouseUp:
   13.69 -        SDL_SendMouseButton(data->mouse, SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber]));
   13.70 +        SDL_SendMouseButton(SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber]));
   13.71          break;
   13.72      case NSLeftMouseDragged:
   13.73      case NSRightMouseDragged:
   13.74      case NSOtherMouseDragged: /* usually middle mouse dragged */
   13.75      case NSMouseMoved:
   13.76 -        SDL_SendMouseMotion(data->mouse, 0, (int)point.x, (int)point.y, 0);
   13.77 +        SDL_SendMouseMotion(0, (int)point.x, (int)point.y);
   13.78          break;
   13.79      default: /* just to avoid compiler warnings */
   13.80          break;
   13.81 @@ -120,9 +107,6 @@
   13.82  void
   13.83  Cocoa_QuitMouse(_THIS)
   13.84  {
   13.85 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   13.86 -
   13.87 -    SDL_DelMouse(data->mouse);
   13.88  }
   13.89  
   13.90  /* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/video/cocoa/SDL_cocoavideo.h	Sun May 09 19:55:28 2010 -0700
    14.2 +++ b/src/video/cocoa/SDL_cocoavideo.h	Sun May 09 20:47:22 2010 -0700
    14.3 @@ -57,8 +57,6 @@
    14.4  {
    14.5      SInt32 osversion;
    14.6      unsigned int modifierFlags;
    14.7 -    int mouse;
    14.8 -    int keyboard;
    14.9      void *key_layout;
   14.10      SDLTranslatorResponder *fieldEdit;
   14.11      Uint32 screensaver_activity;
    15.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sun May 09 19:55:28 2010 -0700
    15.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sun May 09 20:47:22 2010 -0700
    15.3 @@ -126,28 +126,21 @@
    15.4  
    15.5  - (void)windowDidBecomeKey:(NSNotification *)aNotification
    15.6  {
    15.7 -    int index;
    15.8 -
    15.9      /* We're going to get keyboard events, since we're key. */
   15.10 -    index = _data->videodata->keyboard;
   15.11 -    SDL_SetKeyboardFocus(index, _data->window);
   15.12 +    SDL_SetKeyboardFocus(_data->window);
   15.13  }
   15.14  
   15.15  - (void)windowDidResignKey:(NSNotification *)aNotification
   15.16  {
   15.17 -    int index;
   15.18 -    SDL_Mouse *mouse;
   15.19 -
   15.20      /* Some other window will get mouse events, since we're not key. */
   15.21 -    index = _data->videodata->mouse;
   15.22 -    mouse = SDL_GetMouse(index);
   15.23 -    if (mouse->focus == _data->window) {
   15.24 -        SDL_SetMouseFocus(index, 0);
   15.25 +    if (SDL_GetMouseFocus() == _data->window) {
   15.26 +        SDL_SetMouseFocus(NULL);
   15.27      }
   15.28  
   15.29      /* Some other window will get keyboard events, since we're not key. */
   15.30 -    index = _data->videodata->keyboard;
   15.31 -    SDL_SetKeyboardFocus(index, 0);
   15.32 +    if (SDL_GetKeyboardFocus() == _data->window) {
   15.33 +        SDL_SetKeyboardFocus(NULL);
   15.34 +    }
   15.35  }
   15.36  
   15.37  - (void)windowDidHide:(NSNotification *)aNotification
   15.38 @@ -162,10 +155,8 @@
   15.39  
   15.40  - (void)mouseDown:(NSEvent *)theEvent
   15.41  {
   15.42 -    int index;
   15.43      int button;
   15.44  
   15.45 -    index = _data->videodata->mouse;
   15.46      switch ([theEvent buttonNumber]) {
   15.47      case 0:
   15.48          button = SDL_BUTTON_LEFT;
   15.49 @@ -180,7 +171,7 @@
   15.50          button = [theEvent buttonNumber];
   15.51          break;
   15.52      }
   15.53 -    SDL_SendMouseButton(index, SDL_PRESSED, button);
   15.54 +    SDL_SendMouseButton(SDL_PRESSED, button);
   15.55  }
   15.56  
   15.57  - (void)rightMouseDown:(NSEvent *)theEvent
   15.58 @@ -195,10 +186,8 @@
   15.59  
   15.60  - (void)mouseUp:(NSEvent *)theEvent
   15.61  {
   15.62 -    int index;
   15.63      int button;
   15.64  
   15.65 -    index = _data->videodata->mouse;
   15.66      switch ([theEvent buttonNumber]) {
   15.67      case 0:
   15.68          button = SDL_BUTTON_LEFT;
   15.69 @@ -213,7 +202,7 @@
   15.70          button = [theEvent buttonNumber];
   15.71          break;
   15.72      }
   15.73 -    SDL_SendMouseButton(index, SDL_RELEASED, button);
   15.74 +    SDL_SendMouseButton(SDL_RELEASED, button);
   15.75  }
   15.76  
   15.77  - (void)rightMouseUp:(NSEvent *)theEvent
   15.78 @@ -229,24 +218,18 @@
   15.79  - (void)mouseMoved:(NSEvent *)theEvent
   15.80  {
   15.81      SDL_Window *window = _data->window;
   15.82 -    int index;
   15.83 -    SDL_Mouse *mouse;
   15.84      NSPoint point;
   15.85  
   15.86 -    index = _data->videodata->mouse;
   15.87 -    mouse = SDL_GetMouse(index);
   15.88      point = [theEvent locationInWindow];
   15.89      point.y = window->h - point.y;
   15.90      if ( point.x < 0 || point.x >= window->w ||
   15.91           point.y < 0 || point.y >= window->h ) {
   15.92 -        if (mouse->focus != 0) {
   15.93 -            SDL_SetMouseFocus(index, 0);
   15.94 +        if (SDL_GetMouseFocus() == window) {
   15.95 +            SDL_SetMouseFocus(NULL);
   15.96          }
   15.97      } else {
   15.98 -        if (mouse->focus != _data->window) {
   15.99 -            SDL_SetMouseFocus(index, _data->window);
  15.100 -        }
  15.101 -        SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y, 0);
  15.102 +        SDL_SetMouseFocus(_data->window);
  15.103 +        SDL_SendMouseMotion(0, (int)point.x, (int)point.y);
  15.104      }
  15.105  }
  15.106  
  15.107 @@ -267,10 +250,7 @@
  15.108  
  15.109  - (void)scrollWheel:(NSEvent *)theEvent
  15.110  {
  15.111 -    int index;
  15.112 -
  15.113 -    index = _data->videodata->mouse;
  15.114 -    SDL_SendMouseWheel(index, (int)([theEvent deltaX]+0.9f), (int)([theEvent deltaY]+0.9f));
  15.115 +    SDL_SendMouseWheel((int)([theEvent deltaX]+0.9f), (int)([theEvent deltaY]+0.9f));
  15.116  }
  15.117  
  15.118  @end
  15.119 @@ -361,9 +341,8 @@
  15.120          window->flags &= ~SDL_WINDOW_MINIMIZED;
  15.121      }
  15.122      if ([nswindow isKeyWindow]) {
  15.123 -        int index = data->videodata->keyboard;
  15.124          window->flags |= SDL_WINDOW_INPUT_FOCUS;
  15.125 -        SDL_SetKeyboardFocus(index, data->window);
  15.126 +        SDL_SetKeyboardFocus(data->window);
  15.127  
  15.128          if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
  15.129              /* FIXME */
  15.130 @@ -385,8 +364,6 @@
  15.131      NSRect rect;
  15.132      SDL_Rect bounds;
  15.133      unsigned int style;
  15.134 -    NSString *title;
  15.135 -    int status;
  15.136  
  15.137      Cocoa_GetDisplayBounds(_this, display, &bounds);
  15.138      if ((window->flags & SDL_WINDOW_FULLSCREEN)
  15.139 @@ -452,7 +429,6 @@
  15.140      NSAutoreleasePool *pool;
  15.141      NSWindow *nswindow = (NSWindow *) data;
  15.142      NSString *title;
  15.143 -    int status;
  15.144  
  15.145      pool = [[NSAutoreleasePool alloc] init];
  15.146  
  15.147 @@ -625,7 +601,7 @@
  15.148  SDL_bool
  15.149  Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
  15.150  {
  15.151 -    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
  15.152 +    //NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
  15.153  
  15.154      if (info->version.major <= SDL_MAJOR_VERSION) {
  15.155          //info->window = nswindow;
    16.1 --- a/src/video/uikit/SDL_uikitview.h	Sun May 09 19:55:28 2010 -0700
    16.2 +++ b/src/video/uikit/SDL_uikitview.h	Sun May 09 20:47:22 2010 -0700
    16.3 @@ -38,8 +38,10 @@
    16.4  #else
    16.5  @interface SDL_uikitview : UIView {
    16.6  #endif
    16.7 -		
    16.8 +	
    16.9 +#if FIXME_MULTITOUCH
   16.10  	SDL_Mouse mice[MAX_SIMULTANEOUS_TOUCHES];
   16.11 +#endif
   16.12  
   16.13  #if SDL_IPHONE_KEYBOARD
   16.14  	UITextField *textField;
    17.1 --- a/src/video/uikit/SDL_uikitview.m	Sun May 09 19:55:28 2010 -0700
    17.2 +++ b/src/video/uikit/SDL_uikitview.m	Sun May 09 20:47:22 2010 -0700
    17.3 @@ -47,6 +47,7 @@
    17.4  	[self initializeKeyboard];
    17.5  #endif	
    17.6  
    17.7 +#if FIXME_MULTITOUCH
    17.8  	int i;
    17.9  	for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
   17.10          mice[i].id = i;
   17.11 @@ -54,6 +55,7 @@
   17.12  		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
   17.13  	}
   17.14  	self.multipleTouchEnabled = YES;
   17.15 +#endif
   17.16  			
   17.17  	return self;
   17.18  
   17.19 @@ -64,6 +66,7 @@
   17.20  	NSEnumerator *enumerator = [touches objectEnumerator];
   17.21  	UITouch *touch =(UITouch*)[enumerator nextObject];
   17.22  	
   17.23 +#if FIXME_MULTITOUCH
   17.24  	/* associate touches with mice, so long as we have slots */
   17.25  	int i;
   17.26  	int found = 0;
   17.27 @@ -104,7 +107,8 @@
   17.28  		/* switch back to our old mouse */
   17.29  		SDL_SelectMouse(oldMouse);
   17.30  		
   17.31 -	}	
   17.32 +	}
   17.33 +#endif
   17.34  }
   17.35  
   17.36  - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   17.37 @@ -112,6 +116,7 @@
   17.38  	NSEnumerator *enumerator = [touches objectEnumerator];
   17.39  	UITouch *touch=nil;
   17.40  	
   17.41 +#if FIXME_MULTITOUCH
   17.42  	while(touch = (UITouch *)[enumerator nextObject]) {
   17.43  		/* search for the mouse slot associated with this touch */
   17.44  		int i, found = NO;
   17.45 @@ -127,6 +132,7 @@
   17.46  			}
   17.47  		}
   17.48  	}
   17.49 +#endif
   17.50  }
   17.51  
   17.52  - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
   17.53 @@ -143,6 +149,7 @@
   17.54  	NSEnumerator *enumerator = [touches objectEnumerator];
   17.55  	UITouch *touch=nil;
   17.56  	
   17.57 +#if FIXME_MULTITOUCH
   17.58  	while(touch = (UITouch *)[enumerator nextObject]) {
   17.59  		/* try to find the mouse associated with this touch */
   17.60  		int i, found = NO;
   17.61 @@ -157,6 +164,7 @@
   17.62  			}
   17.63  		}
   17.64  	}
   17.65 +#endif
   17.66  }
   17.67  
   17.68  /*
    18.1 --- a/src/video/win32/SDL_win32events.c	Sun May 09 19:55:28 2010 -0700
    18.2 +++ b/src/video/win32/SDL_win32events.c	Sun May 09 20:47:22 2010 -0700
    18.3 @@ -58,12 +58,6 @@
    18.4  #define WM_INPUT 0x00ff
    18.5  #endif
    18.6  
    18.7 -extern HCTX *g_hCtx;
    18.8 -extern HANDLE *mice;
    18.9 -extern int total_mice;
   18.10 -extern int tablet;
   18.11 -int pressure = 0;               /* the pressure reported by the tablet */
   18.12 -
   18.13  static WPARAM
   18.14  RemapVKEY(WPARAM wParam, LPARAM lParam)
   18.15  {
   18.16 @@ -104,8 +98,6 @@
   18.17  WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   18.18  {
   18.19      SDL_WindowData *data;
   18.20 -    RAWINPUT *raw;
   18.21 -    PACKET packet;
   18.22      LRESULT returnCode = -1;
   18.23  
   18.24      /* Send a SDL_SYSWMEVENT if the application wants them */
   18.25 @@ -142,35 +134,6 @@
   18.26  
   18.27      switch (msg) {
   18.28  
   18.29 -    case WT_PACKET:
   18.30 -        {
   18.31 -            /* if we receive such data we need to update the pressure */
   18.32 -            SDL_VideoData *videodata = data->videodata;
   18.33 -            if (videodata->wintabDLL
   18.34 -                && videodata->WTPacket((HCTX) lParam, (UINT) wParam, &packet)) {
   18.35 -                SDL_ChangeEnd(tablet, (int) packet.pkCursor);
   18.36 -                pressure = (int) packet.pkNormalPressure;
   18.37 -            }
   18.38 -        }
   18.39 -        break;
   18.40 -
   18.41 -    case WT_PROXIMITY:
   18.42 -        {
   18.43 -            /* checking where the proximity message showed up */
   18.44 -            int h_context = LOWORD(lParam);
   18.45 -            POINT point;
   18.46 -            GetCursorPos(&point);
   18.47 -            ScreenToClient(hwnd, &point);
   18.48 -
   18.49 -            /* are we in proximity or out of proximity */
   18.50 -            if (h_context == 0) {
   18.51 -                SDL_SendProximity(tablet, point.x, point.y, SDL_PROXIMITYOUT);
   18.52 -            } else {
   18.53 -                SDL_SendProximity(tablet, point.x, point.y, SDL_PROXIMITYIN);
   18.54 -            }
   18.55 -        }
   18.56 -        break;
   18.57 -
   18.58      case WM_SHOWWINDOW:
   18.59          {
   18.60              if (wParam) {
   18.61 @@ -183,13 +146,9 @@
   18.62  
   18.63      case WM_ACTIVATE:
   18.64          {
   18.65 -            int index;
   18.66 -            SDL_Keyboard *keyboard;
   18.67              BOOL minimized;
   18.68  
   18.69              minimized = HIWORD(wParam);
   18.70 -            index = data->videodata->keyboard;
   18.71 -            keyboard = SDL_GetKeyboard(index);
   18.72              if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
   18.73                  SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
   18.74                  SDL_SendWindowEvent(data->window,
   18.75 @@ -200,13 +159,13 @@
   18.76                                          SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
   18.77                  }
   18.78  #endif
   18.79 -                if (keyboard && keyboard->focus != data->window) {
   18.80 -                    SDL_SetKeyboardFocus(index, data->window);
   18.81 +                if (SDL_GetKeyboardFocus() != data->window) {
   18.82 +                    SDL_SetKeyboardFocus(data->window);
   18.83                  }
   18.84                  /* FIXME: Update keyboard state */
   18.85              } else {
   18.86 -                if (keyboard && keyboard->focus == data->window) {
   18.87 -                    SDL_SetKeyboardFocus(index, 0);
   18.88 +                if (SDL_GetKeyboardFocus() == data->window) {
   18.89 +                    SDL_SetKeyboardFocus(NULL);
   18.90                  }
   18.91                  if (minimized) {
   18.92                      SDL_SendWindowEvent(data->window,
   18.93 @@ -217,124 +176,22 @@
   18.94          returnCode = 0;
   18.95          break;
   18.96  
   18.97 -/* WinCE has no RawInput, so we use the classic mouse events.
   18.98 -   In classic Win32 this is done by WM_INPUT
   18.99 - */
  18.100 -#ifdef _WIN32_WCE
  18.101      case WM_MOUSEMOVE:
  18.102 -        SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
  18.103 +        SDL_SendMouseMotion(0, LOWORD(lParam), HIWORD(lParam));
  18.104          break;
  18.105  
  18.106      case WM_LBUTTONDOWN:
  18.107 -        SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
  18.108 -        SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT);
  18.109 +        SDL_SendMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT);
  18.110          break;
  18.111  
  18.112      case WM_LBUTTONUP:
  18.113 -        SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
  18.114 -        SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT);
  18.115 +        SDL_SendMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT);
  18.116          break;
  18.117 -#else /* _WIN32_WCE */
  18.118 -
  18.119 -    case WM_INPUT:             /* mouse events */
  18.120 -        {
  18.121 -            LPBYTE lpb;
  18.122 -            const RAWINPUTHEADER *header;
  18.123 -            int index = -1;
  18.124 -            int i;
  18.125 -            int size = 0;
  18.126 -            const RAWMOUSE *raw_mouse = NULL;
  18.127 -            POINT point;
  18.128 -            USHORT flags;
  18.129 -            int w, h;
  18.130 -
  18.131 -            /* we're collecting raw data to be able to identify the mouse (if there are several) */
  18.132 -            GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size,
  18.133 -                            sizeof(RAWINPUTHEADER));
  18.134 -            lpb = SDL_stack_alloc(BYTE, size);
  18.135 -            GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size,
  18.136 -                            sizeof(RAWINPUTHEADER));
  18.137 -            raw = (RAWINPUT *) lpb;
  18.138 -            header = &raw->header;
  18.139 -            flags = raw->data.mouse.usButtonFlags;
  18.140 -
  18.141 -            /* we're checking which mouse generated the event */
  18.142 -            for (i = 0; i < total_mice; ++i) {
  18.143 -                if (mice[i] == header->hDevice) {
  18.144 -                    index = i;
  18.145 -                    break;
  18.146 -                }
  18.147 -            }
  18.148 -            if (index < 0) {
  18.149 -                /* New mouse?  Should we dynamically update mouse list? */
  18.150 -                returnCode = 0;
  18.151 -                break;
  18.152 -            }
  18.153 -
  18.154 -            GetCursorPos(&point);
  18.155 -            ScreenToClient(hwnd, &point);
  18.156 -
  18.157 -            SDL_GetWindowSize(data->window, &w, &h);
  18.158 -            if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) {
  18.159 -                SDL_SetMouseFocus(index, data->window);
  18.160 -            } else {
  18.161 -                SDL_SetMouseFocus(index, 0);
  18.162 -                /* FIXME: Should we be doing anything else here? */
  18.163 -                break;
  18.164 -            }
  18.165 -
  18.166 -            /* if the message was sent by a tablet we have to send also pressure */
  18.167 -            if (index == tablet) {
  18.168 -                SDL_SendMouseMotion(index, 0, point.x, point.y, pressure);
  18.169 -            } else {
  18.170 -                SDL_SendMouseMotion(index, 0, point.x, point.y, 0);
  18.171 -            }
  18.172 -            /* we're sending mouse buttons messages to check up if sth changed */
  18.173 -            if (flags & RI_MOUSE_LEFT_BUTTON_DOWN) {
  18.174 -                SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_LEFT);
  18.175 -            } else if (flags & RI_MOUSE_LEFT_BUTTON_UP) {
  18.176 -                SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_LEFT);
  18.177 -            }
  18.178 -            if (flags & RI_MOUSE_MIDDLE_BUTTON_DOWN) {
  18.179 -                SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_MIDDLE);
  18.180 -            } else if (flags & RI_MOUSE_MIDDLE_BUTTON_UP) {
  18.181 -                SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_MIDDLE);
  18.182 -            }
  18.183 -            if (flags & RI_MOUSE_RIGHT_BUTTON_DOWN) {
  18.184 -                SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_RIGHT);
  18.185 -            } else if (flags & RI_MOUSE_RIGHT_BUTTON_UP) {
  18.186 -                SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_RIGHT);
  18.187 -            }
  18.188 -            if (flags & RI_MOUSE_BUTTON_4_DOWN) {
  18.189 -                SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_X1);
  18.190 -            } else if (flags & RI_MOUSE_BUTTON_4_UP) {
  18.191 -                SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_X1);
  18.192 -            }
  18.193 -            if (flags & RI_MOUSE_BUTTON_5_DOWN) {
  18.194 -                SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_X2);
  18.195 -            } else if (flags & RI_MOUSE_BUTTON_5_UP) {
  18.196 -                SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_X2);
  18.197 -            }
  18.198 -            if (flags & RI_MOUSE_WHEEL) {
  18.199 -                SDL_SendMouseWheel(index, 0,
  18.200 -                                   (short) raw->data.mouse.usButtonData);
  18.201 -            }
  18.202 -            SDL_stack_free(lpb);
  18.203 -        }
  18.204 -        returnCode = 0;
  18.205 -        break;
  18.206 -#endif /* _WIN32_WCE */
  18.207  
  18.208      case WM_MOUSELEAVE:
  18.209          {
  18.210 -            int i;
  18.211 -
  18.212 -            for (i = 0; i < SDL_GetNumMice(); ++i) {
  18.213 -                SDL_Mouse *mouse = SDL_GetMouse(i);
  18.214 -
  18.215 -                if (mouse->focus == data->window) {
  18.216 -                    SDL_SetMouseFocus(i, 0);
  18.217 -                }
  18.218 +            if (SDL_GetMouseFocus() == data->window) {
  18.219 +                SDL_SetMouseFocus(NULL);
  18.220              }
  18.221          }
  18.222          returnCode = 0;
  18.223 @@ -343,15 +200,12 @@
  18.224      case WM_SYSKEYDOWN:
  18.225      case WM_KEYDOWN:
  18.226          {
  18.227 -            int index;
  18.228 -
  18.229              /* Ignore repeated keys */
  18.230              if (lParam & REPEATED_KEYMASK) {
  18.231                  returnCode = 0;
  18.232                  break;
  18.233              }
  18.234  
  18.235 -            index = data->videodata->keyboard;
  18.236              wParam = RemapVKEY(wParam, lParam);
  18.237              switch (wParam) {
  18.238              case VK_CONTROL:
  18.239 @@ -388,7 +242,7 @@
  18.240                  break;
  18.241              }
  18.242              if (wParam < 256) {
  18.243 -                SDL_SendKeyboardKey(index, SDL_PRESSED,
  18.244 +                SDL_SendKeyboardKey(SDL_PRESSED,
  18.245                                      data->videodata->key_layout[wParam]);
  18.246              }
  18.247          }
  18.248 @@ -398,9 +252,6 @@
  18.249      case WM_SYSKEYUP:
  18.250      case WM_KEYUP:
  18.251          {
  18.252 -            int index;
  18.253 -
  18.254 -            index = data->videodata->keyboard;
  18.255              wParam = RemapVKEY(wParam, lParam);
  18.256              switch (wParam) {
  18.257              case VK_CONTROL:
  18.258 @@ -441,11 +292,11 @@
  18.259              if (wParam == VK_SNAPSHOT
  18.260                  && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
  18.261                  SDL_RELEASED) {
  18.262 -                SDL_SendKeyboardKey(index, SDL_PRESSED,
  18.263 +                SDL_SendKeyboardKey(SDL_PRESSED,
  18.264                                      data->videodata->key_layout[wParam]);
  18.265              }
  18.266              if (wParam < 256) {
  18.267 -                SDL_SendKeyboardKey(index, SDL_RELEASED,
  18.268 +                SDL_SendKeyboardKey(SDL_RELEASED,
  18.269                                      data->videodata->key_layout[wParam]);
  18.270              }
  18.271          }
  18.272 @@ -470,14 +321,14 @@
  18.273                  text[2] = 0x80 | (char) (wParam & 0x3F);
  18.274                  text[3] = '\0';
  18.275              }
  18.276 -            SDL_SendKeyboardText(data->videodata->keyboard, text);
  18.277 +            SDL_SendKeyboardText(text);
  18.278          }
  18.279          returnCode = 0;
  18.280          break;
  18.281  
  18.282      case WM_INPUTLANGCHANGE:
  18.283          {
  18.284 -            WIN_UpdateKeymap(data->videodata->keyboard);
  18.285 +            WIN_UpdateKeymap();
  18.286          }
  18.287          returnCode = 1;
  18.288          break;
    19.1 --- a/src/video/win32/SDL_win32keyboard.c	Sun May 09 19:55:28 2010 -0700
    19.2 +++ b/src/video/win32/SDL_win32keyboard.c	Sun May 09 20:47:22 2010 -0700
    19.3 @@ -50,7 +50,6 @@
    19.4  WIN_InitKeyboard(_THIS)
    19.5  {
    19.6      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    19.7 -    SDL_Keyboard keyboard;
    19.8      int i;
    19.9  
   19.10      /* Make sure the alpha scancodes are correct.  T isn't usually remapped */
   19.11 @@ -82,9 +81,7 @@
   19.12  
   19.13      data->key_layout = win32_scancode_table;
   19.14  
   19.15 -    SDL_zero(keyboard);
   19.16 -    data->keyboard = SDL_AddKeyboard(&keyboard, -1);
   19.17 -    WIN_UpdateKeymap(data->keyboard);
   19.18 +    WIN_UpdateKeymap();
   19.19  
   19.20      SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
   19.21      SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows");
   19.22 @@ -92,7 +89,7 @@
   19.23  }
   19.24  
   19.25  void
   19.26 -WIN_UpdateKeymap(int keyboard)
   19.27 +WIN_UpdateKeymap()
   19.28  {
   19.29      int i;
   19.30      SDL_scancode scancode;
   19.31 @@ -117,15 +114,12 @@
   19.32              keymap[scancode] = (MapVirtualKey(i, MAPVK_VK_TO_CHAR) & 0x7FFF);
   19.33          }
   19.34      }
   19.35 -    SDL_SetKeymap(keyboard, 0, keymap, SDL_NUM_SCANCODES);
   19.36 +    SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
   19.37  }
   19.38  
   19.39  void
   19.40  WIN_QuitKeyboard(_THIS)
   19.41  {
   19.42 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   19.43 -
   19.44 -    SDL_DelKeyboard(data->keyboard);
   19.45  }
   19.46  
   19.47  /* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/src/video/win32/SDL_win32keyboard.h	Sun May 09 19:55:28 2010 -0700
    20.2 +++ b/src/video/win32/SDL_win32keyboard.h	Sun May 09 20:47:22 2010 -0700
    20.3 @@ -28,7 +28,7 @@
    20.4  extern BYTE keypad_scancodes[10];
    20.5  
    20.6  extern void WIN_InitKeyboard(_THIS);
    20.7 -extern void WIN_UpdateKeymap(int keyboard);
    20.8 +extern void WIN_UpdateKeymap(void);
    20.9  extern void WIN_QuitKeyboard(_THIS);
   20.10  
   20.11  #endif /* _SDL_win32keyboard_h */
    21.1 --- a/src/video/win32/SDL_win32modes.c	Sun May 09 19:55:28 2010 -0700
    21.2 +++ b/src/video/win32/SDL_win32modes.c	Sun May 09 20:47:22 2010 -0700
    21.3 @@ -160,7 +160,6 @@
    21.4  int
    21.5  WIN_InitModes(_THIS)
    21.6  {
    21.7 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    21.8      DWORD i, j, count;
    21.9      DISPLAY_DEVICE device;
   21.10  
    22.1 --- a/src/video/win32/SDL_win32mouse.c	Sun May 09 19:55:28 2010 -0700
    22.2 +++ b/src/video/win32/SDL_win32mouse.c	Sun May 09 20:47:22 2010 -0700
    22.3 @@ -31,182 +31,14 @@
    22.4  
    22.5  #include "SDL_win32video.h"
    22.6  
    22.7 -#include "../../events/SDL_mouse_c.h"
    22.8 -
    22.9 -extern HANDLE *mice;
   22.10 -extern int total_mice;
   22.11 -extern int tablet;
   22.12 -
   22.13  void
   22.14  WIN_InitMouse(_THIS)
   22.15  {
   22.16 -    int index = 0;
   22.17 -    RAWINPUTDEVICELIST *deviceList = NULL;
   22.18 -    int devCount = 0;
   22.19 -    int i;
   22.20 -    UINT tmp = 0;
   22.21 -    char *buffer = NULL;
   22.22 -    char *tab = "wacom";        /* since windows does't give us handles to tablets, we have to detect a tablet by it's name */
   22.23 -    const char *rdp = "rdp_mou";
   22.24 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   22.25 -
   22.26 -/* WinCE has no RawInputDeviceList */
   22.27 -#ifdef _WIN32_WCE
   22.28 -    SDL_Mouse mouse;
   22.29 -    SDL_zero(mouse);
   22.30 -    mouse.id = 0;
   22.31 -    SDL_AddMouse(&mouse, "Stylus", 0, 0, 1);
   22.32 -#else
   22.33 -    /* we're checking for the number of rawinput devices */
   22.34 -    if (GetRawInputDeviceList(NULL, &devCount, sizeof(RAWINPUTDEVICELIST))) {
   22.35 -        return;
   22.36 -    }
   22.37 -
   22.38 -    deviceList = SDL_malloc(sizeof(RAWINPUTDEVICELIST) * devCount);
   22.39 -
   22.40 -    /* we're getting the raw input device list */
   22.41 -    GetRawInputDeviceList(deviceList, &devCount, sizeof(RAWINPUTDEVICELIST));
   22.42 -    mice = SDL_malloc(devCount * sizeof(HANDLE));
   22.43 -
   22.44 -    /* we're getting the details of the devices */
   22.45 -    for (i = 0; i < devCount; ++i) {
   22.46 -        int is_rdp = 0;
   22.47 -        UINT j;
   22.48 -        UINT k;
   22.49 -        char *default_device_name = "Pointing device xx";
   22.50 -        const char *reg_key_root = "System\\CurrentControlSet\\Enum\\";
   22.51 -        char *device_name = SDL_malloc(256 * sizeof(char));
   22.52 -        char *key_name = NULL;
   22.53 -        char *tmp_name = NULL;
   22.54 -        LONG rc = 0;
   22.55 -        HKEY hkey;
   22.56 -        DWORD regtype = REG_SZ;
   22.57 -        DWORD out = 256 * sizeof(char);
   22.58 -        SDL_Mouse mouse;
   22.59 -        size_t l;
   22.60 -        if (deviceList[i].dwType != RIM_TYPEMOUSE) {    /* if a device isn't a mouse type we don't want it */
   22.61 -            continue;
   22.62 -        }
   22.63 -        if (GetRawInputDeviceInfoA
   22.64 -            (deviceList[i].hDevice, RIDI_DEVICENAME, NULL, &tmp) < 0) {
   22.65 -            continue;
   22.66 -        }
   22.67 -        buffer = SDL_malloc((tmp + 1) * sizeof(char));
   22.68 -        key_name =
   22.69 -            SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char));
   22.70 -
   22.71 -        /* we're getting the device registry path and polishing it to get it's name,
   22.72 -           surely there must be an easier way, but we haven't found it yet */
   22.73 -        if (GetRawInputDeviceInfoA
   22.74 -            (deviceList[i].hDevice, RIDI_DEVICENAME, buffer, &tmp) < 0) {
   22.75 -            continue;
   22.76 -        }
   22.77 -        buffer += 4;
   22.78 -        tmp -= 4;
   22.79 -        tmp_name = buffer;
   22.80 -        for (j = 0; j < tmp; ++j) {
   22.81 -            if (*tmp_name == '#') {
   22.82 -                *tmp_name = '\\';
   22.83 -            }
   22.84 -
   22.85 -            else if (*tmp_name == '{') {
   22.86 -                break;
   22.87 -            }
   22.88 -            ++tmp_name;
   22.89 -        }
   22.90 -        *tmp_name = '\0';
   22.91 -        SDL_memcpy(key_name, reg_key_root, SDL_strlen(reg_key_root));
   22.92 -        SDL_memcpy(key_name + (SDL_strlen(reg_key_root)), buffer, j + 1);
   22.93 -        l = SDL_strlen(key_name);
   22.94 -        is_rdp = 0;
   22.95 -        if (l >= 7) {
   22.96 -            for (j = 0; j < l - 7; ++j) {
   22.97 -                for (k = 0; k < 7; ++k) {
   22.98 -                    if (rdp[k] !=
   22.99 -                        SDL_tolower((unsigned char) key_name[j + k])) {
  22.100 -                        break;
  22.101 -                    }
  22.102 -                }
  22.103 -                if (k == 7) {
  22.104 -                    is_rdp = 1;
  22.105 -                    break;
  22.106 -                }
  22.107 -            }
  22.108 -        }
  22.109 -
  22.110 -        buffer -= 4;
  22.111 -
  22.112 -        if (is_rdp == 1) {
  22.113 -            SDL_free(buffer);
  22.114 -            SDL_free(key_name);
  22.115 -            SDL_free(device_name);
  22.116 -            is_rdp = 0;
  22.117 -            continue;
  22.118 -        }
  22.119 -
  22.120 -        /* we're opening the registry key to get the mouse name */
  22.121 -        rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_name, 0, KEY_READ, &hkey);
  22.122 -        if (rc != ERROR_SUCCESS) {
  22.123 -            SDL_memcpy(device_name, default_device_name,
  22.124 -                       SDL_strlen(default_device_name));
  22.125 -        }
  22.126 -        rc = RegQueryValueExA(hkey, "DeviceDesc", NULL, &regtype, device_name,
  22.127 -                              &out);
  22.128 -        RegCloseKey(hkey);
  22.129 -        if (rc != ERROR_SUCCESS) {
  22.130 -            SDL_memcpy(device_name, default_device_name,
  22.131 -                       SDL_strlen(default_device_name));
  22.132 -        }
  22.133 -
  22.134 -        /* we're saving the handle to the device */
  22.135 -        mice[index] = deviceList[i].hDevice;
  22.136 -        SDL_zero(mouse);
  22.137 -        mouse.id = index;
  22.138 -        l = SDL_strlen(device_name);
  22.139 -
  22.140 -        /* we're checking if the device isn't by any chance a tablet */
  22.141 -        if (data->wintabDLL && tablet == -1) {
  22.142 -            for (j = 0; j < l - 5; ++j) {
  22.143 -                for (k = 0; k < 5; ++k) {
  22.144 -                    if (tab[k] !=
  22.145 -                        SDL_tolower((unsigned char) device_name[j + k])) {
  22.146 -                        break;
  22.147 -                    }
  22.148 -                }
  22.149 -                if (k == 5) {
  22.150 -                    tablet = index;
  22.151 -                    break;
  22.152 -                }
  22.153 -            }
  22.154 -        }
  22.155 -
  22.156 -        /* if it's a tablet, let's read it's maximum and minimum pressure */
  22.157 -        if (tablet == index) {
  22.158 -            AXIS pressure;
  22.159 -            int cursors;
  22.160 -            data->WTInfoA(WTI_DEVICES, DVC_NPRESSURE, &pressure);
  22.161 -            data->WTInfoA(WTI_DEVICES, DVC_NCSRTYPES, &cursors);
  22.162 -            SDL_AddMouse(&mouse, device_name, pressure.axMax, pressure.axMin,
  22.163 -                         cursors);
  22.164 -        } else {
  22.165 -            SDL_AddMouse(&mouse, device_name, 0, 0, 1);
  22.166 -        }
  22.167 -        ++index;
  22.168 -        SDL_free(buffer);
  22.169 -        SDL_free(key_name);
  22.170 -    }
  22.171 -    total_mice = index;
  22.172 -    SDL_free(deviceList);
  22.173 -#endif /*_WIN32_WCE*/
  22.174  }
  22.175  
  22.176  void
  22.177  WIN_QuitMouse(_THIS)
  22.178  {
  22.179 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
  22.180 -
  22.181 -    /* let's delete all of the mice */
  22.182 -    SDL_MouseQuit();
  22.183  }
  22.184  
  22.185  /* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/video/win32/SDL_win32video.c	Sun May 09 19:55:28 2010 -0700
    23.2 +++ b/src/video/win32/SDL_win32video.c	Sun May 09 20:47:22 2010 -0700
    23.3 @@ -35,11 +35,6 @@
    23.4  static int WIN_VideoInit(_THIS);
    23.5  static void WIN_VideoQuit(_THIS);
    23.6  
    23.7 -int total_mice = 0;             /* total mouse count */
    23.8 -HANDLE *mice = NULL;            /* the handles to the detected mice */
    23.9 -HCTX *g_hCtx = NULL;            /* handles to tablet contexts */
   23.10 -int tablet = -1;                /* we're assuming that there is no tablet */
   23.11 -
   23.12  /* WIN32 driver bootstrap functions */
   23.13  
   23.14  static int
   23.15 @@ -66,9 +61,6 @@
   23.16          FreeLibrary(data->ddrawDLL);
   23.17      }
   23.18  #endif
   23.19 -    if (data->wintabDLL) {
   23.20 -        FreeLibrary(data->wintabDLL);
   23.21 -    }
   23.22      SDL_free(device->driverdata);
   23.23      SDL_free(device);
   23.24  }
   23.25 @@ -85,8 +77,10 @@
   23.26      device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
   23.27      if (device) {
   23.28          data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
   23.29 +    } else {
   23.30 +        data = NULL;
   23.31      }
   23.32 -    if (!device || !data) {
   23.33 +    if (!data) {
   23.34          SDL_OutOfMemory();
   23.35          if (device) {
   23.36              SDL_free(device);
   23.37 @@ -131,32 +125,6 @@
   23.38      }
   23.39  #endif /* SDL_VIDEO_RENDER_DDRAW */
   23.40  
   23.41 -    data->wintabDLL = LoadLibrary(TEXT("WINTAB32.DLL"));
   23.42 -    if (data->wintabDLL) {
   23.43 -#define PROCNAME(X) #X
   23.44 -        data->WTInfoA =
   23.45 -            (UINT(*)(UINT, UINT, LPVOID)) GetProcAddress(data->wintabDLL,
   23.46 -                                                         PROCNAME(WTInfoA));
   23.47 -        data->WTOpenA =
   23.48 -            (HCTX(*)(HWND, LPLOGCONTEXTA, BOOL)) GetProcAddress(data->
   23.49 -                                                                wintabDLL,
   23.50 -                                                                PROCNAME
   23.51 -                                                                (WTOpenA));
   23.52 -        data->WTPacket =
   23.53 -            (int (*)(HCTX, UINT, LPVOID)) GetProcAddress(data->wintabDLL,
   23.54 -                                                         PROCNAME(WTPacket));
   23.55 -        data->WTClose =
   23.56 -            (BOOL(*)(HCTX)) GetProcAddress(data->wintabDLL,
   23.57 -                                           PROCNAME(WTClose));
   23.58 -#undef PROCNAME
   23.59 -
   23.60 -        if (!data->WTInfoA || !data->WTOpenA || !data->WTPacket
   23.61 -            || !data->WTClose) {
   23.62 -            FreeLibrary(data->wintabDLL);
   23.63 -            data->wintabDLL = NULL;
   23.64 -        }
   23.65 -    }
   23.66 -
   23.67      /* Set the function pointers */
   23.68      device->VideoInit = WIN_VideoInit;
   23.69      device->VideoQuit = WIN_VideoQuit;
   23.70 @@ -225,7 +193,6 @@
   23.71      GAPI_AddRenderDriver(_this);
   23.72  #endif
   23.73  
   23.74 -    g_hCtx = SDL_malloc(sizeof(HCTX));
   23.75      WIN_InitKeyboard(_this);
   23.76      WIN_InitMouse(_this);
   23.77  
   23.78 @@ -238,7 +205,6 @@
   23.79      WIN_QuitModes(_this);
   23.80      WIN_QuitKeyboard(_this);
   23.81      WIN_QuitMouse(_this);
   23.82 -    SDL_free(g_hCtx);
   23.83  }
   23.84  
   23.85  /* vim: set ts=4 sw=4 expandtab: */
    24.1 --- a/src/video/win32/SDL_win32video.h	Sun May 09 19:55:28 2010 -0700
    24.2 +++ b/src/video/win32/SDL_win32video.h	Sun May 09 20:47:22 2010 -0700
    24.3 @@ -45,11 +45,6 @@
    24.4  #include "ddraw.h"
    24.5  #endif
    24.6  
    24.7 -#include "wactab/wintab.h"
    24.8 -#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR)
    24.9 -#define PACKETMODE 0
   24.10 -#include "wactab/pktdef.h"
   24.11 -
   24.12  #include "SDL_win32events.h"
   24.13  #include "SDL_win32gamma.h"
   24.14  #include "SDL_win32keyboard.h"
   24.15 @@ -79,16 +74,6 @@
   24.16      IDirectDraw *ddraw;
   24.17  #endif
   24.18  
   24.19 -/* *INDENT-OFF* */
   24.20 -    /* Function pointers for the Wacom API */
   24.21 -    HANDLE wintabDLL;
   24.22 -    UINT (*WTInfoA) (UINT, UINT, LPVOID);
   24.23 -    HCTX (*WTOpenA) (HWND, LPLOGCONTEXTA, BOOL);
   24.24 -    int (*WTPacket) (HCTX, UINT, LPVOID);
   24.25 -    BOOL (*WTClose) (HCTX);
   24.26 -/* *INDENT-ON* */
   24.27 -
   24.28 -    int keyboard;
   24.29      const SDL_scancode *key_layout;
   24.30  } SDL_VideoData;
   24.31  
    25.1 --- a/src/video/win32/SDL_win32window.c	Sun May 09 19:55:28 2010 -0700
    25.2 +++ b/src/video/win32/SDL_win32window.c	Sun May 09 20:47:22 2010 -0700
    25.3 @@ -73,9 +73,6 @@
    25.4  
    25.5  #endif
    25.6  
    25.7 -extern HCTX *g_hCtx;            /* the table of tablet event contexts, each windows has to have it's own tablet context */
    25.8 -static Uint32 highestId = 0;    /* the highest id of the tablet context */
    25.9 -
   25.10  /* Fake window to help with DirectInput events. */
   25.11  HWND SDL_HelperWindow = NULL;
   25.12  static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
   25.13 @@ -165,9 +162,8 @@
   25.14          }
   25.15      }
   25.16      if (GetFocus() == hwnd) {
   25.17 -        int index = data->videodata->keyboard;
   25.18          window->flags |= SDL_WINDOW_INPUT_FOCUS;
   25.19 -        SDL_SetKeyboardFocus(index, data->window);
   25.20 +        SDL_SetKeyboardFocus(data->window);
   25.21  
   25.22          if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
   25.23              RECT rect;
   25.24 @@ -186,11 +182,7 @@
   25.25  int
   25.26  WIN_CreateWindow(_THIS, SDL_Window * window)
   25.27  {
   25.28 -    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
   25.29      SDL_VideoDisplay *display = window->display;
   25.30 -    RAWINPUTDEVICE Rid;
   25.31 -    AXIS TabX, TabY;
   25.32 -    LOGCONTEXTA lc;
   25.33      HWND hwnd;
   25.34      HWND top;
   25.35      RECT rect;
   25.36 @@ -257,48 +249,6 @@
   25.37          return -1;
   25.38      }
   25.39  
   25.40 -    /* we're configuring the tablet data. See Wintab reference for more info */
   25.41 -    if (videodata->wintabDLL
   25.42 -        && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) {
   25.43 -        lc.lcPktData = PACKETDATA;
   25.44 -        lc.lcPktMode = PACKETMODE;
   25.45 -        lc.lcOptions |= CXO_MESSAGES;
   25.46 -        lc.lcOptions |= CXO_SYSTEM;
   25.47 -        lc.lcMoveMask = PACKETDATA;
   25.48 -        lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA;
   25.49 -        videodata->WTInfoA(WTI_DEVICES, DVC_X, &TabX);
   25.50 -        videodata->WTInfoA(WTI_DEVICES, DVC_Y, &TabY);
   25.51 -        lc.lcInOrgX = 0;
   25.52 -        lc.lcInOrgY = 0;
   25.53 -        lc.lcInExtX = TabX.axMax;
   25.54 -        lc.lcInExtY = TabY.axMax;
   25.55 -        lc.lcOutOrgX = 0;
   25.56 -        lc.lcOutOrgY = 0;
   25.57 -        lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN);
   25.58 -        lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN);
   25.59 -        if (window->id > highestId) {
   25.60 -            HCTX *tmp_hctx;
   25.61 -            highestId = window->id;
   25.62 -            tmp_hctx =
   25.63 -                (HCTX *) SDL_realloc(g_hCtx, (highestId + 1) * sizeof(HCTX));
   25.64 -            if (!tmp_hctx) {
   25.65 -                SDL_OutOfMemory();
   25.66 -                DestroyWindow(hwnd);
   25.67 -                return -1;
   25.68 -            }
   25.69 -            g_hCtx = tmp_hctx;
   25.70 -        }
   25.71 -        g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
   25.72 -    }
   25.73 -#ifndef _WIN32_WCE              /* has no RawInput */
   25.74 -    /* we're telling the window, we want it to report raw input events from mice */
   25.75 -    Rid.usUsagePage = 0x01;
   25.76 -    Rid.usUsage = 0x02;
   25.77 -    Rid.dwFlags = RIDEV_INPUTSINK;
   25.78 -    Rid.hwndTarget = hwnd;
   25.79 -    RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
   25.80 -#endif
   25.81 -
   25.82      WIN_PumpEvents(_this);
   25.83  
   25.84      if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) {
   25.85 @@ -620,15 +570,11 @@
   25.86  void
   25.87  WIN_DestroyWindow(_THIS, SDL_Window * window)
   25.88  {
   25.89 -    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
   25.90      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   25.91  
   25.92      if (data) {
   25.93          ReleaseDC(data->hwnd, data->hdc);
   25.94          if (data->created) {
   25.95 -            if (videodata->wintabDLL) {
   25.96 -                videodata->WTClose(g_hCtx[window->id]);
   25.97 -            }
   25.98              DestroyWindow(data->hwnd);
   25.99          }
  25.100          SDL_free(data);
    26.1 --- a/src/video/win32/wactab/pktdef.h	Sun May 09 19:55:28 2010 -0700
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,237 +0,0 @@
    26.4 -/* *INDENT-OFF* */
    26.5 -/* -------------------------------- pktdef.h -------------------------------- */
    26.6 -/* Combined 16 & 32-bit version. */
    26.7 -
    26.8 -/*------------------------------------------------------------------------------
    26.9 -The text and information contained in this file may be freely used,
   26.10 -copied, or distributed without compensation or licensing restrictions.
   26.11 -
   26.12 -This file is copyright 1991-1998 by LCS/Telegraphics.
   26.13 -------------------------------------------------------------------------------*/
   26.14 -/*------------------------------------------------------------------------------
   26.15 -
   26.16 -How to use pktdef.h:
   26.17 -
   26.18 -1. Include wintab.h
   26.19 -2. if using just one packet format:
   26.20 -	a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits
   26.21 -	   (use the PK_* identifiers).
   26.22 -	b. Include pktdef.h.
   26.23 -	c. The generated structure typedef will be called PACKET.  Use PACKETDATA
   26.24 -	   and PACKETMODE to fill in the LOGCONTEXT structure.
   26.25 -3. If using multiple packet formats, for each one:
   26.26 -	a. Define PACKETNAME. Its text value will be a prefix for this packet's
   26.27 -	   parameters and names.
   26.28 -	b. Define <PACKETNAME>PACKETDATA and <PACKETNAME>PACKETMODE similar to
   26.29 -	   2.a. above.
   26.30 -	c. Include pktdef.h.
   26.31 -	d. The generated structure typedef will be called
   26.32 -	   <PACKETNAME>PACKET. Compare with 2.c. above and example #2 below.
   26.33 -4. If using extension packet data, do the following additional steps
   26.34 -   for each extension:
   26.35 -	a. Before including pktdef.h, define <PACKETNAME>PACKET<EXTENSION>
   26.36 -	   as either PKEXT_ABSOLUTE or PKEXT_RELATIVE.
   26.37 -	b. The generated structure typedef will contain a field for the
   26.38 -	   extension data.
   26.39 -	c. Scan the WTI_EXTENSION categories to find the extension's
   26.40 -	   packet mask bit.
   26.41 -	d. OR the packet mask bit with <PACKETNAME>PACKETDATA and use the
   26.42 -	   result in the lcPktData field of the LOGCONTEXT structure.
   26.43 -	e. If <PACKETNAME>PACKET<EXTENSION> was PKEXT_RELATIVE, OR the
   26.44 -	   packet mask bit with <PACKETNAME>PACKETMODE and use the result
   26.45 -	   in the lcPktMode field of the LOGCONTEXT structure.
   26.46 -
   26.47 -
   26.48 -Example #1.	-- single packet format
   26.49 -
   26.50 -#include <wintab.h>
   26.51 -#define PACKETDATA	PK_X | PK_Y | PK_BUTTONS	/@ x, y, buttons @/
   26.52 -#define PACKETMODE	PK_BUTTONS					/@ buttons relative mode @/
   26.53 -#include <pktdef.h>
   26.54 -...
   26.55 -	lc.lcPktData = PACKETDATA;
   26.56 -	lc.lcPktMode = PACKETMODE;
   26.57 -
   26.58 -Example #2. -- multiple formats
   26.59 -
   26.60 -#include <wintab.h>
   26.61 -#define PACKETNAME		MOE
   26.62 -#define MOEPACKETDATA	PK_X | PK_Y | PK_BUTTONS	/@ x, y, buttons @/
   26.63 -#define MOEPACKETMODE	PK_BUTTONS					/@ buttons relative mode @/
   26.64 -#include <pktdef.h>
   26.65 -#define PACKETNAME		LARRY
   26.66 -#define LARRYPACKETDATA	PK_Y | PK_Z | PK_BUTTONS	/@ y, z, buttons @/
   26.67 -#define LARRYPACKETMODE	PK_BUTTONS					/@ buttons relative mode @/
   26.68 -#include <pktdef.h>
   26.69 -#define PACKETNAME		CURLY
   26.70 -#define CURLYPACKETDATA	PK_X | PK_Z | PK_BUTTONS	/@ x, z, buttons @/
   26.71 -#define CURLYPACKETMODE	PK_BUTTONS					/@ buttons relative mode @/
   26.72 -#include <pktdef.h>
   26.73 -...
   26.74 -	lcMOE.lcPktData = MOEPACKETDATA;
   26.75 -	lcMOE.lcPktMode = MOEPACKETMODE;
   26.76 -...
   26.77 -	lcLARRY.lcPktData = LARRYPACKETDATA;
   26.78 -	lcLARRY.lcPktMode = LARRYPACKETMODE;
   26.79 -...
   26.80 -	lcCURLY.lcPktData = CURLYPACKETDATA;
   26.81 -	lcCURLY.lcPktMode = CURLYPACKETMODE;
   26.82 -
   26.83 -Example #3. -- extension packet data "XFOO".
   26.84 -	
   26.85 -#include <wintab.h>
   26.86 -#define PACKETDATA	PK_X | PK_Y | PK_BUTTONS	/@ x, y, buttons @/
   26.87 -#define PACKETMODE	PK_BUTTONS					/@ buttons relative mode @/
   26.88 -#define PACKETXFOO	PKEXT_ABSOLUTE				/@ XFOO absolute mode @/
   26.89 -#include <pktdef.h>
   26.90 -...
   26.91 -UINT ScanExts(UINT wTag)
   26.92 -{
   26.93 -	UINT i;
   26.94 -	UINT wScanTag;
   26.95 -
   26.96 -	/@ scan for wTag's info category. @/
   26.97 -	for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) {
   26.98 -		 if (wTag == wScanTag) {
   26.99 -			/@ return category offset from WTI_EXTENSIONS. @/
  26.100 -			return i;
  26.101 -		}
  26.102 -	}
  26.103 -	/@ return error code. @/
  26.104 -	return 0xFFFF;
  26.105 -}
  26.106 -...
  26.107 -	lc.lcPktData = PACKETDATA;
  26.108 -	lc.lcPktMode = PACKETMODE;
  26.109 -#ifdef PACKETXFOO
  26.110 -	categoryXFOO = ScanExts(WTX_XFOO);
  26.111 -	WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO);
  26.112 -	lc.lcPktData |= maskXFOO;
  26.113 -#if PACKETXFOO == PKEXT_RELATIVE
  26.114 -	lc.lcPktMode |= maskXFOO;
  26.115 -#endif
  26.116 -#endif
  26.117 -	WTOpen(hWnd, &lc, TRUE);
  26.118 -
  26.119 -
  26.120 -------------------------------------------------------------------------------*/
  26.121 -#ifdef __cplusplus
  26.122 -extern "C" {
  26.123 -#endif	/* __cplusplus */
  26.124 -
  26.125 -#ifndef PACKETNAME
  26.126 -	/* if no packet name prefix */
  26.127 -	#define __PFX(x)	x
  26.128 -	#define __IFX(x,y)	x ## y
  26.129 -#else
  26.130 -	/* add prefixes and infixes to packet format names */
  26.131 -	#define __PFX(x)		__PFX2(PACKETNAME,x)
  26.132 -	#define __PFX2(p,x)		__PFX3(p,x)
  26.133 -	#define __PFX3(p,x)		p ## x
  26.134 -	#define __IFX(x,y)		__IFX2(x,PACKETNAME,y)
  26.135 -	#define __IFX2(x,i,y)	__IFX3(x,i,y)
  26.136 -	#define __IFX3(x,i,y)	x ## i ## y
  26.137 -#endif
  26.138 -
  26.139 -#define __SFX2(x,s)		__SFX3(x,s)
  26.140 -#define __SFX3(x,s)		x ## s
  26.141 -
  26.142 -#define __TAG  	__IFX(tag,PACKET)
  26.143 -#define __TYPES	__PFX(PACKET), * __IFX(P,PACKET), NEAR * __IFX(NP,PACKET), \
  26.144 -					FAR * __IFX(LP,PACKET)
  26.145 -
  26.146 -#define __DATA		(__PFX(PACKETDATA))
  26.147 -#define __MODE		(__PFX(PACKETMODE))
  26.148 -#define __EXT(x)	__SFX2(__PFX(PACKET),x)
  26.149 -
  26.150 -	
  26.151 -typedef struct __TAG {
  26.152 -	#if (__DATA & PK_CONTEXT)
  26.153 -		HCTX			pkContext;
  26.154 -	#endif
  26.155 -	#if (__DATA & PK_STATUS)
  26.156 -		UINT			pkStatus;
  26.157 -	#endif
  26.158 -	#if (__DATA & PK_TIME)
  26.159 -		DWORD			pkTime;
  26.160 -	#endif
  26.161 -	#if (__DATA & PK_CHANGED)
  26.162 -		WTPKT			pkChanged;
  26.163 -	#endif
  26.164 -	#if (__DATA & PK_SERIAL_NUMBER)
  26.165 -		UINT			pkSerialNumber;
  26.166 -	#endif
  26.167 -	#if (__DATA & PK_CURSOR)
  26.168 -		UINT			pkCursor;
  26.169 -	#endif
  26.170 -	#if (__DATA & PK_BUTTONS)
  26.171 -		DWORD			pkButtons;
  26.172 -	#endif
  26.173 -	#if (__DATA & PK_X)
  26.174 -		LONG			pkX;
  26.175 -	#endif
  26.176 -	#if (__DATA & PK_Y)
  26.177 -		LONG			pkY;
  26.178 -	#endif
  26.179 -	#if (__DATA & PK_Z)
  26.180 -		LONG			pkZ;
  26.181 -	#endif
  26.182 -	#if (__DATA & PK_NORMAL_PRESSURE)
  26.183 -		#if (__MODE & PK_NORMAL_PRESSURE)
  26.184 -			/* relative */
  26.185 -			int			pkNormalPressure;
  26.186 -		#else
  26.187 -			/* absolute */
  26.188 -			UINT		pkNormalPressure;
  26.189 -		#endif
  26.190 -	#endif
  26.191 -	#if (__DATA & PK_TANGENT_PRESSURE)
  26.192 -		#if (__MODE & PK_TANGENT_PRESSURE)
  26.193 -			/* relative */
  26.194 -			int			pkTangentPressure;
  26.195 -		#else
  26.196 -			/* absolute */
  26.197 -			UINT		pkTangentPressure;
  26.198 -		#endif
  26.199 -	#endif
  26.200 -	#if (__DATA & PK_ORIENTATION)
  26.201 -		ORIENTATION		pkOrientation;
  26.202 -	#endif
  26.203 -	#if (__DATA & PK_ROTATION)
  26.204 -		ROTATION		pkRotation; /* 1.1 */
  26.205 -	#endif
  26.206 -
  26.207 -#ifndef NOWTEXTENSIONS
  26.208 -	/* extensions begin here. */
  26.209 -	#if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE)
  26.210 -		UINT			pkFKeys;
  26.211 -	#endif
  26.212 -	#if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE)
  26.213 -		TILT			pkTilt;
  26.214 -	#endif
  26.215 -	#if (__EXT(EXPKEYS) == PKEXT_RELATIVE) || (__EXT(EXPKEYS) == PKEXT_ABSOLUTE)
  26.216 -		WORD			pkExpKeys[4]; /* 1.3 */
  26.217 -	#endif
  26.218 -#endif
  26.219 -
  26.220 -} __TYPES ;
  26.221 -
  26.222 -#undef PACKETNAME
  26.223 -#undef __TAG
  26.224 -#undef __TAG2
  26.225 -#undef __TYPES
  26.226 -#undef __TYPES2
  26.227 -#undef __DATA
  26.228 -#undef __MODE
  26.229 -#undef __PFX
  26.230 -#undef __PFX2
  26.231 -#undef __PFX3
  26.232 -#undef __IFX
  26.233 -#undef __IFX2
  26.234 -#undef __IFX3
  26.235 -#undef __SFX2
  26.236 -#undef __SFX3
  26.237 -
  26.238 -#ifdef __cplusplus
  26.239 -}
  26.240 -#endif	/* __cplusplus */
    27.1 --- a/src/video/win32/wactab/wintab.h	Sun May 09 19:55:28 2010 -0700
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,866 +0,0 @@
    27.4 -/* *INDENT-OFF* */
    27.5 -/* -------------------------------- wintab.h -------------------------------- */
    27.6 -/* Combined 16 & 32-bit version. */
    27.7 -
    27.8 -/*------------------------------------------------------------------------------
    27.9 -The text and information contained in this file may be freely used,
   27.10 -copied, or distributed without compensation or licensing restrictions.
   27.11 -
   27.12 -This file is copyright 1991-1998 by LCS/Telegraphics.
   27.13 -------------------------------------------------------------------------------*/
   27.14 -
   27.15 -#ifndef _INC_WINTAB     /* prevent multiple includes */
   27.16 -#define _INC_WINTAB
   27.17 -
   27.18 -#ifdef __cplusplus
   27.19 -extern "C" {
   27.20 -#endif	/* __cplusplus */
   27.21 -
   27.22 -/* -------------------------------------------------------------------------- */
   27.23 -/* Messages */
   27.24 -#ifndef NOWTMESSAGES
   27.25 -
   27.26 -	#define WT_DEFBASE		0x7FF0
   27.27 -	#define WT_MAXOFFSET	0xF
   27.28 -
   27.29 -	#define _WT_PACKET(b)		((b)+0)
   27.30 -	#define _WT_CTXOPEN(b)		((b)+1)
   27.31 -	#define _WT_CTXCLOSE(b)		((b)+2)
   27.32 -	#define _WT_CTXUPDATE(b)	((b)+3)
   27.33 -	#define _WT_CTXOVERLAP(b)	((b)+4)
   27.34 -	#define _WT_PROXIMITY(b)	((b)+5)
   27.35 -	#define _WT_INFOCHANGE(b)	((b)+6)
   27.36 -	#define _WT_CSRCHANGE(b)	((b)+7) /* 1.1 */
   27.37 -	#define _WT_MAX(b)			((b)+WT_MAXOFFSET)
   27.38 -	
   27.39 -	#define WT_PACKET			_WT_PACKET(WT_DEFBASE)
   27.40 -	#define WT_CTXOPEN			_WT_CTXOPEN(WT_DEFBASE)
   27.41 -	#define WT_CTXCLOSE			_WT_CTXCLOSE(WT_DEFBASE)
   27.42 -	#define WT_CTXUPDATE		_WT_CTXUPDATE(WT_DEFBASE)
   27.43 -	#define WT_CTXOVERLAP		_WT_CTXOVERLAP(WT_DEFBASE)
   27.44 -	#define WT_PROXIMITY		_WT_PROXIMITY(WT_DEFBASE)
   27.45 -	#define WT_INFOCHANGE		_WT_INFOCHANGE(WT_DEFBASE)
   27.46 -	#define WT_CSRCHANGE		_WT_CSRCHANGE(WT_DEFBASE) /* 1.1 */
   27.47 -	#define WT_MAX				_WT_MAX(WT_DEFBASE)
   27.48 -
   27.49 -#endif
   27.50 -
   27.51 -/* -------------------------------------------------------------------------- */
   27.52 -/* -------------------------------------------------------------------------- */
   27.53 -/* Data Types */
   27.54 -
   27.55 -/* -------------------------------------------------------------------------- */
   27.56 -/* COMMON DATA DEFS */
   27.57 -
   27.58 -DECLARE_HANDLE(HMGR);		/* manager handle */
   27.59 -DECLARE_HANDLE(HCTX);		/* context handle */
   27.60 -DECLARE_HANDLE(HWTHOOK);	/* hook handle */
   27.61 -
   27.62 -typedef DWORD WTPKT;		/* packet mask */
   27.63 -
   27.64 -
   27.65 -#ifndef NOWTPKT
   27.66 -
   27.67 -	/* WTPKT bits */
   27.68 -	#define PK_CONTEXT			0x0001	/* reporting context */
   27.69 -	#define PK_STATUS			0x0002	/* status bits */
   27.70 -	#define PK_TIME				0x0004	/* time stamp */
   27.71 -	#define PK_CHANGED			0x0008	/* change bit vector */
   27.72 -	#define PK_SERIAL_NUMBER   	0x0010	/* packet serial number */
   27.73 -	#define PK_CURSOR			0x0020	/* reporting cursor */
   27.74 -	#define PK_BUTTONS			0x0040	/* button information */
   27.75 -	#define PK_X				0x0080	/* x axis */
   27.76 -	#define PK_Y				0x0100	/* y axis */
   27.77 -	#define PK_Z				0x0200	/* z axis */
   27.78 -	#define PK_NORMAL_PRESSURE	0x0400	/* normal or tip pressure */
   27.79 -	#define PK_TANGENT_PRESSURE	0x0800	/* tangential or barrel pressure */
   27.80 -	#define PK_ORIENTATION		0x1000	/* orientation info: tilts */
   27.81 -	#define PK_ROTATION			0x2000	/* rotation info; 1.1 */
   27.82 -
   27.83 -#endif
   27.84 -
   27.85 -typedef DWORD FIX32;				/* fixed-point arithmetic type */
   27.86 -
   27.87 -#ifndef NOFIX32
   27.88 -	#define INT(x)	HIWORD(x)
   27.89 -	#define FRAC(x)	LOWORD(x)
   27.90 -
   27.91 -	#define CASTFIX32(x)	((FIX32)((x)*65536L))
   27.92 -
   27.93 -	#define ROUND(x)		(INT(x) + (FRAC(x) > (WORD)0x8000))
   27.94 -
   27.95 -	#define FIX_MUL(c, a, b)						\
   27.96 -		(c = (((DWORD)FRAC(a) * FRAC(b)) >> 16) +	\
   27.97 -			(DWORD)INT(a) * FRAC(b) +				\
   27.98 -			(DWORD)INT(b) * FRAC(a) +				\
   27.99 -			((DWORD)INT(a) * INT(b) << 16))
  27.100 -
  27.101 -	#ifdef _WINDLL
  27.102 -		#define FIX_DIV_SC static
  27.103 -	#else
  27.104 -		#define FIX_DIV_SC
  27.105 -	#endif
  27.106 -
  27.107 -	#define FIX_DIV(c, a, b)					\
  27.108 -		{							   			\
  27.109 -			FIX_DIV_SC DWORD temp, rem, btemp;	\
  27.110 -									   			\
  27.111 -			/* fraction done bytewise */		\
  27.112 -			temp = ((a / b) << 16);				\
  27.113 -			rem = a % b;			   			\
  27.114 -			btemp = b;							\
  27.115 -			if (INT(btemp) < 256) {				\
  27.116 -				rem <<= 8;				   		\
  27.117 -			}									\
  27.118 -			else {								\
  27.119 -				btemp >>= 8;					\
  27.120 -			}									\
  27.121 -			temp += ((rem / btemp) << 8);  		\
  27.122 -			rem %= btemp;			   			\
  27.123 -			rem <<= 8;				   			\
  27.124 -			temp += rem / btemp;		   		\
  27.125 -			c = temp;				   			\
  27.126 -		}
  27.127 -#endif
  27.128 -
  27.129 -/* -------------------------------------------------------------------------- */
  27.130 -/* INFO DATA DEFS */
  27.131 -
  27.132 -#ifndef NOWTINFO
  27.133 -
  27.134 -#ifndef NOWTAXIS
  27.135 -
  27.136 -typedef struct tagAXIS {
  27.137 -	LONG	axMin;
  27.138 -	LONG	axMax;
  27.139 -	UINT	axUnits;
  27.140 -	FIX32	axResolution;
  27.141 -} AXIS, *PAXIS, NEAR *NPAXIS, FAR *LPAXIS;
  27.142 -
  27.143 -	/* unit specifiers */
  27.144 -	#define TU_NONE			0
  27.145 -	#define TU_INCHES		1
  27.146 -	#define TU_CENTIMETERS	2
  27.147 -	#define TU_CIRCLE		3
  27.148 -
  27.149 -#endif
  27.150 -
  27.151 -#ifndef NOWTSYSBUTTONS
  27.152 -
  27.153 -/* system button assignment values */
  27.154 -#define SBN_NONE		0x00
  27.155 -#define SBN_LCLICK		0x01
  27.156 -#define SBN_LDBLCLICK	0x02
  27.157 -#define SBN_LDRAG		0x03
  27.158 -#define SBN_RCLICK		0x04
  27.159 -#define SBN_RDBLCLICK	0x05
  27.160 -#define SBN_RDRAG		0x06
  27.161 -#define SBN_MCLICK		0x07
  27.162 -#define SBN_MDBLCLICK	0x08
  27.163 -#define SBN_MDRAG		0x09
  27.164 -/* for Pen Windows */
  27.165 -#define SBN_PTCLICK		0x10
  27.166 -#define SBN_PTDBLCLICK	0x20
  27.167 -#define SBN_PTDRAG		0x30
  27.168 -#define SBN_PNCLICK		0x40
  27.169 -#define SBN_PNDBLCLICK	0x50
  27.170 -#define SBN_PNDRAG		0x60
  27.171 -#define SBN_P1CLICK		0x70
  27.172 -#define SBN_P1DBLCLICK	0x80
  27.173 -#define SBN_P1DRAG		0x90
  27.174 -#define SBN_P2CLICK		0xA0
  27.175 -#define SBN_P2DBLCLICK	0xB0
  27.176 -#define SBN_P2DRAG		0xC0
  27.177 -#define SBN_P3CLICK		0xD0
  27.178 -#define SBN_P3DBLCLICK	0xE0
  27.179 -#define SBN_P3DRAG		0xF0
  27.180 -
  27.181 -#endif
  27.182 -
  27.183 -#ifndef NOWTCAPABILITIES
  27.184 -
  27.185 -/* hardware capabilities */
  27.186 -#define HWC_INTEGRATED		0x0001
  27.187 -#define HWC_TOUCH			0x0002
  27.188 -#define HWC_HARDPROX		0x0004
  27.189 -#define HWC_PHYSID_CURSORS	0x0008 /* 1.1 */
  27.190 -#endif
  27.191 -
  27.192 -#ifndef NOWTIFC
  27.193 -
  27.194 -#ifndef NOWTCURSORS 
  27.195 -
  27.196 -/* cursor capabilities */
  27.197 -#define CRC_MULTIMODE	0x0001 /* 1.1 */
  27.198 -#define CRC_AGGREGATE	0x0002 /* 1.1 */
  27.199 -#define CRC_INVERT		0x0004 /* 1.1 */
  27.200 -
  27.201 -#endif 
  27.202 -
  27.203 -/* info categories */
  27.204 -#define WTI_INTERFACE		1
  27.205 -	#define IFC_WINTABID		1
  27.206 -	#define IFC_SPECVERSION		2
  27.207 -	#define IFC_IMPLVERSION		3
  27.208 -	#define IFC_NDEVICES		4
  27.209 -	#define IFC_NCURSORS		5
  27.210 -	#define IFC_NCONTEXTS		6
  27.211 -	#define IFC_CTXOPTIONS		7
  27.212 -	#define IFC_CTXSAVESIZE		8
  27.213 -	#define IFC_NEXTENSIONS		9
  27.214 -	#define IFC_NMANAGERS		10
  27.215 -	#define IFC_MAX				10
  27.216 -
  27.217 -
  27.218 -#endif
  27.219 -
  27.220 -#ifndef NOWTSTATUS
  27.221 -
  27.222 -#define WTI_STATUS			2
  27.223 -	#define STA_CONTEXTS		1
  27.224 -	#define STA_SYSCTXS			2
  27.225 -	#define STA_PKTRATE			3
  27.226 -	#define STA_PKTDATA			4
  27.227 -	#define STA_MANAGERS		5
  27.228 -	#define STA_SYSTEM			6
  27.229 -	#define STA_BUTTONUSE		7
  27.230 -	#define STA_SYSBTNUSE		8
  27.231 -	#define STA_MAX				8
  27.232 -
  27.233 -#endif
  27.234 -
  27.235 -#ifndef NOWTDEFCONTEXT
  27.236 -
  27.237 -#define WTI_DEFCONTEXT	3
  27.238 -#define WTI_DEFSYSCTX	4
  27.239 -#define WTI_DDCTXS		400 /* 1.1 */
  27.240 -#define WTI_DSCTXS		500 /* 1.1 */
  27.241 -	#define CTX_NAME		1
  27.242 -	#define CTX_OPTIONS		2
  27.243 -	#define CTX_STATUS		3
  27.244 -	#define CTX_LOCKS		4
  27.245 -	#define CTX_MSGBASE		5
  27.246 -	#define CTX_DEVICE		6
  27.247 -	#define CTX_PKTRATE		7
  27.248 -	#define CTX_PKTDATA		8
  27.249 -	#define CTX_PKTMODE		9
  27.250 -	#define CTX_MOVEMASK	10
  27.251 -	#define CTX_BTNDNMASK	11
  27.252 -	#define CTX_BTNUPMASK	12
  27.253 -	#define CTX_INORGX		13
  27.254 -	#define CTX_INORGY		14
  27.255 -	#define CTX_INORGZ		15
  27.256 -	#define CTX_INEXTX		16
  27.257 -	#define CTX_INEXTY		17
  27.258 -	#define CTX_INEXTZ		18
  27.259 -	#define CTX_OUTORGX		19
  27.260 -	#define CTX_OUTORGY		20
  27.261 -	#define CTX_OUTORGZ		21
  27.262 -	#define CTX_OUTEXTX		22
  27.263 -	#define CTX_OUTEXTY		23
  27.264 -	#define CTX_OUTEXTZ		24
  27.265 -	#define CTX_SENSX		25
  27.266 -	#define CTX_SENSY		26
  27.267 -	#define CTX_SENSZ		27
  27.268 -	#define CTX_SYSMODE		28
  27.269 -	#define CTX_SYSORGX		29
  27.270 -	#define CTX_SYSORGY		30
  27.271 -	#define CTX_SYSEXTX		31
  27.272 -	#define CTX_SYSEXTY		32
  27.273 -	#define CTX_SYSSENSX	33
  27.274 -	#define CTX_SYSSENSY	34
  27.275 -	#define CTX_MAX			34
  27.276 -
  27.277 -#endif
  27.278 -
  27.279 -#ifndef NOWTDEVICES
  27.280 -
  27.281 -#define WTI_DEVICES		100
  27.282 -	#define DVC_NAME			1
  27.283 -	#define DVC_HARDWARE		2
  27.284 -	#define DVC_NCSRTYPES		3
  27.285 -	#define DVC_FIRSTCSR		4
  27.286 -	#define DVC_PKTRATE			5
  27.287 -	#define DVC_PKTDATA			6
  27.288 -	#define DVC_PKTMODE			7
  27.289 -	#define DVC_CSRDATA			8
  27.290 -	#define DVC_XMARGIN			9
  27.291 -	#define DVC_YMARGIN			10
  27.292 -	#define DVC_ZMARGIN			11
  27.293 -	#define DVC_X				12
  27.294 -	#define DVC_Y				13
  27.295 -	#define DVC_Z				14
  27.296 -	#define DVC_NPRESSURE		15
  27.297 -	#define DVC_TPRESSURE		16
  27.298 -	#define DVC_ORIENTATION		17
  27.299 -	#define DVC_ROTATION		18 /* 1.1 */
  27.300 -	#define DVC_PNPID			19 /* 1.1 */
  27.301 -	#define DVC_MAX				19
  27.302 -
  27.303 -#endif
  27.304 -
  27.305 -#ifndef NOWTCURSORS
  27.306 -
  27.307 -#define WTI_CURSORS		200
  27.308 -	#define CSR_NAME			1
  27.309 -	#define CSR_ACTIVE			2
  27.310 -	#define CSR_PKTDATA			3
  27.311 -	#define CSR_BUTTONS			4
  27.312 -	#define CSR_BUTTONBITS		5
  27.313 -	#define CSR_BTNNAMES		6
  27.314 -	#define CSR_BUTTONMAP		7
  27.315 -	#define CSR_SYSBTNMAP		8
  27.316 -	#define CSR_NPBUTTON		9
  27.317 -	#define CSR_NPBTNMARKS		10
  27.318 -	#define CSR_NPRESPONSE		11
  27.319 -	#define CSR_TPBUTTON		12
  27.320 -	#define CSR_TPBTNMARKS		13
  27.321 -	#define CSR_TPRESPONSE		14
  27.322 -	#define CSR_PHYSID			15 /* 1.1 */
  27.323 -	#define CSR_MODE			16 /* 1.1 */
  27.324 -	#define CSR_MINPKTDATA		17 /* 1.1 */
  27.325 -	#define CSR_MINBUTTONS		18 /* 1.1 */
  27.326 -	#define CSR_CAPABILITIES	19 /* 1.1 */
  27.327 -	#define CSR_TYPE				20 /* 1.2 */
  27.328 -	#define CSR_MAX				20
  27.329 -
  27.330 -#endif
  27.331 -
  27.332 -#ifndef NOWTEXTENSIONS
  27.333 -
  27.334 -#define WTI_EXTENSIONS	300
  27.335 -	#define EXT_NAME		1
  27.336 -	#define EXT_TAG			2
  27.337 -	#define EXT_MASK		3
  27.338 -	#define EXT_SIZE		4
  27.339 -	#define EXT_AXES		5
  27.340 -	#define EXT_DEFAULT		6
  27.341 -	#define EXT_DEFCONTEXT	7
  27.342 -	#define EXT_DEFSYSCTX	8
  27.343 -	#define EXT_CURSORS		9 
  27.344 -	#define EXT_MAX			109 /* Allow 100 cursors */
  27.345 -
  27.346 -#endif
  27.347 -
  27.348 -#endif
  27.349 -
  27.350 -/* -------------------------------------------------------------------------- */
  27.351 -/* CONTEXT DATA DEFS */
  27.352 -
  27.353 -#define LCNAMELEN	40
  27.354 -#define LC_NAMELEN	40
  27.355 -#ifdef WIN32
  27.356 -typedef struct tagLOGCONTEXTA {
  27.357 -	char	lcName[LCNAMELEN];
  27.358 -	UINT	lcOptions;
  27.359 -	UINT	lcStatus;
  27.360 -	UINT	lcLocks;
  27.361 -	UINT	lcMsgBase;
  27.362 -	UINT	lcDevice;
  27.363 -	UINT	lcPktRate;
  27.364 -	WTPKT	lcPktData;
  27.365 -	WTPKT	lcPktMode;
  27.366 -	WTPKT	lcMoveMask;
  27.367 -	DWORD	lcBtnDnMask;
  27.368 -	DWORD	lcBtnUpMask;
  27.369 -	LONG	lcInOrgX;
  27.370 -	LONG	lcInOrgY;
  27.371 -	LONG	lcInOrgZ;
  27.372 -	LONG	lcInExtX;
  27.373 -	LONG	lcInExtY;
  27.374 -	LONG	lcInExtZ;
  27.375 -	LONG	lcOutOrgX;
  27.376 -	LONG	lcOutOrgY;
  27.377 -	LONG	lcOutOrgZ;
  27.378 -	LONG	lcOutExtX;
  27.379 -	LONG	lcOutExtY;
  27.380 -	LONG	lcOutExtZ;
  27.381 -	FIX32	lcSensX;
  27.382 -	FIX32	lcSensY;
  27.383 -	FIX32	lcSensZ;
  27.384 -	BOOL	lcSysMode;
  27.385 -	int		lcSysOrgX;
  27.386 -	int		lcSysOrgY;
  27.387 -	int		lcSysExtX;
  27.388 -	int		lcSysExtY;
  27.389 -	FIX32	lcSysSensX;
  27.390 -	FIX32	lcSysSensY;
  27.391 -} LOGCONTEXTA, *PLOGCONTEXTA, NEAR *NPLOGCONTEXTA, FAR *LPLOGCONTEXTA;
  27.392 -typedef struct tagLOGCONTEXTW {
  27.393 -	WCHAR	lcName[LCNAMELEN];
  27.394 -	UINT	lcOptions;
  27.395 -	UINT	lcStatus;
  27.396 -	UINT	lcLocks;
  27.397 -	UINT	lcMsgBase;
  27.398 -	UINT	lcDevice;
  27.399 -	UINT	lcPktRate;
  27.400 -	WTPKT	lcPktData;
  27.401 -	WTPKT	lcPktMode;
  27.402 -	WTPKT	lcMoveMask;
  27.403 -	DWORD	lcBtnDnMask;
  27.404 -	DWORD	lcBtnUpMask;
  27.405 -	LONG	lcInOrgX;
  27.406 -	LONG	lcInOrgY;
  27.407 -	LONG	lcInOrgZ;
  27.408 -	LONG	lcInExtX;
  27.409 -	LONG	lcInExtY;
  27.410 -	LONG	lcInExtZ;
  27.411 -	LONG	lcOutOrgX;
  27.412 -	LONG	lcOutOrgY;
  27.413 -	LONG	lcOutOrgZ;
  27.414 -	LONG	lcOutExtX;
  27.415 -	LONG	lcOutExtY;
  27.416 -	LONG	lcOutExtZ;
  27.417 -	FIX32	lcSensX;
  27.418 -	FIX32	lcSensY;
  27.419 -	FIX32	lcSensZ;
  27.420 -	BOOL	lcSysMode;
  27.421 -	int		lcSysOrgX;
  27.422 -	int		lcSysOrgY;
  27.423 -	int		lcSysExtX;
  27.424 -	int		lcSysExtY;
  27.425 -	FIX32	lcSysSensX;
  27.426 -	FIX32	lcSysSensY;
  27.427 -} LOGCONTEXTW, *PLOGCONTEXTW, NEAR *NPLOGCONTEXTW, FAR *LPLOGCONTEXTW;
  27.428 -#ifdef UNICODE
  27.429 -typedef LOGCONTEXTW LOGCONTEXT;
  27.430 -typedef PLOGCONTEXTW PLOGCONTEXT;
  27.431 -typedef NPLOGCONTEXTW NPLOGCONTEXT;
  27.432 -typedef LPLOGCONTEXTW LPLOGCONTEXT;
  27.433 -#else
  27.434 -typedef LOGCONTEXTA LOGCONTEXT;
  27.435 -typedef PLOGCONTEXTA PLOGCONTEXT;
  27.436 -typedef NPLOGCONTEXTA NPLOGCONTEXT;
  27.437 -typedef LPLOGCONTEXTA LPLOGCONTEXT;
  27.438 -#endif /* UNICODE */
  27.439 -#else /* WIN32 */
  27.440 -typedef struct tagLOGCONTEXT {
  27.441 -	char	lcName[LCNAMELEN];
  27.442 -	UINT	lcOptions;
  27.443 -	UINT	lcStatus;
  27.444 -	UINT	lcLocks;
  27.445 -	UINT	lcMsgBase;
  27.446 -	UINT	lcDevice;
  27.447 -	UINT	lcPktRate;
  27.448 -	WTPKT	lcPktData;
  27.449 -	WTPKT	lcPktMode;
  27.450 -	WTPKT	lcMoveMask;
  27.451 -	DWORD	lcBtnDnMask;
  27.452 -	DWORD	lcBtnUpMask;
  27.453 -	LONG	lcInOrgX;
  27.454 -	LONG	lcInOrgY;
  27.455 -	LONG	lcInOrgZ;
  27.456 -	LONG	lcInExtX;
  27.457 -	LONG	lcInExtY;
  27.458 -	LONG	lcInExtZ;
  27.459 -	LONG	lcOutOrgX;
  27.460 -	LONG	lcOutOrgY;
  27.461 -	LONG	lcOutOrgZ;
  27.462 -	LONG	lcOutExtX;
  27.463 -	LONG	lcOutExtY;
  27.464 -	LONG	lcOutExtZ;
  27.465 -	FIX32	lcSensX;
  27.466 -	FIX32	lcSensY;
  27.467 -	FIX32	lcSensZ;
  27.468 -	BOOL	lcSysMode;
  27.469 -	int		lcSysOrgX;
  27.470 -	int		lcSysOrgY;
  27.471 -	int		lcSysExtX;
  27.472 -	int		lcSysExtY;
  27.473 -	FIX32	lcSysSensX;
  27.474 -	FIX32	lcSysSensY;
  27.475 -} LOGCONTEXT, *PLOGCONTEXT, NEAR *NPLOGCONTEXT, FAR *LPLOGCONTEXT;
  27.476 -#endif /* WIN32 */
  27.477 -
  27.478 -	/* context option values */
  27.479 -	#define CXO_SYSTEM		0x0001
  27.480 -	#define CXO_PEN			0x0002
  27.481 -	#define CXO_MESSAGES	0x0004
  27.482 -	#define CXO_MARGIN		0x8000
  27.483 -	#define CXO_MGNINSIDE	0x4000
  27.484 -	#define CXO_CSRMESSAGES	0x0008 /* 1.1 */
  27.485 -
  27.486 -	/* context status values */
  27.487 -	#define CXS_DISABLED	0x0001
  27.488 -	#define CXS_OBSCURED	0x0002
  27.489 -	#define CXS_ONTOP		0x0004
  27.490 -
  27.491 -	/* context lock values */
  27.492 -	#define CXL_INSIZE		0x0001
  27.493 -	#define CXL_INASPECT	0x0002
  27.494 -	#define CXL_SENSITIVITY	0x0004
  27.495 -	#define CXL_MARGIN		0x0008
  27.496 -	#define CXL_SYSOUT		0x0010
  27.497 -
  27.498 -/* -------------------------------------------------------------------------- */
  27.499 -/* EVENT DATA DEFS */
  27.500 -
  27.501 -/* For packet structure definition, see pktdef.h */
  27.502 -
  27.503 -/* packet status values */
  27.504 -#define TPS_PROXIMITY		0x0001
  27.505 -#define TPS_QUEUE_ERR		0x0002
  27.506 -#define TPS_MARGIN			0x0004
  27.507 -#define TPS_GRAB			0x0008
  27.508 -#define TPS_INVERT			0x0010 /* 1.1 */
  27.509 -
  27.510 -typedef struct tagORIENTATION {
  27.511 -	int orAzimuth;
  27.512 -	int orAltitude;
  27.513 -	int orTwist;
  27.514 -} ORIENTATION, *PORIENTATION, NEAR *NPORIENTATION, FAR *LPORIENTATION;
  27.515 -
  27.516 -typedef struct tagROTATION { /* 1.1 */
  27.517 -	int	roPitch;
  27.518 -	int roRoll;
  27.519 -	int roYaw;
  27.520 -} ROTATION, *PROTATION, NEAR *NPROTATION, FAR *LPROTATION;
  27.521 -// grandfather in obsolete member names.
  27.522 -#define rotPitch	roPitch
  27.523 -#define rotRoll		roRoll
  27.524 -#define rotYaw		roYaw
  27.525 -
  27.526 -/* relative buttons */
  27.527 -#define TBN_NONE	0
  27.528 -#define TBN_UP		1
  27.529 -#define TBN_DOWN	2
  27.530 -
  27.531 -/* -------------------------------------------------------------------------- */
  27.532 -/* DEVICE CONFIG CONSTANTS */
  27.533 -
  27.534 -#ifndef NOWTDEVCFG
  27.535 -
  27.536 -#define WTDC_NONE		0
  27.537 -#define WTDC_CANCEL		1
  27.538 -#define WTDC_OK			2
  27.539 -#define WTDC_RESTART	3
  27.540 -
  27.541 -#endif
  27.542 -
  27.543 -/* -------------------------------------------------------------------------- */
  27.544 -/* HOOK CONSTANTS */
  27.545 -
  27.546 -#ifndef NOWTHOOKS
  27.547 -
  27.548 -#define WTH_PLAYBACK		1
  27.549 -#define WTH_RECORD			2
  27.550 -
  27.551 -#define WTHC_GETLPLPFN	    (-3)
  27.552 -#define WTHC_LPLPFNNEXT	    (-2)
  27.553 -#define WTHC_LPFNNEXT	    (-1)
  27.554 -#define WTHC_ACTION		    0
  27.555 -#define WTHC_GETNEXT   	    1
  27.556 -#define WTHC_SKIP 	   		2
  27.557 -
  27.558 -#endif
  27.559 -
  27.560 -/* -------------------------------------------------------------------------- */
  27.561 -/* PREFERENCE FUNCTION CONSTANTS */
  27.562 -
  27.563 -#ifndef NOWTPREF
  27.564 -
  27.565 -#define WTP_LPDEFAULT	((LPVOID)-1L)
  27.566 -#define WTP_DWDEFAULT	((DWORD)-1L)
  27.567 -
  27.568 -#endif
  27.569 -
  27.570 -/* -------------------------------------------------------------------------- */
  27.571 -/* EXTENSION TAGS AND CONSTANTS */
  27.572 -
  27.573 -#ifndef NOWTEXTENSIONS
  27.574 -
  27.575 -/* constants for use with pktdef.h */
  27.576 -#define PKEXT_ABSOLUTE	1
  27.577 -#define PKEXT_RELATIVE	2
  27.578 -
  27.579 -/* Extension tags. */
  27.580 -#define WTX_OBT			0	/* Out of bounds tracking */
  27.581 -#define WTX_FKEYS		1	/* Function keys */
  27.582 -#define WTX_TILT		2	/* Raw Cartesian tilt; 1.1 */
  27.583 -#define WTX_CSRMASK		3	/* select input by cursor type; 1.1 */
  27.584 -#define WTX_XBTNMASK	4	/* Extended button mask; 1.1 */
  27.585 -#define WTX_EXPKEYS	5	/* ExpressKeys; 1.3 */
  27.586 -
  27.587 -typedef struct tagXBTNMASK {
  27.588 -	BYTE xBtnDnMask[32];
  27.589 -	BYTE xBtnUpMask[32];
  27.590 -} XBTNMASK;
  27.591 -
  27.592 -typedef struct tagTILT { /* 1.1 */
  27.593 -	int tiltX;
  27.594 -	int tiltY;
  27.595 -} TILT;
  27.596 -
  27.597 -#endif
  27.598 -
  27.599 -/* -------------------------------------------------------------------------- */
  27.600 -/* -------------------------------------------------------------------------- */
  27.601 -/* Functions */
  27.602 -
  27.603 -	#ifndef API
  27.604 -		#ifndef WINAPI
  27.605 -			#define API			FAR PASCAL
  27.606 -		#else
  27.607 -			#define API			WINAPI
  27.608 -		#endif
  27.609 -	#endif
  27.610 -
  27.611 -#ifndef NOWTCALLBACKS
  27.612 -
  27.613 -	#ifndef CALLBACK
  27.614 -	#define CALLBACK	FAR PASCAL
  27.615 -	#endif
  27.616 -
  27.617 -	#ifndef NOWTMANAGERFXNS
  27.618 -	/* callback function types */
  27.619 -	typedef BOOL (WINAPI * WTENUMPROC)(HCTX, LPARAM); /* changed CALLBACK->WINAPI, 1.1 */
  27.620 -	typedef BOOL (WINAPI * WTCONFIGPROC)(HCTX, HWND);
  27.621 -	typedef LRESULT (WINAPI * WTHOOKPROC)(int, WPARAM, LPARAM);
  27.622 -	typedef WTHOOKPROC FAR *LPWTHOOKPROC;
  27.623 -	#endif
  27.624 -
  27.625 -#endif
  27.626 -
  27.627 -
  27.628 -#ifndef NOWTFUNCTIONS
  27.629 -
  27.630 -	#ifndef NOWTBASICFXNS
  27.631 -	/* BASIC FUNCTIONS */
  27.632 -#ifdef WIN32
  27.633 -	UINT API WTInfoA(UINT, UINT, LPVOID);
  27.634 -	#define ORD_WTInfoA						20
  27.635 -	UINT API WTInfoW(UINT, UINT, LPVOID);
  27.636 -	#define ORD_WTInfoW					  1020
  27.637 -	#ifdef UNICODE
  27.638 -	#define WTInfo  WTInfoW
  27.639 -	#define ORD_WTInfo  ORD_WTInfoW
  27.640 -	#else
  27.641 -	#define WTInfo  WTInfoA
  27.642 -	#define ORD_WTInfo  ORD_WTInfoA
  27.643 -	#endif /* !UNICODE */
  27.644 -#else
  27.645 -	UINT API WTInfo(UINT, UINT, LPVOID);
  27.646 -	#define ORD_WTInfo						20
  27.647 -#endif
  27.648 -#ifdef WIN32
  27.649 -	HCTX API WTOpenA(HWND, LPLOGCONTEXTA, BOOL);
  27.650 -	#define ORD_WTOpenA						21
  27.651 -	HCTX API WTOpenW(HWND, LPLOGCONTEXTW, BOOL);
  27.652 -	#define ORD_WTOpenW					  1021
  27.653 -	#ifdef UNICODE
  27.654 -	#define WTOpen  WTOpenW
  27.655 -	#define ORD_WTOpen  ORD_WTOpenW
  27.656 -	#else
  27.657 -	#define WTOpen  WTOpenA
  27.658 -	#define ORD_WTOpen  ORD_WTOpenA
  27.659 -	#endif /* !UNICODE */
  27.660 -#else
  27.661 -	HCTX API WTOpen(HWND, LPLOGCONTEXT, BOOL);
  27.662 -	#define ORD_WTOpen						21
  27.663 -#endif
  27.664 -	BOOL API WTClose(HCTX);
  27.665 -	#define ORD_WTClose						22
  27.666 -	int API WTPacketsGet(HCTX, int, LPVOID);
  27.667 -	#define ORD_WTPacketsGet				23
  27.668 -	BOOL API WTPacket(HCTX, UINT, LPVOID);
  27.669 -	#define ORD_WTPacket					24
  27.670 -	#endif
  27.671 -
  27.672 -	#ifndef NOWTVISIBILITYFXNS
  27.673 -	/* VISIBILITY FUNCTIONS */
  27.674 -	BOOL API WTEnable(HCTX, BOOL);
  27.675 -	#define ORD_WTEnable					40
  27.676 -	BOOL API WTOverlap(HCTX, BOOL);
  27.677 -	#define ORD_WTOverlap					41
  27.678 -	#endif
  27.679 -
  27.680 -	#ifndef NOWTCTXEDITFXNS
  27.681 -	/* CONTEXT EDITING FUNCTIONS */
  27.682 -	BOOL API WTConfig(HCTX, HWND);
  27.683 -	#define ORD_WTConfig					60
  27.684 -#ifdef WIN32
  27.685 -	BOOL API WTGetA(HCTX, LPLOGCONTEXTA);
  27.686 -	#define ORD_WTGetA						61
  27.687 -	BOOL API WTGetW(HCTX, LPLOGCONTEXTW);
  27.688 -	#define ORD_WTGetW					  1061
  27.689 -	#ifdef UNICODE
  27.690 -	#define WTGet  WTGetW
  27.691 -	#define ORD_WTGet  ORD_WTGetW
  27.692 -	#else
  27.693 -	#define WTGet  WTGetA
  27.694 -	#define ORD_WTGet  ORD_WTGetA
  27.695 -	#endif /* !UNICODE */
  27.696 -#else
  27.697 -	BOOL API WTGet(HCTX, LPLOGCONTEXT);
  27.698 -	#define ORD_WTGet						61
  27.699 -#endif
  27.700 -#ifdef WIN32
  27.701 -	BOOL API WTSetA(HCTX, LPLOGCONTEXTA);
  27.702 -	#define ORD_WTSetA						62
  27.703 -	BOOL API WTSetW(HCTX, LPLOGCONTEXTW);
  27.704 -	#define ORD_WTSetW					  1062
  27.705 -	#ifdef UNICODE
  27.706 -	#define WTSet  WTSetW
  27.707 -	#define ORD_WTSet  ORD_WTSetW
  27.708 -	#else
  27.709 -	#define WTSet  WTSetA
  27.710 -	#define ORD_WTSet  ORD_WTSetA
  27.711 -	#endif /* !UNICODE */
  27.712 -#else
  27.713 -	BOOL API WTSet(HCTX, LPLOGCONTEXT);
  27.714 -	#define ORD_WTSet						62
  27.715 -#endif
  27.716 -	BOOL API WTExtGet(HCTX, UINT, LPVOID);
  27.717 -	#define ORD_WTExtGet					63
  27.718 -	BOOL API WTExtSet(HCTX, UINT, LPVOID);
  27.719 -	#define ORD_WTExtSet					64
  27.720 -	BOOL API WTSave(HCTX, LPVOID);
  27.721 -	#define ORD_WTSave						65
  27.722 -	HCTX API WTRestore(HWND, LPVOID, BOOL);
  27.723 -	#define ORD_WTRestore					66
  27.724 -	#endif
  27.725 -
  27.726 -	#ifndef NOWTQUEUEFXNS
  27.727 -	/* ADVANCED PACKET AND QUEUE FUNCTIONS */
  27.728 -	int API WTPacketsPeek(HCTX, int, LPVOID);
  27.729 -	#define ORD_WTPacketsPeek				80
  27.730 -	int API WTDataGet(HCTX, UINT, UINT, int, LPVOID, LPINT);
  27.731 -	#define ORD_WTDataGet					81
  27.732 -	int API WTDataPeek(HCTX, UINT, UINT, int, LPVOID, LPINT);
  27.733 -	#define ORD_WTDataPeek					82
  27.734 -#ifndef WIN32
  27.735 -/* OBSOLETE IN WIN32! */
  27.736 -	DWORD API WTQueuePackets(HCTX);
  27.737 -	#define ORD_WTQueuePackets				83
  27.738 -#endif
  27.739 -	int API WTQueueSizeGet(HCTX);
  27.740 -	#define ORD_WTQueueSizeGet				84
  27.741 -	BOOL API WTQueueSizeSet(HCTX, int);
  27.742 -	#define ORD_WTQueueSizeSet				85
  27.743 -	#endif
  27.744 -
  27.745 -	#ifndef NOWTHMGRFXNS
  27.746 -	/* MANAGER HANDLE FUNCTIONS */
  27.747 -	HMGR API WTMgrOpen(HWND, UINT);
  27.748 -	#define ORD_WTMgrOpen					100
  27.749 -	BOOL API WTMgrClose(HMGR);
  27.750 -	#define ORD_WTMgrClose					101
  27.751 -	#endif
  27.752 -
  27.753 -	#ifndef NOWTMGRCTXFXNS
  27.754 -	/* MANAGER CONTEXT FUNCTIONS */
  27.755 -	BOOL API WTMgrContextEnum(HMGR, WTENUMPROC, LPARAM);
  27.756 -	#define ORD_WTMgrContextEnum			120
  27.757 -	HWND API WTMgrContextOwner(HMGR, HCTX);
  27.758 -	#define ORD_WTMgrContextOwner			121
  27.759 -	HCTX API WTMgrDefContext(HMGR, BOOL);
  27.760 -	#define ORD_WTMgrDefContext				122
  27.761 -	HCTX API WTMgrDefContextEx(HMGR, UINT, BOOL); /* 1.1 */
  27.762 -	#define ORD_WTMgrDefContextEx			206
  27.763 -	#endif
  27.764 -	
  27.765 -	#ifndef NOWTMGRCONFIGFXNS
  27.766 -	/* MANAGER CONFIG BOX  FUNCTIONS */
  27.767 -	UINT API WTMgrDeviceConfig(HMGR, UINT, HWND);
  27.768 -	#define ORD_WTMgrDeviceConfig			140
  27.769 -#ifndef WIN32
  27.770 -/* OBSOLETE IN WIN32! */
  27.771 -	BOOL API WTMgrConfigReplace(HMGR, BOOL, WTCONFIGPROC);
  27.772 -	#define ORD_WTMgrConfigReplace			141
  27.773 -#endif
  27.774 -	#endif
  27.775 -
  27.776 -	#ifndef NOWTMGRHOOKFXNS
  27.777 -	/* MANAGER PACKET HOOK FUNCTIONS */
  27.778 -#ifndef WIN32
  27.779 -/* OBSOLETE IN WIN32! */
  27.780 -	WTHOOKPROC API WTMgrPacketHook(HMGR, BOOL, int, WTHOOKPROC);
  27.781 -	#define ORD_WTMgrPacketHook				160
  27.782 -	LRESULT API WTMgrPacketHookDefProc(int, WPARAM, LPARAM, LPWTHOOKPROC);
  27.783 -	#define ORD_WTMgrPacketHookDefProc		161
  27.784 -#endif
  27.785 -	#endif
  27.786 -
  27.787 -	#ifndef NOWTMGRPREFFXNS
  27.788 -	/* MANAGER PREFERENCE DATA FUNCTIONS */
  27.789 -	BOOL API WTMgrExt(HMGR, UINT, LPVOID);
  27.790 -	#define ORD_WTMgrExt					180
  27.791 -	BOOL API WTMgrCsrEnable(HMGR, UINT, BOOL);
  27.792 -	#define ORD_WTMgrCsrEnable				181
  27.793 -	BOOL API WTMgrCsrButtonMap(HMGR, UINT, LPBYTE, LPBYTE);
  27.794 -	#define ORD_WTMgrCsrButtonMap			182
  27.795 -	BOOL API WTMgrCsrPressureBtnMarks(HMGR, UINT, DWORD, DWORD);
  27.796 -	#define ORD_WTMgrCsrPressureBtnMarks	183
  27.797 -	BOOL API WTMgrCsrPressureResponse(HMGR, UINT, UINT FAR *, UINT FAR *);
  27.798 -	#define ORD_WTMgrCsrPressureResponse	184
  27.799 -	BOOL API WTMgrCsrExt(HMGR, UINT, UINT, LPVOID);
  27.800 -	#define ORD_WTMgrCsrExt					185
  27.801 -	#endif
  27.802 -
  27.803 -/* Win32 replacements for non-portable functions. */
  27.804 -	#ifndef NOWTQUEUEFXNS
  27.805 -	/* ADVANCED PACKET AND QUEUE FUNCTIONS */
  27.806 -	BOOL API WTQueuePacketsEx(HCTX, UINT FAR *, UINT FAR *);
  27.807 -	#define ORD_WTQueuePacketsEx			200
  27.808 -	#endif
  27.809 -
  27.810 -	#ifndef NOWTMGRCONFIGFXNS
  27.811 -	/* MANAGER CONFIG BOX  FUNCTIONS */
  27.812 -#ifdef WIN32
  27.813 -	BOOL API WTMgrConfigReplaceExA(HMGR, BOOL, LPSTR, LPSTR);
  27.814 -	#define ORD_WTMgrConfigReplaceExA		202
  27.815 -	BOOL API WTMgrConfigReplaceExW(HMGR, BOOL, LPWSTR, LPSTR);
  27.816 -	#define ORD_WTMgrConfigReplaceExW		1202
  27.817 -	#ifdef UNICODE
  27.818 -	#define WTMgrConfigReplaceEx  WTMgrConfigReplaceExW
  27.819 -	#define ORD_WTMgrConfigReplaceEx  ORD_WTMgrConfigReplaceExW
  27.820 -	#else
  27.821 -	#define WTMgrConfigReplaceEx  WTMgrConfigReplaceExA
  27.822 -	#define ORD_WTMgrConfigReplaceEx  ORD_WTMgrConfigReplaceExA
  27.823 -	#endif /* !UNICODE */
  27.824 -#else
  27.825 -	BOOL API WTMgrConfigReplaceEx(HMGR, BOOL, LPSTR, LPSTR);
  27.826 -	#define ORD_WTMgrConfigReplaceEx		202
  27.827 -#endif
  27.828 -	#endif
  27.829 -
  27.830 -	#ifndef NOWTMGRHOOKFXNS
  27.831 -	/* MANAGER PACKET HOOK FUNCTIONS */
  27.832 -#ifdef WIN32
  27.833 -	HWTHOOK API WTMgrPacketHookExA(HMGR, int, LPSTR, LPSTR);
  27.834 -	#define ORD_WTMgrPacketHookExA			203
  27.835 -	HWTHOOK API WTMgrPacketHookExW(HMGR, int, LPWSTR, LPSTR);
  27.836 -	#define ORD_WTMgrPacketHookExW			1203
  27.837 -	#ifdef UNICODE
  27.838 -	#define WTMgrPacketHookEx  WTMgrPacketHookExW
  27.839 -	#define ORD_WTMgrPacketHookEx  ORD_WTMgrPacketHookExW
  27.840 -	#else
  27.841 -	#define WTMgrPacketHookEx  WTMgrPacketHookExA
  27.842 -	#define ORD_WTMgrPacketHookEx  ORD_WTMgrPacketHookExA
  27.843 -	#endif /* !UNICODE */
  27.844 -#else
  27.845 -	HWTHOOK API WTMgrPacketHookEx(HMGR, int, LPSTR, LPSTR);
  27.846 -	#define ORD_WTMgrPacketHookEx			203
  27.847 -#endif
  27.848 -	BOOL API WTMgrPacketUnhook(HWTHOOK);
  27.849 -	#define ORD_WTMgrPacketUnhook			204
  27.850 -	LRESULT API WTMgrPacketHookNext(HWTHOOK, int, WPARAM, LPARAM);
  27.851 -	#define ORD_WTMgrPacketHookNext			205
  27.852 -	#endif
  27.853 -
  27.854 -	#ifndef NOWTMGRPREFFXNS
  27.855 -	/* MANAGER PREFERENCE DATA FUNCTIONS */
  27.856 -	BOOL API WTMgrCsrPressureBtnMarksEx(HMGR, UINT, UINT FAR *, UINT FAR *);
  27.857 -	#define ORD_WTMgrCsrPressureBtnMarksEx	201
  27.858 -	#endif
  27.859 -
  27.860 -
  27.861 -
  27.862 -#endif
  27.863 -
  27.864 -#ifdef __cplusplus
  27.865 -}
  27.866 -#endif	/* __cplusplus */
  27.867 -
  27.868 -#endif /* #define _INC_WINTAB */
  27.869 -
    28.1 --- a/src/video/win32/wactab/wintabx.h	Sun May 09 19:55:28 2010 -0700
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,136 +0,0 @@
    28.4 -/* *INDENT-OFF* */
    28.5 -/* ------------------------------- wintabx.h -------------------------------- */
    28.6 -/* Combined 16 & 32-bit version. */
    28.7 -
    28.8 -
    28.9 -/*------------------------------------------------------------------------------
   28.10 -The text and information contained in this file may be freely used,
   28.11 -copied, or distributed without compensation or licensing restrictions.
   28.12 -
   28.13 -This file is copyright 1991-1998 by LCS/Telegraphics.
   28.14 -------------------------------------------------------------------------------*/
   28.15 -
   28.16 -#ifndef _INC_WINTABX     /* prevent multiple includes */
   28.17 -#define _INC_WINTABX
   28.18 -
   28.19 -#ifdef __cplusplus
   28.20 -extern "C" {
   28.21 -#endif	/* __cplusplus */
   28.22 -
   28.23 -/* prototype for wintabx.lib. */
   28.24 -#define _UnlinkWinTab _UnlinkWintab	
   28.25 -#ifdef WIN32
   28.26 -	extern WINAPI _UnlinkWintab(void);
   28.27 -#else
   28.28 -	extern FAR _UnlinkWintab(void);
   28.29 -#endif
   28.30 -
   28.31 -/****** Wintab message crackers ***********************************************/
   28.32 -
   28.33 -#ifndef HANDLE_MSG
   28.34 -#define HANDLE_MSG(hwnd, message, fn)    \
   28.35 -    case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn))
   28.36 -#endif
   28.37 -
   28.38 -/* void Cls_OnWintabPacket(HWND hwnd, HCTX hCtx, UINT sn) */
   28.39 -#define HANDLE_WT_PACKET(hwnd, wParam, lParam, fn) \
   28.40 -    ((fn)((hwnd), (HCTX)(lParam), (UINT)(wParam)), 0L)
   28.41 -#define FORWARD__WT_PACKET(hwnd, bs, hCtx, sn, fn) \
   28.42 -    (void)(fn)((hwnd), _WT_PACKET(bs), (WPARAM)(UINT)(sn), (LPARAM)(HCTX)(hCtx))
   28.43 -#define FORWARD_WT_PACKET(hwnd, hCtx, sn, fn) \
   28.44 -	FORWARD__WT_PACKET(hwnd, WT_DEFBASE, hCtx, sn, fn)
   28.45 -
   28.46 -/* void Cls_OnWintabCtxOpen(HWND hwnd, HCTX hCtx, UINT sf) */
   28.47 -#define HANDLE_WT_CTXOPEN(hwnd, wParam, lParam, fn) \
   28.48 -    ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
   28.49 -#define FORWARD__WT_CTXOPEN(hwnd, bs, hCtx, sf, fn) \
   28.50 -    (void)(fn)((hwnd), _WT_CTXOPEN(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
   28.51 -#define FORWARD_WT_CTXOPEN(hwnd, hCtx, sf, fn) \
   28.52 -	FORWARD__WT_CTXOPEN(hwnd, WT_DEFBASE, hCtx, sf, fn)
   28.53 -
   28.54 -/* void Cls_OnWintabCtxClose(HWND hwnd, HCTX hCtx, UINT sf) */
   28.55 -#define HANDLE_WT_CTXCLOSE(hwnd, wParam, lParam, fn) \
   28.56 -    ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
   28.57 -#define FORWARD__WT_CTXCLOSE(hwnd, bs, hCtx, sf, fn) \
   28.58 -    (void)(fn)((hwnd), _WT_CTXCLOSE(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
   28.59 -#define FORWARD_WT_CTXCLOSE(hwnd, hCtx, sf, fn) \
   28.60 -	FORWARD__WT_CTXCLOSE(hwnd, WT_DEFBASE, hCtx, sf, fn)
   28.61 -
   28.62 -/* void Cls_OnWintabCtxUpdate(HWND hwnd, HCTX hCtx, UINT sf) */
   28.63 -#define HANDLE_WT_CTXUPDATE(hwnd, wParam, lParam, fn) \
   28.64 -    ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
   28.65 -#define FORWARD__WT_CTXUPDATE(hwnd, bs, hCtx, sf, fn) \
   28.66 -    (void)(fn)((hwnd), _WT_CTXUPDATE(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
   28.67 -#define FORWARD_WT_CTXUPDATE(hwnd, hCtx, sf, fn) \
   28.68 -	FORWARD__WT_CTXUPDATE(hwnd, WT_DEFBASE, hCtx, sf, fn)
   28.69 -
   28.70 -/* void Cls_OnWintabCtxOverlap(HWND hwnd, HCTX hCtx, UINT sf) */
   28.71 -#define HANDLE_WT_CTXOVERLAP(hwnd, wParam, lParam, fn) \
   28.72 -    ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L)
   28.73 -#define FORWARD__WT_CTXOVERLAP(hwnd, bs, hCtx, sf, fn) \
   28.74 -    (void)(fn)((hwnd), _WT_CTXOVERLAP(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf))
   28.75 -#define FORWARD_WT_CTXOVERLAP(hwnd, hCtx, sf, fn) \
   28.76 -	FORWARD__WT_CTXOVERLAP(hwnd, WT_DEFBASE, hCtx, sf, fn)
   28.77 -
   28.78 -/* void Cls_OnWintabProximity(HWND hwnd, HCTX hCtx, BOOL cp, BOOL hp) */
   28.79 -#define HANDLE_WT_PROXIMITY(hwnd, wParam, lParam, fn) \
   28.80 -    ((fn)((hwnd), (HCTX)(wParam), (BOOL)LOWORD(lParam),  (BOOL)HIWORD(lParam)), 0L)
   28.81 -#define FORWARD__WT_PROXIMITY(hwnd, bs, hCtx, cp, hp, fn) \
   28.82 -    (void)(fn)((hwnd), _WT_PROXIMITY(bs), (WPARAM)(HCTX)(hCtx), MAKELPARAM((cp), (hp))
   28.83 -#define FORWARD_WT_PROXIMITY(hwnd, hCtx, sf, fn) \
   28.84 -	FORWARD__WT_PROXIMITY(hwnd, WT_DEFBASE, hCtx, cp, hp, fn)
   28.85 -
   28.86 -/* void Cls_OnWintabInfoChange(HWND hwnd, HMGR hMgr, UINT c, UINT i) */
   28.87 -#define HANDLE_WT_INFOCHANGE(hwnd, wParam, lParam, fn) \
   28.88 -    ((fn)((hwnd), (HMGR)(wParam), (UINT)LOWORD(lParam),  (UINT)HIWORD(lParam)), 0L)
   28.89 -#define FORWARD__WT_INFOCHANGE(hwnd, bs, hMgr, cp, hp, fn) \
   28.90 -    (void)(fn)((hwnd), _WT_INFOCHANGE(bs), (WPARAM)(HMGR)(hMgr), MAKELPARAM((c), (i))
   28.91 -#define FORWARD_WT_INFOCHANGE(hwnd, hMgr, sf, fn) \
   28.92 -	FORWARD__WT_INFOCHANGE(hwnd, WT_DEFBASE, hMgr, cp, hp, fn)
   28.93 -
   28.94 -/****** Alternate porting layer macros ****************************************/
   28.95 -
   28.96 -#define GET_WT_PACKET_HCTX(wp, lp)			((HCTX)lp)
   28.97 -#define GET_WT_PACKET_SERIAL(wp, lp)		(wp)
   28.98 -#define GET_WT_PACKET_MPS(h, s)				\
   28.99 -		(s), (LPARAM)(h)
  28.100 -
  28.101 -#define GET_WT_CTXOPEN_HCTX(wp, lp)			((HCTX)wp)
  28.102 -#define GET_WT_CTXOPEN_STATUS(wp, lp)		((UINT)lp)
  28.103 -#define GET_WT_CTXOPEN_MPS(h, s)			\
  28.104 -		(WPARAM)(h), (LPARAM)(s)
  28.105 -
  28.106 -#define GET_WT_CTXCLOSE_HCTX(wp, lp)		((HCTX)wp)
  28.107 -#define GET_WT_CTXCLOSE_STATUS(wp, lp)		((UINT)lp)
  28.108 -#define GET_WT_CTXCLOSE_MPS(h, s)			\
  28.109 -		(WPARAM)(h), (LPARAM)(s)
  28.110 -
  28.111 -#define GET_WT_CTXUPDATE_HCTX(wp, lp)		((HCTX)wp)
  28.112 -#define GET_WT_CTXUPDATE_STATUS(wp, lp)		((UINT)lp)
  28.113 -#define GET_WT_CTXUPDATE_MPS(h, s)			\
  28.114 -		(WPARAM)(h), (LPARAM)(s)
  28.115 -
  28.116 -#define GET_WT_CTXOVERLAP_HCTX(wp, lp)		((HCTX)wp)
  28.117 -#define GET_WT_CTXOVERLAP_STATUS(wp, lp)	((UINT)lp)
  28.118 -#define GET_WT_CTXOVERLAP_MPS(h, s)			\
  28.119 -		(WPARAM)(h), (LPARAM)(s)
  28.120 -
  28.121 -#define GET_WT_PROXIMITY_HCTX(wp, lp)		((HCTX)wp)
  28.122 -#define GET_WT_PROXIMITY_CTXPROX(wp, lp)	LOWORD(lp)
  28.123 -#define GET_WT_PROXIMITY_HARDPROX(wp, lp)	HIWORD(lp)
  28.124 -#define GET_WT_PROXIMITY_MPS(h, fc, fh)		\
  28.125 -		(WPARAM)(h), MAKELONG(fc, fh)
  28.126 -
  28.127 -#define GET_WT_INFOCHANGE_HMGR(wp, lp)		((HMGR)wp)
  28.128 -#define GET_WT_INFOCHANGE_CATEGORY(wp, lp)	LOWORD(lp)
  28.129 -#define GET_WT_INFOCHANGE_INDEX(wp, lp)		HIWORD(lp)
  28.130 -#define GET_WT_INFOCHANGE_MPS(h, c, i)		\
  28.131 -		(WPARAM)(h), MAKELONG(c, i)
  28.132 -
  28.133 -
  28.134 -#ifdef __cplusplus
  28.135 -}
  28.136 -#endif	/* __cplusplus */
  28.137 -
  28.138 -#endif /* #define _INC_WINTABX */
  28.139 -
    29.1 --- a/src/video/x11/SDL_x11events.c	Sun May 09 19:55:28 2010 -0700
    29.2 +++ b/src/video/x11/SDL_x11events.c	Sun May 09 20:47:22 2010 -0700
    29.3 @@ -23,12 +23,14 @@
    29.4  
    29.5  #include <sys/types.h>
    29.6  #include <sys/time.h>
    29.7 +#include <signal.h>
    29.8  #include <unistd.h>
    29.9  
   29.10  #include "SDL_x11video.h"
   29.11  #include "../../events/SDL_events_c.h"
   29.12  #include "../../events/SDL_mouse_c.h"
   29.13  
   29.14 +#include "SDL_timer.h"
   29.15  #include "SDL_syswm.h"
   29.16  
   29.17  static void
   29.18 @@ -93,13 +95,7 @@
   29.19              if (xevent.xcrossing.mode == NotifyUngrab)
   29.20                  printf("Mode: NotifyUngrab\n");
   29.21  #endif
   29.22 -#if 1
   29.23 -            /* FIXME: Should we reset data for all mice? */
   29.24 -            for (i = 0; i < SDL_GetNumMice(); ++i) {
   29.25 -                SDL_Mouse *mouse = SDL_GetMouse(i);
   29.26 -                SDL_SetMouseFocus(mouse->id, data->window);
   29.27 -            }
   29.28 -#endif
   29.29 +            SDL_SetMouseFocus(data->window);
   29.30          }
   29.31          break;
   29.32  
   29.33 @@ -116,13 +112,7 @@
   29.34                  printf("Mode: NotifyUngrab\n");
   29.35  #endif
   29.36              if (xevent.xcrossing.detail != NotifyInferior) {
   29.37 -#if 1
   29.38 -                /* FIXME: Should we reset data for all mice? */
   29.39 -	        for (i = 0; i < SDL_GetNumMice(); ++i) {
   29.40 -		    SDL_Mouse *mouse = SDL_GetMouse(i);
   29.41 -		    SDL_SetMouseFocus(mouse->id, 0);
   29.42 -	        }
   29.43 -#endif
   29.44 +                SDL_SetMouseFocus(NULL);
   29.45              }
   29.46          }
   29.47          break;
   29.48 @@ -132,7 +122,7 @@
   29.49  #ifdef DEBUG_XEVENTS
   29.50              printf("FocusIn!\n");
   29.51  #endif
   29.52 -            SDL_SetKeyboardFocus(videodata->keyboard, data->window);
   29.53 +            SDL_SetKeyboardFocus(data->window);
   29.54  #ifdef X_HAVE_UTF8_STRING
   29.55              if (data->ic) {
   29.56                  XSetICFocus(data->ic);
   29.57 @@ -146,7 +136,7 @@
   29.58  #ifdef DEBUG_XEVENTS
   29.59              printf("FocusOut!\n");
   29.60  #endif
   29.61 -            SDL_SetKeyboardFocus(videodata->keyboard, 0);
   29.62 +            SDL_SetKeyboardFocus(NULL);
   29.63  #ifdef X_HAVE_UTF8_STRING
   29.64              if (data->ic) {
   29.65                  XUnsetICFocus(data->ic);
   29.66 @@ -185,8 +175,7 @@
   29.67  #ifdef DEBUG_XEVENTS
   29.68              printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
   29.69  #endif
   29.70 -            SDL_SendKeyboardKey(videodata->keyboard, SDL_PRESSED,
   29.71 -                                videodata->key_layout[keycode]);
   29.72 +            SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
   29.73  #if 0
   29.74              if (videodata->key_layout[keycode] == SDLK_UNKNOWN) {
   29.75                  int min_keycode, max_keycode;
   29.76 @@ -210,7 +199,7 @@
   29.77              XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
   29.78  #endif
   29.79              if (*text) {
   29.80 -                SDL_SendKeyboardText(videodata->keyboard, text);
   29.81 +                SDL_SendKeyboardText(text);
   29.82              }
   29.83          }
   29.84          break;
   29.85 @@ -222,8 +211,7 @@
   29.86  #ifdef DEBUG_XEVENTS
   29.87              printf("KeyRelease (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
   29.88  #endif
   29.89 -            SDL_SendKeyboardKey(videodata->keyboard, SDL_RELEASED,
   29.90 -                                videodata->key_layout[keycode]);
   29.91 +            SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]);
   29.92          }
   29.93          break;
   29.94  
   29.95 @@ -280,79 +268,25 @@
   29.96          }
   29.97          break;
   29.98  
   29.99 +    case MotionNotify:{
  29.100 +#ifdef DEBUG_MOTION
  29.101 +            printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
  29.102 +#endif
  29.103 +            SDL_SendMouseMotion(0, xevent.xmotion.x, xevent.xmotion.y);
  29.104 +        }
  29.105 +        break;
  29.106 +
  29.107 +    case ButtonPress:{
  29.108 +            SDL_SendMouseButton(SDL_PRESSED, xevent.xbutton.button);
  29.109 +        }
  29.110 +        break;
  29.111 +
  29.112 +    case ButtonRelease:{
  29.113 +            SDL_SendMouseButton(SDL_RELEASED, xevent.xbutton.button);
  29.114 +        }
  29.115 +        break;
  29.116 +
  29.117      default:{
  29.118 -            for (i = 0; i < SDL_GetNumMice(); ++i) {
  29.119 -                SDL_Mouse *mouse;
  29.120 -#if SDL_VIDEO_DRIVER_X11_XINPUT
  29.121 -                X11_MouseData *data;
  29.122 -#endif
  29.123 -
  29.124 -                mouse = SDL_GetMouse(i);
  29.125 -                if (!mouse->driverdata) {
  29.126 -                    switch (xevent.type) {
  29.127 -                    case MotionNotify:
  29.128 -#ifdef DEBUG_MOTION
  29.129 -                        printf("X11 motion: %d,%d\n", xevent.xmotion.x,
  29.130 -                               xevent.xmotion.y);
  29.131 -#endif
  29.132 -                        SDL_SendMouseMotion(mouse->id, 0, xevent.xmotion.x,
  29.133 -                                            xevent.xmotion.y, 0);
  29.134 -                        break;
  29.135 -
  29.136 -                    case ButtonPress:
  29.137 -                        SDL_SendMouseButton(mouse->id, SDL_PRESSED,
  29.138 -                                            xevent.xbutton.button);
  29.139 -                        break;
  29.140 -
  29.141 -                    case ButtonRelease:
  29.142 -                        SDL_SendMouseButton(mouse->id, SDL_RELEASED,
  29.143 -                                            xevent.xbutton.button);
  29.144 -                        break;
  29.145 -                    }
  29.146 -                    continue;
  29.147 -                }
  29.148 -#if SDL_VIDEO_DRIVER_X11_XINPUT
  29.149 -                data = (X11_MouseData *) mouse->driverdata;
  29.150 -                if (xevent.type == data->motion) {
  29.151 -                    XDeviceMotionEvent *move =
  29.152 -                        (XDeviceMotionEvent *) & xevent;
  29.153 -#ifdef DEBUG_MOTION
  29.154 -                    printf("X11 motion: %d,%d\n", move->x, move->y);
  29.155 -#endif
  29.156 -                    SDL_SendMouseMotion(move->deviceid, 0, move->x, move->y,
  29.157 -                                        move->axis_data[2]);
  29.158 -                    return;
  29.159 -                }
  29.160 -                if (xevent.type == data->button_pressed) {
  29.161 -                    XDeviceButtonPressedEvent *pressed =
  29.162 -                        (XDeviceButtonPressedEvent *) & xevent;
  29.163 -                    SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
  29.164 -                                        pressed->button);
  29.165 -                    return;
  29.166 -                }
  29.167 -                if (xevent.type == data->button_released) {
  29.168 -                    XDeviceButtonReleasedEvent *released =
  29.169 -                        (XDeviceButtonReleasedEvent *) & xevent;
  29.170 -                    SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
  29.171 -                                        released->button);
  29.172 -                    return;
  29.173 -                }
  29.174 -                if (xevent.type == data->proximity_in) {
  29.175 -                    XProximityNotifyEvent *proximity =
  29.176 -                        (XProximityNotifyEvent *) & xevent;
  29.177 -                    SDL_SendProximity(proximity->deviceid, proximity->x,
  29.178 -                                      proximity->y, SDL_PROXIMITYIN);
  29.179 -                    return;
  29.180 -                }
  29.181 -                if (xevent.type == data->proximity_out) {
  29.182 -                    XProximityNotifyEvent *proximity =
  29.183 -                        (XProximityNotifyEvent *) & xevent;
  29.184 -                    SDL_SendProximity(proximity->deviceid, proximity->x,
  29.185 -                                      proximity->y, SDL_PROXIMITYOUT);
  29.186 -                    return;
  29.187 -                }
  29.188 -#endif
  29.189 -            }
  29.190  #ifdef DEBUG_XEVENTS
  29.191              printf("Unhandled event %d\n", xevent.type);
  29.192  #endif
    30.1 --- a/src/video/x11/SDL_x11keyboard.c	Sun May 09 19:55:28 2010 -0700
    30.2 +++ b/src/video/x11/SDL_x11keyboard.c	Sun May 09 20:47:22 2010 -0700
    30.3 @@ -172,7 +172,6 @@
    30.4  X11_InitKeyboard(_THIS)
    30.5  {
    30.6      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    30.7 -    SDL_Keyboard keyboard;
    30.8      int i, j;
    30.9      int min_keycode, max_keycode;
   30.10      struct {
   30.11 @@ -251,8 +250,6 @@
   30.12          }
   30.13      }
   30.14  
   30.15 -    SDL_zero(keyboard);
   30.16 -    data->keyboard = SDL_AddKeyboard(&keyboard, -1);
   30.17      X11_UpdateKeymap(_this);
   30.18  
   30.19      SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
   30.20 @@ -280,15 +277,12 @@
   30.21  
   30.22          keymap[scancode] = X11_KeyCodeToSDLKey(data->display, (KeyCode)i);
   30.23      }
   30.24 -    SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES);
   30.25 +    SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
   30.26  }
   30.27  
   30.28  void
   30.29  X11_QuitKeyboard(_THIS)
   30.30  {
   30.31 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
   30.32 -
   30.33 -    SDL_DelKeyboard(data->keyboard);
   30.34  }
   30.35  
   30.36  /* vi: set ts=4 sw=4 expandtab: */
    31.1 --- a/src/video/x11/SDL_x11mouse.c	Sun May 09 19:55:28 2010 -0700
    31.2 +++ b/src/video/x11/SDL_x11mouse.c	Sun May 09 20:47:22 2010 -0700
    31.3 @@ -24,139 +24,14 @@
    31.4  #include "SDL_x11mouse.h"
    31.5  #include "../../events/SDL_mouse_c.h"
    31.6  
    31.7 -#if SDL_VIDEO_DRIVER_X11_XINPUT
    31.8 -static void
    31.9 -X11_FreeMouse(SDL_Mouse * mouse)
   31.10 -{
   31.11 -    X11_MouseData *data = (X11_MouseData *) mouse->driverdata;
   31.12 -
   31.13 -    if (data) {
   31.14 -        XCloseDevice(data->display, data->device);
   31.15 -        SDL_free(data);
   31.16 -    }
   31.17 -}
   31.18 -#endif
   31.19 -
   31.20  void
   31.21  X11_InitMouse(_THIS)
   31.22  {
   31.23 -    SDL_Mouse mouse;
   31.24 -#if SDL_VIDEO_DRIVER_X11_XINPUT
   31.25 -    Display *display = ((SDL_VideoData *) _this->driverdata)->display;
   31.26 -    X11_MouseData *data;
   31.27 -    int i, j, n;
   31.28 -    XDeviceInfo *DevList;
   31.29 -    XAnyClassPtr deviceClass;
   31.30 -    int event_code;
   31.31 -    XEventClass xEvent;
   31.32 -#endif
   31.33 -    int num_mice = 0;
   31.34 -
   31.35 -    SDL_zero(mouse);
   31.36 -
   31.37 -#if SDL_VIDEO_DRIVER_X11_XINPUT
   31.38 -    /* we're getting the list of input devices */
   31.39 -    n = 0;
   31.40 -    if (SDL_X11_HAVE_XINPUT) {
   31.41 -        DevList = XListInputDevices(display, &n);
   31.42 -    }
   31.43 -
   31.44 -    /* we're aquiring valuators: mice, tablets, etc. */
   31.45 -    for (i = 0; i < n; ++i) {
   31.46 -        /* if it's the core pointer or core keyborard we don't want it */
   31.47 -        if ((DevList[i].use != IsXPointer && DevList[i].use != IsXKeyboard)) {
   31.48 -            /* we have to check all of the device classes */
   31.49 -            deviceClass = DevList[i].inputclassinfo;
   31.50 -            for (j = 0; j < DevList[i].num_classes; ++j) {
   31.51 -                if (deviceClass->class == ValuatorClass) {      /* bingo ;) */
   31.52 -                    XValuatorInfo *valInfo;
   31.53 -
   31.54 -                    data = (X11_MouseData *) SDL_calloc(1, sizeof(*data));
   31.55 -                    if (!data) {
   31.56 -                        continue;
   31.57 -                    }
   31.58 -                    data->display = display;
   31.59 -                    data->device = XOpenDevice(display, DevList[i].id);
   31.60 -
   31.61 -                    /* motion events */
   31.62 -                    DeviceMotionNotify(data->device, event_code, xEvent);
   31.63 -                    if (xEvent) {
   31.64 -                        data->xevents[data->num_xevents++] = xEvent;
   31.65 -                        data->motion = event_code;
   31.66 -                    }
   31.67 -
   31.68 -                    /* button events */
   31.69 -                    DeviceButtonPress(data->device, event_code, xEvent);
   31.70 -                    if (xEvent) {
   31.71 -                        data->xevents[data->num_xevents++] = xEvent;
   31.72 -                        data->button_pressed = event_code;
   31.73 -                    }
   31.74 -                    DeviceButtonRelease(data->device, event_code, xEvent);
   31.75 -                    if (xEvent) {
   31.76 -                        data->xevents[data->num_xevents++] = xEvent;
   31.77 -                        data->button_released = event_code;
   31.78 -                    }
   31.79 -
   31.80 -                    /* proximity events */
   31.81 -                    ProximityIn(data->device, event_code, xEvent);
   31.82 -                    if (xEvent) {
   31.83 -                        data->xevents[data->num_xevents++] = xEvent;
   31.84 -                        data->proximity_in = event_code;
   31.85 -                    }
   31.86 -                    ProximityOut(data->device, event_code, xEvent);
   31.87 -                    if (xEvent) {
   31.88 -                        data->xevents[data->num_xevents++] = xEvent;
   31.89 -                        data->proximity_out = event_code;
   31.90 -                    }
   31.91 -
   31.92 -                    SDL_zero(mouse);
   31.93 -                    mouse.id = DevList[i].id;
   31.94 -                    mouse.FreeMouse = X11_FreeMouse;
   31.95 -                    mouse.driverdata = data;
   31.96 -
   31.97 -                    /* lets get the device parameters */
   31.98 -                    valInfo = (XValuatorInfo *) deviceClass;
   31.99 -                    /* if the device reports pressure, lets check it parameteres */
  31.100 -                    if (valInfo->num_axes > 2) {
  31.101 -                        SDL_AddMouse(&mouse, DevList[i].name,
  31.102 -                                     valInfo->axes[2].max_value,
  31.103 -                                     valInfo->axes[2].min_value, 1);
  31.104 -                    } else {
  31.105 -                        SDL_AddMouse(&mouse, DevList[i].name, 0, 0, 1);
  31.106 -                    }
  31.107 -#ifndef IsXExtensionPointer
  31.108 -#define IsXExtensionPointer 4
  31.109 -#endif
  31.110 -                    if (DevList[i].use == IsXExtensionPointer) {
  31.111 -                        ++num_mice;
  31.112 -                    }
  31.113 -                    break;
  31.114 -                }
  31.115 -                /* if it's not class we're interested in, lets go further */
  31.116 -                deviceClass =
  31.117 -                    (XAnyClassPtr) ((char *) deviceClass +
  31.118 -                                    deviceClass->length);
  31.119 -            }
  31.120 -        }
  31.121 -    }
  31.122 -    XFreeDeviceList(DevList);
  31.123 -#endif
  31.124 -
  31.125 -    if (num_mice == 0) {
  31.126 -        SDL_zero(mouse);
  31.127 -        SDL_AddMouse(&mouse, "CorePointer", 0, 0, 1);
  31.128 -    }
  31.129  }
  31.130  
  31.131  void
  31.132  X11_QuitMouse(_THIS)
  31.133  {
  31.134 -    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
  31.135 -
  31.136 -    /* !!! FIXME: use XCloseDevice()? Or maybe handle under SDL_MouseQuit()? */
  31.137 -
  31.138 -    /* let's delete all of the mice */
  31.139 -    SDL_MouseQuit();
  31.140  }
  31.141  
  31.142  /* vi: set ts=4 sw=4 expandtab: */
    32.1 --- a/src/video/x11/SDL_x11video.h	Sun May 09 19:55:28 2010 -0700
    32.2 +++ b/src/video/x11/SDL_x11video.h	Sun May 09 20:47:22 2010 -0700
    32.3 @@ -67,7 +67,6 @@
    32.4      int numwindows;
    32.5      SDL_WindowData **windowlist;
    32.6      int windowlistlength;
    32.7 -    int keyboard;
    32.8      Atom WM_DELETE_WINDOW;
    32.9      SDL_scancode key_layout[256];
   32.10  } SDL_VideoData;
    33.1 --- a/src/video/x11/SDL_x11window.c	Sun May 09 19:55:28 2010 -0700
    33.2 +++ b/src/video/x11/SDL_x11window.c	Sun May 09 20:47:22 2010 -0700
    33.3 @@ -22,6 +22,7 @@
    33.4  #include "SDL_config.h"
    33.5  
    33.6  #include "../SDL_sysvideo.h"
    33.7 +#include "../SDL_pixels_c.h"
    33.8  #include "../../events/SDL_keyboard_c.h"
    33.9  #include "../../events/SDL_mouse_c.h"
   33.10  
   33.11 @@ -34,6 +35,7 @@
   33.12  #include "SDL_x11opengles.h"
   33.13  #endif
   33.14  
   33.15 +#include "SDL_timer.h"
   33.16  #include "SDL_syswm.h"
   33.17  
   33.18  #define _NET_WM_STATE_REMOVE    0l
   33.19 @@ -67,7 +69,6 @@
   33.20      int numwindows = videodata->numwindows;
   33.21      int windowlistlength = videodata->windowlistlength;
   33.22      SDL_WindowData **windowlist = videodata->windowlist;
   33.23 -    int index;
   33.24  
   33.25      /* Allocate the window data */
   33.26      data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
   33.27 @@ -275,8 +276,7 @@
   33.28      if (visual->class == PseudoColor) {
   33.29          printf("asking for PseudoColor\n");
   33.30  
   33.31 -        Status status;
   33.32 -        XStandardColormap cmap;
   33.33 +/*      Status status; */
   33.34          XColor *colorcells;
   33.35          Colormap colormap;
   33.36          Sint32 pix;
   33.37 @@ -387,7 +387,6 @@
   33.38          }
   33.39      } else if (visual->class == DirectColor) {
   33.40          Status status;
   33.41 -        XStandardColormap cmap;
   33.42          XColor *colorcells;
   33.43          Colormap colormap;
   33.44          int i;
   33.45 @@ -397,9 +396,9 @@
   33.46          int rshift, gshift, bshift;
   33.47  
   33.48          /* Is the colormap we need already registered in SDL? */
   33.49 -        if (colormap =
   33.50 -            X11_LookupColormap(data->display,
   33.51 -                               displaydata->screen, visual->visualid)) {
   33.52 +        if ((colormap =
   33.53 +             X11_LookupColormap(data->display,
   33.54 +                                displaydata->screen, visual->visualid))) {
   33.55              xattr.colormap = colormap;
   33.56  /*             printf("found existing colormap\n"); */
   33.57          } else {
   33.58 @@ -647,7 +646,6 @@
   33.59      /* Tell KDE to keep fullscreen windows on top */
   33.60      if (window->flags & SDL_WINDOW_FULLSCREEN) {
   33.61          XEvent ev;
   33.62 -        long mask;
   33.63  
   33.64          SDL_zero(ev);
   33.65          ev.xclient.type = ClientMessage;
   33.66 @@ -710,32 +708,6 @@
   33.67      }
   33.68  #endif
   33.69  
   33.70 -#if SDL_VIDEO_DRIVER_X11_XINPUT
   33.71 -    /* we're informing the display what extension events we want to receive from it */
   33.72 -    {
   33.73 -        int i, j, n = 0;
   33.74 -        XEventClass xevents[256];
   33.75 -
   33.76 -        for (i = 0; i < SDL_GetNumMice(); ++i) {
   33.77 -            SDL_Mouse *mouse;
   33.78 -            X11_MouseData *data;
   33.79 -
   33.80 -            mouse = SDL_GetMouse(i);
   33.81 -            data = (X11_MouseData *) mouse->driverdata;
   33.82 -            if (!data) {
   33.83 -                continue;
   33.84 -            }
   33.85 -
   33.86 -            for (j = 0; j < data->num_xevents; ++j) {
   33.87 -                xevents[n++] = data->xevents[j];
   33.88 -            }
   33.89 -        }
   33.90 -        if (n > 0) {
   33.91 -            XSelectExtensionEvent(data->display, w, xevents, n);
   33.92 -        }
   33.93 -    }
   33.94 -#endif
   33.95 -
   33.96      return 0;
   33.97  }
   33.98  
   33.99 @@ -869,8 +841,6 @@
  33.100  X11_SetWindowPosition(_THIS, SDL_Window * window)
  33.101  {
  33.102      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  33.103 -    SDL_DisplayData *displaydata =
  33.104 -        (SDL_DisplayData *) window->display->driverdata;
  33.105      Display *display = data->videodata->display;
  33.106      int x, y;
  33.107  
    34.1 --- a/test/common.c	Sun May 09 19:55:28 2010 -0700
    34.2 +++ b/test/common.c	Sun May 09 20:47:22 2010 -0700
    34.3 @@ -929,45 +929,44 @@
    34.4          break;
    34.5      case SDL_KEYDOWN:
    34.6          fprintf(stderr,
    34.7 -                "Keyboard %d: key pressed  in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
    34.8 -                event->key.which, event->key.windowID,
    34.9 +                "Keyboard: key pressed  in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
   34.10 +                event->key.windowID,
   34.11                  event->key.keysym.scancode,
   34.12                  SDL_GetScancodeName(event->key.keysym.scancode),
   34.13                  event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
   34.14          break;
   34.15      case SDL_KEYUP:
   34.16          fprintf(stderr,
   34.17 -                "Keyboard %d: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
   34.18 -                event->key.which, event->key.windowID,
   34.19 +                "Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
   34.20 +                event->key.windowID,
   34.21                  event->key.keysym.scancode,
   34.22                  SDL_GetScancodeName(event->key.keysym.scancode),
   34.23                  event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
   34.24          break;
   34.25      case SDL_TEXTINPUT:
   34.26 -        fprintf(stderr, "Keyboard %d: text input \"%s\" in window %d",
   34.27 -                event->text.which, event->text.text, event->text.windowID);
   34.28 +        fprintf(stderr, "Keyboard: text input \"%s\" in window %d",
   34.29 +                event->text.text, event->text.windowID);
   34.30          break;
   34.31      case SDL_MOUSEMOTION:
   34.32 -        fprintf(stderr, "Mouse %d: moved to %d,%d (%d,%d) in window %d",
   34.33 -                event->motion.which, event->motion.x, event->motion.y,
   34.34 +        fprintf(stderr, "Mouse: moved to %d,%d (%d,%d) in window %d",
   34.35 +                event->motion.x, event->motion.y,
   34.36                  event->motion.xrel, event->motion.yrel,
   34.37                  event->motion.windowID);
   34.38          break;
   34.39      case SDL_MOUSEBUTTONDOWN:
   34.40 -        fprintf(stderr, "Mouse %d: button %d pressed at %d,%d in window %d",
   34.41 -                event->button.which, event->button.button, event->button.x,
   34.42 -                event->button.y, event->button.windowID);
   34.43 +        fprintf(stderr, "Mouse: button %d pressed at %d,%d in window %d",
   34.44 +                event->button.button, event->button.x, event->button.y,
   34.45 +                event->button.windowID);
   34.46          break;
   34.47      case SDL_MOUSEBUTTONUP:
   34.48 -        fprintf(stderr, "Mouse %d: button %d released at %d,%d in window %d",
   34.49 -                event->button.which, event->button.button, event->button.x,
   34.50 -                event->button.y, event->button.windowID);
   34.51 +        fprintf(stderr, "Mouse: button %d released at %d,%d in window %d",
   34.52 +                event->button.button, event->button.x, event->button.y,
   34.53 +                event->button.windowID);
   34.54          break;
   34.55      case SDL_MOUSEWHEEL:
   34.56          fprintf(stderr,
   34.57 -                "Mouse %d: wheel scrolled %d in x and %d in y in window %d",
   34.58 -                event->wheel.which, event->wheel.x, event->wheel.y,
   34.59 -                event->wheel.windowID);
   34.60 +                "Mouse: wheel scrolled %d in x and %d in y in window %d",
   34.61 +                event->wheel.x, event->wheel.y, event->wheel.windowID);
   34.62          break;
   34.63      case SDL_JOYBALLMOTION:
   34.64          fprintf(stderr, "Joystick %d: ball %d moved by %d,%d",
    35.1 --- a/test/testime.c	Sun May 09 19:55:28 2010 -0700
    35.2 +++ b/test/testime.c	Sun May 09 20:47:22 2010 -0700
    35.3 @@ -279,8 +279,8 @@
    35.4              }
    35.5  
    35.6              fprintf(stderr,
    35.7 -                    "Keyboard %d: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
    35.8 -                    event.key.which, event.key.keysym.scancode,
    35.9 +                    "Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
   35.10 +                    event.key.keysym.scancode,
   35.11                      SDL_GetScancodeName(event.key.keysym.scancode),
   35.12                      event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
   35.13              break;
   35.14 @@ -290,8 +290,7 @@
   35.15                  markedRect.w < 0)
   35.16                  break;
   35.17  
   35.18 -            fprintf(stderr, "Keyboard %d: text input \"%s\"\n",
   35.19 -                    event.text.which, event.text.text);
   35.20 +            fprintf(stderr, "Keyboard: text input \"%s\"\n", event.text.text);
   35.21  
   35.22              if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
   35.23                  strcpy(text + SDL_strlen(text), event.text.text);
    36.1 --- a/test/testintersections.c	Sun May 09 19:55:28 2010 -0700
    36.2 +++ b/test/testintersections.c	Sun May 09 20:47:22 2010 -0700
    36.3 @@ -288,20 +288,16 @@
    36.4              CommonEvent(state, &event, &done);
    36.5              switch (event.type) {
    36.6              case SDL_MOUSEBUTTONDOWN:
    36.7 -                if (event.button.which == 0) {
    36.8 -                    mouse_begin_x = event.button.x;
    36.9 -                    mouse_begin_y = event.button.y;
   36.10 -                }
   36.11 +                mouse_begin_x = event.button.x;
   36.12 +                mouse_begin_y = event.button.y;
   36.13                  break;
   36.14              case SDL_MOUSEBUTTONUP:
   36.15 -                if (event.button.which == 0) {
   36.16 -                    if (event.button.button == 3)
   36.17 -                        add_line(mouse_begin_x, mouse_begin_y, event.button.x,
   36.18 -                                 event.button.y);
   36.19 -                    if (event.button.button == 1)
   36.20 -                        add_rect(mouse_begin_x, mouse_begin_y, event.button.x,
   36.21 -                                 event.button.y);
   36.22 -                }
   36.23 +                if (event.button.button == 3)
   36.24 +                    add_line(mouse_begin_x, mouse_begin_y, event.button.x,
   36.25 +                             event.button.y);
   36.26 +                if (event.button.button == 1)
   36.27 +                    add_rect(mouse_begin_x, mouse_begin_y, event.button.x,
   36.28 +                             event.button.y);
   36.29                  break;
   36.30              case SDL_KEYDOWN:
   36.31                  switch (event.key.keysym.sym) {