From 54753025c9e23b920021e97f1c22d3e1f087a4fc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 9 May 2010 20:47:22 -0700 Subject: [PATCH 01/44] 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 | 2 +- include/SDL_events.h | 50 +- include/SDL_input.h | 88 +++ include/SDL_keyboard.h | 28 +- include/SDL_mouse.h | 149 ++--- include/SDL_video.h | 1 - src/SDL_compat.c | 4 - src/events/SDL_keyboard.c | 203 ++----- src/events/SDL_keyboard_c.h | 47 +- src/events/SDL_mouse.c | 549 ++++-------------- src/events/SDL_mouse_c.h | 93 +-- src/video/cocoa/SDL_cocoakeyboard.m | 96 ++- src/video/cocoa/SDL_cocoamouse.m | 36 +- src/video/cocoa/SDL_cocoavideo.h | 2 - src/video/cocoa/SDL_cocoawindow.m | 54 +- src/video/uikit/SDL_uikitview.h | 4 +- src/video/uikit/SDL_uikitview.m | 10 +- src/video/win32/SDL_win32events.c | 177 +----- src/video/win32/SDL_win32keyboard.c | 12 +- src/video/win32/SDL_win32keyboard.h | 2 +- src/video/win32/SDL_win32modes.c | 1 - src/video/win32/SDL_win32mouse.c | 168 ------ src/video/win32/SDL_win32video.c | 40 +- src/video/win32/SDL_win32video.h | 15 - src/video/win32/SDL_win32window.c | 56 +- src/video/win32/wactab/pktdef.h | 237 -------- src/video/win32/wactab/wintab.h | 866 ---------------------------- src/video/win32/wactab/wintabx.h | 136 ----- src/video/x11/SDL_x11events.c | 118 +--- src/video/x11/SDL_x11keyboard.c | 8 +- src/video/x11/SDL_x11mouse.c | 125 ---- src/video/x11/SDL_x11video.h | 1 - src/video/x11/SDL_x11window.c | 42 +- test/common.c | 33 +- test/testime.c | 7 +- test/testintersections.c | 20 +- 36 files changed, 504 insertions(+), 2976 deletions(-) create mode 100644 include/SDL_input.h delete mode 100644 src/video/win32/wactab/pktdef.h delete mode 100644 src/video/win32/wactab/wintab.h delete mode 100644 src/video/win32/wactab/wintabx.h diff --git a/Makefile.in b/Makefile.in index bbcae1177..87df4de3d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,7 +44,7 @@ EMBEDSPU = @EMBEDSPU@ 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 -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 +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 LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ diff --git a/include/SDL_events.h b/include/SDL_events.h index fbdc46c94..91bdd8624 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -75,9 +75,13 @@ typedef enum SDL_MOUSEBUTTONUP, /**< Mouse button released */ SDL_MOUSEWHEEL, /**< Mouse wheel motion */ - /* Tablet events */ - SDL_PROXIMITYIN = 0x500, /**< Proximity In event */ - SDL_PROXIMITYOUT, /**< Proximity Out event */ + /* Tablet or multiple mice input device events */ + SDL_INPUTMOTION = 0x500, /**< Input moved */ + SDL_INPUTBUTTONDOWN, /**< Input button pressed */ + SDL_INPUTBUTTONUP, /**< Input button released */ + SDL_INPUTWHEEL, /**< Input wheel motion */ + SDL_INPUTPROXIMITYIN, /**< Input pen entered proximity */ + SDL_INPUTPROXIMITYOUT, /**< Input pen left proximity */ /* Joystick events */ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ @@ -124,10 +128,10 @@ typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ Uint32 windowID; /**< The window with keyboard focus, if any */ - Uint8 which; /**< The keyboard device index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 padding1; Uint8 padding2; + Uint8 padding3; SDL_keysym keysym; /**< The key that was pressed or released */ } SDL_KeyboardEvent; @@ -139,7 +143,6 @@ typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ Uint32 windowID; /**< The window with keyboard focus, if any */ - Uint8 which; /**< The keyboard device index */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ int start; /**< The start cursor of selected editing text */ int length; /**< The length of selected editing text */ @@ -154,10 +157,6 @@ typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ Uint32 windowID; /**< The window with keyboard focus, if any */ - Uint8 which; /**< The keyboard device index */ - Uint8 padding1; - Uint8 padding2; - Uint8 padding3; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -168,20 +167,12 @@ typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ Uint32 windowID; /**< The window with mouse focus, if any */ - Uint8 which; /**< The mouse device index */ Uint8 state; /**< The current button state */ Uint8 padding1; Uint8 padding2; + Uint8 padding3; int x; /**< X coordinate, relative to window */ int y; /**< Y coordinate, relative to window */ - int z; /**< Z coordinate, for future use */ - int pressure; /**< Pressure reported by tablets */ - int pressure_max; /**< Maximum value of the pressure reported by the device */ - int pressure_min; /**< Minimum value of the pressure reported by the device */ - int rotation; /**< For future use */ - int tilt_x; /**< For future use */ - int tilt_y; /**< For future use */ - int cursor; /**< The cursor being used in the event */ int xrel; /**< The relative motion in the X direction */ int yrel; /**< The relative motion in the Y direction */ } SDL_MouseMotionEvent; @@ -193,10 +184,10 @@ typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ Uint32 windowID; /**< The window with mouse focus, if any */ - Uint8 which; /**< The mouse device index */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 padding1; + Uint8 padding2; int x; /**< X coordinate, relative to window */ int y; /**< Y coordinate, relative to window */ } SDL_MouseButtonEvent; @@ -208,30 +199,10 @@ typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ Uint32 windowID; /**< The window with mouse focus, if any */ - Uint8 which; /**< The mouse device index */ - Uint8 padding1; - Uint8 padding2; - Uint8 padding3; int x; /**< The amount scrolled horizontally */ int y; /**< The amount scrolled vertically */ } SDL_MouseWheelEvent; -/** - * \brief Tablet pen proximity event - */ -typedef struct SDL_ProximityEvent -{ - Uint32 type; /**< ::SDL_PROXIMITYIN or ::SDL_PROXIMITYOUT */ - Uint32 windowID; /**< The associated window */ - Uint8 which; - Uint8 padding1; - Uint8 padding2; - Uint8 padding3; - int cursor; - int x; - int y; -} SDL_ProximityEvent; - /** * \brief Joystick axis motion event structure (event.jaxis.*) */ @@ -371,7 +342,6 @@ typedef union SDL_Event SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ - SDL_ProximityEvent proximity; /**< Proximity In or Out event */ /** Temporarily here for backwards compatibility */ /*@{*/ diff --git a/include/SDL_input.h b/include/SDL_input.h new file mode 100644 index 000000000..455138f1b --- /dev/null +++ b/include/SDL_input.h @@ -0,0 +1,88 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/** + * \file SDL_input.h + * + * Include file for lowlevel SDL input device handling. + * + * This talks about individual devices, and not the system cursor. If you + * just want to know when the user moves the pointer somewhere in your + * window, this is NOT the API you want. This one handles things like + * multi-touch, drawing tablets, and multiple, separate mice. + * + * The other API is in SDL_mouse.h + */ + +#ifndef _SDL_input_h +#define _SDL_input_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +/* Function prototypes */ + +/* !!! FIXME: real documentation + * - Redetect devices + * - This invalidates all existing device information from previous queries! + * - There is an implicit (re)detect upon SDL_Init(). + */ +extern DECLSPEC int SDLCALL SDL_RedetectInputDevices(void); + +/** + * \brief Get the number of mouse input devices available. + */ +extern DECLSPEC int SDLCALL SDL_GetNumInputDevices(void); + +/** + * \brief Gets the name of a device with the given index. + * + * \param index is the index of the device, whose name is to be returned. + * + * \return the name of the device with the specified index + */ +extern DECLSPEC const char *SDLCALL SDL_GetInputDeviceName(int index); + + +extern DECLSPEC int SDLCALL SDL_IsDeviceDisconnected(int index); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_mouse_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/include/SDL_keyboard.h b/include/SDL_keyboard.h index 4c013ba2c..4482ac028 100644 --- a/include/SDL_keyboard.h +++ b/include/SDL_keyboard.h @@ -32,6 +32,7 @@ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_keysym.h" +#include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -55,25 +56,12 @@ typedef struct SDL_keysym /* Function prototypes */ /** - * \brief Get the number of keyboard input devices available. - * - * \sa SDL_SelectKeyboard() - */ -extern DECLSPEC int SDLCALL SDL_GetNumKeyboards(void); - -/** - * \brief Set the index of the currently selected keyboard. - * - * \return The index of the previously selected keyboard. - * - * \note You can query the currently selected keyboard by passing an index of -1. - * - * \sa SDL_GetNumKeyboards() + * \brief Get the window which currently has keyboard focus. */ -extern DECLSPEC int SDLCALL SDL_SelectKeyboard(int index); +extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); /** - * \brief Get a snapshot of the current state of the selected keyboard. + * \brief Get a snapshot of the current state of the keyboard. * * \param numkeys if non-NULL, receives the length of the returned array. * @@ -90,20 +78,20 @@ extern DECLSPEC int SDLCALL SDL_SelectKeyboard(int index); extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); /** - * \brief Get the current key modifier state for the selected keyboard. + * \brief Get the current key modifier state for the keyboard. */ extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); /** - * \brief Set the current key modifier state for the selected keyboard. + * \brief Set the current key modifier state for the keyboard. * * \note This does not change the keyboard state, only the key modifier flags. */ extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); /** - * \brief Get the key code corresponding to the given scancode according to the - * current keyboard layout. + * \brief Get the key code corresponding to the given scancode according + * to the current keyboard layout. * * See ::SDLKey for details. * diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index a52ad8836..cb3cd9ccf 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -24,6 +24,22 @@ * \file SDL_mouse.h * * Include file for SDL mouse event handling. + * + * Please note that this ONLY discusses "mice" with the notion of the + * desktop GUI. You (usually) have one system cursor, and the OS hides + * the hardware details from you. If you plug in 10 mice, all ten move that + * one cursor. For many applications and games, this is perfect, and this + * API has served hundreds of SDL programs well since its birth. + * + * It's not the whole picture, though. If you want more lowlevel control, + * SDL offers a different API, that gives you visibility into each input + * device, multi-touch interfaces, etc. + * + * Those two APIs are incompatible, and you usually should not use both + * at the same time. But for legacy purposes, this API refers to a "mouse" + * when it actually means the system pointer and not a physical mouse. + * + * The other API is in SDL_input.h */ #ifndef _SDL_mouse_h @@ -43,45 +59,50 @@ extern "C" { typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ + /* Function prototypes */ /** - * \brief Get the number of mouse input devices available. - * - * \sa SDL_SelectMouse() + * \brief Get the window which currently has mouse focus. */ -extern DECLSPEC int SDLCALL SDL_GetNumMice(void); +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); /** - * \brief Gets the name of a mouse with the given index. - * - * \param index is the index of the mouse, which name is to be returned. + * \brief Retrieve the current state of the mouse. * - * \return the name of the mouse with the specified index + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse cursor position relative to the focus window for the currently + * selected mouse. You can pass NULL for either x or y. */ -extern DECLSPEC char *SDLCALL SDL_GetMouseName(int index); +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); /** - * \brief Set the index of the currently selected mouse. - * - * \return The index of the previously selected mouse. - * - * \note You can query the currently selected mouse by passing an index of -1. - * - * \sa SDL_GetNumMice() + * \brief Retrieve the relative state of the mouse. + * + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState(). */ -extern DECLSPEC int SDLCALL SDL_SelectMouse(int index); +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); /** - * \brief Get the window which currently has focus for the specified mouse. + * \brief Moves the mouse to the given position within the window. + * + * \param window The window to move the mouse into, or NULL for the current mouse focus + * \param x The x coordinate within the window + * \param y The y coordinate within the window + * + * \note This function generates a mouse motion event */ -extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocusWindow(int index); +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, + int x, int y); /** - * \brief Set relative mouse mode for the specified mouse. + * \brief Set relative mouse mode. * * \param enabled Whether or not to enable relative mode - * + * * \return 0 on success, or -1 if relative mode is not supported. * * While the mouse is in relative mode, the cursor is hidden, and the @@ -93,51 +114,18 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocusWindow(int index); * * \sa SDL_GetRelativeMouseMode() */ -extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index, - SDL_bool enabled); +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); /** - * \brief Query whether relative mouse mode is enabled for the specified mouse. + * \brief Query whether relative mouse mode is enabled. * * \sa SDL_SetRelativeMouseMode() */ -extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index); - -/** - * \brief Retrieve the current state of the specified mouse. - * - * The current button state is returned as a button bitmask, which can - * be tested using the SDL_BUTTON(X) macros, and x and y are set to the - * mouse cursor position relative to the focus window for the currently - * selected mouse. You can pass NULL for either x or y. - */ -extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); - -/** - * \brief Retrieve the state of the specified mouse. - * - * The current button state is returned as a button bitmask, which can - * be tested using the SDL_BUTTON(X) macros, and x and y are set to the - * mouse deltas since the last call to SDL_GetRelativeMouseState(). - */ -extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x, - int *y); +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); /** - * \brief Moves the currently selected mouse to the given position within the window. - * - * \param window The window to move the mouse into, or NULL for the current mouse focus - * \param x The x coordinate within the window - * \param y The y coordinate within the window - * - * \note This function generates a mouse motion event - */ -extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, - int x, int y); - -/** - * \brief Create a cursor for the currently selected mouse, using the - * specified bitmap data and mask (in MSB format). + * \brief Create a cursor, using the specified bitmap data and + * mask (in MSB format). * * The cursor width must be a multiple of 8 bits. * @@ -148,7 +136,7 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, * 1 1 Black * 0 0 Transparent * 1 0 Inverted color if possible, black - if not. + * if not. * * * \sa SDL_FreeCursor() @@ -159,14 +147,12 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, int hot_y); /** - * \brief Set the active cursor for the currently selected mouse. - * - * \note The cursor must have been created for the selected mouse. + * \brief Set the active cursor. */ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); /** - * \brief Return the active cursor for the currently selected mouse. + * \brief Return the active cursor. */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); @@ -178,8 +164,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); /** - * \brief Toggle whether or not the cursor is shown for the currently selected - * mouse. + * \brief Toggle whether or not the cursor is shown. * * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current * state. @@ -188,38 +173,6 @@ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); */ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); -/** - * \brief Gets the number of cursors a pointing device supports. - * - * Useful for tablet users. Useful only under Windows. - * - * \param index is the index of the pointing device, which number of cursors we - * want to receive. - * - * \return the number of cursors supported by the pointing device. On Windows - * if a device is a tablet it returns a number >=1. Normal mice always - * return 1. - * - * On Linux every device reports one cursor. - */ -extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index); - -/** - * \brief Returns the index of the current cursor used by a specific pointing - * device. - * - * Useful only under Windows. - * - * \param index is the index of the pointing device, which cursor index we want - * to receive. - * - * \return the index of the cursor currently used by a specific pointing - * device. Always 0 under Linux. On Windows if the device isn't a - * tablet it returns 0. If the device is the tablet it returns the - * cursor index. 0 - stylus, 1 - eraser, 2 - cursor. - */ -extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index); - /** * Used as a mask when testing buttons in buttonstate. * - Button 1: Left mouse button diff --git a/include/SDL_video.h b/include/SDL_video.h index a0db406cd..804869f69 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -88,7 +88,6 @@ typedef struct * \sa SDL_SetWindowTitle() * \sa SDL_ShowWindow() */ -struct SDL_Window; typedef struct SDL_Window SDL_Window; /** diff --git a/src/SDL_compat.c b/src/SDL_compat.c index a985dc35f..0c094e8a7 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -277,16 +277,13 @@ SDL_CompatEventFilter(void *userdata, SDL_Event * event) case SDL_MOUSEWHEEL: { Uint8 button; - int selected; int x, y; if (event->wheel.y == 0) { break; } - selected = SDL_SelectMouse(event->wheel.which); SDL_GetMouseState(&x, &y); - SDL_SelectMouse(selected); if (event->wheel.y > 0) { button = SDL_BUTTON_WHEELUP; @@ -294,7 +291,6 @@ SDL_CompatEventFilter(void *userdata, SDL_Event * event) button = SDL_BUTTON_WHEELDOWN; } - fake.button.which = event->wheel.which; fake.button.button = button; fake.button.x = x; fake.button.y = y; diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index e6a9ca0ef..f25bc6af8 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -30,9 +30,19 @@ /* Global keyboard information */ -static int SDL_num_keyboards; -static int SDL_current_keyboard; -static SDL_Keyboard **SDL_keyboards; + +typedef struct SDL_Keyboard SDL_Keyboard; + +struct SDL_Keyboard +{ + /* Data common to all keyboards */ + SDL_Window *focus; + Uint16 modstate; + Uint8 keystate[SDL_NUM_SCANCODES]; + SDLKey keymap[SDL_NUM_SCANCODES]; +}; + +static SDL_Keyboard SDL_keyboard; static const SDLKey SDL_default_keymap[SDL_NUM_SCANCODES] = { 0, 0, 0, 0, @@ -544,75 +554,15 @@ SDL_KeyboardInit(void) return (0); } -SDL_Keyboard * -SDL_GetKeyboard(int index) -{ - if (index < 0 || index >= SDL_num_keyboards) { - return NULL; - } - return SDL_keyboards[index]; -} - -int -SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index) -{ - SDL_Keyboard **keyboards; - - /* Add the keyboard to the list of keyboards */ - if (index < 0 || index >= SDL_num_keyboards || SDL_keyboards[index]) { - keyboards = - (SDL_Keyboard **) SDL_realloc(SDL_keyboards, - (SDL_num_keyboards + - 1) * sizeof(*keyboards)); - if (!keyboards) { - SDL_OutOfMemory(); - return -1; - } - - SDL_keyboards = keyboards; - index = SDL_num_keyboards++; - } - SDL_keyboards[index] = - (SDL_Keyboard *) SDL_malloc(sizeof(*SDL_keyboards[index])); - if (!SDL_keyboards[index]) { - SDL_OutOfMemory(); - return -1; - } - *SDL_keyboards[index] = *keyboard; - - return index; -} - -void -SDL_DelKeyboard(int index) -{ - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); - - if (!keyboard) { - return; - } - - if (keyboard->FreeKeyboard) { - keyboard->FreeKeyboard(keyboard); - } - SDL_free(keyboard); - - SDL_keyboards[index] = NULL; -} - void -SDL_ResetKeyboard(int index) +SDL_ResetKeyboard(void) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); + SDL_Keyboard *keyboard = &SDL_keyboard; SDL_scancode scancode; - if (!keyboard) { - return; - } - for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keystate[scancode] == SDL_PRESSED) { - SDL_SendKeyboardKey(index, SDL_RELEASED, scancode); + SDL_SendKeyboardKey(SDL_RELEASED, scancode); } } } @@ -624,13 +574,9 @@ SDL_GetDefaultKeymap(SDLKey * keymap) } void -SDL_SetKeymap(int index, int start, SDLKey * keys, int length) +SDL_SetKeymap(int start, SDLKey * keys, int length) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); - - if (!keyboard) { - return; - } + SDL_Keyboard *keyboard = &SDL_keyboard; if (start < 0 || start + length > SDL_NUM_SCANCODES) { return; @@ -645,33 +591,23 @@ SDL_SetScancodeName(SDL_scancode scancode, const char *name) SDL_scancode_names[scancode] = name; } -void -SDL_SetKeyboardFocus(int index, SDL_Window * window) +SDL_Window * +SDL_GetKeyboardFocus(void) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); - int i; - SDL_bool focus; + SDL_Keyboard *keyboard = &SDL_keyboard; - if (!keyboard) { - return; - } + return keyboard->focus; +} + +void +SDL_SetKeyboardFocus(SDL_Window * window) +{ + SDL_Keyboard *keyboard = &SDL_keyboard; /* See if the current window has lost focus */ if (keyboard->focus && keyboard->focus != window) { - focus = SDL_FALSE; - for (i = 0; i < SDL_num_keyboards; ++i) { - if (i != index) { - SDL_Keyboard *check = SDL_GetKeyboard(i); - if (check && check->focus == keyboard->focus) { - focus = SDL_TRUE; - break; - } - } - } - if (!focus) { - SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST, - 0, 0); - } + SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST, + 0, 0); } keyboard->focus = window; @@ -687,14 +623,14 @@ SDL_SetKeyboardFocus(int index, SDL_Window * window) } int -SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode) +SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); + SDL_Keyboard *keyboard = &SDL_keyboard; int posted; Uint16 modstate; Uint32 type; - if (!keyboard || !scancode) { + if (!scancode) { return 0; } #if 0 @@ -807,7 +743,6 @@ SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode) if (SDL_GetEventState(type) == SDL_ENABLE) { SDL_Event event; event.key.type = type; - event.key.which = (Uint8) index; event.key.state = state; event.key.keysym.scancode = scancode; event.key.keysym.sym = keyboard->keymap[scancode]; @@ -820,22 +755,17 @@ SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode) } int -SDL_SendKeyboardText(int index, const char *text) +SDL_SendKeyboardText(const char *text) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); + SDL_Keyboard *keyboard = &SDL_keyboard; int posted; - if (!keyboard) { - return 0; - } - /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_Event event; event.text.type = SDL_TEXTINPUT; event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; - event.text.which = (Uint8) index; SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); @@ -844,22 +774,17 @@ SDL_SendKeyboardText(int index, const char *text) } int -SDL_SendEditingText(int index, const char *text, int start, int length) +SDL_SendEditingText(const char *text, int start, int length) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(index); + SDL_Keyboard *keyboard = &SDL_keyboard; int posted; - if (!keyboard) { - return 0; - } - /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) { SDL_Event event; event.edit.type = SDL_TEXTEDITING; event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; - event.text.which = (Uint8) index; event.edit.start = start; event.edit.length = length; SDL_strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); @@ -871,93 +796,49 @@ SDL_SendEditingText(int index, const char *text, int start, int length) void SDL_KeyboardQuit(void) { - int i; - - for (i = 0; i < SDL_num_keyboards; ++i) { - SDL_DelKeyboard(i); - } - SDL_num_keyboards = 0; - SDL_current_keyboard = 0; - - if (SDL_keyboards) { - SDL_free(SDL_keyboards); - SDL_keyboards = NULL; - } -} - -int -SDL_GetNumKeyboards(void) -{ - return SDL_num_keyboards; -} - -int -SDL_SelectKeyboard(int index) -{ - if (index >= 0 && index < SDL_num_keyboards) { - SDL_current_keyboard = index; - } - return SDL_current_keyboard; } Uint8 * SDL_GetKeyboardState(int *numkeys) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); + SDL_Keyboard *keyboard = &SDL_keyboard; if (numkeys != (int *) 0) { *numkeys = SDL_NUM_SCANCODES; } - - if (!keyboard) { - return NULL; - } return keyboard->keystate; } SDLMod SDL_GetModState(void) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); + SDL_Keyboard *keyboard = &SDL_keyboard; - if (!keyboard) { - return KMOD_NONE; - } return keyboard->modstate; } void SDL_SetModState(SDLMod modstate) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); + SDL_Keyboard *keyboard = &SDL_keyboard; - if (!keyboard) { - return; - } keyboard->modstate = modstate; } SDLKey SDL_GetKeyFromScancode(SDL_scancode scancode) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); + SDL_Keyboard *keyboard = &SDL_keyboard; - if (!keyboard) { - return SDLK_UNKNOWN; - } return keyboard->keymap[scancode]; } SDL_scancode SDL_GetScancodeFromKey(SDLKey key) { - SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); + SDL_Keyboard *keyboard = &SDL_keyboard; SDL_scancode scancode; - if (!keyboard) { - return SDL_SCANCODE_UNKNOWN; - } - for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keymap[scancode] == key) { diff --git a/src/events/SDL_keyboard_c.h b/src/events/SDL_keyboard_c.h index d4021ff35..1eeb9718c 100644 --- a/src/events/SDL_keyboard_c.h +++ b/src/events/SDL_keyboard_c.h @@ -27,44 +27,17 @@ #include "SDL_keysym.h" #include "SDL_events.h" -typedef struct SDL_Keyboard SDL_Keyboard; - -struct SDL_Keyboard -{ - /* Free the keyboard when it's time */ - void (*FreeKeyboard) (SDL_Keyboard * keyboard); - - /* Data common to all keyboards */ - SDL_Window *focus; - Uint16 modstate; - Uint8 keystate[SDL_NUM_SCANCODES]; - SDLKey keymap[SDL_NUM_SCANCODES]; - - void *driverdata; -}; - /* Initialize the keyboard subsystem */ extern int SDL_KeyboardInit(void); -/* Get the keyboard at an index */ -extern SDL_Keyboard *SDL_GetKeyboard(int index); - -/* Add a keyboard, possibly reattaching at a particular index (or -1), - returning the index of the keyboard, or -1 if there was an error. - */ -extern int SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index); - -/* Remove a keyboard at an index, clearing the slot for later */ -extern void SDL_DelKeyboard(int index); - -/* Clear the state of a keyboard at an index */ -extern void SDL_ResetKeyboard(int index); +/* Clear the state of the keyboard */ +extern void SDL_ResetKeyboard(void); /* Get the default keymap */ extern void SDL_GetDefaultKeymap(SDLKey * keymap); -/* Set the mapping of scancode to key codes for this keyboard */ -extern void SDL_SetKeymap(int index, int start, SDLKey * keys, int length); +/* Set the mapping of scancode to key codes */ +extern void SDL_SetKeymap(int start, SDLKey * keys, int length); /* Set a platform-dependent key name, overriding the default platform-agnostic name. Encoded as UTF-8. The string is not copied, thus the pointer given to @@ -73,16 +46,16 @@ extern void SDL_SetKeymap(int index, int start, SDLKey * keys, int length); extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name); /* Set the keyboard focus window */ -extern void SDL_SetKeyboardFocus(int index, SDL_Window * window); +extern void SDL_SetKeyboardFocus(SDL_Window * window); -/* Send a keyboard event for a keyboard at an index */ -extern int SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode); +/* Send a keyboard key event */ +extern int SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode); -/* Send keyboard text input for a keyboard at an index */ -extern int SDL_SendKeyboardText(int index, const char *text); +/* Send keyboard text input */ +extern int SDL_SendKeyboardText(const char *text); /* Send editing text for selected range from start to end */ -extern int SDL_SendEditingText(int index, const char *text, int start, int end); +extern int SDL_SendEditingText(const char *text, int start, int end); /* Shutdown the keyboard subsystem */ extern void SDL_KeyboardQuit(void); diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index c9e229654..e8a9ccd75 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -29,382 +29,97 @@ #include "../video/SDL_sysvideo.h" -static int SDL_num_mice = 0; -static int SDL_current_mouse = -1; -static SDL_Mouse **SDL_mice = NULL; +/* Global mouse information */ +typedef struct SDL_Mouse SDL_Mouse; -/* Public functions */ -int -SDL_MouseInit(void) +struct SDL_Mouse { - return (0); -} + /* Create a cursor from a surface */ + SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y); -SDL_Mouse * -SDL_GetMouse(int index) -{ - if (index < 0 || index >= SDL_num_mice) { - return NULL; - } - return SDL_mice[index]; -} + /* Show the specified cursor, or hide if cursor is NULL */ + int (*ShowCursor) (SDL_Cursor * cursor); -static int -SDL_GetMouseIndexId(int id) -{ - int index; - SDL_Mouse *mouse; + /* This is called when a mouse motion event occurs */ + void (*MoveCursor) (SDL_Cursor * cursor); - for (index = 0; index < SDL_num_mice; ++index) { - mouse = SDL_GetMouse(index); - if (mouse->id == id) { - return index; - } - } - return -1; -} + /* Free a window manager cursor */ + void (*FreeCursor) (SDL_Cursor * cursor); -int -SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max, - int pressure_min, int ends) -{ - SDL_Mouse **mice; - int selected_mouse; - int index; - size_t length; - - if (SDL_GetMouseIndexId(mouse->id) != -1) { - SDL_SetError("Mouse ID already in use"); - } - - /* Add the mouse to the list of mice */ - mice = (SDL_Mouse **) SDL_realloc(SDL_mice, - (SDL_num_mice + 1) * sizeof(*mice)); - if (!mice) { - SDL_OutOfMemory(); - return -1; - } - - SDL_mice = mice; - index = SDL_num_mice++; - - SDL_mice[index] = (SDL_Mouse *) SDL_malloc(sizeof(*SDL_mice[index])); - if (!SDL_mice[index]) { - SDL_OutOfMemory(); - return -1; - } - *SDL_mice[index] = *mouse; - - /* we're setting the mouse properties */ - length = 0; - length = SDL_strlen(name); - SDL_mice[index]->focus = 0; - SDL_mice[index]->name = SDL_malloc((length + 2) * sizeof(char)); - SDL_strlcpy(SDL_mice[index]->name, name, length + 1); - SDL_mice[index]->pressure_max = pressure_max; - SDL_mice[index]->pressure_min = pressure_min; - SDL_mice[index]->cursor_shown = SDL_TRUE; - selected_mouse = SDL_SelectMouse(index); - SDL_mice[index]->cur_cursor = NULL; - SDL_mice[index]->def_cursor = - SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, - DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY); - SDL_SetCursor(SDL_mice[index]->def_cursor); - /* we're assuming that all mice are in the computer sensing zone */ - SDL_mice[index]->proximity = SDL_TRUE; - /* we're assuming that all mice are working in the absolute position mode - thanx to that, the users that don't want to use many mice don't have to - worry about anything */ - SDL_mice[index]->relative_mode = SDL_FALSE; - SDL_mice[index]->current_end = 0; - SDL_mice[index]->total_ends = ends; - SDL_SelectMouse(selected_mouse); - - return index; -} + /* Warp the mouse to (x,y) */ + void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x, int y); -void -SDL_DelMouse(int index) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (!mouse) { - return; - } - - mouse->def_cursor = NULL; - SDL_free(mouse->name); - while (mouse->cursors) { - SDL_FreeCursor(mouse->cursors); - } - - if (mouse->FreeMouse) { - mouse->FreeMouse(mouse); - } - SDL_free(mouse); + /* Data common to all mice */ + SDL_Window *focus; + int x; + int y; + int xdelta; + int ydelta; + int last_x, last_y; /* the last reported x and y coordinates */ + Uint8 buttonstate; + SDL_bool relative_mode; - SDL_mice[index] = NULL; -} + SDL_Cursor *cursors; + SDL_Cursor *def_cursor; + SDL_Cursor *cur_cursor; + SDL_bool cursor_shown; +}; -void -SDL_ResetMouse(int index) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); +static SDL_Mouse SDL_mouse; - if (!mouse) { - return; - } - - /* FIXME */ -} - -void -SDL_MouseQuit(void) -{ - int i; - - for (i = 0; i < SDL_num_mice; ++i) { - SDL_DelMouse(i); - } - SDL_num_mice = 0; - SDL_current_mouse = -1; - - if (SDL_mice) { - SDL_free(SDL_mice); - SDL_mice = NULL; - } -} +/* Public functions */ int -SDL_GetNumMice(void) +SDL_MouseInit(void) { - return SDL_num_mice; + return (0); } -int -SDL_SelectMouse(int index) +void +SDL_ResetMouse(void) { - if (index >= 0 && index < SDL_num_mice) { - SDL_current_mouse = index; - } - return SDL_current_mouse; + /* FIXME */ } SDL_Window * -SDL_GetMouseFocusWindow(int index) +SDL_GetMouseFocus(void) { - SDL_Mouse *mouse = SDL_GetMouse(index); + SDL_Mouse *mouse = &SDL_mouse; - if (!mouse) { - return 0; - } return mouse->focus; } -static int SDLCALL -FlushMouseMotion(void *param, SDL_Event * event) -{ - if (event->type == SDL_MOUSEMOTION - && event->motion.which == (Uint8) SDL_current_mouse) { - return 0; - } else { - return 1; - } -} - -int -SDL_SetRelativeMouseMode(int index, SDL_bool enabled) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (!mouse) { - return -1; - } - - /* Flush pending mouse motion */ - mouse->flush_motion = SDL_TRUE; - SDL_PumpEvents(); - mouse->flush_motion = SDL_FALSE; - SDL_FilterEvents(FlushMouseMotion, mouse); - - /* Set the relative mode */ - mouse->relative_mode = enabled; - - /* Update cursor visibility */ - SDL_SetCursor(NULL); - - if (!enabled) { - /* Restore the expected mouse position */ - SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y); - } - return 0; -} - -SDL_bool -SDL_GetRelativeMouseMode(int index) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (!mouse) { - return SDL_FALSE; - } - return mouse->relative_mode; -} - -Uint8 -SDL_GetMouseState(int *x, int *y) -{ - SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); - - if (!mouse) { - if (x) { - *x = 0; - } - if (y) { - *y = 0; - } - return 0; - } - - if (x) { - *x = mouse->x; - } - if (y) { - *y = mouse->y; - } - return mouse->buttonstate; -} - -Uint8 -SDL_GetRelativeMouseState(int index, int *x, int *y) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (!mouse) { - if (x) { - *x = 0; - } - if (y) { - *y = 0; - } - return 0; - } - - if (x) { - *x = mouse->xdelta; - } - if (y) { - *y = mouse->ydelta; - } - mouse->xdelta = 0; - mouse->ydelta = 0; - return mouse->buttonstate; -} - void -SDL_SetMouseFocus(int id, SDL_Window * window) +SDL_SetMouseFocus(SDL_Window * window) { - int index = SDL_GetMouseIndexId(id); - SDL_Mouse *mouse = SDL_GetMouse(index); - int i; - SDL_bool focus; + SDL_Mouse *mouse = &SDL_mouse; - if (!mouse || (mouse->focus == window)) { + if (mouse->focus == window) { return; } /* See if the current window has lost focus */ if (mouse->focus) { - focus = SDL_FALSE; - for (i = 0; i < SDL_num_mice; ++i) { - SDL_Mouse *check; - if (i != index) { - check = SDL_GetMouse(i); - if (check && check->focus == mouse->focus) { - focus = SDL_TRUE; - break; - } - } - } - if (!focus) { - SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0); - } + SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0); } mouse->focus = window; if (mouse->focus) { - focus = SDL_FALSE; - for (i = 0; i < SDL_num_mice; ++i) { - SDL_Mouse *check; - if (i != index) { - check = SDL_GetMouse(i); - if (check && check->focus == mouse->focus) { - focus = SDL_TRUE; - break; - } - } - } - if (!focus) { - SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0); - } + SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0); } } int -SDL_SendProximity(int id, int x, int y, int type) +SDL_SendMouseMotion(int relative, int x, int y) { - int index = SDL_GetMouseIndexId(id); - SDL_Mouse *mouse = SDL_GetMouse(index); - int posted = 0; - - if (!mouse) { - return 0; - } - - mouse->last_x = x; - mouse->last_y = y; - if (SDL_GetEventState(type) == SDL_ENABLE) { - SDL_Event event; - event.proximity.which = (Uint8) index; - event.proximity.x = x; - event.proximity.y = y; - event.proximity.cursor = mouse->current_end; - event.proximity.type = type; - /* FIXME: is this right? */ - event.proximity.windowID = mouse->focus ? mouse->focus->id : 0; - posted = (SDL_PushEvent(&event) > 0); - if (type == SDL_PROXIMITYIN) { - mouse->proximity = SDL_TRUE; - } else { - mouse->proximity = SDL_FALSE; - } - } - return posted; -} - -int -SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure) -{ - int index = SDL_GetMouseIndexId(id); - SDL_Mouse *mouse = SDL_GetMouse(index); + SDL_Mouse *mouse = &SDL_mouse; int posted; int xrel; int yrel; int x_max = 0, y_max = 0; - if (!mouse || mouse->flush_motion) { - return 0; - } - - /* if the mouse is out of proximity we don't to want to have any motion from it */ - if (mouse->proximity == SDL_FALSE) { - mouse->last_x = x; - mouse->last_y = y; - return 0; - } - /* the relative motion is calculated regarding the system cursor last position */ if (relative) { xrel = x; @@ -451,35 +166,26 @@ SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure) mouse->xdelta += xrel; mouse->ydelta += yrel; - mouse->pressure = pressure; +#if 0 /* FIXME */ /* Move the mouse cursor, if needed */ if (mouse->cursor_shown && !mouse->relative_mode && mouse->MoveCursor && mouse->cur_cursor) { mouse->MoveCursor(mouse->cur_cursor); } +#endif /* Post the event, if desired */ posted = 0; - if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE && - mouse->proximity == SDL_TRUE) { + if (SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE) { SDL_Event event; event.motion.type = SDL_MOUSEMOTION; - event.motion.which = (Uint8) index; + event.motion.windowID = mouse->focus ? mouse->focus->id : 0; event.motion.state = mouse->buttonstate; event.motion.x = mouse->x; event.motion.y = mouse->y; - event.motion.z = mouse->z; - event.motion.pressure = mouse->pressure; - event.motion.pressure_max = mouse->pressure_max; - event.motion.pressure_min = mouse->pressure_min; - event.motion.rotation = 0; - event.motion.tilt_x = 0; - event.motion.tilt_y = 0; - event.motion.cursor = mouse->current_end; event.motion.xrel = xrel; event.motion.yrel = yrel; - event.motion.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } mouse->last_x = mouse->x; @@ -488,17 +194,12 @@ SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure) } int -SDL_SendMouseButton(int id, Uint8 state, Uint8 button) +SDL_SendMouseButton(Uint8 state, Uint8 button) { - int index = SDL_GetMouseIndexId(id); - SDL_Mouse *mouse = SDL_GetMouse(index); + SDL_Mouse *mouse = &SDL_mouse; int posted; Uint32 type; - if (!mouse) { - return 0; - } - /* Figure out which event to perform */ switch (state) { case SDL_PRESSED: @@ -527,7 +228,6 @@ SDL_SendMouseButton(int id, Uint8 state, Uint8 button) if (SDL_GetEventState(type) == SDL_ENABLE) { SDL_Event event; event.type = type; - event.button.which = (Uint8) index; event.button.state = state; event.button.button = button; event.button.x = mouse->x; @@ -539,12 +239,12 @@ SDL_SendMouseButton(int id, Uint8 state, Uint8 button) } int -SDL_SendMouseWheel(int index, int x, int y) +SDL_SendMouseWheel(int x, int y) { - SDL_Mouse *mouse = SDL_GetMouse(index); + SDL_Mouse *mouse = &SDL_mouse; int posted; - if (!mouse || (!x && !y)) { + if (!x && !y) { return 0; } @@ -553,53 +253,108 @@ SDL_SendMouseWheel(int index, int x, int y) if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) { SDL_Event event; event.type = SDL_MOUSEWHEEL; - event.wheel.which = (Uint8) index; + event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; event.wheel.x = x; event.wheel.y = y; - event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } return posted; } void -SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) +SDL_MouseQuit(void) { - SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); +} - if (!mouse) { - return; +Uint8 +SDL_GetMouseState(int *x, int *y) +{ + SDL_Mouse *mouse = &SDL_mouse; + + if (x) { + *x = mouse->x; + } + if (y) { + *y = mouse->y; } + return mouse->buttonstate; +} + +Uint8 +SDL_GetRelativeMouseState(int *x, int *y) +{ + SDL_Mouse *mouse = &SDL_mouse; + + if (x) { + *x = mouse->xdelta; + } + if (y) { + *y = mouse->ydelta; + } + mouse->xdelta = 0; + mouse->ydelta = 0; + return mouse->buttonstate; +} + +void +SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) +{ + SDL_Mouse *mouse = &SDL_mouse; if (mouse->WarpMouse) { mouse->WarpMouse(mouse, window, x, y); } else { - SDL_SetMouseFocus(SDL_current_mouse, window); - SDL_SendMouseMotion(SDL_current_mouse, 0, x, y, 0); + SDL_SetMouseFocus(window); + SDL_SendMouseMotion(0, x, y); + } +} + +int +SDL_SetRelativeMouseMode(SDL_bool enabled) +{ + SDL_Mouse *mouse = &SDL_mouse; + + /* Flush pending mouse motion */ + SDL_FlushEvent(SDL_MOUSEMOTION); + + /* Set the relative mode */ + mouse->relative_mode = enabled; + + if (!enabled) { + /* Restore the expected mouse position */ + SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y); } + + /* Update cursor visibility */ + SDL_SetCursor(NULL); + + return 0; +} + +SDL_bool +SDL_GetRelativeMouseMode() +{ + SDL_Mouse *mouse = &SDL_mouse; + + return mouse->relative_mode; } SDL_Cursor * SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y) { - SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); + SDL_Mouse *mouse = &SDL_mouse; SDL_Surface *surface; SDL_Cursor *cursor; int x, y; Uint32 *pixel; - Uint8 datab, maskb; + Uint8 datab = 0, maskb = 0; const Uint32 black = 0xFF000000; const Uint32 white = 0xFFFFFFFF; const Uint32 transparent = 0x00000000; - if (!mouse) { - SDL_SetError("No mice are initialized"); - return NULL; - } - if (!mouse->CreateCursor) { - SDL_SetError("Current mouse doesn't have cursor support"); + SDL_SetError("Cursors are not currently supported"); return NULL; } @@ -638,7 +393,6 @@ SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, cursor = mouse->CreateCursor(surface, hot_x, hot_y); if (cursor) { - cursor->mouse = mouse; cursor->next = mouse->cursors; mouse->cursors = cursor; } @@ -655,12 +409,7 @@ SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, void SDL_SetCursor(SDL_Cursor * cursor) { - SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); - - if (!mouse) { - SDL_SetError("No mice are initialized"); - return; - } + SDL_Mouse *mouse = &SDL_mouse; /* Set the new cursor */ if (cursor) { @@ -694,7 +443,7 @@ SDL_SetCursor(SDL_Cursor * cursor) SDL_Cursor * SDL_GetCursor(void) { - SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); + SDL_Mouse *mouse = &SDL_mouse; if (!mouse) { return NULL; @@ -705,13 +454,12 @@ SDL_GetCursor(void) void SDL_FreeCursor(SDL_Cursor * cursor) { - SDL_Mouse *mouse; + SDL_Mouse *mouse = &SDL_mouse; SDL_Cursor *curr, *prev; if (!cursor) { return; } - mouse = cursor->mouse; if (cursor == mouse->def_cursor) { return; @@ -740,7 +488,7 @@ SDL_FreeCursor(SDL_Cursor * cursor) int SDL_ShowCursor(int toggle) { - SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); + SDL_Mouse *mouse = &SDL_mouse; SDL_bool shown; if (!mouse) { @@ -761,47 +509,4 @@ SDL_ShowCursor(int toggle) return shown; } -char * -SDL_GetMouseName(int index) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - if (!mouse) { - return NULL; - } - return mouse->name; -} - -void -SDL_ChangeEnd(int id, int end) -{ - int index = SDL_GetMouseIndexId(id); - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (mouse) { - mouse->current_end = end; - } -} - -int -SDL_GetCursorsNumber(int index) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (!mouse) { - return -1; - } - return mouse->total_ends; -} - -int -SDL_GetCurrentCursor(int index) -{ - SDL_Mouse *mouse = SDL_GetMouse(index); - - if (!mouse) { - return -1; - } - return mouse->current_end; -} - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index 7ed0cf7b6..284468fa9 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -24,108 +24,33 @@ #ifndef _SDL_mouse_c_h #define _SDL_mouse_c_h -typedef struct SDL_Mouse SDL_Mouse; - struct SDL_Cursor { - SDL_Mouse *mouse; SDL_Cursor *next; void *driverdata; }; -struct SDL_Mouse -{ - /* Create a cursor from a surface */ - SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y); - - /* Show the specified cursor, or hide if cursor is NULL */ - int (*ShowCursor) (SDL_Cursor * cursor); - - /* This is called when a mouse motion event occurs */ - void (*MoveCursor) (SDL_Cursor * cursor); - - /* Free a window manager cursor */ - void (*FreeCursor) (SDL_Cursor * cursor); - - /* Warp the mouse to (x,y) */ - void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x, - int y); - - /* Free the mouse when it's time */ - void (*FreeMouse) (SDL_Mouse * mouse); - - /* data common for tablets */ - int pressure; - int pressure_max; - int pressure_min; - int tilt; /* for future use */ - int rotation; /* for future use */ - int total_ends; - int current_end; - - /* Data common to all mice */ - int id; - SDL_Window *focus; - int which; - int x; - int y; - int z; /* for future use */ - int xdelta; - int ydelta; - int last_x, last_y; /* the last reported x and y coordinates */ - char *name; - Uint8 buttonstate; - SDL_bool relative_mode; - SDL_bool proximity; - SDL_bool flush_motion; - - SDL_Cursor *cursors; - SDL_Cursor *def_cursor; - SDL_Cursor *cur_cursor; - SDL_bool cursor_shown; - - void *driverdata; -}; - /* Initialize the mouse subsystem */ extern int SDL_MouseInit(void); -/* Get the mouse at an index */ -extern SDL_Mouse *SDL_GetMouse(int index); - -/* Add a mouse, possibly reattaching at a particular index (or -1), - returning the index of the mouse, or -1 if there was an error. - */ -extern int SDL_AddMouse(const SDL_Mouse * mouse, char *name, - int pressure_max, int pressure_min, int ends); - -/* Remove a mouse at an index, clearing the slot for later */ -extern void SDL_DelMouse(int index); - -/* Clear the button state of a mouse at an index */ -extern void SDL_ResetMouse(int index); +/* Clear the mouse state */ +extern void SDL_ResetMouse(void); /* Set the mouse focus window */ -extern void SDL_SetMouseFocus(int id, SDL_Window * window); +extern void SDL_SetMouseFocus(SDL_Window * window); -/* Send a mouse motion event for a mouse */ -extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z); +/* Send a mouse motion event */ +extern int SDL_SendMouseMotion(int relative, int x, int y); -/* Send a mouse button event for a mouse */ -extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button); +/* Send a mouse button event */ +extern int SDL_SendMouseButton(Uint8 state, Uint8 button); -/* Send a mouse wheel event for a mouse */ -extern int SDL_SendMouseWheel(int id, int x, int y); - -/* Send a proximity event for a mouse */ -extern int SDL_SendProximity(int id, int x, int y, int type); +/* Send a mouse wheel event */ +extern int SDL_SendMouseWheel(int x, int y); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); -/* FIXME: Where do these functions go in this header? */ -extern void SDL_ChangeEnd(int id, int end); - #endif /* _SDL_mouse_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index e6266c9e4..9fd89d15d 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -62,20 +62,13 @@ @interface SDLTranslatorResponder : NSView NSRange _markedRange; NSRange _selectedRange; SDL_Rect _inputRect; - int _keyboard; } - (void) doCommandBySelector:(SEL)myselector; - (void) setInputRect:(SDL_Rect *) rect; -- (void) setKeyboard:(int) keyboard; @end @implementation SDLTranslatorResponder -- (void) setKeyboard:(int) keyboard -{ - _keyboard = keyboard; -} - - (void) setInputRect:(SDL_Rect *) rect { _inputRect = *rect; @@ -94,7 +87,7 @@ - (void) insertText:(id) aString else str = [aString UTF8String]; - SDL_SendKeyboardText(_keyboard, str); + SDL_SendKeyboardText(str); } - (void) doCommandBySelector:(SEL) myselector @@ -140,7 +133,7 @@ - (void) setMarkedText:(id) aString _selectedRange = selRange; _markedRange = NSMakeRange(0, [aString length]); - SDL_SendEditingText(_keyboard, [aString UTF8String], + SDL_SendEditingText([aString UTF8String], selRange.location, selRange.length); DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText, @@ -204,7 +197,7 @@ - (NSArray *) validAttributesForMarkedText * differentiating between left and right versions of the keys. */ static void -DoUnsidedModifiers(int keyboard, unsigned short scancode, +DoUnsidedModifiers(unsigned short scancode, unsigned int oldMods, unsigned int newMods) { const int mapping[] = { @@ -226,14 +219,14 @@ - (NSArray *) validAttributesForMarkedText if (oldMask && oldMask != newMask) { /* modifier up event */ /* If this was Caps Lock, we need some additional voodoo to make SDL happy */ if (bit == NSAlphaShiftKeyMask) { - SDL_SendKeyboardKey(keyboard, SDL_PRESSED, mapping[i]); + SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]); } - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, mapping[i]); + SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]); } else if (newMask && oldMask != newMask) { /* modifier down event */ - SDL_SendKeyboardKey(keyboard, SDL_PRESSED, mapping[i]); + SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]); /* If this was Caps Lock, we need some additional voodoo to make SDL happy */ if (bit == NSAlphaShiftKeyMask) { - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, mapping[i]); + SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]); } } } @@ -244,8 +237,7 @@ - (NSArray *) validAttributesForMarkedText * sides was made. */ static void -HandleNonDeviceModifier(int keyboard, - unsigned int device_independent_mask, +HandleNonDeviceModifier(unsigned int device_independent_mask, unsigned int oldMods, unsigned int newMods, SDL_scancode scancode) @@ -259,9 +251,9 @@ - (NSArray *) validAttributesForMarkedText newMask = newMods & device_independent_mask; if (oldMask && oldMask != newMask) { - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, scancode); + SDL_SendKeyboardKey(SDL_RELEASED, scancode); } else if (newMask && oldMask != newMask) { - SDL_SendKeyboardKey(keyboard, SDL_PRESSED, scancode); + SDL_SendKeyboardKey(SDL_PRESSED, scancode); } } @@ -269,8 +261,7 @@ - (NSArray *) validAttributesForMarkedText * This function sets the actual SDL_PrivateKeyboard event. */ static void -HandleModifierOneSide(int keyboard, - unsigned int oldMods, unsigned int newMods, +HandleModifierOneSide(unsigned int oldMods, unsigned int newMods, SDL_scancode scancode, unsigned int sided_device_dependent_mask) { @@ -287,9 +278,9 @@ - (NSArray *) validAttributesForMarkedText * find out which it is. */ if (new_dep_mask && old_dep_mask != new_dep_mask) { - SDL_SendKeyboardKey(keyboard, SDL_PRESSED, scancode); + SDL_SendKeyboardKey(SDL_PRESSED, scancode); } else { - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, scancode); + SDL_SendKeyboardKey(SDL_RELEASED, scancode); } } @@ -298,8 +289,7 @@ - (NSArray *) validAttributesForMarkedText * e.g. left-shift vs right-shift. */ static void -HandleModifierSide(int keyboard, - int device_independent_mask, +HandleModifierSide(int device_independent_mask, unsigned int oldMods, unsigned int newMods, SDL_scancode left_scancode, SDL_scancode right_scancode, @@ -316,7 +306,7 @@ - (NSArray *) validAttributesForMarkedText */ if ((device_dependent_mask & newMods) == 0) { /* Revert to the old behavior */ - HandleNonDeviceModifier(keyboard, device_independent_mask, oldMods, newMods, left_scancode); + HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode); return; } @@ -329,10 +319,10 @@ - (NSArray *) validAttributesForMarkedText * change or if the bits don't both exist. */ if (left_device_dependent_mask & diff_mod) { - HandleModifierOneSide(keyboard, oldMods, newMods, left_scancode, left_device_dependent_mask); + HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask); } if (right_device_dependent_mask & diff_mod) { - HandleModifierOneSide(keyboard, oldMods, newMods, right_scancode, right_device_dependent_mask); + HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask); } } } @@ -343,8 +333,7 @@ - (NSArray *) validAttributesForMarkedText * can't still be down). */ static void -ReleaseModifierSide(int keyboard, - unsigned int device_independent_mask, +ReleaseModifierSide(unsigned int device_independent_mask, unsigned int oldMods, unsigned int newMods, SDL_scancode left_scancode, SDL_scancode right_scancode, @@ -362,7 +351,7 @@ - (NSArray *) validAttributesForMarkedText /* In this case, we can't detect the keyboard, so use the left side * to represent both, and release it. */ - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, left_scancode); + SDL_SendKeyboardKey(SDL_RELEASED, left_scancode); return; } @@ -373,10 +362,10 @@ - (NSArray *) validAttributesForMarkedText * so I hope this doesn't cause other problems. */ if ( left_device_dependent_mask & oldMods ) { - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, left_scancode); + SDL_SendKeyboardKey(SDL_RELEASED, left_scancode); } if ( right_device_dependent_mask & oldMods ) { - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, right_scancode); + SDL_SendKeyboardKey(SDL_RELEASED, right_scancode); } } @@ -384,7 +373,7 @@ - (NSArray *) validAttributesForMarkedText * This function handles the CapsLock case. */ static void -HandleCapsLock(int keyboard, unsigned short scancode, +HandleCapsLock(unsigned short scancode, unsigned int oldMods, unsigned int newMods) { unsigned int oldMask, newMask; @@ -393,16 +382,16 @@ - (NSArray *) validAttributesForMarkedText newMask = newMods & NSAlphaShiftKeyMask; if (oldMask != newMask) { - SDL_SendKeyboardKey(keyboard, SDL_PRESSED, SDL_SCANCODE_CAPSLOCK); - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK); } oldMask = oldMods & NSNumericPadKeyMask; newMask = newMods & NSNumericPadKeyMask; if (oldMask != newMask) { - SDL_SendKeyboardKey(keyboard, SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR); - SDL_SendKeyboardKey(keyboard, SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR); + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR); } } @@ -410,7 +399,7 @@ - (NSArray *) validAttributesForMarkedText * correct side of the key. */ static void -DoSidedModifiers(int keyboard, unsigned short scancode, +DoSidedModifiers(unsigned short scancode, unsigned int oldMods, unsigned int newMods) { /* Set up arrays for the key syms for the left and right side. */ @@ -435,7 +424,7 @@ - (NSArray *) validAttributesForMarkedText unsigned int i, bit; /* Handle CAPSLOCK separately because it doesn't have a left/right side */ - HandleCapsLock(keyboard, scancode, oldMods, newMods); + HandleCapsLock(scancode, oldMods, newMods); /* Iterate through the bits, testing each against the old modifiers */ for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) { @@ -448,7 +437,7 @@ - (NSArray *) validAttributesForMarkedText * and right side keys may alternate or both may be pressed. */ if (newMask) { - HandleModifierSide(keyboard, bit, oldMods, newMods, + HandleModifierSide(bit, oldMods, newMods, left_mapping[i], right_mapping[i], left_device_mapping[i], right_device_mapping[i]); } @@ -456,7 +445,7 @@ - (NSArray *) validAttributesForMarkedText * the device dependent bits to release the correct keys. */ else if (oldMask && oldMask != newMask) { - ReleaseModifierSide(keyboard, bit, oldMods, newMods, + ReleaseModifierSide(bit, oldMods, newMods, left_mapping[i], right_mapping[i], left_device_mapping[i], right_device_mapping[i]); } @@ -477,9 +466,9 @@ - (NSArray *) validAttributesForMarkedText * left side and right side modifiers is available. */ if (data->osversion >= 0x1030) { - DoSidedModifiers(data->keyboard, scancode, data->modifierFlags, modifierFlags); + DoSidedModifiers(scancode, data->modifierFlags, modifierFlags); } else { - DoUnsidedModifiers(data->keyboard, scancode, data->modifierFlags, modifierFlags); + DoUnsidedModifiers(scancode, data->modifierFlags, modifierFlags); } data->modifierFlags = modifierFlags; } @@ -549,7 +538,7 @@ - (NSArray *) validAttributesForMarkedText keymap[scancode] = s[0]; } } - SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES); + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); return; } @@ -603,7 +592,7 @@ - (NSArray *) validAttributesForMarkedText keymap[scancode] = c; } } - SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES); + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); return; } #endif @@ -613,10 +602,7 @@ - (NSArray *) validAttributesForMarkedText Cocoa_InitKeyboard(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - SDL_Keyboard keyboard; - SDL_zero(keyboard); - data->keyboard = SDL_AddKeyboard(&keyboard, -1); UpdateKeymap(data); /* Set our own names for the platform-dependent but layout-independent keys */ @@ -645,8 +631,6 @@ - (NSArray *) validAttributesForMarkedText [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)]; } - [data->fieldEdit setKeyboard: data->keyboard]; - if (![[data->fieldEdit superview] isEqual: parentView]) { // DEBUG_IME(@"add fieldEdit to window contentView"); @@ -686,7 +670,9 @@ - (NSArray *) validAttributesForMarkedText SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; unsigned short scancode = [event keyCode]; SDL_scancode code; +#if 0 const char *text; +#endif if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { /* see comments in SDL_cocoakeys.h */ @@ -706,7 +692,7 @@ - (NSArray *) validAttributesForMarkedText /* See if we need to rebuild the keyboard layout */ UpdateKeymap(data); - SDL_SendKeyboardKey(data->keyboard, SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_PRESSED, code); #if 1 if (code == SDL_SCANCODE_UNKNOWN) { fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); @@ -719,14 +705,14 @@ - (NSArray *) validAttributesForMarkedText #if 0 text = [[event characters] UTF8String]; if(text && *text) { - SDL_SendKeyboardText(data->keyboard, text); + SDL_SendKeyboardText(text); [data->fieldEdit setString:@""]; } #endif } break; case NSKeyUp: - SDL_SendKeyboardKey(data->keyboard, SDL_RELEASED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); break; case NSFlagsChanged: /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */ @@ -740,10 +726,6 @@ - (NSArray *) validAttributesForMarkedText void Cocoa_QuitKeyboard(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - NSAutoreleasePool *pool; - - SDL_DelKeyboard(data->keyboard); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 1a71840c7..02ad198b4 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -29,11 +29,6 @@ void Cocoa_InitMouse(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - SDL_Mouse mouse; - - SDL_zero(mouse); - data->mouse = SDL_AddMouse(&mouse, "Mouse", 0, 0, 1); } static int @@ -54,10 +49,8 @@ void Cocoa_HandleMouseEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - SDL_Mouse *mouse = SDL_GetMouse(data->mouse); int i; - NSPoint point; + NSPoint point = { 0, 0 }; SDL_Window *window; /* See if there are any fullscreen windows that might handle this event */ @@ -73,44 +66,38 @@ point = [NSEvent mouseLocation]; point.x = point.x - bounds.x; point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - bounds.y; - if (point.x < 0 || point.x >= candidate->w || - point.y < 0 || point.y >= candidate->h) { - /* The mouse is out of this fullscreen display */ - if (mouse->focus == candidate) { - SDL_SetMouseFocus(data->mouse, 0); - } - } else { + if ((point.x >= 0 && point.x < candidate->w) || + (point.y >= 0 && point.y < candidate->h)) { /* This is it! */ window = candidate; break; } } } - if (!window) { - return; - } /* Set the focus appropriately */ - if (mouse->focus != window) { - SDL_SetMouseFocus(data->mouse, window); + SDL_SetMouseFocus(window); + + if (window) { + return; } switch ([event type]) { case NSLeftMouseDown: case NSOtherMouseDown: case NSRightMouseDown: - SDL_SendMouseButton(data->mouse, SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber])); + SDL_SendMouseButton(SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber])); break; case NSLeftMouseUp: case NSOtherMouseUp: case NSRightMouseUp: - SDL_SendMouseButton(data->mouse, SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber])); + SDL_SendMouseButton(SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber])); break; case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: /* usually middle mouse dragged */ case NSMouseMoved: - SDL_SendMouseMotion(data->mouse, 0, (int)point.x, (int)point.y, 0); + SDL_SendMouseMotion(0, (int)point.x, (int)point.y); break; default: /* just to avoid compiler warnings */ break; @@ -120,9 +107,6 @@ void Cocoa_QuitMouse(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - - SDL_DelMouse(data->mouse); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 0ddb91a7c..8f12dc056 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -57,8 +57,6 @@ typedef struct SDL_VideoData { SInt32 osversion; unsigned int modifierFlags; - int mouse; - int keyboard; void *key_layout; SDLTranslatorResponder *fieldEdit; Uint32 screensaver_activity; diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 110b839a1..1f3fc515e 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -126,28 +126,21 @@ - (void)windowDidDeminiaturize:(NSNotification *)aNotification - (void)windowDidBecomeKey:(NSNotification *)aNotification { - int index; - /* We're going to get keyboard events, since we're key. */ - index = _data->videodata->keyboard; - SDL_SetKeyboardFocus(index, _data->window); + SDL_SetKeyboardFocus(_data->window); } - (void)windowDidResignKey:(NSNotification *)aNotification { - int index; - SDL_Mouse *mouse; - /* Some other window will get mouse events, since we're not key. */ - index = _data->videodata->mouse; - mouse = SDL_GetMouse(index); - if (mouse->focus == _data->window) { - SDL_SetMouseFocus(index, 0); + if (SDL_GetMouseFocus() == _data->window) { + SDL_SetMouseFocus(NULL); } /* Some other window will get keyboard events, since we're not key. */ - index = _data->videodata->keyboard; - SDL_SetKeyboardFocus(index, 0); + if (SDL_GetKeyboardFocus() == _data->window) { + SDL_SetKeyboardFocus(NULL); + } } - (void)windowDidHide:(NSNotification *)aNotification @@ -162,10 +155,8 @@ - (void)windowDidUnhide:(NSNotification *)aNotification - (void)mouseDown:(NSEvent *)theEvent { - int index; int button; - index = _data->videodata->mouse; switch ([theEvent buttonNumber]) { case 0: button = SDL_BUTTON_LEFT; @@ -180,7 +171,7 @@ - (void)mouseDown:(NSEvent *)theEvent button = [theEvent buttonNumber]; break; } - SDL_SendMouseButton(index, SDL_PRESSED, button); + SDL_SendMouseButton(SDL_PRESSED, button); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -195,10 +186,8 @@ - (void)otherMouseDown:(NSEvent *)theEvent - (void)mouseUp:(NSEvent *)theEvent { - int index; int button; - index = _data->videodata->mouse; switch ([theEvent buttonNumber]) { case 0: button = SDL_BUTTON_LEFT; @@ -213,7 +202,7 @@ - (void)mouseUp:(NSEvent *)theEvent button = [theEvent buttonNumber]; break; } - SDL_SendMouseButton(index, SDL_RELEASED, button); + SDL_SendMouseButton(SDL_RELEASED, button); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -229,24 +218,18 @@ - (void)otherMouseUp:(NSEvent *)theEvent - (void)mouseMoved:(NSEvent *)theEvent { SDL_Window *window = _data->window; - int index; - SDL_Mouse *mouse; NSPoint point; - index = _data->videodata->mouse; - mouse = SDL_GetMouse(index); point = [theEvent locationInWindow]; point.y = window->h - point.y; if ( point.x < 0 || point.x >= window->w || point.y < 0 || point.y >= window->h ) { - if (mouse->focus != 0) { - SDL_SetMouseFocus(index, 0); + if (SDL_GetMouseFocus() == window) { + SDL_SetMouseFocus(NULL); } } else { - if (mouse->focus != _data->window) { - SDL_SetMouseFocus(index, _data->window); - } - SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y, 0); + SDL_SetMouseFocus(_data->window); + SDL_SendMouseMotion(0, (int)point.x, (int)point.y); } } @@ -267,10 +250,7 @@ - (void)otherMouseDragged:(NSEvent *)theEvent - (void)scrollWheel:(NSEvent *)theEvent { - int index; - - index = _data->videodata->mouse; - SDL_SendMouseWheel(index, (int)([theEvent deltaX]+0.9f), (int)([theEvent deltaY]+0.9f)); + SDL_SendMouseWheel((int)([theEvent deltaX]+0.9f), (int)([theEvent deltaY]+0.9f)); } @end @@ -361,9 +341,8 @@ - (BOOL)canBecomeMainWindow window->flags &= ~SDL_WINDOW_MINIMIZED; } if ([nswindow isKeyWindow]) { - int index = data->videodata->keyboard; window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(index, data->window); + SDL_SetKeyboardFocus(data->window); if (window->flags & SDL_WINDOW_INPUT_GRABBED) { /* FIXME */ @@ -385,8 +364,6 @@ - (BOOL)canBecomeMainWindow NSRect rect; SDL_Rect bounds; unsigned int style; - NSString *title; - int status; Cocoa_GetDisplayBounds(_this, display, &bounds); if ((window->flags & SDL_WINDOW_FULLSCREEN) @@ -452,7 +429,6 @@ - (BOOL)canBecomeMainWindow NSAutoreleasePool *pool; NSWindow *nswindow = (NSWindow *) data; NSString *title; - int status; pool = [[NSAutoreleasePool alloc] init]; @@ -625,7 +601,7 @@ - (BOOL)canBecomeMainWindow SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + //NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; if (info->version.major <= SDL_MAJOR_VERSION) { //info->window = nswindow; diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index a2f182b32..3e0315704 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -38,8 +38,10 @@ #else @interface SDL_uikitview : UIView { #endif - + +#if FIXME_MULTITOUCH SDL_Mouse mice[MAX_SIMULTANEOUS_TOUCHES]; +#endif #if SDL_IPHONE_KEYBOARD UITextField *textField; diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index e3dc19ec7..da03d0c2e 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -47,6 +47,7 @@ - (id)initWithFrame:(CGRect)frame { [self initializeKeyboard]; #endif +#if FIXME_MULTITOUCH int i; for (i=0; ivideodata; - if (videodata->wintabDLL - && videodata->WTPacket((HCTX) lParam, (UINT) wParam, &packet)) { - SDL_ChangeEnd(tablet, (int) packet.pkCursor); - pressure = (int) packet.pkNormalPressure; - } - } - break; - - case WT_PROXIMITY: - { - /* checking where the proximity message showed up */ - int h_context = LOWORD(lParam); - POINT point; - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - - /* are we in proximity or out of proximity */ - if (h_context == 0) { - SDL_SendProximity(tablet, point.x, point.y, SDL_PROXIMITYOUT); - } else { - SDL_SendProximity(tablet, point.x, point.y, SDL_PROXIMITYIN); - } - } - break; - case WM_SHOWWINDOW: { if (wParam) { @@ -183,13 +146,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: { - int index; - SDL_Keyboard *keyboard; BOOL minimized; minimized = HIWORD(wParam); - index = data->videodata->keyboard; - keyboard = SDL_GetKeyboard(index); if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); SDL_SendWindowEvent(data->window, @@ -200,13 +159,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_WINDOWEVENT_MAXIMIZED, 0, 0); } #endif - if (keyboard && keyboard->focus != data->window) { - SDL_SetKeyboardFocus(index, data->window); + if (SDL_GetKeyboardFocus() != data->window) { + SDL_SetKeyboardFocus(data->window); } /* FIXME: Update keyboard state */ } else { - if (keyboard && keyboard->focus == data->window) { - SDL_SetKeyboardFocus(index, 0); + if (SDL_GetKeyboardFocus() == data->window) { + SDL_SetKeyboardFocus(NULL); } if (minimized) { SDL_SendWindowEvent(data->window, @@ -217,124 +176,22 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) returnCode = 0; break; -/* WinCE has no RawInput, so we use the classic mouse events. - In classic Win32 this is done by WM_INPUT - */ -#ifdef _WIN32_WCE case WM_MOUSEMOVE: - SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0); + SDL_SendMouseMotion(0, LOWORD(lParam), HIWORD(lParam)); break; case WM_LBUTTONDOWN: - SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0); - SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT); break; case WM_LBUTTONUP: - SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0); - SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT); - break; -#else /* _WIN32_WCE */ - - case WM_INPUT: /* mouse events */ - { - LPBYTE lpb; - const RAWINPUTHEADER *header; - int index = -1; - int i; - int size = 0; - const RAWMOUSE *raw_mouse = NULL; - POINT point; - USHORT flags; - int w, h; - - /* we're collecting raw data to be able to identify the mouse (if there are several) */ - GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, - sizeof(RAWINPUTHEADER)); - lpb = SDL_stack_alloc(BYTE, size); - GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, - sizeof(RAWINPUTHEADER)); - raw = (RAWINPUT *) lpb; - header = &raw->header; - flags = raw->data.mouse.usButtonFlags; - - /* we're checking which mouse generated the event */ - for (i = 0; i < total_mice; ++i) { - if (mice[i] == header->hDevice) { - index = i; - break; - } - } - if (index < 0) { - /* New mouse? Should we dynamically update mouse list? */ - returnCode = 0; - break; - } - - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - - SDL_GetWindowSize(data->window, &w, &h); - if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) { - SDL_SetMouseFocus(index, data->window); - } else { - SDL_SetMouseFocus(index, 0); - /* FIXME: Should we be doing anything else here? */ - break; - } - - /* if the message was sent by a tablet we have to send also pressure */ - if (index == tablet) { - SDL_SendMouseMotion(index, 0, point.x, point.y, pressure); - } else { - SDL_SendMouseMotion(index, 0, point.x, point.y, 0); - } - /* we're sending mouse buttons messages to check up if sth changed */ - if (flags & RI_MOUSE_LEFT_BUTTON_DOWN) { - SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_LEFT); - } else if (flags & RI_MOUSE_LEFT_BUTTON_UP) { - SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_LEFT); - } - if (flags & RI_MOUSE_MIDDLE_BUTTON_DOWN) { - SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_MIDDLE); - } else if (flags & RI_MOUSE_MIDDLE_BUTTON_UP) { - SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_MIDDLE); - } - if (flags & RI_MOUSE_RIGHT_BUTTON_DOWN) { - SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_RIGHT); - } else if (flags & RI_MOUSE_RIGHT_BUTTON_UP) { - SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_RIGHT); - } - if (flags & RI_MOUSE_BUTTON_4_DOWN) { - SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_X1); - } else if (flags & RI_MOUSE_BUTTON_4_UP) { - SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_X1); - } - if (flags & RI_MOUSE_BUTTON_5_DOWN) { - SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_X2); - } else if (flags & RI_MOUSE_BUTTON_5_UP) { - SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_X2); - } - if (flags & RI_MOUSE_WHEEL) { - SDL_SendMouseWheel(index, 0, - (short) raw->data.mouse.usButtonData); - } - SDL_stack_free(lpb); - } - returnCode = 0; + SDL_SendMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT); break; -#endif /* _WIN32_WCE */ case WM_MOUSELEAVE: { - int i; - - for (i = 0; i < SDL_GetNumMice(); ++i) { - SDL_Mouse *mouse = SDL_GetMouse(i); - - if (mouse->focus == data->window) { - SDL_SetMouseFocus(i, 0); - } + if (SDL_GetMouseFocus() == data->window) { + SDL_SetMouseFocus(NULL); } } returnCode = 0; @@ -343,15 +200,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SYSKEYDOWN: case WM_KEYDOWN: { - int index; - /* Ignore repeated keys */ if (lParam & REPEATED_KEYMASK) { returnCode = 0; break; } - index = data->videodata->keyboard; wParam = RemapVKEY(wParam, lParam); switch (wParam) { case VK_CONTROL: @@ -388,7 +242,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; } if (wParam < 256) { - SDL_SendKeyboardKey(index, SDL_PRESSED, + SDL_SendKeyboardKey(SDL_PRESSED, data->videodata->key_layout[wParam]); } } @@ -398,9 +252,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SYSKEYUP: case WM_KEYUP: { - int index; - - index = data->videodata->keyboard; wParam = RemapVKEY(wParam, lParam); switch (wParam) { case VK_CONTROL: @@ -441,11 +292,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (wParam == VK_SNAPSHOT && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == SDL_RELEASED) { - SDL_SendKeyboardKey(index, SDL_PRESSED, + SDL_SendKeyboardKey(SDL_PRESSED, data->videodata->key_layout[wParam]); } if (wParam < 256) { - SDL_SendKeyboardKey(index, SDL_RELEASED, + SDL_SendKeyboardKey(SDL_RELEASED, data->videodata->key_layout[wParam]); } } @@ -470,14 +321,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) text[2] = 0x80 | (char) (wParam & 0x3F); text[3] = '\0'; } - SDL_SendKeyboardText(data->videodata->keyboard, text); + SDL_SendKeyboardText(text); } returnCode = 0; break; case WM_INPUTLANGCHANGE: { - WIN_UpdateKeymap(data->videodata->keyboard); + WIN_UpdateKeymap(); } returnCode = 1; break; diff --git a/src/video/win32/SDL_win32keyboard.c b/src/video/win32/SDL_win32keyboard.c index d975be28e..fb4e0ff41 100644 --- a/src/video/win32/SDL_win32keyboard.c +++ b/src/video/win32/SDL_win32keyboard.c @@ -50,7 +50,6 @@ void WIN_InitKeyboard(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - SDL_Keyboard keyboard; int i; /* Make sure the alpha scancodes are correct. T isn't usually remapped */ @@ -82,9 +81,7 @@ WIN_InitKeyboard(_THIS) data->key_layout = win32_scancode_table; - SDL_zero(keyboard); - data->keyboard = SDL_AddKeyboard(&keyboard, -1); - WIN_UpdateKeymap(data->keyboard); + WIN_UpdateKeymap(); SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows"); @@ -92,7 +89,7 @@ WIN_InitKeyboard(_THIS) } void -WIN_UpdateKeymap(int keyboard) +WIN_UpdateKeymap() { int i; SDL_scancode scancode; @@ -117,15 +114,12 @@ WIN_UpdateKeymap(int keyboard) keymap[scancode] = (MapVirtualKey(i, MAPVK_VK_TO_CHAR) & 0x7FFF); } } - SDL_SetKeymap(keyboard, 0, keymap, SDL_NUM_SCANCODES); + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); } void WIN_QuitKeyboard(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - - SDL_DelKeyboard(data->keyboard); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32keyboard.h b/src/video/win32/SDL_win32keyboard.h index dd5b28de6..c67410a63 100644 --- a/src/video/win32/SDL_win32keyboard.h +++ b/src/video/win32/SDL_win32keyboard.h @@ -28,7 +28,7 @@ extern BYTE alpha_scancodes[26]; extern BYTE keypad_scancodes[10]; extern void WIN_InitKeyboard(_THIS); -extern void WIN_UpdateKeymap(int keyboard); +extern void WIN_UpdateKeymap(void); extern void WIN_QuitKeyboard(_THIS); #endif /* _SDL_win32keyboard_h */ diff --git a/src/video/win32/SDL_win32modes.c b/src/video/win32/SDL_win32modes.c index f8cfde9a5..847e08343 100644 --- a/src/video/win32/SDL_win32modes.c +++ b/src/video/win32/SDL_win32modes.c @@ -160,7 +160,6 @@ WIN_AddDisplay(LPTSTR DeviceName) int WIN_InitModes(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; DWORD i, j, count; DISPLAY_DEVICE device; diff --git a/src/video/win32/SDL_win32mouse.c b/src/video/win32/SDL_win32mouse.c index ca9847f05..093720bcb 100644 --- a/src/video/win32/SDL_win32mouse.c +++ b/src/video/win32/SDL_win32mouse.c @@ -31,182 +31,14 @@ #include "SDL_win32video.h" -#include "../../events/SDL_mouse_c.h" - -extern HANDLE *mice; -extern int total_mice; -extern int tablet; - void WIN_InitMouse(_THIS) { - int index = 0; - RAWINPUTDEVICELIST *deviceList = NULL; - int devCount = 0; - int i; - UINT tmp = 0; - char *buffer = NULL; - char *tab = "wacom"; /* since windows does't give us handles to tablets, we have to detect a tablet by it's name */ - const char *rdp = "rdp_mou"; - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - -/* WinCE has no RawInputDeviceList */ -#ifdef _WIN32_WCE - SDL_Mouse mouse; - SDL_zero(mouse); - mouse.id = 0; - SDL_AddMouse(&mouse, "Stylus", 0, 0, 1); -#else - /* we're checking for the number of rawinput devices */ - if (GetRawInputDeviceList(NULL, &devCount, sizeof(RAWINPUTDEVICELIST))) { - return; - } - - deviceList = SDL_malloc(sizeof(RAWINPUTDEVICELIST) * devCount); - - /* we're getting the raw input device list */ - GetRawInputDeviceList(deviceList, &devCount, sizeof(RAWINPUTDEVICELIST)); - mice = SDL_malloc(devCount * sizeof(HANDLE)); - - /* we're getting the details of the devices */ - for (i = 0; i < devCount; ++i) { - int is_rdp = 0; - UINT j; - UINT k; - char *default_device_name = "Pointing device xx"; - const char *reg_key_root = "System\\CurrentControlSet\\Enum\\"; - char *device_name = SDL_malloc(256 * sizeof(char)); - char *key_name = NULL; - char *tmp_name = NULL; - LONG rc = 0; - HKEY hkey; - DWORD regtype = REG_SZ; - DWORD out = 256 * sizeof(char); - SDL_Mouse mouse; - size_t l; - if (deviceList[i].dwType != RIM_TYPEMOUSE) { /* if a device isn't a mouse type we don't want it */ - continue; - } - if (GetRawInputDeviceInfoA - (deviceList[i].hDevice, RIDI_DEVICENAME, NULL, &tmp) < 0) { - continue; - } - buffer = SDL_malloc((tmp + 1) * sizeof(char)); - key_name = - SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char)); - - /* we're getting the device registry path and polishing it to get it's name, - surely there must be an easier way, but we haven't found it yet */ - if (GetRawInputDeviceInfoA - (deviceList[i].hDevice, RIDI_DEVICENAME, buffer, &tmp) < 0) { - continue; - } - buffer += 4; - tmp -= 4; - tmp_name = buffer; - for (j = 0; j < tmp; ++j) { - if (*tmp_name == '#') { - *tmp_name = '\\'; - } - - else if (*tmp_name == '{') { - break; - } - ++tmp_name; - } - *tmp_name = '\0'; - SDL_memcpy(key_name, reg_key_root, SDL_strlen(reg_key_root)); - SDL_memcpy(key_name + (SDL_strlen(reg_key_root)), buffer, j + 1); - l = SDL_strlen(key_name); - is_rdp = 0; - if (l >= 7) { - for (j = 0; j < l - 7; ++j) { - for (k = 0; k < 7; ++k) { - if (rdp[k] != - SDL_tolower((unsigned char) key_name[j + k])) { - break; - } - } - if (k == 7) { - is_rdp = 1; - break; - } - } - } - - buffer -= 4; - - if (is_rdp == 1) { - SDL_free(buffer); - SDL_free(key_name); - SDL_free(device_name); - is_rdp = 0; - continue; - } - - /* we're opening the registry key to get the mouse name */ - rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key_name, 0, KEY_READ, &hkey); - if (rc != ERROR_SUCCESS) { - SDL_memcpy(device_name, default_device_name, - SDL_strlen(default_device_name)); - } - rc = RegQueryValueExA(hkey, "DeviceDesc", NULL, ®type, device_name, - &out); - RegCloseKey(hkey); - if (rc != ERROR_SUCCESS) { - SDL_memcpy(device_name, default_device_name, - SDL_strlen(default_device_name)); - } - - /* we're saving the handle to the device */ - mice[index] = deviceList[i].hDevice; - SDL_zero(mouse); - mouse.id = index; - l = SDL_strlen(device_name); - - /* we're checking if the device isn't by any chance a tablet */ - if (data->wintabDLL && tablet == -1) { - for (j = 0; j < l - 5; ++j) { - for (k = 0; k < 5; ++k) { - if (tab[k] != - SDL_tolower((unsigned char) device_name[j + k])) { - break; - } - } - if (k == 5) { - tablet = index; - break; - } - } - } - - /* if it's a tablet, let's read it's maximum and minimum pressure */ - if (tablet == index) { - AXIS pressure; - int cursors; - data->WTInfoA(WTI_DEVICES, DVC_NPRESSURE, &pressure); - data->WTInfoA(WTI_DEVICES, DVC_NCSRTYPES, &cursors); - SDL_AddMouse(&mouse, device_name, pressure.axMax, pressure.axMin, - cursors); - } else { - SDL_AddMouse(&mouse, device_name, 0, 0, 1); - } - ++index; - SDL_free(buffer); - SDL_free(key_name); - } - total_mice = index; - SDL_free(deviceList); -#endif /*_WIN32_WCE*/ } void WIN_QuitMouse(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - - /* let's delete all of the mice */ - SDL_MouseQuit(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32video.c b/src/video/win32/SDL_win32video.c index 1ee4f64b2..c93d4f72e 100644 --- a/src/video/win32/SDL_win32video.c +++ b/src/video/win32/SDL_win32video.c @@ -35,11 +35,6 @@ static int WIN_VideoInit(_THIS); static void WIN_VideoQuit(_THIS); -int total_mice = 0; /* total mouse count */ -HANDLE *mice = NULL; /* the handles to the detected mice */ -HCTX *g_hCtx = NULL; /* handles to tablet contexts */ -int tablet = -1; /* we're assuming that there is no tablet */ - /* WIN32 driver bootstrap functions */ static int @@ -66,9 +61,6 @@ WIN_DeleteDevice(SDL_VideoDevice * device) FreeLibrary(data->ddrawDLL); } #endif - if (data->wintabDLL) { - FreeLibrary(data->wintabDLL); - } SDL_free(device->driverdata); SDL_free(device); } @@ -85,8 +77,10 @@ WIN_CreateDevice(int devindex) device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (device) { data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + } else { + data = NULL; } - if (!device || !data) { + if (!data) { SDL_OutOfMemory(); if (device) { SDL_free(device); @@ -131,32 +125,6 @@ WIN_CreateDevice(int devindex) } #endif /* SDL_VIDEO_RENDER_DDRAW */ - data->wintabDLL = LoadLibrary(TEXT("WINTAB32.DLL")); - if (data->wintabDLL) { -#define PROCNAME(X) #X - data->WTInfoA = - (UINT(*)(UINT, UINT, LPVOID)) GetProcAddress(data->wintabDLL, - PROCNAME(WTInfoA)); - data->WTOpenA = - (HCTX(*)(HWND, LPLOGCONTEXTA, BOOL)) GetProcAddress(data-> - wintabDLL, - PROCNAME - (WTOpenA)); - data->WTPacket = - (int (*)(HCTX, UINT, LPVOID)) GetProcAddress(data->wintabDLL, - PROCNAME(WTPacket)); - data->WTClose = - (BOOL(*)(HCTX)) GetProcAddress(data->wintabDLL, - PROCNAME(WTClose)); -#undef PROCNAME - - if (!data->WTInfoA || !data->WTOpenA || !data->WTPacket - || !data->WTClose) { - FreeLibrary(data->wintabDLL); - data->wintabDLL = NULL; - } - } - /* Set the function pointers */ device->VideoInit = WIN_VideoInit; device->VideoQuit = WIN_VideoQuit; @@ -225,7 +193,6 @@ WIN_VideoInit(_THIS) GAPI_AddRenderDriver(_this); #endif - g_hCtx = SDL_malloc(sizeof(HCTX)); WIN_InitKeyboard(_this); WIN_InitMouse(_this); @@ -238,7 +205,6 @@ WIN_VideoQuit(_THIS) WIN_QuitModes(_this); WIN_QuitKeyboard(_this); WIN_QuitMouse(_this); - SDL_free(g_hCtx); } /* vim: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32video.h b/src/video/win32/SDL_win32video.h index fb1e96f96..3cfb63219 100644 --- a/src/video/win32/SDL_win32video.h +++ b/src/video/win32/SDL_win32video.h @@ -45,11 +45,6 @@ #include "ddraw.h" #endif -#include "wactab/wintab.h" -#define PACKETDATA ( PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_CURSOR) -#define PACKETMODE 0 -#include "wactab/pktdef.h" - #include "SDL_win32events.h" #include "SDL_win32gamma.h" #include "SDL_win32keyboard.h" @@ -79,16 +74,6 @@ typedef struct SDL_VideoData IDirectDraw *ddraw; #endif -/* *INDENT-OFF* */ - /* Function pointers for the Wacom API */ - HANDLE wintabDLL; - UINT (*WTInfoA) (UINT, UINT, LPVOID); - HCTX (*WTOpenA) (HWND, LPLOGCONTEXTA, BOOL); - int (*WTPacket) (HCTX, UINT, LPVOID); - BOOL (*WTClose) (HCTX); -/* *INDENT-ON* */ - - int keyboard; const SDL_scancode *key_layout; } SDL_VideoData; diff --git a/src/video/win32/SDL_win32window.c b/src/video/win32/SDL_win32window.c index f69d38573..fc1cd154f 100644 --- a/src/video/win32/SDL_win32window.c +++ b/src/video/win32/SDL_win32window.c @@ -73,9 +73,6 @@ CE_SHFullScreen(HWND hwndRequester, DWORD dwState) #endif -extern HCTX *g_hCtx; /* the table of tablet event contexts, each windows has to have it's own tablet context */ -static Uint32 highestId = 0; /* the highest id of the tablet context */ - /* Fake window to help with DirectInput events. */ HWND SDL_HelperWindow = NULL; static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); @@ -165,9 +162,8 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } } if (GetFocus() == hwnd) { - int index = data->videodata->keyboard; window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(index, data->window); + SDL_SetKeyboardFocus(data->window); if (window->flags & SDL_WINDOW_INPUT_GRABBED) { RECT rect; @@ -186,11 +182,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) int WIN_CreateWindow(_THIS, SDL_Window * window) { - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_VideoDisplay *display = window->display; - RAWINPUTDEVICE Rid; - AXIS TabX, TabY; - LOGCONTEXTA lc; HWND hwnd; HWND top; RECT rect; @@ -257,48 +249,6 @@ WIN_CreateWindow(_THIS, SDL_Window * window) return -1; } - /* we're configuring the tablet data. See Wintab reference for more info */ - if (videodata->wintabDLL - && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) { - lc.lcPktData = PACKETDATA; - lc.lcPktMode = PACKETMODE; - lc.lcOptions |= CXO_MESSAGES; - lc.lcOptions |= CXO_SYSTEM; - lc.lcMoveMask = PACKETDATA; - lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA; - videodata->WTInfoA(WTI_DEVICES, DVC_X, &TabX); - videodata->WTInfoA(WTI_DEVICES, DVC_Y, &TabY); - lc.lcInOrgX = 0; - lc.lcInOrgY = 0; - lc.lcInExtX = TabX.axMax; - lc.lcInExtY = TabY.axMax; - lc.lcOutOrgX = 0; - lc.lcOutOrgY = 0; - lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN); - lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN); - if (window->id > highestId) { - HCTX *tmp_hctx; - highestId = window->id; - tmp_hctx = - (HCTX *) SDL_realloc(g_hCtx, (highestId + 1) * sizeof(HCTX)); - if (!tmp_hctx) { - SDL_OutOfMemory(); - DestroyWindow(hwnd); - return -1; - } - g_hCtx = tmp_hctx; - } - g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); - } -#ifndef _WIN32_WCE /* has no RawInput */ - /* we're telling the window, we want it to report raw input events from mice */ - Rid.usUsagePage = 0x01; - Rid.usUsage = 0x02; - Rid.dwFlags = RIDEV_INPUTSINK; - Rid.hwndTarget = hwnd; - RegisterRawInputDevices(&Rid, 1, sizeof(Rid)); -#endif - WIN_PumpEvents(_this); if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { @@ -620,15 +570,11 @@ WIN_SetWindowGrab(_THIS, SDL_Window * window) void WIN_DestroyWindow(_THIS, SDL_Window * window) { - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (data) { ReleaseDC(data->hwnd, data->hdc); if (data->created) { - if (videodata->wintabDLL) { - videodata->WTClose(g_hCtx[window->id]); - } DestroyWindow(data->hwnd); } SDL_free(data); diff --git a/src/video/win32/wactab/pktdef.h b/src/video/win32/wactab/pktdef.h deleted file mode 100644 index 4c8f573d8..000000000 --- a/src/video/win32/wactab/pktdef.h +++ /dev/null @@ -1,237 +0,0 @@ -/* *INDENT-OFF* */ -/* -------------------------------- pktdef.h -------------------------------- */ -/* Combined 16 & 32-bit version. */ - -/*------------------------------------------------------------------------------ -The text and information contained in this file may be freely used, -copied, or distributed without compensation or licensing restrictions. - -This file is copyright 1991-1998 by LCS/Telegraphics. -------------------------------------------------------------------------------*/ -/*------------------------------------------------------------------------------ - -How to use pktdef.h: - -1. Include wintab.h -2. if using just one packet format: - a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits - (use the PK_* identifiers). - b. Include pktdef.h. - c. The generated structure typedef will be called PACKET. Use PACKETDATA - and PACKETMODE to fill in the LOGCONTEXT structure. -3. If using multiple packet formats, for each one: - a. Define PACKETNAME. Its text value will be a prefix for this packet's - parameters and names. - b. Define PACKETDATA and PACKETMODE similar to - 2.a. above. - c. Include pktdef.h. - d. The generated structure typedef will be called - PACKET. Compare with 2.c. above and example #2 below. -4. If using extension packet data, do the following additional steps - for each extension: - a. Before including pktdef.h, define PACKET - as either PKEXT_ABSOLUTE or PKEXT_RELATIVE. - b. The generated structure typedef will contain a field for the - extension data. - c. Scan the WTI_EXTENSION categories to find the extension's - packet mask bit. - d. OR the packet mask bit with PACKETDATA and use the - result in the lcPktData field of the LOGCONTEXT structure. - e. If PACKET was PKEXT_RELATIVE, OR the - packet mask bit with PACKETMODE and use the result - in the lcPktMode field of the LOGCONTEXT structure. - - -Example #1. -- single packet format - -#include -#define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/ -#define PACKETMODE PK_BUTTONS /@ buttons relative mode @/ -#include -... - lc.lcPktData = PACKETDATA; - lc.lcPktMode = PACKETMODE; - -Example #2. -- multiple formats - -#include -#define PACKETNAME MOE -#define MOEPACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/ -#define MOEPACKETMODE PK_BUTTONS /@ buttons relative mode @/ -#include -#define PACKETNAME LARRY -#define LARRYPACKETDATA PK_Y | PK_Z | PK_BUTTONS /@ y, z, buttons @/ -#define LARRYPACKETMODE PK_BUTTONS /@ buttons relative mode @/ -#include -#define PACKETNAME CURLY -#define CURLYPACKETDATA PK_X | PK_Z | PK_BUTTONS /@ x, z, buttons @/ -#define CURLYPACKETMODE PK_BUTTONS /@ buttons relative mode @/ -#include -... - lcMOE.lcPktData = MOEPACKETDATA; - lcMOE.lcPktMode = MOEPACKETMODE; -... - lcLARRY.lcPktData = LARRYPACKETDATA; - lcLARRY.lcPktMode = LARRYPACKETMODE; -... - lcCURLY.lcPktData = CURLYPACKETDATA; - lcCURLY.lcPktMode = CURLYPACKETMODE; - -Example #3. -- extension packet data "XFOO". - -#include -#define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/ -#define PACKETMODE PK_BUTTONS /@ buttons relative mode @/ -#define PACKETXFOO PKEXT_ABSOLUTE /@ XFOO absolute mode @/ -#include -... -UINT ScanExts(UINT wTag) -{ - UINT i; - UINT wScanTag; - - /@ scan for wTag's info category. @/ - for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) { - if (wTag == wScanTag) { - /@ return category offset from WTI_EXTENSIONS. @/ - return i; - } - } - /@ return error code. @/ - return 0xFFFF; -} -... - lc.lcPktData = PACKETDATA; - lc.lcPktMode = PACKETMODE; -#ifdef PACKETXFOO - categoryXFOO = ScanExts(WTX_XFOO); - WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO); - lc.lcPktData |= maskXFOO; -#if PACKETXFOO == PKEXT_RELATIVE - lc.lcPktMode |= maskXFOO; -#endif -#endif - WTOpen(hWnd, &lc, TRUE); - - -------------------------------------------------------------------------------*/ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifndef PACKETNAME - /* if no packet name prefix */ - #define __PFX(x) x - #define __IFX(x,y) x ## y -#else - /* add prefixes and infixes to packet format names */ - #define __PFX(x) __PFX2(PACKETNAME,x) - #define __PFX2(p,x) __PFX3(p,x) - #define __PFX3(p,x) p ## x - #define __IFX(x,y) __IFX2(x,PACKETNAME,y) - #define __IFX2(x,i,y) __IFX3(x,i,y) - #define __IFX3(x,i,y) x ## i ## y -#endif - -#define __SFX2(x,s) __SFX3(x,s) -#define __SFX3(x,s) x ## s - -#define __TAG __IFX(tag,PACKET) -#define __TYPES __PFX(PACKET), * __IFX(P,PACKET), NEAR * __IFX(NP,PACKET), \ - FAR * __IFX(LP,PACKET) - -#define __DATA (__PFX(PACKETDATA)) -#define __MODE (__PFX(PACKETMODE)) -#define __EXT(x) __SFX2(__PFX(PACKET),x) - - -typedef struct __TAG { - #if (__DATA & PK_CONTEXT) - HCTX pkContext; - #endif - #if (__DATA & PK_STATUS) - UINT pkStatus; - #endif - #if (__DATA & PK_TIME) - DWORD pkTime; - #endif - #if (__DATA & PK_CHANGED) - WTPKT pkChanged; - #endif - #if (__DATA & PK_SERIAL_NUMBER) - UINT pkSerialNumber; - #endif - #if (__DATA & PK_CURSOR) - UINT pkCursor; - #endif - #if (__DATA & PK_BUTTONS) - DWORD pkButtons; - #endif - #if (__DATA & PK_X) - LONG pkX; - #endif - #if (__DATA & PK_Y) - LONG pkY; - #endif - #if (__DATA & PK_Z) - LONG pkZ; - #endif - #if (__DATA & PK_NORMAL_PRESSURE) - #if (__MODE & PK_NORMAL_PRESSURE) - /* relative */ - int pkNormalPressure; - #else - /* absolute */ - UINT pkNormalPressure; - #endif - #endif - #if (__DATA & PK_TANGENT_PRESSURE) - #if (__MODE & PK_TANGENT_PRESSURE) - /* relative */ - int pkTangentPressure; - #else - /* absolute */ - UINT pkTangentPressure; - #endif - #endif - #if (__DATA & PK_ORIENTATION) - ORIENTATION pkOrientation; - #endif - #if (__DATA & PK_ROTATION) - ROTATION pkRotation; /* 1.1 */ - #endif - -#ifndef NOWTEXTENSIONS - /* extensions begin here. */ - #if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE) - UINT pkFKeys; - #endif - #if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE) - TILT pkTilt; - #endif - #if (__EXT(EXPKEYS) == PKEXT_RELATIVE) || (__EXT(EXPKEYS) == PKEXT_ABSOLUTE) - WORD pkExpKeys[4]; /* 1.3 */ - #endif -#endif - -} __TYPES ; - -#undef PACKETNAME -#undef __TAG -#undef __TAG2 -#undef __TYPES -#undef __TYPES2 -#undef __DATA -#undef __MODE -#undef __PFX -#undef __PFX2 -#undef __PFX3 -#undef __IFX -#undef __IFX2 -#undef __IFX3 -#undef __SFX2 -#undef __SFX3 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/src/video/win32/wactab/wintab.h b/src/video/win32/wactab/wintab.h deleted file mode 100644 index d1f495e8e..000000000 --- a/src/video/win32/wactab/wintab.h +++ /dev/null @@ -1,866 +0,0 @@ -/* *INDENT-OFF* */ -/* -------------------------------- wintab.h -------------------------------- */ -/* Combined 16 & 32-bit version. */ - -/*------------------------------------------------------------------------------ -The text and information contained in this file may be freely used, -copied, or distributed without compensation or licensing restrictions. - -This file is copyright 1991-1998 by LCS/Telegraphics. -------------------------------------------------------------------------------*/ - -#ifndef _INC_WINTAB /* prevent multiple includes */ -#define _INC_WINTAB - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* -------------------------------------------------------------------------- */ -/* Messages */ -#ifndef NOWTMESSAGES - - #define WT_DEFBASE 0x7FF0 - #define WT_MAXOFFSET 0xF - - #define _WT_PACKET(b) ((b)+0) - #define _WT_CTXOPEN(b) ((b)+1) - #define _WT_CTXCLOSE(b) ((b)+2) - #define _WT_CTXUPDATE(b) ((b)+3) - #define _WT_CTXOVERLAP(b) ((b)+4) - #define _WT_PROXIMITY(b) ((b)+5) - #define _WT_INFOCHANGE(b) ((b)+6) - #define _WT_CSRCHANGE(b) ((b)+7) /* 1.1 */ - #define _WT_MAX(b) ((b)+WT_MAXOFFSET) - - #define WT_PACKET _WT_PACKET(WT_DEFBASE) - #define WT_CTXOPEN _WT_CTXOPEN(WT_DEFBASE) - #define WT_CTXCLOSE _WT_CTXCLOSE(WT_DEFBASE) - #define WT_CTXUPDATE _WT_CTXUPDATE(WT_DEFBASE) - #define WT_CTXOVERLAP _WT_CTXOVERLAP(WT_DEFBASE) - #define WT_PROXIMITY _WT_PROXIMITY(WT_DEFBASE) - #define WT_INFOCHANGE _WT_INFOCHANGE(WT_DEFBASE) - #define WT_CSRCHANGE _WT_CSRCHANGE(WT_DEFBASE) /* 1.1 */ - #define WT_MAX _WT_MAX(WT_DEFBASE) - -#endif - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ -/* Data Types */ - -/* -------------------------------------------------------------------------- */ -/* COMMON DATA DEFS */ - -DECLARE_HANDLE(HMGR); /* manager handle */ -DECLARE_HANDLE(HCTX); /* context handle */ -DECLARE_HANDLE(HWTHOOK); /* hook handle */ - -typedef DWORD WTPKT; /* packet mask */ - - -#ifndef NOWTPKT - - /* WTPKT bits */ - #define PK_CONTEXT 0x0001 /* reporting context */ - #define PK_STATUS 0x0002 /* status bits */ - #define PK_TIME 0x0004 /* time stamp */ - #define PK_CHANGED 0x0008 /* change bit vector */ - #define PK_SERIAL_NUMBER 0x0010 /* packet serial number */ - #define PK_CURSOR 0x0020 /* reporting cursor */ - #define PK_BUTTONS 0x0040 /* button information */ - #define PK_X 0x0080 /* x axis */ - #define PK_Y 0x0100 /* y axis */ - #define PK_Z 0x0200 /* z axis */ - #define PK_NORMAL_PRESSURE 0x0400 /* normal or tip pressure */ - #define PK_TANGENT_PRESSURE 0x0800 /* tangential or barrel pressure */ - #define PK_ORIENTATION 0x1000 /* orientation info: tilts */ - #define PK_ROTATION 0x2000 /* rotation info; 1.1 */ - -#endif - -typedef DWORD FIX32; /* fixed-point arithmetic type */ - -#ifndef NOFIX32 - #define INT(x) HIWORD(x) - #define FRAC(x) LOWORD(x) - - #define CASTFIX32(x) ((FIX32)((x)*65536L)) - - #define ROUND(x) (INT(x) + (FRAC(x) > (WORD)0x8000)) - - #define FIX_MUL(c, a, b) \ - (c = (((DWORD)FRAC(a) * FRAC(b)) >> 16) + \ - (DWORD)INT(a) * FRAC(b) + \ - (DWORD)INT(b) * FRAC(a) + \ - ((DWORD)INT(a) * INT(b) << 16)) - - #ifdef _WINDLL - #define FIX_DIV_SC static - #else - #define FIX_DIV_SC - #endif - - #define FIX_DIV(c, a, b) \ - { \ - FIX_DIV_SC DWORD temp, rem, btemp; \ - \ - /* fraction done bytewise */ \ - temp = ((a / b) << 16); \ - rem = a % b; \ - btemp = b; \ - if (INT(btemp) < 256) { \ - rem <<= 8; \ - } \ - else { \ - btemp >>= 8; \ - } \ - temp += ((rem / btemp) << 8); \ - rem %= btemp; \ - rem <<= 8; \ - temp += rem / btemp; \ - c = temp; \ - } -#endif - -/* -------------------------------------------------------------------------- */ -/* INFO DATA DEFS */ - -#ifndef NOWTINFO - -#ifndef NOWTAXIS - -typedef struct tagAXIS { - LONG axMin; - LONG axMax; - UINT axUnits; - FIX32 axResolution; -} AXIS, *PAXIS, NEAR *NPAXIS, FAR *LPAXIS; - - /* unit specifiers */ - #define TU_NONE 0 - #define TU_INCHES 1 - #define TU_CENTIMETERS 2 - #define TU_CIRCLE 3 - -#endif - -#ifndef NOWTSYSBUTTONS - -/* system button assignment values */ -#define SBN_NONE 0x00 -#define SBN_LCLICK 0x01 -#define SBN_LDBLCLICK 0x02 -#define SBN_LDRAG 0x03 -#define SBN_RCLICK 0x04 -#define SBN_RDBLCLICK 0x05 -#define SBN_RDRAG 0x06 -#define SBN_MCLICK 0x07 -#define SBN_MDBLCLICK 0x08 -#define SBN_MDRAG 0x09 -/* for Pen Windows */ -#define SBN_PTCLICK 0x10 -#define SBN_PTDBLCLICK 0x20 -#define SBN_PTDRAG 0x30 -#define SBN_PNCLICK 0x40 -#define SBN_PNDBLCLICK 0x50 -#define SBN_PNDRAG 0x60 -#define SBN_P1CLICK 0x70 -#define SBN_P1DBLCLICK 0x80 -#define SBN_P1DRAG 0x90 -#define SBN_P2CLICK 0xA0 -#define SBN_P2DBLCLICK 0xB0 -#define SBN_P2DRAG 0xC0 -#define SBN_P3CLICK 0xD0 -#define SBN_P3DBLCLICK 0xE0 -#define SBN_P3DRAG 0xF0 - -#endif - -#ifndef NOWTCAPABILITIES - -/* hardware capabilities */ -#define HWC_INTEGRATED 0x0001 -#define HWC_TOUCH 0x0002 -#define HWC_HARDPROX 0x0004 -#define HWC_PHYSID_CURSORS 0x0008 /* 1.1 */ -#endif - -#ifndef NOWTIFC - -#ifndef NOWTCURSORS - -/* cursor capabilities */ -#define CRC_MULTIMODE 0x0001 /* 1.1 */ -#define CRC_AGGREGATE 0x0002 /* 1.1 */ -#define CRC_INVERT 0x0004 /* 1.1 */ - -#endif - -/* info categories */ -#define WTI_INTERFACE 1 - #define IFC_WINTABID 1 - #define IFC_SPECVERSION 2 - #define IFC_IMPLVERSION 3 - #define IFC_NDEVICES 4 - #define IFC_NCURSORS 5 - #define IFC_NCONTEXTS 6 - #define IFC_CTXOPTIONS 7 - #define IFC_CTXSAVESIZE 8 - #define IFC_NEXTENSIONS 9 - #define IFC_NMANAGERS 10 - #define IFC_MAX 10 - - -#endif - -#ifndef NOWTSTATUS - -#define WTI_STATUS 2 - #define STA_CONTEXTS 1 - #define STA_SYSCTXS 2 - #define STA_PKTRATE 3 - #define STA_PKTDATA 4 - #define STA_MANAGERS 5 - #define STA_SYSTEM 6 - #define STA_BUTTONUSE 7 - #define STA_SYSBTNUSE 8 - #define STA_MAX 8 - -#endif - -#ifndef NOWTDEFCONTEXT - -#define WTI_DEFCONTEXT 3 -#define WTI_DEFSYSCTX 4 -#define WTI_DDCTXS 400 /* 1.1 */ -#define WTI_DSCTXS 500 /* 1.1 */ - #define CTX_NAME 1 - #define CTX_OPTIONS 2 - #define CTX_STATUS 3 - #define CTX_LOCKS 4 - #define CTX_MSGBASE 5 - #define CTX_DEVICE 6 - #define CTX_PKTRATE 7 - #define CTX_PKTDATA 8 - #define CTX_PKTMODE 9 - #define CTX_MOVEMASK 10 - #define CTX_BTNDNMASK 11 - #define CTX_BTNUPMASK 12 - #define CTX_INORGX 13 - #define CTX_INORGY 14 - #define CTX_INORGZ 15 - #define CTX_INEXTX 16 - #define CTX_INEXTY 17 - #define CTX_INEXTZ 18 - #define CTX_OUTORGX 19 - #define CTX_OUTORGY 20 - #define CTX_OUTORGZ 21 - #define CTX_OUTEXTX 22 - #define CTX_OUTEXTY 23 - #define CTX_OUTEXTZ 24 - #define CTX_SENSX 25 - #define CTX_SENSY 26 - #define CTX_SENSZ 27 - #define CTX_SYSMODE 28 - #define CTX_SYSORGX 29 - #define CTX_SYSORGY 30 - #define CTX_SYSEXTX 31 - #define CTX_SYSEXTY 32 - #define CTX_SYSSENSX 33 - #define CTX_SYSSENSY 34 - #define CTX_MAX 34 - -#endif - -#ifndef NOWTDEVICES - -#define WTI_DEVICES 100 - #define DVC_NAME 1 - #define DVC_HARDWARE 2 - #define DVC_NCSRTYPES 3 - #define DVC_FIRSTCSR 4 - #define DVC_PKTRATE 5 - #define DVC_PKTDATA 6 - #define DVC_PKTMODE 7 - #define DVC_CSRDATA 8 - #define DVC_XMARGIN 9 - #define DVC_YMARGIN 10 - #define DVC_ZMARGIN 11 - #define DVC_X 12 - #define DVC_Y 13 - #define DVC_Z 14 - #define DVC_NPRESSURE 15 - #define DVC_TPRESSURE 16 - #define DVC_ORIENTATION 17 - #define DVC_ROTATION 18 /* 1.1 */ - #define DVC_PNPID 19 /* 1.1 */ - #define DVC_MAX 19 - -#endif - -#ifndef NOWTCURSORS - -#define WTI_CURSORS 200 - #define CSR_NAME 1 - #define CSR_ACTIVE 2 - #define CSR_PKTDATA 3 - #define CSR_BUTTONS 4 - #define CSR_BUTTONBITS 5 - #define CSR_BTNNAMES 6 - #define CSR_BUTTONMAP 7 - #define CSR_SYSBTNMAP 8 - #define CSR_NPBUTTON 9 - #define CSR_NPBTNMARKS 10 - #define CSR_NPRESPONSE 11 - #define CSR_TPBUTTON 12 - #define CSR_TPBTNMARKS 13 - #define CSR_TPRESPONSE 14 - #define CSR_PHYSID 15 /* 1.1 */ - #define CSR_MODE 16 /* 1.1 */ - #define CSR_MINPKTDATA 17 /* 1.1 */ - #define CSR_MINBUTTONS 18 /* 1.1 */ - #define CSR_CAPABILITIES 19 /* 1.1 */ - #define CSR_TYPE 20 /* 1.2 */ - #define CSR_MAX 20 - -#endif - -#ifndef NOWTEXTENSIONS - -#define WTI_EXTENSIONS 300 - #define EXT_NAME 1 - #define EXT_TAG 2 - #define EXT_MASK 3 - #define EXT_SIZE 4 - #define EXT_AXES 5 - #define EXT_DEFAULT 6 - #define EXT_DEFCONTEXT 7 - #define EXT_DEFSYSCTX 8 - #define EXT_CURSORS 9 - #define EXT_MAX 109 /* Allow 100 cursors */ - -#endif - -#endif - -/* -------------------------------------------------------------------------- */ -/* CONTEXT DATA DEFS */ - -#define LCNAMELEN 40 -#define LC_NAMELEN 40 -#ifdef WIN32 -typedef struct tagLOGCONTEXTA { - char lcName[LCNAMELEN]; - UINT lcOptions; - UINT lcStatus; - UINT lcLocks; - UINT lcMsgBase; - UINT lcDevice; - UINT lcPktRate; - WTPKT lcPktData; - WTPKT lcPktMode; - WTPKT lcMoveMask; - DWORD lcBtnDnMask; - DWORD lcBtnUpMask; - LONG lcInOrgX; - LONG lcInOrgY; - LONG lcInOrgZ; - LONG lcInExtX; - LONG lcInExtY; - LONG lcInExtZ; - LONG lcOutOrgX; - LONG lcOutOrgY; - LONG lcOutOrgZ; - LONG lcOutExtX; - LONG lcOutExtY; - LONG lcOutExtZ; - FIX32 lcSensX; - FIX32 lcSensY; - FIX32 lcSensZ; - BOOL lcSysMode; - int lcSysOrgX; - int lcSysOrgY; - int lcSysExtX; - int lcSysExtY; - FIX32 lcSysSensX; - FIX32 lcSysSensY; -} LOGCONTEXTA, *PLOGCONTEXTA, NEAR *NPLOGCONTEXTA, FAR *LPLOGCONTEXTA; -typedef struct tagLOGCONTEXTW { - WCHAR lcName[LCNAMELEN]; - UINT lcOptions; - UINT lcStatus; - UINT lcLocks; - UINT lcMsgBase; - UINT lcDevice; - UINT lcPktRate; - WTPKT lcPktData; - WTPKT lcPktMode; - WTPKT lcMoveMask; - DWORD lcBtnDnMask; - DWORD lcBtnUpMask; - LONG lcInOrgX; - LONG lcInOrgY; - LONG lcInOrgZ; - LONG lcInExtX; - LONG lcInExtY; - LONG lcInExtZ; - LONG lcOutOrgX; - LONG lcOutOrgY; - LONG lcOutOrgZ; - LONG lcOutExtX; - LONG lcOutExtY; - LONG lcOutExtZ; - FIX32 lcSensX; - FIX32 lcSensY; - FIX32 lcSensZ; - BOOL lcSysMode; - int lcSysOrgX; - int lcSysOrgY; - int lcSysExtX; - int lcSysExtY; - FIX32 lcSysSensX; - FIX32 lcSysSensY; -} LOGCONTEXTW, *PLOGCONTEXTW, NEAR *NPLOGCONTEXTW, FAR *LPLOGCONTEXTW; -#ifdef UNICODE -typedef LOGCONTEXTW LOGCONTEXT; -typedef PLOGCONTEXTW PLOGCONTEXT; -typedef NPLOGCONTEXTW NPLOGCONTEXT; -typedef LPLOGCONTEXTW LPLOGCONTEXT; -#else -typedef LOGCONTEXTA LOGCONTEXT; -typedef PLOGCONTEXTA PLOGCONTEXT; -typedef NPLOGCONTEXTA NPLOGCONTEXT; -typedef LPLOGCONTEXTA LPLOGCONTEXT; -#endif /* UNICODE */ -#else /* WIN32 */ -typedef struct tagLOGCONTEXT { - char lcName[LCNAMELEN]; - UINT lcOptions; - UINT lcStatus; - UINT lcLocks; - UINT lcMsgBase; - UINT lcDevice; - UINT lcPktRate; - WTPKT lcPktData; - WTPKT lcPktMode; - WTPKT lcMoveMask; - DWORD lcBtnDnMask; - DWORD lcBtnUpMask; - LONG lcInOrgX; - LONG lcInOrgY; - LONG lcInOrgZ; - LONG lcInExtX; - LONG lcInExtY; - LONG lcInExtZ; - LONG lcOutOrgX; - LONG lcOutOrgY; - LONG lcOutOrgZ; - LONG lcOutExtX; - LONG lcOutExtY; - LONG lcOutExtZ; - FIX32 lcSensX; - FIX32 lcSensY; - FIX32 lcSensZ; - BOOL lcSysMode; - int lcSysOrgX; - int lcSysOrgY; - int lcSysExtX; - int lcSysExtY; - FIX32 lcSysSensX; - FIX32 lcSysSensY; -} LOGCONTEXT, *PLOGCONTEXT, NEAR *NPLOGCONTEXT, FAR *LPLOGCONTEXT; -#endif /* WIN32 */ - - /* context option values */ - #define CXO_SYSTEM 0x0001 - #define CXO_PEN 0x0002 - #define CXO_MESSAGES 0x0004 - #define CXO_MARGIN 0x8000 - #define CXO_MGNINSIDE 0x4000 - #define CXO_CSRMESSAGES 0x0008 /* 1.1 */ - - /* context status values */ - #define CXS_DISABLED 0x0001 - #define CXS_OBSCURED 0x0002 - #define CXS_ONTOP 0x0004 - - /* context lock values */ - #define CXL_INSIZE 0x0001 - #define CXL_INASPECT 0x0002 - #define CXL_SENSITIVITY 0x0004 - #define CXL_MARGIN 0x0008 - #define CXL_SYSOUT 0x0010 - -/* -------------------------------------------------------------------------- */ -/* EVENT DATA DEFS */ - -/* For packet structure definition, see pktdef.h */ - -/* packet status values */ -#define TPS_PROXIMITY 0x0001 -#define TPS_QUEUE_ERR 0x0002 -#define TPS_MARGIN 0x0004 -#define TPS_GRAB 0x0008 -#define TPS_INVERT 0x0010 /* 1.1 */ - -typedef struct tagORIENTATION { - int orAzimuth; - int orAltitude; - int orTwist; -} ORIENTATION, *PORIENTATION, NEAR *NPORIENTATION, FAR *LPORIENTATION; - -typedef struct tagROTATION { /* 1.1 */ - int roPitch; - int roRoll; - int roYaw; -} ROTATION, *PROTATION, NEAR *NPROTATION, FAR *LPROTATION; -// grandfather in obsolete member names. -#define rotPitch roPitch -#define rotRoll roRoll -#define rotYaw roYaw - -/* relative buttons */ -#define TBN_NONE 0 -#define TBN_UP 1 -#define TBN_DOWN 2 - -/* -------------------------------------------------------------------------- */ -/* DEVICE CONFIG CONSTANTS */ - -#ifndef NOWTDEVCFG - -#define WTDC_NONE 0 -#define WTDC_CANCEL 1 -#define WTDC_OK 2 -#define WTDC_RESTART 3 - -#endif - -/* -------------------------------------------------------------------------- */ -/* HOOK CONSTANTS */ - -#ifndef NOWTHOOKS - -#define WTH_PLAYBACK 1 -#define WTH_RECORD 2 - -#define WTHC_GETLPLPFN (-3) -#define WTHC_LPLPFNNEXT (-2) -#define WTHC_LPFNNEXT (-1) -#define WTHC_ACTION 0 -#define WTHC_GETNEXT 1 -#define WTHC_SKIP 2 - -#endif - -/* -------------------------------------------------------------------------- */ -/* PREFERENCE FUNCTION CONSTANTS */ - -#ifndef NOWTPREF - -#define WTP_LPDEFAULT ((LPVOID)-1L) -#define WTP_DWDEFAULT ((DWORD)-1L) - -#endif - -/* -------------------------------------------------------------------------- */ -/* EXTENSION TAGS AND CONSTANTS */ - -#ifndef NOWTEXTENSIONS - -/* constants for use with pktdef.h */ -#define PKEXT_ABSOLUTE 1 -#define PKEXT_RELATIVE 2 - -/* Extension tags. */ -#define WTX_OBT 0 /* Out of bounds tracking */ -#define WTX_FKEYS 1 /* Function keys */ -#define WTX_TILT 2 /* Raw Cartesian tilt; 1.1 */ -#define WTX_CSRMASK 3 /* select input by cursor type; 1.1 */ -#define WTX_XBTNMASK 4 /* Extended button mask; 1.1 */ -#define WTX_EXPKEYS 5 /* ExpressKeys; 1.3 */ - -typedef struct tagXBTNMASK { - BYTE xBtnDnMask[32]; - BYTE xBtnUpMask[32]; -} XBTNMASK; - -typedef struct tagTILT { /* 1.1 */ - int tiltX; - int tiltY; -} TILT; - -#endif - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ -/* Functions */ - - #ifndef API - #ifndef WINAPI - #define API FAR PASCAL - #else - #define API WINAPI - #endif - #endif - -#ifndef NOWTCALLBACKS - - #ifndef CALLBACK - #define CALLBACK FAR PASCAL - #endif - - #ifndef NOWTMANAGERFXNS - /* callback function types */ - typedef BOOL (WINAPI * WTENUMPROC)(HCTX, LPARAM); /* changed CALLBACK->WINAPI, 1.1 */ - typedef BOOL (WINAPI * WTCONFIGPROC)(HCTX, HWND); - typedef LRESULT (WINAPI * WTHOOKPROC)(int, WPARAM, LPARAM); - typedef WTHOOKPROC FAR *LPWTHOOKPROC; - #endif - -#endif - - -#ifndef NOWTFUNCTIONS - - #ifndef NOWTBASICFXNS - /* BASIC FUNCTIONS */ -#ifdef WIN32 - UINT API WTInfoA(UINT, UINT, LPVOID); - #define ORD_WTInfoA 20 - UINT API WTInfoW(UINT, UINT, LPVOID); - #define ORD_WTInfoW 1020 - #ifdef UNICODE - #define WTInfo WTInfoW - #define ORD_WTInfo ORD_WTInfoW - #else - #define WTInfo WTInfoA - #define ORD_WTInfo ORD_WTInfoA - #endif /* !UNICODE */ -#else - UINT API WTInfo(UINT, UINT, LPVOID); - #define ORD_WTInfo 20 -#endif -#ifdef WIN32 - HCTX API WTOpenA(HWND, LPLOGCONTEXTA, BOOL); - #define ORD_WTOpenA 21 - HCTX API WTOpenW(HWND, LPLOGCONTEXTW, BOOL); - #define ORD_WTOpenW 1021 - #ifdef UNICODE - #define WTOpen WTOpenW - #define ORD_WTOpen ORD_WTOpenW - #else - #define WTOpen WTOpenA - #define ORD_WTOpen ORD_WTOpenA - #endif /* !UNICODE */ -#else - HCTX API WTOpen(HWND, LPLOGCONTEXT, BOOL); - #define ORD_WTOpen 21 -#endif - BOOL API WTClose(HCTX); - #define ORD_WTClose 22 - int API WTPacketsGet(HCTX, int, LPVOID); - #define ORD_WTPacketsGet 23 - BOOL API WTPacket(HCTX, UINT, LPVOID); - #define ORD_WTPacket 24 - #endif - - #ifndef NOWTVISIBILITYFXNS - /* VISIBILITY FUNCTIONS */ - BOOL API WTEnable(HCTX, BOOL); - #define ORD_WTEnable 40 - BOOL API WTOverlap(HCTX, BOOL); - #define ORD_WTOverlap 41 - #endif - - #ifndef NOWTCTXEDITFXNS - /* CONTEXT EDITING FUNCTIONS */ - BOOL API WTConfig(HCTX, HWND); - #define ORD_WTConfig 60 -#ifdef WIN32 - BOOL API WTGetA(HCTX, LPLOGCONTEXTA); - #define ORD_WTGetA 61 - BOOL API WTGetW(HCTX, LPLOGCONTEXTW); - #define ORD_WTGetW 1061 - #ifdef UNICODE - #define WTGet WTGetW - #define ORD_WTGet ORD_WTGetW - #else - #define WTGet WTGetA - #define ORD_WTGet ORD_WTGetA - #endif /* !UNICODE */ -#else - BOOL API WTGet(HCTX, LPLOGCONTEXT); - #define ORD_WTGet 61 -#endif -#ifdef WIN32 - BOOL API WTSetA(HCTX, LPLOGCONTEXTA); - #define ORD_WTSetA 62 - BOOL API WTSetW(HCTX, LPLOGCONTEXTW); - #define ORD_WTSetW 1062 - #ifdef UNICODE - #define WTSet WTSetW - #define ORD_WTSet ORD_WTSetW - #else - #define WTSet WTSetA - #define ORD_WTSet ORD_WTSetA - #endif /* !UNICODE */ -#else - BOOL API WTSet(HCTX, LPLOGCONTEXT); - #define ORD_WTSet 62 -#endif - BOOL API WTExtGet(HCTX, UINT, LPVOID); - #define ORD_WTExtGet 63 - BOOL API WTExtSet(HCTX, UINT, LPVOID); - #define ORD_WTExtSet 64 - BOOL API WTSave(HCTX, LPVOID); - #define ORD_WTSave 65 - HCTX API WTRestore(HWND, LPVOID, BOOL); - #define ORD_WTRestore 66 - #endif - - #ifndef NOWTQUEUEFXNS - /* ADVANCED PACKET AND QUEUE FUNCTIONS */ - int API WTPacketsPeek(HCTX, int, LPVOID); - #define ORD_WTPacketsPeek 80 - int API WTDataGet(HCTX, UINT, UINT, int, LPVOID, LPINT); - #define ORD_WTDataGet 81 - int API WTDataPeek(HCTX, UINT, UINT, int, LPVOID, LPINT); - #define ORD_WTDataPeek 82 -#ifndef WIN32 -/* OBSOLETE IN WIN32! */ - DWORD API WTQueuePackets(HCTX); - #define ORD_WTQueuePackets 83 -#endif - int API WTQueueSizeGet(HCTX); - #define ORD_WTQueueSizeGet 84 - BOOL API WTQueueSizeSet(HCTX, int); - #define ORD_WTQueueSizeSet 85 - #endif - - #ifndef NOWTHMGRFXNS - /* MANAGER HANDLE FUNCTIONS */ - HMGR API WTMgrOpen(HWND, UINT); - #define ORD_WTMgrOpen 100 - BOOL API WTMgrClose(HMGR); - #define ORD_WTMgrClose 101 - #endif - - #ifndef NOWTMGRCTXFXNS - /* MANAGER CONTEXT FUNCTIONS */ - BOOL API WTMgrContextEnum(HMGR, WTENUMPROC, LPARAM); - #define ORD_WTMgrContextEnum 120 - HWND API WTMgrContextOwner(HMGR, HCTX); - #define ORD_WTMgrContextOwner 121 - HCTX API WTMgrDefContext(HMGR, BOOL); - #define ORD_WTMgrDefContext 122 - HCTX API WTMgrDefContextEx(HMGR, UINT, BOOL); /* 1.1 */ - #define ORD_WTMgrDefContextEx 206 - #endif - - #ifndef NOWTMGRCONFIGFXNS - /* MANAGER CONFIG BOX FUNCTIONS */ - UINT API WTMgrDeviceConfig(HMGR, UINT, HWND); - #define ORD_WTMgrDeviceConfig 140 -#ifndef WIN32 -/* OBSOLETE IN WIN32! */ - BOOL API WTMgrConfigReplace(HMGR, BOOL, WTCONFIGPROC); - #define ORD_WTMgrConfigReplace 141 -#endif - #endif - - #ifndef NOWTMGRHOOKFXNS - /* MANAGER PACKET HOOK FUNCTIONS */ -#ifndef WIN32 -/* OBSOLETE IN WIN32! */ - WTHOOKPROC API WTMgrPacketHook(HMGR, BOOL, int, WTHOOKPROC); - #define ORD_WTMgrPacketHook 160 - LRESULT API WTMgrPacketHookDefProc(int, WPARAM, LPARAM, LPWTHOOKPROC); - #define ORD_WTMgrPacketHookDefProc 161 -#endif - #endif - - #ifndef NOWTMGRPREFFXNS - /* MANAGER PREFERENCE DATA FUNCTIONS */ - BOOL API WTMgrExt(HMGR, UINT, LPVOID); - #define ORD_WTMgrExt 180 - BOOL API WTMgrCsrEnable(HMGR, UINT, BOOL); - #define ORD_WTMgrCsrEnable 181 - BOOL API WTMgrCsrButtonMap(HMGR, UINT, LPBYTE, LPBYTE); - #define ORD_WTMgrCsrButtonMap 182 - BOOL API WTMgrCsrPressureBtnMarks(HMGR, UINT, DWORD, DWORD); - #define ORD_WTMgrCsrPressureBtnMarks 183 - BOOL API WTMgrCsrPressureResponse(HMGR, UINT, UINT FAR *, UINT FAR *); - #define ORD_WTMgrCsrPressureResponse 184 - BOOL API WTMgrCsrExt(HMGR, UINT, UINT, LPVOID); - #define ORD_WTMgrCsrExt 185 - #endif - -/* Win32 replacements for non-portable functions. */ - #ifndef NOWTQUEUEFXNS - /* ADVANCED PACKET AND QUEUE FUNCTIONS */ - BOOL API WTQueuePacketsEx(HCTX, UINT FAR *, UINT FAR *); - #define ORD_WTQueuePacketsEx 200 - #endif - - #ifndef NOWTMGRCONFIGFXNS - /* MANAGER CONFIG BOX FUNCTIONS */ -#ifdef WIN32 - BOOL API WTMgrConfigReplaceExA(HMGR, BOOL, LPSTR, LPSTR); - #define ORD_WTMgrConfigReplaceExA 202 - BOOL API WTMgrConfigReplaceExW(HMGR, BOOL, LPWSTR, LPSTR); - #define ORD_WTMgrConfigReplaceExW 1202 - #ifdef UNICODE - #define WTMgrConfigReplaceEx WTMgrConfigReplaceExW - #define ORD_WTMgrConfigReplaceEx ORD_WTMgrConfigReplaceExW - #else - #define WTMgrConfigReplaceEx WTMgrConfigReplaceExA - #define ORD_WTMgrConfigReplaceEx ORD_WTMgrConfigReplaceExA - #endif /* !UNICODE */ -#else - BOOL API WTMgrConfigReplaceEx(HMGR, BOOL, LPSTR, LPSTR); - #define ORD_WTMgrConfigReplaceEx 202 -#endif - #endif - - #ifndef NOWTMGRHOOKFXNS - /* MANAGER PACKET HOOK FUNCTIONS */ -#ifdef WIN32 - HWTHOOK API WTMgrPacketHookExA(HMGR, int, LPSTR, LPSTR); - #define ORD_WTMgrPacketHookExA 203 - HWTHOOK API WTMgrPacketHookExW(HMGR, int, LPWSTR, LPSTR); - #define ORD_WTMgrPacketHookExW 1203 - #ifdef UNICODE - #define WTMgrPacketHookEx WTMgrPacketHookExW - #define ORD_WTMgrPacketHookEx ORD_WTMgrPacketHookExW - #else - #define WTMgrPacketHookEx WTMgrPacketHookExA - #define ORD_WTMgrPacketHookEx ORD_WTMgrPacketHookExA - #endif /* !UNICODE */ -#else - HWTHOOK API WTMgrPacketHookEx(HMGR, int, LPSTR, LPSTR); - #define ORD_WTMgrPacketHookEx 203 -#endif - BOOL API WTMgrPacketUnhook(HWTHOOK); - #define ORD_WTMgrPacketUnhook 204 - LRESULT API WTMgrPacketHookNext(HWTHOOK, int, WPARAM, LPARAM); - #define ORD_WTMgrPacketHookNext 205 - #endif - - #ifndef NOWTMGRPREFFXNS - /* MANAGER PREFERENCE DATA FUNCTIONS */ - BOOL API WTMgrCsrPressureBtnMarksEx(HMGR, UINT, UINT FAR *, UINT FAR *); - #define ORD_WTMgrCsrPressureBtnMarksEx 201 - #endif - - - -#endif - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* #define _INC_WINTAB */ - diff --git a/src/video/win32/wactab/wintabx.h b/src/video/win32/wactab/wintabx.h deleted file mode 100644 index 7bd4ef18e..000000000 --- a/src/video/win32/wactab/wintabx.h +++ /dev/null @@ -1,136 +0,0 @@ -/* *INDENT-OFF* */ -/* ------------------------------- wintabx.h -------------------------------- */ -/* Combined 16 & 32-bit version. */ - - -/*------------------------------------------------------------------------------ -The text and information contained in this file may be freely used, -copied, or distributed without compensation or licensing restrictions. - -This file is copyright 1991-1998 by LCS/Telegraphics. -------------------------------------------------------------------------------*/ - -#ifndef _INC_WINTABX /* prevent multiple includes */ -#define _INC_WINTABX - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* prototype for wintabx.lib. */ -#define _UnlinkWinTab _UnlinkWintab -#ifdef WIN32 - extern WINAPI _UnlinkWintab(void); -#else - extern FAR _UnlinkWintab(void); -#endif - -/****** Wintab message crackers ***********************************************/ - -#ifndef HANDLE_MSG -#define HANDLE_MSG(hwnd, message, fn) \ - case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn)) -#endif - -/* void Cls_OnWintabPacket(HWND hwnd, HCTX hCtx, UINT sn) */ -#define HANDLE_WT_PACKET(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HCTX)(lParam), (UINT)(wParam)), 0L) -#define FORWARD__WT_PACKET(hwnd, bs, hCtx, sn, fn) \ - (void)(fn)((hwnd), _WT_PACKET(bs), (WPARAM)(UINT)(sn), (LPARAM)(HCTX)(hCtx)) -#define FORWARD_WT_PACKET(hwnd, hCtx, sn, fn) \ - FORWARD__WT_PACKET(hwnd, WT_DEFBASE, hCtx, sn, fn) - -/* void Cls_OnWintabCtxOpen(HWND hwnd, HCTX hCtx, UINT sf) */ -#define HANDLE_WT_CTXOPEN(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L) -#define FORWARD__WT_CTXOPEN(hwnd, bs, hCtx, sf, fn) \ - (void)(fn)((hwnd), _WT_CTXOPEN(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf)) -#define FORWARD_WT_CTXOPEN(hwnd, hCtx, sf, fn) \ - FORWARD__WT_CTXOPEN(hwnd, WT_DEFBASE, hCtx, sf, fn) - -/* void Cls_OnWintabCtxClose(HWND hwnd, HCTX hCtx, UINT sf) */ -#define HANDLE_WT_CTXCLOSE(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L) -#define FORWARD__WT_CTXCLOSE(hwnd, bs, hCtx, sf, fn) \ - (void)(fn)((hwnd), _WT_CTXCLOSE(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf)) -#define FORWARD_WT_CTXCLOSE(hwnd, hCtx, sf, fn) \ - FORWARD__WT_CTXCLOSE(hwnd, WT_DEFBASE, hCtx, sf, fn) - -/* void Cls_OnWintabCtxUpdate(HWND hwnd, HCTX hCtx, UINT sf) */ -#define HANDLE_WT_CTXUPDATE(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L) -#define FORWARD__WT_CTXUPDATE(hwnd, bs, hCtx, sf, fn) \ - (void)(fn)((hwnd), _WT_CTXUPDATE(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf)) -#define FORWARD_WT_CTXUPDATE(hwnd, hCtx, sf, fn) \ - FORWARD__WT_CTXUPDATE(hwnd, WT_DEFBASE, hCtx, sf, fn) - -/* void Cls_OnWintabCtxOverlap(HWND hwnd, HCTX hCtx, UINT sf) */ -#define HANDLE_WT_CTXOVERLAP(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HCTX)(wParam), (UINT)(lParam)), 0L) -#define FORWARD__WT_CTXOVERLAP(hwnd, bs, hCtx, sf, fn) \ - (void)(fn)((hwnd), _WT_CTXOVERLAP(bs), (WPARAM)(HCTX)(hCtx), (LPARAM)(UINT)(sf)) -#define FORWARD_WT_CTXOVERLAP(hwnd, hCtx, sf, fn) \ - FORWARD__WT_CTXOVERLAP(hwnd, WT_DEFBASE, hCtx, sf, fn) - -/* void Cls_OnWintabProximity(HWND hwnd, HCTX hCtx, BOOL cp, BOOL hp) */ -#define HANDLE_WT_PROXIMITY(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HCTX)(wParam), (BOOL)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L) -#define FORWARD__WT_PROXIMITY(hwnd, bs, hCtx, cp, hp, fn) \ - (void)(fn)((hwnd), _WT_PROXIMITY(bs), (WPARAM)(HCTX)(hCtx), MAKELPARAM((cp), (hp)) -#define FORWARD_WT_PROXIMITY(hwnd, hCtx, sf, fn) \ - FORWARD__WT_PROXIMITY(hwnd, WT_DEFBASE, hCtx, cp, hp, fn) - -/* void Cls_OnWintabInfoChange(HWND hwnd, HMGR hMgr, UINT c, UINT i) */ -#define HANDLE_WT_INFOCHANGE(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HMGR)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L) -#define FORWARD__WT_INFOCHANGE(hwnd, bs, hMgr, cp, hp, fn) \ - (void)(fn)((hwnd), _WT_INFOCHANGE(bs), (WPARAM)(HMGR)(hMgr), MAKELPARAM((c), (i)) -#define FORWARD_WT_INFOCHANGE(hwnd, hMgr, sf, fn) \ - FORWARD__WT_INFOCHANGE(hwnd, WT_DEFBASE, hMgr, cp, hp, fn) - -/****** Alternate porting layer macros ****************************************/ - -#define GET_WT_PACKET_HCTX(wp, lp) ((HCTX)lp) -#define GET_WT_PACKET_SERIAL(wp, lp) (wp) -#define GET_WT_PACKET_MPS(h, s) \ - (s), (LPARAM)(h) - -#define GET_WT_CTXOPEN_HCTX(wp, lp) ((HCTX)wp) -#define GET_WT_CTXOPEN_STATUS(wp, lp) ((UINT)lp) -#define GET_WT_CTXOPEN_MPS(h, s) \ - (WPARAM)(h), (LPARAM)(s) - -#define GET_WT_CTXCLOSE_HCTX(wp, lp) ((HCTX)wp) -#define GET_WT_CTXCLOSE_STATUS(wp, lp) ((UINT)lp) -#define GET_WT_CTXCLOSE_MPS(h, s) \ - (WPARAM)(h), (LPARAM)(s) - -#define GET_WT_CTXUPDATE_HCTX(wp, lp) ((HCTX)wp) -#define GET_WT_CTXUPDATE_STATUS(wp, lp) ((UINT)lp) -#define GET_WT_CTXUPDATE_MPS(h, s) \ - (WPARAM)(h), (LPARAM)(s) - -#define GET_WT_CTXOVERLAP_HCTX(wp, lp) ((HCTX)wp) -#define GET_WT_CTXOVERLAP_STATUS(wp, lp) ((UINT)lp) -#define GET_WT_CTXOVERLAP_MPS(h, s) \ - (WPARAM)(h), (LPARAM)(s) - -#define GET_WT_PROXIMITY_HCTX(wp, lp) ((HCTX)wp) -#define GET_WT_PROXIMITY_CTXPROX(wp, lp) LOWORD(lp) -#define GET_WT_PROXIMITY_HARDPROX(wp, lp) HIWORD(lp) -#define GET_WT_PROXIMITY_MPS(h, fc, fh) \ - (WPARAM)(h), MAKELONG(fc, fh) - -#define GET_WT_INFOCHANGE_HMGR(wp, lp) ((HMGR)wp) -#define GET_WT_INFOCHANGE_CATEGORY(wp, lp) LOWORD(lp) -#define GET_WT_INFOCHANGE_INDEX(wp, lp) HIWORD(lp) -#define GET_WT_INFOCHANGE_MPS(h, c, i) \ - (WPARAM)(h), MAKELONG(c, i) - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* #define _INC_WINTABX */ - diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 598093fed..6b7003994 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -23,12 +23,14 @@ #include #include +#include #include #include "SDL_x11video.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_mouse_c.h" +#include "SDL_timer.h" #include "SDL_syswm.h" static void @@ -93,13 +95,7 @@ X11_DispatchEvent(_THIS) if (xevent.xcrossing.mode == NotifyUngrab) printf("Mode: NotifyUngrab\n"); #endif -#if 1 - /* FIXME: Should we reset data for all mice? */ - for (i = 0; i < SDL_GetNumMice(); ++i) { - SDL_Mouse *mouse = SDL_GetMouse(i); - SDL_SetMouseFocus(mouse->id, data->window); - } -#endif + SDL_SetMouseFocus(data->window); } break; @@ -116,13 +112,7 @@ X11_DispatchEvent(_THIS) printf("Mode: NotifyUngrab\n"); #endif if (xevent.xcrossing.detail != NotifyInferior) { -#if 1 - /* FIXME: Should we reset data for all mice? */ - for (i = 0; i < SDL_GetNumMice(); ++i) { - SDL_Mouse *mouse = SDL_GetMouse(i); - SDL_SetMouseFocus(mouse->id, 0); - } -#endif + SDL_SetMouseFocus(NULL); } } break; @@ -132,7 +122,7 @@ X11_DispatchEvent(_THIS) #ifdef DEBUG_XEVENTS printf("FocusIn!\n"); #endif - SDL_SetKeyboardFocus(videodata->keyboard, data->window); + SDL_SetKeyboardFocus(data->window); #ifdef X_HAVE_UTF8_STRING if (data->ic) { XSetICFocus(data->ic); @@ -146,7 +136,7 @@ X11_DispatchEvent(_THIS) #ifdef DEBUG_XEVENTS printf("FocusOut!\n"); #endif - SDL_SetKeyboardFocus(videodata->keyboard, 0); + SDL_SetKeyboardFocus(NULL); #ifdef X_HAVE_UTF8_STRING if (data->ic) { XUnsetICFocus(data->ic); @@ -185,8 +175,7 @@ X11_DispatchEvent(_THIS) #ifdef DEBUG_XEVENTS printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); #endif - SDL_SendKeyboardKey(videodata->keyboard, SDL_PRESSED, - videodata->key_layout[keycode]); + SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); #if 0 if (videodata->key_layout[keycode] == SDLK_UNKNOWN) { int min_keycode, max_keycode; @@ -210,7 +199,7 @@ X11_DispatchEvent(_THIS) XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL); #endif if (*text) { - SDL_SendKeyboardText(videodata->keyboard, text); + SDL_SendKeyboardText(text); } } break; @@ -222,8 +211,7 @@ X11_DispatchEvent(_THIS) #ifdef DEBUG_XEVENTS printf("KeyRelease (X11 keycode = 0x%X)\n", xevent.xkey.keycode); #endif - SDL_SendKeyboardKey(videodata->keyboard, SDL_RELEASED, - videodata->key_layout[keycode]); + SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]); } break; @@ -280,79 +268,25 @@ X11_DispatchEvent(_THIS) } break; - default:{ - for (i = 0; i < SDL_GetNumMice(); ++i) { - SDL_Mouse *mouse; -#if SDL_VIDEO_DRIVER_X11_XINPUT - X11_MouseData *data; -#endif - - mouse = SDL_GetMouse(i); - if (!mouse->driverdata) { - switch (xevent.type) { - case MotionNotify: -#ifdef DEBUG_MOTION - printf("X11 motion: %d,%d\n", xevent.xmotion.x, - xevent.xmotion.y); -#endif - SDL_SendMouseMotion(mouse->id, 0, xevent.xmotion.x, - xevent.xmotion.y, 0); - break; - - case ButtonPress: - SDL_SendMouseButton(mouse->id, SDL_PRESSED, - xevent.xbutton.button); - break; - - case ButtonRelease: - SDL_SendMouseButton(mouse->id, SDL_RELEASED, - xevent.xbutton.button); - break; - } - continue; - } -#if SDL_VIDEO_DRIVER_X11_XINPUT - data = (X11_MouseData *) mouse->driverdata; - if (xevent.type == data->motion) { - XDeviceMotionEvent *move = - (XDeviceMotionEvent *) & xevent; + case MotionNotify:{ #ifdef DEBUG_MOTION - printf("X11 motion: %d,%d\n", move->x, move->y); + printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); #endif - SDL_SendMouseMotion(move->deviceid, 0, move->x, move->y, - move->axis_data[2]); - return; - } - if (xevent.type == data->button_pressed) { - XDeviceButtonPressedEvent *pressed = - (XDeviceButtonPressedEvent *) & xevent; - SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED, - pressed->button); - return; - } - if (xevent.type == data->button_released) { - XDeviceButtonReleasedEvent *released = - (XDeviceButtonReleasedEvent *) & xevent; - SDL_SendMouseButton(released->deviceid, SDL_RELEASED, - released->button); - return; - } - if (xevent.type == data->proximity_in) { - XProximityNotifyEvent *proximity = - (XProximityNotifyEvent *) & xevent; - SDL_SendProximity(proximity->deviceid, proximity->x, - proximity->y, SDL_PROXIMITYIN); - return; - } - if (xevent.type == data->proximity_out) { - XProximityNotifyEvent *proximity = - (XProximityNotifyEvent *) & xevent; - SDL_SendProximity(proximity->deviceid, proximity->x, - proximity->y, SDL_PROXIMITYOUT); - return; - } -#endif - } + SDL_SendMouseMotion(0, xevent.xmotion.x, xevent.xmotion.y); + } + break; + + case ButtonPress:{ + SDL_SendMouseButton(SDL_PRESSED, xevent.xbutton.button); + } + break; + + case ButtonRelease:{ + SDL_SendMouseButton(SDL_RELEASED, xevent.xbutton.button); + } + break; + + default:{ #ifdef DEBUG_XEVENTS printf("Unhandled event %d\n", xevent.type); #endif diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 0726d99e6..dc80195a1 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -172,7 +172,6 @@ int X11_InitKeyboard(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - SDL_Keyboard keyboard; int i, j; int min_keycode, max_keycode; struct { @@ -251,8 +250,6 @@ X11_InitKeyboard(_THIS) } } - SDL_zero(keyboard); - data->keyboard = SDL_AddKeyboard(&keyboard, -1); X11_UpdateKeymap(_this); SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); @@ -280,15 +277,12 @@ X11_UpdateKeymap(_THIS) keymap[scancode] = X11_KeyCodeToSDLKey(data->display, (KeyCode)i); } - SDL_SetKeymap(data->keyboard, 0, keymap, SDL_NUM_SCANCODES); + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); } void X11_QuitKeyboard(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - - SDL_DelKeyboard(data->keyboard); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 8b999f8d5..dbf5b6189 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -24,139 +24,14 @@ #include "SDL_x11mouse.h" #include "../../events/SDL_mouse_c.h" -#if SDL_VIDEO_DRIVER_X11_XINPUT -static void -X11_FreeMouse(SDL_Mouse * mouse) -{ - X11_MouseData *data = (X11_MouseData *) mouse->driverdata; - - if (data) { - XCloseDevice(data->display, data->device); - SDL_free(data); - } -} -#endif - void X11_InitMouse(_THIS) { - SDL_Mouse mouse; -#if SDL_VIDEO_DRIVER_X11_XINPUT - Display *display = ((SDL_VideoData *) _this->driverdata)->display; - X11_MouseData *data; - int i, j, n; - XDeviceInfo *DevList; - XAnyClassPtr deviceClass; - int event_code; - XEventClass xEvent; -#endif - int num_mice = 0; - - SDL_zero(mouse); - -#if SDL_VIDEO_DRIVER_X11_XINPUT - /* we're getting the list of input devices */ - n = 0; - if (SDL_X11_HAVE_XINPUT) { - DevList = XListInputDevices(display, &n); - } - - /* we're aquiring valuators: mice, tablets, etc. */ - for (i = 0; i < n; ++i) { - /* if it's the core pointer or core keyborard we don't want it */ - if ((DevList[i].use != IsXPointer && DevList[i].use != IsXKeyboard)) { - /* we have to check all of the device classes */ - deviceClass = DevList[i].inputclassinfo; - for (j = 0; j < DevList[i].num_classes; ++j) { - if (deviceClass->class == ValuatorClass) { /* bingo ;) */ - XValuatorInfo *valInfo; - - data = (X11_MouseData *) SDL_calloc(1, sizeof(*data)); - if (!data) { - continue; - } - data->display = display; - data->device = XOpenDevice(display, DevList[i].id); - - /* motion events */ - DeviceMotionNotify(data->device, event_code, xEvent); - if (xEvent) { - data->xevents[data->num_xevents++] = xEvent; - data->motion = event_code; - } - - /* button events */ - DeviceButtonPress(data->device, event_code, xEvent); - if (xEvent) { - data->xevents[data->num_xevents++] = xEvent; - data->button_pressed = event_code; - } - DeviceButtonRelease(data->device, event_code, xEvent); - if (xEvent) { - data->xevents[data->num_xevents++] = xEvent; - data->button_released = event_code; - } - - /* proximity events */ - ProximityIn(data->device, event_code, xEvent); - if (xEvent) { - data->xevents[data->num_xevents++] = xEvent; - data->proximity_in = event_code; - } - ProximityOut(data->device, event_code, xEvent); - if (xEvent) { - data->xevents[data->num_xevents++] = xEvent; - data->proximity_out = event_code; - } - - SDL_zero(mouse); - mouse.id = DevList[i].id; - mouse.FreeMouse = X11_FreeMouse; - mouse.driverdata = data; - - /* lets get the device parameters */ - valInfo = (XValuatorInfo *) deviceClass; - /* if the device reports pressure, lets check it parameteres */ - if (valInfo->num_axes > 2) { - SDL_AddMouse(&mouse, DevList[i].name, - valInfo->axes[2].max_value, - valInfo->axes[2].min_value, 1); - } else { - SDL_AddMouse(&mouse, DevList[i].name, 0, 0, 1); - } -#ifndef IsXExtensionPointer -#define IsXExtensionPointer 4 -#endif - if (DevList[i].use == IsXExtensionPointer) { - ++num_mice; - } - break; - } - /* if it's not class we're interested in, lets go further */ - deviceClass = - (XAnyClassPtr) ((char *) deviceClass + - deviceClass->length); - } - } - } - XFreeDeviceList(DevList); -#endif - - if (num_mice == 0) { - SDL_zero(mouse); - SDL_AddMouse(&mouse, "CorePointer", 0, 0, 1); - } } void X11_QuitMouse(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - - /* !!! FIXME: use XCloseDevice()? Or maybe handle under SDL_MouseQuit()? */ - - /* let's delete all of the mice */ - SDL_MouseQuit(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index 1ba0ba392..9989911c9 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -67,7 +67,6 @@ typedef struct SDL_VideoData int numwindows; SDL_WindowData **windowlist; int windowlistlength; - int keyboard; Atom WM_DELETE_WINDOW; SDL_scancode key_layout[256]; } SDL_VideoData; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 18c0e478e..699740418 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -22,6 +22,7 @@ #include "SDL_config.h" #include "../SDL_sysvideo.h" +#include "../SDL_pixels_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" @@ -34,6 +35,7 @@ #include "SDL_x11opengles.h" #endif +#include "SDL_timer.h" #include "SDL_syswm.h" #define _NET_WM_STATE_REMOVE 0l @@ -67,7 +69,6 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) int numwindows = videodata->numwindows; int windowlistlength = videodata->windowlistlength; SDL_WindowData **windowlist = videodata->windowlist; - int index; /* Allocate the window data */ data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); @@ -275,8 +276,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) if (visual->class == PseudoColor) { printf("asking for PseudoColor\n"); - Status status; - XStandardColormap cmap; +/* Status status; */ XColor *colorcells; Colormap colormap; Sint32 pix; @@ -387,7 +387,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) } } else if (visual->class == DirectColor) { Status status; - XStandardColormap cmap; XColor *colorcells; Colormap colormap; int i; @@ -397,9 +396,9 @@ X11_CreateWindow(_THIS, SDL_Window * window) int rshift, gshift, bshift; /* Is the colormap we need already registered in SDL? */ - if (colormap = - X11_LookupColormap(data->display, - displaydata->screen, visual->visualid)) { + if ((colormap = + X11_LookupColormap(data->display, + displaydata->screen, visual->visualid))) { xattr.colormap = colormap; /* printf("found existing colormap\n"); */ } else { @@ -647,7 +646,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* Tell KDE to keep fullscreen windows on top */ if (window->flags & SDL_WINDOW_FULLSCREEN) { XEvent ev; - long mask; SDL_zero(ev); ev.xclient.type = ClientMessage; @@ -710,32 +708,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) } #endif -#if SDL_VIDEO_DRIVER_X11_XINPUT - /* we're informing the display what extension events we want to receive from it */ - { - int i, j, n = 0; - XEventClass xevents[256]; - - for (i = 0; i < SDL_GetNumMice(); ++i) { - SDL_Mouse *mouse; - X11_MouseData *data; - - mouse = SDL_GetMouse(i); - data = (X11_MouseData *) mouse->driverdata; - if (!data) { - continue; - } - - for (j = 0; j < data->num_xevents; ++j) { - xevents[n++] = data->xevents[j]; - } - } - if (n > 0) { - XSelectExtensionEvent(data->display, w, xevents, n); - } - } -#endif - return 0; } @@ -869,8 +841,6 @@ void X11_SetWindowPosition(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - SDL_DisplayData *displaydata = - (SDL_DisplayData *) window->display->driverdata; Display *display = data->videodata->display; int x, y; diff --git a/test/common.c b/test/common.c index 694fa196c..a3e19c909 100644 --- a/test/common.c +++ b/test/common.c @@ -929,45 +929,44 @@ PrintEvent(SDL_Event * event) break; case SDL_KEYDOWN: fprintf(stderr, - "Keyboard %d: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s", - event->key.which, event->key.windowID, + "Keyboard: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s", + event->key.windowID, event->key.keysym.scancode, SDL_GetScancodeName(event->key.keysym.scancode), event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); break; case SDL_KEYUP: fprintf(stderr, - "Keyboard %d: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s", - event->key.which, event->key.windowID, + "Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s", + event->key.windowID, event->key.keysym.scancode, SDL_GetScancodeName(event->key.keysym.scancode), event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); break; case SDL_TEXTINPUT: - fprintf(stderr, "Keyboard %d: text input \"%s\" in window %d", - event->text.which, event->text.text, event->text.windowID); + fprintf(stderr, "Keyboard: text input \"%s\" in window %d", + event->text.text, event->text.windowID); break; case SDL_MOUSEMOTION: - fprintf(stderr, "Mouse %d: moved to %d,%d (%d,%d) in window %d", - event->motion.which, event->motion.x, event->motion.y, + fprintf(stderr, "Mouse: moved to %d,%d (%d,%d) in window %d", + event->motion.x, event->motion.y, event->motion.xrel, event->motion.yrel, event->motion.windowID); break; case SDL_MOUSEBUTTONDOWN: - fprintf(stderr, "Mouse %d: button %d pressed at %d,%d in window %d", - event->button.which, event->button.button, event->button.x, - event->button.y, event->button.windowID); + fprintf(stderr, "Mouse: button %d pressed at %d,%d in window %d", + event->button.button, event->button.x, event->button.y, + event->button.windowID); break; case SDL_MOUSEBUTTONUP: - fprintf(stderr, "Mouse %d: button %d released at %d,%d in window %d", - event->button.which, event->button.button, event->button.x, - event->button.y, event->button.windowID); + fprintf(stderr, "Mouse: button %d released at %d,%d in window %d", + event->button.button, event->button.x, event->button.y, + event->button.windowID); break; case SDL_MOUSEWHEEL: fprintf(stderr, - "Mouse %d: wheel scrolled %d in x and %d in y in window %d", - event->wheel.which, event->wheel.x, event->wheel.y, - event->wheel.windowID); + "Mouse: wheel scrolled %d in x and %d in y in window %d", + event->wheel.x, event->wheel.y, event->wheel.windowID); break; case SDL_JOYBALLMOTION: fprintf(stderr, "Joystick %d: ball %d moved by %d,%d", diff --git a/test/testime.c b/test/testime.c index cf6768ac8..6975d652d 100644 --- a/test/testime.c +++ b/test/testime.c @@ -279,8 +279,8 @@ int main(int argc, char *argv[]) } fprintf(stderr, - "Keyboard %d: scancode 0x%08X = %s, keycode 0x%08X = %s\n", - event.key.which, event.key.keysym.scancode, + "Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n", + event.key.keysym.scancode, SDL_GetScancodeName(event.key.keysym.scancode), event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym)); break; @@ -290,8 +290,7 @@ int main(int argc, char *argv[]) markedRect.w < 0) break; - fprintf(stderr, "Keyboard %d: text input \"%s\"\n", - event.text.which, event.text.text); + fprintf(stderr, "Keyboard: text input \"%s\"\n", event.text.text); if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text)) strcpy(text + SDL_strlen(text), event.text.text); diff --git a/test/testintersections.c b/test/testintersections.c index 7327e3a02..9eed373e2 100644 --- a/test/testintersections.c +++ b/test/testintersections.c @@ -288,20 +288,16 @@ main(int argc, char *argv[]) CommonEvent(state, &event, &done); switch (event.type) { case SDL_MOUSEBUTTONDOWN: - if (event.button.which == 0) { - mouse_begin_x = event.button.x; - mouse_begin_y = event.button.y; - } + mouse_begin_x = event.button.x; + mouse_begin_y = event.button.y; break; case SDL_MOUSEBUTTONUP: - if (event.button.which == 0) { - if (event.button.button == 3) - add_line(mouse_begin_x, mouse_begin_y, event.button.x, - event.button.y); - if (event.button.button == 1) - add_rect(mouse_begin_x, mouse_begin_y, event.button.x, - event.button.y); - } + if (event.button.button == 3) + add_line(mouse_begin_x, mouse_begin_y, event.button.x, + event.button.y); + if (event.button.button == 1) + add_rect(mouse_begin_x, mouse_begin_y, event.button.x, + event.button.y); break; case SDL_KEYDOWN: switch (event.key.keysym.sym) { From b249f9bd9617daa3ecf65e33e8cb7f4bf6d142f8 Mon Sep 17 00:00:00 2001 From: Eric Wing Date: Wed, 12 May 2010 12:49:28 -0700 Subject: [PATCH 02/44] Added the automated test plist file and modified .hgignore to be less aggressive. Discovered that the new plist file for the automated test was not checked in because the .hgignore file was too aggressive. I changed the .hgignore to not ignore the Xcode directory and instead added a longer list of things to ignore. --- .hgignore | 14 +++++++++++++- Xcode/SDL/testsdl-Info.plist | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Xcode/SDL/testsdl-Info.plist diff --git a/.hgignore b/.hgignore index f9ca7b01b..8ec7021e9 100644 --- a/.hgignore +++ b/.hgignore @@ -14,7 +14,19 @@ build build-deps VisualC VisualCE -Xcode +# for Xcode +*.orig +*.swp +*.tmp +*.rej +*~ +*.o +*.mode1* +*.model* +*.perspective* +*.perspective* +*.pbxuser +(^|/)build($|/) .DS_Store sdl.pc include/SDL_config.h diff --git a/Xcode/SDL/testsdl-Info.plist b/Xcode/SDL/testsdl-Info.plist new file mode 100644 index 000000000..88ac6abca --- /dev/null +++ b/Xcode/SDL/testsdl-Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + SDLMain + NSPrincipalClass + NSApplication + + From 5282223c793ab3e0b77587d9d36d1f99644cbdaa Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 24 May 2010 22:56:36 -0700 Subject: [PATCH 03/44] SDL_KillThread() is no longer supported - it was always dangerous! :) --- include/SDL_compat.h | 1 + include/SDL_thread.h | 10 ---------- src/SDL_compat.c | 1 - src/thread/SDL_thread.c | 6 ------ 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/include/SDL_compat.h b/include/SDL_compat.h index 3b7a7acf7..1af228ac5 100644 --- a/include/SDL_compat.h +++ b/include/SDL_compat.h @@ -324,6 +324,7 @@ extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); #define SDL_RenderPoint SDL_RenderDrawPoint #define SDL_RenderLine SDL_RenderDrawLine #define SDL_RenderFill(X) (X) ? SDL_RenderFillRect(X) : SDL_RenderClear() +#define SDL_KillThread(X) extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); diff --git a/include/SDL_thread.h b/include/SDL_thread.h index fc3d36d75..cca172dee 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -149,16 +149,6 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); */ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); -/** - * \deprecated This function is here for binary compatibility with legacy apps, - * but in SDL 1.3 and later, it's a no-op. - * - * You cannot forcibly kill a thread in a safe manner on many platforms. You - * should instead find a way to alert your thread that it is time to terminate, - * and then have it gracefully exit on its own. Do not ever call this function! - */ -extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread * thread); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/SDL_compat.c b/src/SDL_compat.c index 0c094e8a7..87feffc8d 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -1750,7 +1750,6 @@ SDL_EnableUNICODE(int enable) return previous; } - int SDL_putenv(const char *_var) { diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 08181cac9..8004757de 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -305,10 +305,4 @@ SDL_GetThreadID(SDL_Thread * thread) return id; } -void -SDL_KillThread(SDL_Thread * thread) -{ - /* This is a no-op in SDL 1.3 and later. */ -} - /* vi: set ts=4 sw=4 expandtab: */ From 8340558395e94bc65652e2a256601af7abf13ed4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Jun 2010 21:09:45 -0700 Subject: [PATCH 04/44] Fixed wording for consistency --- include/SDL_mutex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_mutex.h b/include/SDL_mutex.h index dcafbb7e2..e066f944b 100644 --- a/include/SDL_mutex.h +++ b/include/SDL_mutex.h @@ -194,7 +194,7 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); * * \return 0 when it is signaled, or -1 on error. */ -extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mut); +extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); /** * Waits for at most \c ms milliseconds, and returns 0 if the condition From e16f04a67a626521e329035ad57781f1ac559044 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 17 Jun 2010 12:33:05 -0700 Subject: [PATCH 05/44] Fixed mouse focus window reporting FIXME: Should the window be a parameter to the mouse events again? --- src/video/win32/SDL_win32events.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/video/win32/SDL_win32events.c diff --git a/src/video/win32/SDL_win32events.c b/src/video/win32/SDL_win32events.c old mode 100644 new mode 100755 index ed025a254..3ed95fec9 --- a/src/video/win32/SDL_win32events.c +++ b/src/video/win32/SDL_win32events.c @@ -176,23 +176,24 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) returnCode = 0; break; - case WM_MOUSEMOVE: + case WM_MOUSEMOVE: + SDL_SetMouseFocus(data->window); SDL_SendMouseMotion(0, LOWORD(lParam), HIWORD(lParam)); break; case WM_LBUTTONDOWN: + SDL_SetMouseFocus(data->window); SDL_SendMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT); break; case WM_LBUTTONUP: + SDL_SetMouseFocus(data->window); SDL_SendMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT); break; case WM_MOUSELEAVE: - { - if (SDL_GetMouseFocus() == data->window) { - SDL_SetMouseFocus(NULL); - } + if (SDL_GetMouseFocus() == data->window) { + SDL_SetMouseFocus(NULL); } returnCode = 0; break; From ad364363d4840c351490afb5ae853669aee7c8a6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 17 Jun 2010 22:23:20 -0700 Subject: [PATCH 06/44] Hello Sam. I did fix/update the SDL 1.3 pandora port today ( 11 june 2010 ) and you can find the "hg diff" attached :) David Carr? ( Cpasjuste ) --- Makefile.pandora | 7 ++++--- include/SDL_config_pandora.h | 6 ++++++ src/video/pandora/SDL_pandora.h | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile.pandora b/Makefile.pandora index 24e4e0bab..60ac8d563 100644 --- a/Makefile.pandora +++ b/Makefile.pandora @@ -12,14 +12,15 @@ CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp TARGET = libSDL.a -SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c \ +SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \ ./src/joystick/*.c ./src/haptic/*.c ./src/power/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \ ./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c ./src/audio/dma/*.c \ ./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \ ./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \ - ./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c ./src/cdrom/dummy/*.c \ - ./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c + ./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \ + ./src/atomic/linux/*.c \ + ./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') diff --git a/include/SDL_config_pandora.h b/include/SDL_config_pandora.h index 227831e63..fbdec93e1 100644 --- a/include/SDL_config_pandora.h +++ b/include/SDL_config_pandora.h @@ -28,6 +28,12 @@ /* General platform specific identifiers */ #include "SDL_platform.h" +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + #define SDL_HAS_64BIT_TYPE 1 #define SDL_BYTEORDER 1234 diff --git a/src/video/pandora/SDL_pandora.h b/src/video/pandora/SDL_pandora.h index 759fc39e4..8597baa07 100644 --- a/src/video/pandora/SDL_pandora.h +++ b/src/video/pandora/SDL_pandora.h @@ -68,8 +68,8 @@ typedef struct SDL_WindowData /* Display and window functions */ int PND_videoinit(_THIS); void PND_videoquit(_THIS); -void PND_getdisplaymodes(_THIS); -int PND_setdisplaymode(_THIS, SDL_DisplayMode * mode); +void PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display); +int PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); int PND_setdisplaypalette(_THIS, SDL_Palette * palette); int PND_getdisplaypalette(_THIS, SDL_Palette * palette); int PND_setdisplaygammaramp(_THIS, Uint16 * ramp); From bf21af2e24e603a084df8f8f4f2b00027dd6dd07 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 26 Jun 2010 08:56:48 -0700 Subject: [PATCH 07/44] Mostly cleaned up warnings with -Wmissing-prototypes --- src/SDL.c | 14 +++---------- src/SDL_assert.c | 1 + src/SDL_assert_c.h | 26 +++++++++++++++++++++++++ src/SDL_compat.c | 2 +- src/SDL_error.c | 2 +- src/SDL_error_c.h | 1 + src/audio/SDL_audio.c | 10 +++++----- src/cpuinfo/SDL_cpuinfo.c | 2 +- src/file/cocoa/SDL_rwopsbundlesupport.m | 2 ++ src/haptic/SDL_haptic.c | 1 + src/haptic/SDL_haptic_c.h | 26 +++++++++++++++++++++++++ src/joystick/SDL_joystick_c.h | 4 ++++ src/main/dummy/SDL_dummy_main.c | 5 ++++- src/thread/SDL_thread.c | 4 ++-- src/video/SDL_blit_slow.c | 1 + src/video/SDL_renderer_sw.c | 1 + src/video/SDL_stretch.c | 4 ++-- src/video/SDL_sysvideo.h | 2 +- src/video/SDL_video.c | 12 +----------- src/video/x11/SDL_x11events.c | 2 +- src/video/x11/SDL_x11render.c | 1 + src/video/x11/SDL_x11video.c | 2 +- src/video/x11/SDL_x11video.h | 2 +- 23 files changed, 88 insertions(+), 39 deletions(-) create mode 100644 src/SDL_assert_c.h create mode 100644 src/haptic/SDL_haptic_c.h diff --git a/src/SDL.c b/src/SDL.c index 52f141578..49620a8e1 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -25,21 +25,15 @@ #include "SDL.h" #include "SDL_fatal.h" -#include "SDL_assert.h" +#include "SDL_assert_c.h" +#include "haptic/SDL_haptic_c.h" +#include "joystick/SDL_joystick_c.h" #if !SDL_VIDEO_DISABLED #include "video/SDL_leaks.h" #endif /* Initialization/Cleanup routines */ -#if !SDL_JOYSTICK_DISABLED -extern int SDL_JoystickInit(void); -extern void SDL_JoystickQuit(void); -#endif -#if !SDL_HAPTIC_DISABLED -extern int SDL_HapticInit(void); -extern int SDL_HapticQuit(void); -#endif #if !SDL_TIMERS_DISABLED extern void SDL_StartTicks(void); extern int SDL_TimerInit(void); @@ -50,8 +44,6 @@ extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowDestroy(void); #endif -extern int SDL_AssertionsInit(void); -extern void SDL_AssertionsQuit(void); /* The initialized subsystems */ static Uint32 SDL_initialized = 0; diff --git a/src/SDL_assert.c b/src/SDL_assert.c index 34cf45868..0c433d80a 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -22,6 +22,7 @@ #include "SDL.h" #include "SDL_assert.h" +#include "SDL_assert_c.h" #include "video/SDL_sysvideo.h" #ifdef _WINDOWS diff --git a/src/SDL_assert_c.h b/src/SDL_assert_c.h new file mode 100644 index 000000000..eb14cfbe0 --- /dev/null +++ b/src/SDL_assert_c.h @@ -0,0 +1,26 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +extern int SDL_AssertionsInit(void); +extern void SDL_AssertionsQuit(void); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/SDL_compat.c b/src/SDL_compat.c index 87feffc8d..bb8e46ba8 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -417,7 +417,7 @@ SetupScreenSaver(int flags) } } -int +static int SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) { int w, h; diff --git a/src/SDL_error.c b/src/SDL_error.c index 894409d86..55d183a5d 100644 --- a/src/SDL_error.c +++ b/src/SDL_error.c @@ -116,7 +116,7 @@ SDL_SetError(const char *fmt, ...) /* This function has a bit more overhead than most error functions so that it supports internationalization and thread-safe errors. */ -char * +static char * SDL_GetErrorMsg(char *errstr, unsigned int maxlen) { SDL_error *error; diff --git a/src/SDL_error_c.h b/src/SDL_error_c.h index bdb59517a..54501f5fa 100644 --- a/src/SDL_error_c.h +++ b/src/SDL_error_c.h @@ -58,4 +58,5 @@ typedef struct SDL_error } SDL_error; #endif /* _SDL_error_c_h */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index fe2f3ff86..e3b02cf94 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -257,7 +257,7 @@ finalize_audio_entry_points(void) /* Streaming functions (for when the input and output buffer sizes are different) */ /* Write [length] bytes from buf into the streamer */ -void +static void SDL_StreamWrite(SDL_AudioStreamer * stream, Uint8 * buf, int length) { int i; @@ -269,7 +269,7 @@ SDL_StreamWrite(SDL_AudioStreamer * stream, Uint8 * buf, int length) } /* Read [length] bytes out of the streamer into buf */ -void +static void SDL_StreamRead(SDL_AudioStreamer * stream, Uint8 * buf, int length) { int i; @@ -280,14 +280,14 @@ SDL_StreamRead(SDL_AudioStreamer * stream, Uint8 * buf, int length) } } -int +static int SDL_StreamLength(SDL_AudioStreamer * stream) { return (stream->write_pos - stream->read_pos) % stream->max_len; } /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */ -int +static int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) { /* First try to allocate the buffer */ @@ -307,7 +307,7 @@ SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) } /* Deinitialize the stream simply by freeing the buffer */ -void +static void SDL_StreamDeinit(SDL_AudioStreamer * stream) { if (stream->buffer != NULL) { diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index f631e4faf..7fa382818 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -335,7 +335,7 @@ SDL_GetCPUCount() } /* Oh, such a sweet sweet trick, just not very useful. :) */ -const char * +static const char * SDL_GetCPUType() { static char SDL_CPUType[48]; diff --git a/src/file/cocoa/SDL_rwopsbundlesupport.m b/src/file/cocoa/SDL_rwopsbundlesupport.m index d9ce0210a..39b4c0e9c 100644 --- a/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,8 @@ #ifdef __APPLE__ #import +#include "SDL_rwopsbundlesupport.h" + /* For proper OS X applications, the resources are contained inside the application bundle. So the strategy is to first check the application bundle for the file, then fallback to the current working directory. Note: One additional corner-case is if the resource is in a framework's resource bundle instead of the app. diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index 2ac4a12b6..af8c39a77 100644 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -22,6 +22,7 @@ #include "SDL_config.h" #include "SDL_syshaptic.h" +#include "SDL_haptic_c.h" #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ diff --git a/src/haptic/SDL_haptic_c.h b/src/haptic/SDL_haptic_c.h new file mode 100644 index 000000000..4144a0fbc --- /dev/null +++ b/src/haptic/SDL_haptic_c.h @@ -0,0 +1,26 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +extern int SDL_HapticInit(void); +extern void SDL_HapticQuit(void); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h index a384b3b8e..e0f8529e2 100644 --- a/src/joystick/SDL_joystick_c.h +++ b/src/joystick/SDL_joystick_c.h @@ -27,6 +27,10 @@ /* The number of available joysticks on the system */ extern Uint8 SDL_numjoysticks; +/* Initialization and shutdown functions */ +extern int SDL_JoystickInit(void); +extern void SDL_JoystickQuit(void); + /* Internal event queueing functions */ extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value); diff --git a/src/main/dummy/SDL_dummy_main.c b/src/main/dummy/SDL_dummy_main.c index e7c2bb6c9..e5a1351f1 100644 --- a/src/main/dummy/SDL_dummy_main.c +++ b/src/main/dummy/SDL_dummy_main.c @@ -12,7 +12,10 @@ main(int argc, char *argv[]) #else /* Nothing to do on this platform */ int -SDL_main_stub_symbol() +SDL_main_stub_symbol(void); + +int +SDL_main_stub_symbol(void) { return 0; } diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 8004757de..71a660e83 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -38,7 +38,7 @@ static int SDL_numthreads = 0; static SDL_Thread **SDL_Threads = NULL; static SDL_mutex *thread_lock = NULL; -int +static int SDL_ThreadsInit(void) { int retval; @@ -56,7 +56,7 @@ SDL_ThreadsInit(void) clean up threads here. If any threads are still running after this call, they will no longer have access to any per-thread data. */ -void +static void SDL_ThreadsQuit(void) { SDL_mutex *mutex; diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c index 4e270e15f..d9b43fd23 100644 --- a/src/video/SDL_blit_slow.c +++ b/src/video/SDL_blit_slow.c @@ -23,6 +23,7 @@ #include "SDL_video.h" #include "SDL_blit.h" +#include "SDL_blit_slow.h" /* The ONE TRUE BLITTER * This puppy has to handle all the unoptimized cases - yes, it's slow. diff --git a/src/video/SDL_renderer_sw.c b/src/video/SDL_renderer_sw.c index fcc902b0a..a9911f35d 100644 --- a/src/video/SDL_renderer_sw.c +++ b/src/video/SDL_renderer_sw.c @@ -26,6 +26,7 @@ #include "SDL_pixels_c.h" #include "SDL_rect_c.h" #include "SDL_yuv_sw_c.h" +#include "SDL_renderer_sw.h" /* SDL surface based renderer implementation */ diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index b0ad3a991..818d0dedc 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -151,7 +151,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp) #endif /* USE_ASM_STRETCH */ #define DEFINE_COPY_ROW(name, type) \ -void name(type *src, int src_w, type *dst, int dst_w) \ +static void name(type *src, int src_w, type *dst, int dst_w) \ { \ int i; \ int pos, inc; \ @@ -175,7 +175,7 @@ DEFINE_COPY_ROW(copy_row4, Uint32) /* *INDENT-ON* */ /* The ASM code doesn't handle 24-bpp stretch blits */ -void +static void copy_row3(Uint8 * src, int src_w, Uint8 * dst, int dst_w) { int i; diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index bc2991287..0a82717ec 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -418,7 +418,7 @@ extern VideoBootStrap PND_bootstrap; #define SDL_CurrentDisplay (&_this->displays[_this->current_display]) #define SDL_CurrentRenderer (SDL_CurrentDisplay->current_renderer) -extern SDL_VideoDevice *SDL_GetVideoDevice(); +extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display); extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 8ac0d1d4c..db8b5d3cb 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -304,7 +304,7 @@ SDL_GetCurrentVideoDriver() } SDL_VideoDevice * -SDL_GetVideoDevice() +SDL_GetVideoDevice(void) { return _this; } @@ -717,16 +717,6 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * return 0; } -int -SDL_SetDisplayMode(const SDL_DisplayMode * mode) -{ - if (!_this) { - SDL_UninitializedVideo(); - return -1; - } - return SDL_SetDisplayModeForDisplay(SDL_CurrentDisplay, mode); -} - int SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode) { diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 6b7003994..1269de037 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -296,7 +296,7 @@ X11_DispatchEvent(_THIS) } /* Ack! XPending() actually performs a blocking read if no events available */ -int +static int X11_Pending(Display * display) { /* Flush the display connection and look to see if events are queued */ diff --git a/src/video/x11/SDL_x11render.c b/src/video/x11/SDL_x11render.c index dcc26c1dc..a1027f925 100644 --- a/src/video/x11/SDL_x11render.c +++ b/src/video/x11/SDL_x11render.c @@ -26,6 +26,7 @@ #include /* For INT_MIN and INT_MAX */ #include "SDL_x11video.h" +#include "SDL_x11render.h" #include "../SDL_rect_c.h" #include "../SDL_pixels_c.h" #include "../SDL_yuv_sw_c.h" diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 2494bce39..86a9e7db9 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -292,7 +292,7 @@ X11_VideoQuit(_THIS) } SDL_bool -X11_UseDirectColorVisuals() +X11_UseDirectColorVisuals(void) { /* Once we implement DirectColor colormaps and gamma ramp support... return SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ? SDL_FALSE : SDL_TRUE; diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index 9989911c9..a550f8485 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -71,7 +71,7 @@ typedef struct SDL_VideoData SDL_scancode key_layout[256]; } SDL_VideoData; -extern SDL_bool X11_UseDirectColorVisuals(); +extern SDL_bool X11_UseDirectColorVisuals(void); #endif /* _SDL_x11video_h */ From 39782a2918cd1be4a6bf9d8d5891028c6b2c2e10 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 26 Jun 2010 08:58:06 -0700 Subject: [PATCH 08/44] Removed one more use of () --- src/video/uikit/jumphack.c | 2 +- src/video/uikit/jumphack.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/uikit/jumphack.c b/src/video/uikit/jumphack.c index 103c4e97a..982ddda3e 100644 --- a/src/video/uikit/jumphack.c +++ b/src/video/uikit/jumphack.c @@ -13,7 +13,7 @@ jmp_buf env; /* returns the jump environment for setting / getting purposes */ jmp_buf * -jump_env() +jump_env(void) { return &env; } diff --git a/src/video/uikit/jumphack.h b/src/video/uikit/jumphack.h index d2b7ceb0d..b517e6355 100644 --- a/src/video/uikit/jumphack.h +++ b/src/video/uikit/jumphack.h @@ -11,6 +11,6 @@ /* see SDL_uikitevents.m for more info */ -extern jmp_buf *jump_env(); +extern jmp_buf *jump_env(void); #endif From 888e4dab863595748bf07ade39d92f25d4f7b7a0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 27 Jun 2010 23:17:36 -0700 Subject: [PATCH 09/44] Typo in documentation --- include/SDL_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_atomic.h b/include/SDL_atomic.h index cd620c314..e3711433f 100644 --- a/include/SDL_atomic.h +++ b/include/SDL_atomic.h @@ -118,7 +118,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 * * * \return The value before it was decremented. * - * \param ptr Address of the value to fetch and drement + * \param ptr Address of the value to fetch and decrement */ extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr); From 196ab379a7d5bb0d0d570c37f9f46c3f44015f01 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 12:32:44 -0700 Subject: [PATCH 10/44] Fixed compile warning with latest mingw32 compiler --- src/thread/win32/SDL_syssem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thread/win32/SDL_syssem.c b/src/thread/win32/SDL_syssem.c index 67551e128..4fcb8c6e1 100644 --- a/src/thread/win32/SDL_syssem.c +++ b/src/thread/win32/SDL_syssem.c @@ -39,7 +39,7 @@ struct SDL_semaphore #else HANDLE id; #endif - Uint32 volatile count; + LONG volatile count; }; @@ -143,7 +143,7 @@ SDL_SemValue(SDL_sem * sem) SDL_SetError("Passed a NULL sem"); return 0; } - return sem->count; + return (Uint32)sem->count; } int From f375fbb00a3df4fb99f14dfbb0df45c410c5cf0d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 12:41:28 -0700 Subject: [PATCH 11/44] Make sure SDL gets installed to the correct prefix for the new cross-compiler tools. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 00c15101d..59df10bca 100644 --- a/configure.in +++ b/configure.in @@ -2420,7 +2420,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ARCH=win32 if test "$build" != "$host"; then # cross-compiling # Default cross-compile location - ac_default_prefix=/usr/local/cross-tools/i386-mingw32 + ac_default_prefix=/usr/local/cross-tools/$host else # Look for the location of the tools and install there if test "$BUILD_PREFIX" != ""; then From 9ef52f224f6aca816798488f8ded2dc786e39400 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 13:10:31 -0700 Subject: [PATCH 12/44] Added missing file to the automated test project --- VisualC/tests/automated/automated.vcproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VisualC/tests/automated/automated.vcproj b/VisualC/tests/automated/automated.vcproj index c5efa0a5f..76ce605ae 100755 --- a/VisualC/tests/automated/automated.vcproj +++ b/VisualC/tests/automated/automated.vcproj @@ -196,6 +196,10 @@ RelativePath="..\..\..\test\automated\rwops\rwops.c" > + + From d1a9277f8f602979860d8f9ba94ede143b30b178 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 13:10:47 -0700 Subject: [PATCH 13/44] Fixed revision type for SDL 1.3 --- test/automated/testsdl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/automated/testsdl.c b/test/automated/testsdl.c index 917e923e8..9d9f037b1 100644 --- a/test/automated/testsdl.c +++ b/test/automated/testsdl.c @@ -133,7 +133,7 @@ static void parse_options( int argc, char *argv[] ) int main( int argc, char *argv[] ) { int failed; - int rev; + const char *rev; SDL_version ver; /* Get options. */ @@ -145,7 +145,7 @@ int main( int argc, char *argv[] ) /* Print some text if verbose. */ SDL_GetVersion( &ver ); rev = SDL_GetRevision(); - SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n", + SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %s\n", ver.major, ver.minor, ver.patch, rev ); /* Automatic tests. */ From 23ace39e1515edd5275968ee41d865929dfda233 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 17:10:34 -0700 Subject: [PATCH 14/44] Split out the Visual C++ 2005 and 2008 projects explicitly. Added the test programs to the Visual C++ 2008 project. --- VisualC/SDL/{SDL.vcproj => SDL_VS2005.vcproj} | 0 VisualC/{SDL.sln => SDL_VS2005.sln} | 4 +- VisualC/SDL_VS2008.sln | 242 +++++++++++++++++- .../{SDLmain.vcproj => SDLmain_VS2005.vcproj} | 0 ...tomated.vcproj => automated_VS2008.vcproj} | 0 ...eckkeys.vcproj => checkkeys_VS2005.vcproj} | 0 .../tests/checkkeys/checkkeys_VS2008.vcproj | 216 ++++++++++++++++ .../{graywin.vcproj => graywin_VS2005.vcproj} | 0 VisualC/tests/graywin/graywin_VS2008.vcproj | 216 ++++++++++++++++ ...loopwave.vcproj => loopwave_VS2005.vcproj} | 0 VisualC/tests/loopwave/loopwave_VS2008.vcproj | 216 ++++++++++++++++ ...stalpha.vcproj => testalpha_VS2005.vcproj} | 0 .../tests/testalpha/testalpha_VS2008.vcproj | 216 ++++++++++++++++ ...stdraw2.vcproj => testdraw2_VS2005.vcproj} | 0 .../tests/testdraw2/testdraw2_VS2008.vcproj | 220 ++++++++++++++++ ...testfile.vcproj => testfile_VS2005.vcproj} | 0 VisualC/tests/testfile/testfile_VS2008.vcproj | 216 ++++++++++++++++ ...stgamma.vcproj => testgamma_VS2005.vcproj} | 0 .../tests/testgamma/testgamma_VS2008.vcproj | 216 ++++++++++++++++ .../{testgl.vcproj => testgl_VS2005.vcproj} | 0 VisualC/tests/testgl/testgl_VS2008.vcproj | 218 ++++++++++++++++ .../{testgl2.vcproj => testgl2_VS2005.vcproj} | 0 VisualC/tests/testgl2/testgl2_VS2008.vcproj | 222 ++++++++++++++++ ...tick.vcproj => testjoystick_VS2005.vcproj} | 0 .../testjoystick/testjoystick_VS2008.vcproj | 216 ++++++++++++++++ ...erlay.vcproj => testoverlay_VS2005.vcproj} | 0 .../testoverlay/testoverlay_VS2008.vcproj | 216 ++++++++++++++++ ...lay2.vcproj => testoverlay2_VS2005.vcproj} | 0 .../testoverlay2/testoverlay2_VS2008.vcproj | 216 ++++++++++++++++ ...lette.vcproj => testpalette_VS2005.vcproj} | 0 .../testpalette/testpalette_VS2008.vcproj | 216 ++++++++++++++++ ...form.vcproj => testplatform_VS2005.vcproj} | 0 .../testplatform/testplatform_VS2008.vcproj | 238 +++++++++++++++++ ...stpower.vcproj => testpower_VS2005.vcproj} | 0 .../tests/testpower/testpower_VS2008.vcproj | 225 ++++++++++++++++ ...sprite.vcproj => testsprite_VS2005.vcproj} | 0 .../tests/testsprite/testsprite_VS2008.vcproj | 216 ++++++++++++++++ ...rite2.vcproj => testsprite2_VS2005.vcproj} | 0 .../testsprite2/testsprite2_VS2008.vcproj | 220 ++++++++++++++++ ...dinfo.vcproj => testvidinfo_VS2005.vcproj} | 0 .../testvidinfo/testvidinfo_VS2008.vcproj | 216 ++++++++++++++++ .../{testwin.vcproj => testwin_VS2005.vcproj} | 0 VisualC/tests/testwin/testwin_VS2008.vcproj | 216 ++++++++++++++++ .../{testwm.vcproj => testwm_VS2005.vcproj} | 0 VisualC/tests/testwm/testwm_VS2008.vcproj | 216 ++++++++++++++++ 45 files changed, 4610 insertions(+), 3 deletions(-) rename VisualC/SDL/{SDL.vcproj => SDL_VS2005.vcproj} (100%) rename VisualC/{SDL.sln => SDL_VS2005.sln} (90%) rename VisualC/SDLmain/{SDLmain.vcproj => SDLmain_VS2005.vcproj} (100%) rename VisualC/tests/automated/{automated.vcproj => automated_VS2008.vcproj} (100%) rename VisualC/tests/checkkeys/{checkkeys.vcproj => checkkeys_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/checkkeys/checkkeys_VS2008.vcproj rename VisualC/tests/graywin/{graywin.vcproj => graywin_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/graywin/graywin_VS2008.vcproj rename VisualC/tests/loopwave/{loopwave.vcproj => loopwave_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/loopwave/loopwave_VS2008.vcproj rename VisualC/tests/testalpha/{testalpha.vcproj => testalpha_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testalpha/testalpha_VS2008.vcproj rename VisualC/tests/testdraw2/{testdraw2.vcproj => testdraw2_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testdraw2/testdraw2_VS2008.vcproj rename VisualC/tests/testfile/{testfile.vcproj => testfile_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testfile/testfile_VS2008.vcproj rename VisualC/tests/testgamma/{testgamma.vcproj => testgamma_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testgamma/testgamma_VS2008.vcproj rename VisualC/tests/testgl/{testgl.vcproj => testgl_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testgl/testgl_VS2008.vcproj rename VisualC/tests/testgl2/{testgl2.vcproj => testgl2_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testgl2/testgl2_VS2008.vcproj rename VisualC/tests/testjoystick/{testjoystick.vcproj => testjoystick_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testjoystick/testjoystick_VS2008.vcproj rename VisualC/tests/testoverlay/{testoverlay.vcproj => testoverlay_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testoverlay/testoverlay_VS2008.vcproj rename VisualC/tests/testoverlay2/{testoverlay2.vcproj => testoverlay2_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj rename VisualC/tests/testpalette/{testpalette.vcproj => testpalette_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testpalette/testpalette_VS2008.vcproj rename VisualC/tests/testplatform/{testplatform.vcproj => testplatform_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testplatform/testplatform_VS2008.vcproj rename VisualC/tests/testpower/{testpower.vcproj => testpower_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testpower/testpower_VS2008.vcproj rename VisualC/tests/testsprite/{testsprite.vcproj => testsprite_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testsprite/testsprite_VS2008.vcproj rename VisualC/tests/testsprite2/{testsprite2.vcproj => testsprite2_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testsprite2/testsprite2_VS2008.vcproj rename VisualC/tests/testvidinfo/{testvidinfo.vcproj => testvidinfo_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj rename VisualC/tests/testwin/{testwin.vcproj => testwin_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testwin/testwin_VS2008.vcproj rename VisualC/tests/testwm/{testwm.vcproj => testwm_VS2005.vcproj} (100%) mode change 100644 => 100755 create mode 100644 VisualC/tests/testwm/testwm_VS2008.vcproj diff --git a/VisualC/SDL/SDL.vcproj b/VisualC/SDL/SDL_VS2005.vcproj similarity index 100% rename from VisualC/SDL/SDL.vcproj rename to VisualC/SDL/SDL_VS2005.vcproj diff --git a/VisualC/SDL.sln b/VisualC/SDL_VS2005.sln similarity index 90% rename from VisualC/SDL.sln rename to VisualC/SDL_VS2005.sln index 83ea90b3b..b14a5a0cc 100644 --- a/VisualC/SDL.sln +++ b/VisualC/SDL_VS2005.sln @@ -1,8 +1,8 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL_VS2005.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain_VS2005.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/VisualC/SDL_VS2008.sln b/VisualC/SDL_VS2008.sln index d14f931b6..4a89f7611 100644 --- a/VisualC/SDL_VS2008.sln +++ b/VisualC/SDL_VS2008.sln @@ -6,12 +6,52 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain_ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{CE748C1F-3C21-4825-AA6A-F895A023F7E7}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "automated", "tests\automated\automated.vcproj", "{DDD710DB-EC7B-4CCB-BD75-535D401A2FE0}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "automated", "tests\automated\automated_VS2008.vcproj", "{DDD710DB-EC7B-4CCB-BD75-535D401A2FE0}" ProjectSection(ProjectDependencies) = postProject {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkkeys", "tests\checkkeys\checkkeys_VS2008.vcproj", "{26828762-C95D-4637-9CB1-7F0979523813}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graywin", "tests\graywin\graywin_VS2008.vcproj", "{0BCCA0BF-073E-439E-BCE0-C9353C177487}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loopwave", "tests\loopwave\loopwave_VS2008.vcproj", "{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testalpha", "tests\testalpha\testalpha_VS2008.vcproj", "{7814D54B-65D3-4677-AD77-E0B980B4FA2D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdraw2", "tests\testdraw2\testdraw2_VS2008.vcproj", "{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfile", "tests\testfile\testfile_VS2008.vcproj", "{CAE4F1D0-314F-4B10-805B-0EFD670133A0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamma", "tests\testgamma\testgamma_VS2008.vcproj", "{D974A0DF-3E2E-445C-A2EB-E899E9B582CB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgl", "tests\testgl\testgl_VS2008.vcproj", "{272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgl2", "tests\testgl2\testgl2_VS2008.vcproj", "{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjoystick", "tests\testjoystick\testjoystick_VS2008.vcproj", "{55812185-D13C-4022-9C81-32E0F4A08304}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testoverlay", "tests\testoverlay\testoverlay_VS2008.vcproj", "{9E320A14-B443-4DD7-8725-B7020DCFF730}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testoverlay2", "tests\testoverlay2\testoverlay2_VS2008.vcproj", "{B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpalette", "tests\testpalette\testpalette_VS2008.vcproj", "{493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testplatform", "tests\testplatform\testplatform_VS2008.vcproj", "{26932B24-EFC6-4E3A-B277-ED653DA37968}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpower", "tests\testpower\testpower_VS2008.vcproj", "{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite", "tests\testsprite\testsprite_VS2008.vcproj", "{5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2_VS2008.vcproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvidinfo", "tests\testvidinfo\testvidinfo_VS2008.vcproj", "{575FD095-EDAB-4BD4-B733-CD4A874F6FB0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testwin", "tests\testwin\testwin_VS2008.vcproj", "{0FFD1A21-11DB-492C-A989-E4F195B0C441}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testwm", "tests\testwm\testwm_VS2008.vcproj", "{6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -55,11 +95,211 @@ Global {DDD710DB-EC7B-4CCB-BD75-535D401A2FE0}.Release|Win32.ActiveCfg = Release|Win32 {DDD710DB-EC7B-4CCB-BD75-535D401A2FE0}.Release|Win32.Build.0 = Release|Win32 {DDD710DB-EC7B-4CCB-BD75-535D401A2FE0}.Release|x64.ActiveCfg = Release|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Debug|Win32.ActiveCfg = Debug|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Debug|Win32.Build.0 = Debug|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Debug|x64.ActiveCfg = Debug|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Release|Win32.ActiveCfg = Release|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Release|Win32.Build.0 = Release|Win32 + {26828762-C95D-4637-9CB1-7F0979523813}.Release|x64.ActiveCfg = Release|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Debug|Win32.ActiveCfg = Debug|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Debug|Win32.Build.0 = Debug|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Debug|x64.ActiveCfg = Debug|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Release|Win32.ActiveCfg = Release|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Release|Win32.Build.0 = Release|Win32 + {0BCCA0BF-073E-439E-BCE0-C9353C177487}.Release|x64.ActiveCfg = Release|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|Win32.ActiveCfg = Debug|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|Win32.Build.0 = Debug|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Debug|x64.ActiveCfg = Debug|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|Win32.ActiveCfg = Release|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|Win32.Build.0 = Release|Win32 + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}.Release|x64.ActiveCfg = Release|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Debug|Win32.ActiveCfg = Debug|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Debug|Win32.Build.0 = Debug|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Debug|x64.ActiveCfg = Debug|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Release|Win32.ActiveCfg = Release|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Release|Win32.Build.0 = Release|Win32 + {7814D54B-65D3-4677-AD77-E0B980B4FA2D}.Release|x64.ActiveCfg = Release|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|Win32.Build.0 = Debug|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Debug|x64.ActiveCfg = Debug|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|Win32.ActiveCfg = Release|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|Win32.Build.0 = Release|Win32 + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}.Release|x64.ActiveCfg = Release|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|Win32.ActiveCfg = Debug|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|Win32.Build.0 = Debug|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Debug|x64.ActiveCfg = Debug|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|Win32.ActiveCfg = Release|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|Win32.Build.0 = Release|Win32 + {CAE4F1D0-314F-4B10-805B-0EFD670133A0}.Release|x64.ActiveCfg = Release|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Debug|Win32.ActiveCfg = Debug|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Debug|Win32.Build.0 = Debug|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Debug|x64.ActiveCfg = Debug|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Release|Win32.ActiveCfg = Release|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Release|Win32.Build.0 = Release|Win32 + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB}.Release|x64.ActiveCfg = Release|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Debug|Win32.ActiveCfg = Debug|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Debug|Win32.Build.0 = Debug|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Debug|x64.ActiveCfg = Debug|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Release|Win32.ActiveCfg = Release|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Release|Win32.Build.0 = Release|Win32 + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}.Release|x64.ActiveCfg = Release|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|Win32.ActiveCfg = Debug|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|Win32.Build.0 = Debug|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Debug|x64.ActiveCfg = Debug|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|Win32.ActiveCfg = Release|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|Win32.Build.0 = Release|Win32 + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884}.Release|x64.ActiveCfg = Release|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|Win32.ActiveCfg = Debug|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|Win32.Build.0 = Debug|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Debug|x64.ActiveCfg = Debug|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Release|Win32.ActiveCfg = Release|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Release|Win32.Build.0 = Release|Win32 + {55812185-D13C-4022-9C81-32E0F4A08304}.Release|x64.ActiveCfg = Release|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Debug|Win32.ActiveCfg = Debug|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Debug|Win32.Build.0 = Debug|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Debug|x64.ActiveCfg = Debug|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Release|Win32.ActiveCfg = Release|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Release|Win32.Build.0 = Release|Win32 + {9E320A14-B443-4DD7-8725-B7020DCFF730}.Release|x64.ActiveCfg = Release|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|Win32.ActiveCfg = Debug|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|Win32.Build.0 = Debug|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Debug|x64.ActiveCfg = Debug|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|Win32.ActiveCfg = Release|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|Win32.Build.0 = Release|Win32 + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}.Release|x64.ActiveCfg = Release|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Debug|Win32.Build.0 = Debug|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Debug|x64.ActiveCfg = Debug|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Release|Win32.ActiveCfg = Release|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Release|Win32.Build.0 = Release|Win32 + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}.Release|x64.ActiveCfg = Release|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|Win32.ActiveCfg = Debug|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|Win32.Build.0 = Debug|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Debug|x64.ActiveCfg = Debug|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|Win32.ActiveCfg = Release|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|Win32.Build.0 = Release|Win32 + {26932B24-EFC6-4E3A-B277-ED653DA37968}.Release|x64.ActiveCfg = Release|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|Win32.ActiveCfg = Debug|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|Win32.Build.0 = Debug|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Debug|x64.ActiveCfg = Debug|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|Win32.ActiveCfg = Release|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|Win32.Build.0 = Release|Win32 + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}.Release|x64.ActiveCfg = Release|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Debug|Win32.ActiveCfg = Debug|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Debug|Win32.Build.0 = Debug|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Debug|x64.ActiveCfg = Debug|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Release|Win32.ActiveCfg = Release|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Release|Win32.Build.0 = Release|Win32 + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}.Release|x64.ActiveCfg = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Win32.ActiveCfg = Debug|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Win32.Build.0 = Debug|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|x64.ActiveCfg = Debug|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Win32.ActiveCfg = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Win32.Build.0 = Release|Win32 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|x64.ActiveCfg = Release|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Debug|Win32.ActiveCfg = Debug|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Debug|Win32.Build.0 = Debug|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Debug|x64.ActiveCfg = Debug|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Release|Win32.ActiveCfg = Release|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Release|Win32.Build.0 = Release|Win32 + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0}.Release|x64.ActiveCfg = Release|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Debug|Win32.ActiveCfg = Debug|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Debug|Win32.Build.0 = Debug|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Debug|x64.ActiveCfg = Debug|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Release|Win32.ActiveCfg = Release|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Release|Win32.Build.0 = Release|Win32 + {0FFD1A21-11DB-492C-A989-E4F195B0C441}.Release|x64.ActiveCfg = Release|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Debug|Win32.ActiveCfg = Debug|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Debug|Win32.Build.0 = Debug|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Debug|x64.ActiveCfg = Debug|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Release_NoSTDIO|Win32.ActiveCfg = Release|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Release_NoSTDIO|Win32.Build.0 = Release|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Release_NoSTDIO|x64.ActiveCfg = Release|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Release|Win32.ActiveCfg = Release|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Release|Win32.Build.0 = Release|Win32 + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {DDD710DB-EC7B-4CCB-BD75-535D401A2FE0} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {26828762-C95D-4637-9CB1-7F0979523813} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {0BCCA0BF-073E-439E-BCE0-C9353C177487} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {7814D54B-65D3-4677-AD77-E0B980B4FA2D} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {CAE4F1D0-314F-4B10-805B-0EFD670133A0} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {D974A0DF-3E2E-445C-A2EB-E899E9B582CB} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {8B5CFB38-CCBA-40A8-AD7A-89C57B070884} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {55812185-D13C-4022-9C81-32E0F4A08304} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {9E320A14-B443-4DD7-8725-B7020DCFF730} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {26932B24-EFC6-4E3A-B277-ED653DA37968} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {5D0930C0-7C91-4ECE-9014-7B7DDE9502E5} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {40FB7794-D3C3-4CFE-BCF4-A80C96635682} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {575FD095-EDAB-4BD4-B733-CD4A874F6FB0} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {0FFD1A21-11DB-492C-A989-E4F195B0C441} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} + {6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB} = {CE748C1F-3C21-4825-AA6A-F895A023F7E7} EndGlobalSection EndGlobal diff --git a/VisualC/SDLmain/SDLmain.vcproj b/VisualC/SDLmain/SDLmain_VS2005.vcproj similarity index 100% rename from VisualC/SDLmain/SDLmain.vcproj rename to VisualC/SDLmain/SDLmain_VS2005.vcproj diff --git a/VisualC/tests/automated/automated.vcproj b/VisualC/tests/automated/automated_VS2008.vcproj similarity index 100% rename from VisualC/tests/automated/automated.vcproj rename to VisualC/tests/automated/automated_VS2008.vcproj diff --git a/VisualC/tests/checkkeys/checkkeys.vcproj b/VisualC/tests/checkkeys/checkkeys_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/checkkeys/checkkeys.vcproj rename to VisualC/tests/checkkeys/checkkeys_VS2005.vcproj diff --git a/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj b/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj new file mode 100644 index 000000000..0b65f863b --- /dev/null +++ b/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/graywin/graywin.vcproj b/VisualC/tests/graywin/graywin_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/graywin/graywin.vcproj rename to VisualC/tests/graywin/graywin_VS2005.vcproj diff --git a/VisualC/tests/graywin/graywin_VS2008.vcproj b/VisualC/tests/graywin/graywin_VS2008.vcproj new file mode 100644 index 000000000..bad7e42fa --- /dev/null +++ b/VisualC/tests/graywin/graywin_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/loopwave/loopwave.vcproj b/VisualC/tests/loopwave/loopwave_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/loopwave/loopwave.vcproj rename to VisualC/tests/loopwave/loopwave_VS2005.vcproj diff --git a/VisualC/tests/loopwave/loopwave_VS2008.vcproj b/VisualC/tests/loopwave/loopwave_VS2008.vcproj new file mode 100644 index 000000000..bbd1e496c --- /dev/null +++ b/VisualC/tests/loopwave/loopwave_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testalpha/testalpha.vcproj b/VisualC/tests/testalpha/testalpha_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testalpha/testalpha.vcproj rename to VisualC/tests/testalpha/testalpha_VS2005.vcproj diff --git a/VisualC/tests/testalpha/testalpha_VS2008.vcproj b/VisualC/tests/testalpha/testalpha_VS2008.vcproj new file mode 100644 index 000000000..11a744cd2 --- /dev/null +++ b/VisualC/tests/testalpha/testalpha_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testdraw2/testdraw2.vcproj b/VisualC/tests/testdraw2/testdraw2_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testdraw2/testdraw2.vcproj rename to VisualC/tests/testdraw2/testdraw2_VS2005.vcproj diff --git a/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj b/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj new file mode 100644 index 000000000..9ae2e73be --- /dev/null +++ b/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testfile/testfile.vcproj b/VisualC/tests/testfile/testfile_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testfile/testfile.vcproj rename to VisualC/tests/testfile/testfile_VS2005.vcproj diff --git a/VisualC/tests/testfile/testfile_VS2008.vcproj b/VisualC/tests/testfile/testfile_VS2008.vcproj new file mode 100644 index 000000000..4a13e74b5 --- /dev/null +++ b/VisualC/tests/testfile/testfile_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testgamma/testgamma.vcproj b/VisualC/tests/testgamma/testgamma_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testgamma/testgamma.vcproj rename to VisualC/tests/testgamma/testgamma_VS2005.vcproj diff --git a/VisualC/tests/testgamma/testgamma_VS2008.vcproj b/VisualC/tests/testgamma/testgamma_VS2008.vcproj new file mode 100644 index 000000000..3f0c35662 --- /dev/null +++ b/VisualC/tests/testgamma/testgamma_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testgl/testgl.vcproj b/VisualC/tests/testgl/testgl_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testgl/testgl.vcproj rename to VisualC/tests/testgl/testgl_VS2005.vcproj diff --git a/VisualC/tests/testgl/testgl_VS2008.vcproj b/VisualC/tests/testgl/testgl_VS2008.vcproj new file mode 100644 index 000000000..f98638349 --- /dev/null +++ b/VisualC/tests/testgl/testgl_VS2008.vcproj @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testgl2/testgl2.vcproj b/VisualC/tests/testgl2/testgl2_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testgl2/testgl2.vcproj rename to VisualC/tests/testgl2/testgl2_VS2005.vcproj diff --git a/VisualC/tests/testgl2/testgl2_VS2008.vcproj b/VisualC/tests/testgl2/testgl2_VS2008.vcproj new file mode 100644 index 000000000..eff20713c --- /dev/null +++ b/VisualC/tests/testgl2/testgl2_VS2008.vcproj @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testjoystick/testjoystick.vcproj b/VisualC/tests/testjoystick/testjoystick_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testjoystick/testjoystick.vcproj rename to VisualC/tests/testjoystick/testjoystick_VS2005.vcproj diff --git a/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj b/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj new file mode 100644 index 000000000..415335b40 --- /dev/null +++ b/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testoverlay/testoverlay.vcproj b/VisualC/tests/testoverlay/testoverlay_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testoverlay/testoverlay.vcproj rename to VisualC/tests/testoverlay/testoverlay_VS2005.vcproj diff --git a/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj b/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj new file mode 100644 index 000000000..a9c3b1d28 --- /dev/null +++ b/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testoverlay2/testoverlay2.vcproj b/VisualC/tests/testoverlay2/testoverlay2_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testoverlay2/testoverlay2.vcproj rename to VisualC/tests/testoverlay2/testoverlay2_VS2005.vcproj diff --git a/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj b/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj new file mode 100644 index 000000000..7fde43adb --- /dev/null +++ b/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testpalette/testpalette.vcproj b/VisualC/tests/testpalette/testpalette_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testpalette/testpalette.vcproj rename to VisualC/tests/testpalette/testpalette_VS2005.vcproj diff --git a/VisualC/tests/testpalette/testpalette_VS2008.vcproj b/VisualC/tests/testpalette/testpalette_VS2008.vcproj new file mode 100644 index 000000000..d12a4ef70 --- /dev/null +++ b/VisualC/tests/testpalette/testpalette_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testplatform/testplatform.vcproj b/VisualC/tests/testplatform/testplatform_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testplatform/testplatform.vcproj rename to VisualC/tests/testplatform/testplatform_VS2005.vcproj diff --git a/VisualC/tests/testplatform/testplatform_VS2008.vcproj b/VisualC/tests/testplatform/testplatform_VS2008.vcproj new file mode 100644 index 000000000..5a229e9ce --- /dev/null +++ b/VisualC/tests/testplatform/testplatform_VS2008.vcproj @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testpower/testpower.vcproj b/VisualC/tests/testpower/testpower_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testpower/testpower.vcproj rename to VisualC/tests/testpower/testpower_VS2005.vcproj diff --git a/VisualC/tests/testpower/testpower_VS2008.vcproj b/VisualC/tests/testpower/testpower_VS2008.vcproj new file mode 100644 index 000000000..8cfb91276 --- /dev/null +++ b/VisualC/tests/testpower/testpower_VS2008.vcproj @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testsprite/testsprite.vcproj b/VisualC/tests/testsprite/testsprite_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testsprite/testsprite.vcproj rename to VisualC/tests/testsprite/testsprite_VS2005.vcproj diff --git a/VisualC/tests/testsprite/testsprite_VS2008.vcproj b/VisualC/tests/testsprite/testsprite_VS2008.vcproj new file mode 100644 index 000000000..3ff67303d --- /dev/null +++ b/VisualC/tests/testsprite/testsprite_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testsprite2/testsprite2.vcproj b/VisualC/tests/testsprite2/testsprite2_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testsprite2/testsprite2.vcproj rename to VisualC/tests/testsprite2/testsprite2_VS2005.vcproj diff --git a/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj b/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj new file mode 100644 index 000000000..08ebaa6e3 --- /dev/null +++ b/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testvidinfo/testvidinfo.vcproj b/VisualC/tests/testvidinfo/testvidinfo_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testvidinfo/testvidinfo.vcproj rename to VisualC/tests/testvidinfo/testvidinfo_VS2005.vcproj diff --git a/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj b/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj new file mode 100644 index 000000000..3f7aff8fa --- /dev/null +++ b/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testwin/testwin.vcproj b/VisualC/tests/testwin/testwin_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testwin/testwin.vcproj rename to VisualC/tests/testwin/testwin_VS2005.vcproj diff --git a/VisualC/tests/testwin/testwin_VS2008.vcproj b/VisualC/tests/testwin/testwin_VS2008.vcproj new file mode 100644 index 000000000..4c12e0d30 --- /dev/null +++ b/VisualC/tests/testwin/testwin_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VisualC/tests/testwm/testwm.vcproj b/VisualC/tests/testwm/testwm_VS2005.vcproj old mode 100644 new mode 100755 similarity index 100% rename from VisualC/tests/testwm/testwm.vcproj rename to VisualC/tests/testwm/testwm_VS2005.vcproj diff --git a/VisualC/tests/testwm/testwm_VS2008.vcproj b/VisualC/tests/testwm/testwm_VS2008.vcproj new file mode 100644 index 000000000..1cf27d790 --- /dev/null +++ b/VisualC/tests/testwm/testwm_VS2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From dbdac00dee2da2daee33891e3c08f801b5dbe475 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 17:14:37 -0700 Subject: [PATCH 15/44] Added dependencies on SDL.lib and SDLmain.lib to the test programs --- VisualC/SDL_VS2008.sln | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/VisualC/SDL_VS2008.sln b/VisualC/SDL_VS2008.sln index 4a89f7611..9943ee578 100644 --- a/VisualC/SDL_VS2008.sln +++ b/VisualC/SDL_VS2008.sln @@ -13,44 +13,124 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "automated", "tests\automate EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkkeys", "tests\checkkeys\checkkeys_VS2008.vcproj", "{26828762-C95D-4637-9CB1-7F0979523813}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graywin", "tests\graywin\graywin_VS2008.vcproj", "{0BCCA0BF-073E-439E-BCE0-C9353C177487}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loopwave", "tests\loopwave\loopwave_VS2008.vcproj", "{AAAD1CB5-7ADA-47AE-85A0-08A6EC48FAFB}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testalpha", "tests\testalpha\testalpha_VS2008.vcproj", "{7814D54B-65D3-4677-AD77-E0B980B4FA2D}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdraw2", "tests\testdraw2\testdraw2_VS2008.vcproj", "{8682FE1E-0CF6-4EDD-9BB5-1733D8C8B4DF}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testfile", "tests\testfile\testfile_VS2008.vcproj", "{CAE4F1D0-314F-4B10-805B-0EFD670133A0}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamma", "tests\testgamma\testgamma_VS2008.vcproj", "{D974A0DF-3E2E-445C-A2EB-E899E9B582CB}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgl", "tests\testgl\testgl_VS2008.vcproj", "{272D976B-A1DF-4DEB-BD7F-5C0D330E0C7D}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgl2", "tests\testgl2\testgl2_VS2008.vcproj", "{8B5CFB38-CCBA-40A8-AD7A-89C57B070884}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjoystick", "tests\testjoystick\testjoystick_VS2008.vcproj", "{55812185-D13C-4022-9C81-32E0F4A08304}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testoverlay", "tests\testoverlay\testoverlay_VS2008.vcproj", "{9E320A14-B443-4DD7-8725-B7020DCFF730}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testoverlay2", "tests\testoverlay2\testoverlay2_VS2008.vcproj", "{B51E0D74-F0A2-45A2-BD2A-8B7D95B8204A}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpalette", "tests\testpalette\testpalette_VS2008.vcproj", "{493A8F38-5DA5-4E2D-B5E9-9E69EE4ED1DC}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testplatform", "tests\testplatform\testplatform_VS2008.vcproj", "{26932B24-EFC6-4E3A-B277-ED653DA37968}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpower", "tests\testpower\testpower_VS2008.vcproj", "{C4E04D18-EF76-4B42-B4C2-16A1BACDC0A3}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite", "tests\testsprite\testsprite_VS2008.vcproj", "{5D0930C0-7C91-4ECE-9014-7B7DDE9502E5}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2_VS2008.vcproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvidinfo", "tests\testvidinfo\testvidinfo_VS2008.vcproj", "{575FD095-EDAB-4BD4-B733-CD4A874F6FB0}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testwin", "tests\testwin\testwin_VS2008.vcproj", "{0FFD1A21-11DB-492C-A989-E4F195B0C441}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testwm", "tests\testwm\testwm_VS2008.vcproj", "{6AF0724B-BAC1-4C9D-AFBF-F63B4A2FB8FB}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} = {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 89f3efbe74e6ce145c81303713995cb09de99ead Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 18:18:25 -0700 Subject: [PATCH 16/44] Removed SDL.lib and SDLmain.lib from the projects since the dependencies are set up properly. --- .../tests/checkkeys/checkkeys_VS2008.vcproj | 8 ------ VisualC/tests/graywin/graywin_VS2008.vcproj | 8 ------ VisualC/tests/loopwave/loopwave_VS2008.vcproj | 8 ------ .../tests/testalpha/testalpha_VS2008.vcproj | 8 ------ .../tests/testdraw2/testdraw2_VS2008.vcproj | 8 ------ VisualC/tests/testfile/testfile_VS2008.vcproj | 8 ------ .../tests/testgamma/testgamma_VS2008.vcproj | 8 ------ VisualC/tests/testgl/testgl_VS2008.vcproj | 8 ------ VisualC/tests/testgl2/testgl2_VS2008.vcproj | 8 ------ .../testjoystick/testjoystick_VS2008.vcproj | 8 ------ .../testoverlay/testoverlay_VS2008.vcproj | 8 ------ .../testoverlay2/testoverlay2_VS2008.vcproj | 8 ------ .../testpalette/testpalette_VS2008.vcproj | 8 ------ .../testplatform/testplatform_VS2008.vcproj | 26 ------------------- .../tests/testpower/testpower_VS2008.vcproj | 16 ------------ .../tests/testsprite/testsprite_VS2008.vcproj | 8 ------ .../testsprite2/testsprite2_VS2008.vcproj | 8 ------ .../testvidinfo/testvidinfo_VS2008.vcproj | 8 ------ VisualC/tests/testwin/testwin_VS2008.vcproj | 8 ------ VisualC/tests/testwm/testwm_VS2008.vcproj | 8 ------ 20 files changed, 186 deletions(-) diff --git a/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj b/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj index 0b65f863b..b2390d1af 100644 --- a/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj +++ b/VisualC/tests/checkkeys/checkkeys_VS2008.vcproj @@ -202,14 +202,6 @@ RelativePath="..\..\..\test\checkkeys.c" > - - - - diff --git a/VisualC/tests/graywin/graywin_VS2008.vcproj b/VisualC/tests/graywin/graywin_VS2008.vcproj index bad7e42fa..b525b9cab 100644 --- a/VisualC/tests/graywin/graywin_VS2008.vcproj +++ b/VisualC/tests/graywin/graywin_VS2008.vcproj @@ -202,14 +202,6 @@ RelativePath="..\..\..\test\graywin.c" > - - - - diff --git a/VisualC/tests/loopwave/loopwave_VS2008.vcproj b/VisualC/tests/loopwave/loopwave_VS2008.vcproj index bbd1e496c..dd75c3dbf 100644 --- a/VisualC/tests/loopwave/loopwave_VS2008.vcproj +++ b/VisualC/tests/loopwave/loopwave_VS2008.vcproj @@ -202,14 +202,6 @@ RelativePath="..\..\..\Test\Loopwave.c" > - - - - diff --git a/VisualC/tests/testalpha/testalpha_VS2008.vcproj b/VisualC/tests/testalpha/testalpha_VS2008.vcproj index 11a744cd2..dae85a03a 100644 --- a/VisualC/tests/testalpha/testalpha_VS2008.vcproj +++ b/VisualC/tests/testalpha/testalpha_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj b/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj index 9ae2e73be..4d8019519 100644 --- a/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj +++ b/VisualC/tests/testdraw2/testdraw2_VS2008.vcproj @@ -202,14 +202,6 @@ RelativePath="..\..\..\test\common.c" > - - - - diff --git a/VisualC/tests/testfile/testfile_VS2008.vcproj b/VisualC/tests/testfile/testfile_VS2008.vcproj index 4a13e74b5..fa365ad93 100644 --- a/VisualC/tests/testfile/testfile_VS2008.vcproj +++ b/VisualC/tests/testfile/testfile_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testgamma/testgamma_VS2008.vcproj b/VisualC/tests/testgamma/testgamma_VS2008.vcproj index 3f0c35662..03add592d 100644 --- a/VisualC/tests/testgamma/testgamma_VS2008.vcproj +++ b/VisualC/tests/testgamma/testgamma_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testgl/testgl_VS2008.vcproj b/VisualC/tests/testgl/testgl_VS2008.vcproj index f98638349..3712a9efe 100644 --- a/VisualC/tests/testgl/testgl_VS2008.vcproj +++ b/VisualC/tests/testgl/testgl_VS2008.vcproj @@ -200,14 +200,6 @@ - - - - diff --git a/VisualC/tests/testgl2/testgl2_VS2008.vcproj b/VisualC/tests/testgl2/testgl2_VS2008.vcproj index eff20713c..f9d7d833f 100644 --- a/VisualC/tests/testgl2/testgl2_VS2008.vcproj +++ b/VisualC/tests/testgl2/testgl2_VS2008.vcproj @@ -204,14 +204,6 @@ RelativePath="..\..\..\test\common.c" > - - - - diff --git a/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj b/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj index 415335b40..e856a7456 100644 --- a/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj +++ b/VisualC/tests/testjoystick/testjoystick_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj b/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj index a9c3b1d28..0fe6d5fef 100644 --- a/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj +++ b/VisualC/tests/testoverlay/testoverlay_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj b/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj index 7fde43adb..2a0f4168a 100644 --- a/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj +++ b/VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testpalette/testpalette_VS2008.vcproj b/VisualC/tests/testpalette/testpalette_VS2008.vcproj index d12a4ef70..8d58abd59 100644 --- a/VisualC/tests/testpalette/testpalette_VS2008.vcproj +++ b/VisualC/tests/testpalette/testpalette_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testplatform/testplatform_VS2008.vcproj b/VisualC/tests/testplatform/testplatform_VS2008.vcproj index 5a229e9ce..a9496fb66 100644 --- a/VisualC/tests/testplatform/testplatform_VS2008.vcproj +++ b/VisualC/tests/testplatform/testplatform_VS2008.vcproj @@ -202,35 +202,9 @@ - - - - - - - - - - diff --git a/VisualC/tests/testpower/testpower_VS2008.vcproj b/VisualC/tests/testpower/testpower_VS2008.vcproj index 8cfb91276..757e2b6a5 100644 --- a/VisualC/tests/testpower/testpower_VS2008.vcproj +++ b/VisualC/tests/testpower/testpower_VS2008.vcproj @@ -199,25 +199,9 @@ - - - - - - - diff --git a/VisualC/tests/testsprite/testsprite_VS2008.vcproj b/VisualC/tests/testsprite/testsprite_VS2008.vcproj index 3ff67303d..3d816b908 100644 --- a/VisualC/tests/testsprite/testsprite_VS2008.vcproj +++ b/VisualC/tests/testsprite/testsprite_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj b/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj index 08ebaa6e3..0f91830b9 100644 --- a/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj +++ b/VisualC/tests/testsprite2/testsprite2_VS2008.vcproj @@ -202,14 +202,6 @@ RelativePath="..\..\..\test\common.c" > - - - - diff --git a/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj b/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj index 3f7aff8fa..338b44a40 100644 --- a/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj +++ b/VisualC/tests/testvidinfo/testvidinfo_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testwin/testwin_VS2008.vcproj b/VisualC/tests/testwin/testwin_VS2008.vcproj index 4c12e0d30..8ccfe588c 100644 --- a/VisualC/tests/testwin/testwin_VS2008.vcproj +++ b/VisualC/tests/testwin/testwin_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - diff --git a/VisualC/tests/testwm/testwm_VS2008.vcproj b/VisualC/tests/testwm/testwm_VS2008.vcproj index 1cf27d790..ee6050dfa 100644 --- a/VisualC/tests/testwm/testwm_VS2008.vcproj +++ b/VisualC/tests/testwm/testwm_VS2008.vcproj @@ -198,14 +198,6 @@ - - - - From c6fb5117f5eac88129f3171a7919d56c359f06ce Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 22:45:15 -0700 Subject: [PATCH 17/44] Fixed usage message - it shouldn't have a printf format specifier --- test/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common.c b/test/common.c index a3e19c909..32d69e2fc 100644 --- a/test/common.c +++ b/test/common.c @@ -6,7 +6,7 @@ #include "common.h" #define VIDEO_USAGE \ -"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display %d] [--fullscreen | --windows N] [--title title] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--double] [--triple]" +"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--double] [--triple]" #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" From 19585e023184b49a52c527cf540b087d251506fb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 22:45:45 -0700 Subject: [PATCH 18/44] Removed obsolete test program. Ryan may resurrect it when the new multi-mouse code is implemented. --- test/Makefile.in | 5 +-- test/testmmousetablet.c | 67 ----------------------------------------- 2 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 test/testmmousetablet.c diff --git a/test/Makefile.in b/test/Makefile.in index 83e71a5d9..42677ecde 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -7,7 +7,7 @@ EXE = @EXE@ CFLAGS = @CFLAGS@ LIBS = @LIBS@ -TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testatomic$(EXE) testaudioinfo$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcursor$(EXE) testdraw2$(EXE) testdyngles$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testfill$(EXE) testgamma$(EXE) testgl2$(EXE) testgles$(EXE) testgl$(EXE) testhaptic$(EXE) testhread$(EXE) testiconv$(EXE) testime$(EXE) testintersections$(EXE) testjoystick$(EXE) testkeys$(EXE) testloadso$(EXE) testlock$(EXE) testmmousetablet$(EXE) testmultiaudio$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testpower$(EXE) testresample$(EXE) testsem$(EXE) testsprite2$(EXE) testsprite$(EXE) testspriteminimal$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm2$(EXE) testwm$(EXE) threadwin$(EXE) torturethread$(EXE) +TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testatomic$(EXE) testaudioinfo$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcursor$(EXE) testdraw2$(EXE) testdyngles$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testfill$(EXE) testgamma$(EXE) testgl2$(EXE) testgles$(EXE) testgl$(EXE) testhaptic$(EXE) testhread$(EXE) testiconv$(EXE) testime$(EXE) testintersections$(EXE) testjoystick$(EXE) testkeys$(EXE) testloadso$(EXE) testlock$(EXE) testmultiaudio$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testpower$(EXE) testresample$(EXE) testsem$(EXE) testsprite2$(EXE) testsprite$(EXE) testspriteminimal$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm2$(EXE) testwm$(EXE) threadwin$(EXE) torturethread$(EXE) all: Makefile $(TARGETS) @@ -149,9 +149,6 @@ testloadso$(EXE): $(srcdir)/testloadso.c testhaptic$(EXE): $(srcdir)/testhaptic.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) -testmmousetablet$(EXE): $(srcdir)/testmmousetablet.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) - testatomic$(EXE): $(srcdir)/testatomic.c $(CC) -o $@ $? $(CFLAGS) $(LIBS) diff --git a/test/testmmousetablet.c b/test/testmmousetablet.c deleted file mode 100644 index 4a85d9fac..000000000 --- a/test/testmmousetablet.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include "SDL.h" - -SDL_Surface *screen; -int quit = 0; - -int -main(int argc, char *argv[]) -{ - SDL_Event event; - int mice; - int i; - printf("Initing...\n"); - if (SDL_Init(0) != 0) { - return 1; - } - if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) { - return 1; - } else { - screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF); - } - mice = SDL_GetNumMice(); - printf("%d pointing devices found\n", mice); - for (i = 0; i < mice; ++i) { - printf("device index: %d name:%s\n", i, SDL_GetMouseName(i)); - } - while (quit != 1) { - if (SDL_PollEvent(&event) == 0) { - } else { - switch (event.type) { - case SDL_MOUSEMOTION: - printf - ("Device id: %d x: %d y: %d relx: %d rely: %d pressure: %d\n \ - pressure_max: %d pressure_min: %d current cursor:%d\n", - event.motion.which, event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel, - event.motion.pressure, event.motion.pressure_max, event.motion.pressure_min, - event.motion.cursor); - break; - case SDL_PROXIMITYIN: - printf("proximity in id: %d x: %d y: %d\n", - (int) event.proximity.which, event.proximity.x, - event.proximity.y); - break; - case SDL_PROXIMITYOUT: - printf("proximity out id: %d x: %d y: %d\n", - (int) event.proximity.which, event.proximity.x, - event.proximity.y); - break; - case SDL_MOUSEBUTTONDOWN: - printf("mouse button down id: %d button:%d\n", - event.button.which, event.button.button); - break; - case SDL_MOUSEBUTTONUP: - printf("mouse button up id: %d button: %d\n", - event.button.which, event.button.button); - break; - case SDL_QUIT: - printf("Quitting\n"); - SDL_QuitSubSystem(SDL_INIT_VIDEO); - SDL_Quit(); - quit = 1; - break; - } - } - } - return 0; -} From 8f7546ed3bb9fd0ecb25bb12ccfd583fca96b452 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 5 Jul 2010 22:48:13 -0700 Subject: [PATCH 19/44] Cleaned up the mouse window focus handling: you always pass in the relative window when sending a mouse event. Fixed a bug where only mouse wheel up was sent on Mac OS X Fixed a bug where mouse window focus was getting hosed by the fullscreen mouse code on Mac OS X --- src/events/SDL_mouse.c | 21 ++++++++++++++++----- src/events/SDL_mouse_c.h | 6 +++--- src/video/cocoa/SDL_cocoamouse.m | 16 ++++++++-------- src/video/cocoa/SDL_cocoawindow.m | 22 +++++++++++++++++----- src/video/win32/SDL_win32events.c | 9 +++------ src/video/x11/SDL_x11events.c | 6 +++--- 6 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index e8a9ccd75..87e47479b 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -112,7 +112,7 @@ SDL_SetMouseFocus(SDL_Window * window) } int -SDL_SendMouseMotion(int relative, int x, int y) +SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y) { SDL_Mouse *mouse = &SDL_mouse; int posted; @@ -120,6 +120,10 @@ SDL_SendMouseMotion(int relative, int x, int y) int yrel; int x_max = 0, y_max = 0; + if (window) { + SDL_SetMouseFocus(window); + } + /* the relative motion is calculated regarding the system cursor last position */ if (relative) { xrel = x; @@ -194,12 +198,16 @@ SDL_SendMouseMotion(int relative, int x, int y) } int -SDL_SendMouseButton(Uint8 state, Uint8 button) +SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button) { SDL_Mouse *mouse = &SDL_mouse; int posted; Uint32 type; + if (window) { + SDL_SetMouseFocus(window); + } + /* Figure out which event to perform */ switch (state) { case SDL_PRESSED: @@ -239,11 +247,15 @@ SDL_SendMouseButton(Uint8 state, Uint8 button) } int -SDL_SendMouseWheel(int x, int y) +SDL_SendMouseWheel(SDL_Window * window, int x, int y) { SDL_Mouse *mouse = &SDL_mouse; int posted; + if (window) { + SDL_SetMouseFocus(window); + } + if (!x && !y) { return 0; } @@ -304,8 +316,7 @@ SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) if (mouse->WarpMouse) { mouse->WarpMouse(mouse, window, x, y); } else { - SDL_SetMouseFocus(window); - SDL_SendMouseMotion(0, x, y); + SDL_SendMouseMotion(window, 0, x, y); } } diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index 284468fa9..0f0f6de54 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -40,13 +40,13 @@ extern void SDL_ResetMouse(void); extern void SDL_SetMouseFocus(SDL_Window * window); /* Send a mouse motion event */ -extern int SDL_SendMouseMotion(int relative, int x, int y); +extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y); /* Send a mouse button event */ -extern int SDL_SendMouseButton(Uint8 state, Uint8 button); +extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button); /* Send a mouse wheel event */ -extern int SDL_SendMouseWheel(int x, int y); +extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 02ad198b4..e3d70bfac 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -52,6 +52,7 @@ int i; NSPoint point = { 0, 0 }; SDL_Window *window; + SDL_Window *focus = SDL_GetMouseFocus(); /* See if there are any fullscreen windows that might handle this event */ window = NULL; @@ -66,19 +67,18 @@ point = [NSEvent mouseLocation]; point.x = point.x - bounds.x; point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - bounds.y; - if ((point.x >= 0 && point.x < candidate->w) || + if ((point.x >= 0 && point.x < candidate->w) && (point.y >= 0 && point.y < candidate->h)) { /* This is it! */ window = candidate; break; + } else if (candidate == focus) { + SDL_SetMouseFocus(NULL); } } } - /* Set the focus appropriately */ - SDL_SetMouseFocus(window); - - if (window) { + if (!window) { return; } @@ -86,18 +86,18 @@ case NSLeftMouseDown: case NSOtherMouseDown: case NSRightMouseDown: - SDL_SendMouseButton(SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber])); + SDL_SendMouseButton(window, SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber])); break; case NSLeftMouseUp: case NSOtherMouseUp: case NSRightMouseUp: - SDL_SendMouseButton(SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber])); + SDL_SendMouseButton(window, SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber])); break; case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: /* usually middle mouse dragged */ case NSMouseMoved: - SDL_SendMouseMotion(0, (int)point.x, (int)point.y); + SDL_SendMouseMotion(window, 0, (int)point.x, (int)point.y); break; default: /* just to avoid compiler warnings */ break; diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 1f3fc515e..be4045c89 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -171,7 +171,7 @@ - (void)mouseDown:(NSEvent *)theEvent button = [theEvent buttonNumber]; break; } - SDL_SendMouseButton(SDL_PRESSED, button); + SDL_SendMouseButton(_data->window, SDL_PRESSED, button); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -202,7 +202,7 @@ - (void)mouseUp:(NSEvent *)theEvent button = [theEvent buttonNumber]; break; } - SDL_SendMouseButton(SDL_RELEASED, button); + SDL_SendMouseButton(_data->window, SDL_RELEASED, button); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -228,8 +228,7 @@ - (void)mouseMoved:(NSEvent *)theEvent SDL_SetMouseFocus(NULL); } } else { - SDL_SetMouseFocus(_data->window); - SDL_SendMouseMotion(0, (int)point.x, (int)point.y); + SDL_SendMouseMotion(window, 0, (int)point.x, (int)point.y); } } @@ -250,7 +249,20 @@ - (void)otherMouseDragged:(NSEvent *)theEvent - (void)scrollWheel:(NSEvent *)theEvent { - SDL_SendMouseWheel((int)([theEvent deltaX]+0.9f), (int)([theEvent deltaY]+0.9f)); + float x = [theEvent deltaX]; + float y = [theEvent deltaY]; + + if (x > 0) { + x += 0.9f; + } else if (x < 0) { + x -= 0.9f; + } + if (y > 0) { + y += 0.9f; + } else if (y < 0) { + y -= 0.9f; + } + SDL_SendMouseWheel(_data->window, (int)x, (int)y); } @end diff --git a/src/video/win32/SDL_win32events.c b/src/video/win32/SDL_win32events.c index 3ed95fec9..1ea7e6c10 100755 --- a/src/video/win32/SDL_win32events.c +++ b/src/video/win32/SDL_win32events.c @@ -177,18 +177,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_MOUSEMOVE: - SDL_SetMouseFocus(data->window); - SDL_SendMouseMotion(0, LOWORD(lParam), HIWORD(lParam)); + SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_LBUTTONDOWN: - SDL_SetMouseFocus(data->window); - SDL_SendMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_LEFT); break; case WM_LBUTTONUP: - SDL_SetMouseFocus(data->window); - SDL_SendMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_LEFT); break; case WM_MOUSELEAVE: diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 1269de037..147dc626d 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -272,17 +272,17 @@ X11_DispatchEvent(_THIS) #ifdef DEBUG_MOTION printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); #endif - SDL_SendMouseMotion(0, xevent.xmotion.x, xevent.xmotion.y); + SDL_SendMouseMotion(data->window, 0, xevent.xmotion.x, xevent.xmotion.y); } break; case ButtonPress:{ - SDL_SendMouseButton(SDL_PRESSED, xevent.xbutton.button); + SDL_SendMouseButton(data->window, SDL_PRESSED, xevent.xbutton.button); } break; case ButtonRelease:{ - SDL_SendMouseButton(SDL_RELEASED, xevent.xbutton.button); + SDL_SendMouseButton(data->window, SDL_RELEASED, xevent.xbutton.button); } break; From d0c3a38b0094370dc9febe9421396a7220c31308 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Jul 2010 08:22:36 -0700 Subject: [PATCH 20/44] Fixed fullscreen window position Fixed position calculation for centered windows --- src/video/win32/SDL_win32window.c | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/video/win32/SDL_win32window.c b/src/video/win32/SDL_win32window.c index fc1cd154f..c84d91568 100644 --- a/src/video/win32/SDL_win32window.c +++ b/src/video/win32/SDL_win32window.c @@ -184,7 +184,6 @@ WIN_CreateWindow(_THIS, SDL_Window * window) { SDL_VideoDisplay *display = window->display; HWND hwnd; - HWND top; RECT rect; SDL_Rect bounds; DWORD style = (WS_CLIPSIBLINGS | WS_CLIPCHILDREN); @@ -202,11 +201,6 @@ WIN_CreateWindow(_THIS, SDL_Window * window) } /* Figure out what the window area will be */ - if (window->flags & SDL_WINDOW_FULLSCREEN) { - top = HWND_TOPMOST; - } else { - top = HWND_NOTOPMOST; - } rect.left = 0; rect.top = 0; rect.right = window->w; @@ -216,9 +210,17 @@ WIN_CreateWindow(_THIS, SDL_Window * window) h = (rect.bottom - rect.top); WIN_GetDisplayBounds(_this, display, &bounds); + if (window->flags & SDL_WINDOW_FULLSCREEN) { + /* The bounds when this window is visible is the fullscreen mode */ + SDL_DisplayMode fullscreen_mode; + if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { + bounds.w = fullscreen_mode.w; + bounds.h = fullscreen_mode.h; + } + } if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->x == SDL_WINDOWPOS_CENTERED) { - x = bounds.x + (bounds.w - window->w) / 2; + x = bounds.x + (bounds.w - w) / 2; } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { if (bounds.x == 0) { x = CW_USEDEFAULT; @@ -230,7 +232,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window) } if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->y == SDL_WINDOWPOS_CENTERED) { - y = bounds.y + (bounds.h - window->h) / 2; + y = bounds.y + (bounds.h - h) / 2; } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { if (bounds.x == 0) { y = CW_USEDEFAULT; @@ -387,6 +389,7 @@ WIN_SetWindowPosition(_THIS, SDL_Window * window) HWND top; BOOL menu; int x, y; + int w, h; /* Figure out what the window area will be */ if (window->flags & SDL_WINDOW_FULLSCREEN) { @@ -405,17 +408,27 @@ WIN_SetWindowPosition(_THIS, SDL_Window * window) menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); #endif AdjustWindowRectEx(&rect, style, menu, 0); + w = (rect.right - rect.left); + h = (rect.bottom - rect.top); WIN_GetDisplayBounds(_this, display, &bounds); + if (window->flags & SDL_WINDOW_FULLSCREEN) { + /* The bounds when this window is visible is the fullscreen mode */ + SDL_DisplayMode fullscreen_mode; + if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { + bounds.w = fullscreen_mode.w; + bounds.h = fullscreen_mode.h; + } + } if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->x == SDL_WINDOWPOS_CENTERED) { - x = bounds.x + (bounds.w - window->w) / 2; + x = bounds.x + (bounds.w - w) / 2; } else { x = bounds.x + window->x + rect.left; } if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->y == SDL_WINDOWPOS_CENTERED) { - y = bounds.y + (bounds.h - window->h) / 2; + y = bounds.y + (bounds.h - h) / 2; } else { y = bounds.y + window->y + rect.top; } From 7361be245986b7c793846e14b744ea4cd40f53a5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Jul 2010 10:58:23 -0700 Subject: [PATCH 21/44] Removed obsolete header file --- VisualC/SDL/SDL_VS2005.vcproj | 4 ---- VisualC/SDL/SDL_VS2008.vcproj | 7 +++---- VisualC/SDLmain/SDLmain_VS2008.vcproj | 9 ++++++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/VisualC/SDL/SDL_VS2005.vcproj b/VisualC/SDL/SDL_VS2005.vcproj index 9ae52b1ea..d58446605 100644 --- a/VisualC/SDL/SDL_VS2005.vcproj +++ b/VisualC/SDL/SDL_VS2005.vcproj @@ -840,10 +840,6 @@ RelativePath="..\..\src\video\SDL_stretch.c" > - - diff --git a/VisualC/SDL/SDL_VS2008.vcproj b/VisualC/SDL/SDL_VS2008.vcproj index bbf91e43a..7cf5d4a1a 100644 --- a/VisualC/SDL/SDL_VS2008.vcproj +++ b/VisualC/SDL/SDL_VS2008.vcproj @@ -5,6 +5,9 @@ Name="SDL" ProjectGUID="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" RootNamespace="SDL" + SccProjectName="Perforce Project" + SccLocalPath="..\.." + SccProvider="MSSCCI:Perforce SCM" TargetFrameworkVersion="131072" > @@ -995,10 +998,6 @@ RelativePath="..\..\src\video\SDL_stretch.c" > - - diff --git a/VisualC/SDLmain/SDLmain_VS2008.vcproj b/VisualC/SDLmain/SDLmain_VS2008.vcproj index 2ef814201..ac482184a 100644 --- a/VisualC/SDLmain/SDLmain_VS2008.vcproj +++ b/VisualC/SDLmain/SDLmain_VS2008.vcproj @@ -4,6 +4,9 @@ Version="9.00" Name="SDLmain" ProjectGUID="{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" + SccProjectName="Perforce Project" + SccLocalPath="..\.." + SccProvider="MSSCCI:Perforce SCM" TargetFrameworkVersion="131072" > @@ -29,7 +32,7 @@ Date: Tue, 6 Jul 2010 22:08:19 -0700 Subject: [PATCH 22/44] Re-implemented single mouse touches on the iPhone/iPad --- src/video/uikit/SDL_uikitopengles.m | 5 +++- src/video/uikit/SDL_uikitview.h | 2 +- src/video/uikit/SDL_uikitview.m | 43 +++++++++++++++++++++++------ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index 76c3c02a1..b10984343 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -125,7 +125,10 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) UIKit_GL_DeleteContext(_this, view); return NULL; } - + + /* Make this window the current mouse focus for touch input */ + SDL_SetMouseFocus(window); + return view; } diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index 3e0315704..341e1cbe3 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -38,7 +38,7 @@ #else @interface SDL_uikitview : UIView { #endif - + #if FIXME_MULTITOUCH SDL_Mouse mice[MAX_SIMULTANEOUS_TOUCHES]; #endif diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index da03d0c2e..f985f50a1 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -64,7 +64,7 @@ - (id)initWithFrame:(CGRect)frame { - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSEnumerator *enumerator = [touches objectEnumerator]; - UITouch *touch =(UITouch*)[enumerator nextObject]; + UITouch *touch = (UITouch*)[enumerator nextObject]; #if FIXME_MULTITOUCH /* associate touches with mice, so long as we have slots */ @@ -101,12 +101,21 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { /* re-calibrate relative mouse motion */ SDL_GetRelativeMouseState(i, NULL, NULL); - /* grab next touch */ - touch = (UITouch*)[enumerator nextObject]; - /* switch back to our old mouse */ SDL_SelectMouse(oldMouse); + /* grab next touch */ + touch = (UITouch*)[enumerator nextObject]; + } +#else + if (touch) { + CGPoint locationInView = [touch locationInView: self]; + + /* send moved event */ + SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y); + + /* send mouse down event */ + SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT); } #endif } @@ -114,10 +123,10 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { NSEnumerator *enumerator = [touches objectEnumerator]; - UITouch *touch=nil; + UITouch *touch = (UITouch*)[enumerator nextObject]; #if FIXME_MULTITOUCH - while(touch = (UITouch *)[enumerator nextObject]) { + while(touch) { /* search for the mouse slot associated with this touch */ int i, found = NO; for (i=0; i Date: Tue, 6 Jul 2010 22:26:03 -0700 Subject: [PATCH 23/44] The arguments to main() should be NULL terminated (SuS v3 compliant) --- src/video/uikit/SDL_uikitappdelegate.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index ac2992d32..5b18e27f2 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -42,11 +42,12 @@ int main(int argc, char **argv) { /* store arguments */ forward_argc = argc; - forward_argv = (char **)malloc(argc * sizeof(char *)); + forward_argv = (char **)malloc((argc+1) * sizeof(char *)); for (i=0; i Date: Wed, 7 Jul 2010 18:58:51 -0700 Subject: [PATCH 24/44] Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now) Updated iPhone demos (which build and run again) --- .../DemosiPhoneOS.xcodeproj/project.pbxproj | 19 ++++++++++++-- Xcode-iPhoneOS/Demos/src/fireworks.c | 2 -- Xcode-iPhoneOS/Demos/src/mixer.c | 5 ++-- Xcode-iPhoneOS/Demos/src/touch.c | 1 - .../TestiPhoneOS.xcodeproj/project.pbxproj | 25 +++++++++++++----- include/SDL_config_iphoneos.h | 7 ++--- src/events/SDL_keyboard.c | 4 +++ src/video/uikit/SDL_uikitopengles.m | 3 +++ src/video/uikit/SDL_uikitview.h | 2 -- src/video/uikit/SDL_uikitview.m | 26 +++++++------------ 10 files changed, 55 insertions(+), 39 deletions(-) diff --git a/Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj b/Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj index e7c99eae7..aaf5d1279 100755 --- a/Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj +++ b/Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj @@ -105,6 +105,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 04AB757011E563D200BE9753 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48920E313154007AB34E /* SDLiPhoneOS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 006E982211955059001DE610 /* testsdl.app */; + remoteInfo = testsdl; + }; FD1B489D0E313154007AB34E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FD1B48920E313154007AB34E /* SDLiPhoneOS.xcodeproj */; @@ -318,6 +325,7 @@ isa = PBXGroup; children = ( FD1B489E0E313154007AB34E /* libSDLiPhoneOS.a */, + 04AB757111E563D200BE9753 /* testsdl.app */, ); name = Products; sourceTree = ""; @@ -523,6 +531,13 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + 04AB757111E563D200BE9753 /* testsdl.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = testsdl.app; + remoteRef = 04AB757011E563D200BE9753 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FD1B489E0E313154007AB34E /* libSDLiPhoneOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -731,7 +746,7 @@ OTHER_CFLAGS = ""; PREBINDING = NO; PRELINK_LIBS = ""; - SDKROOT = iphoneos2.0; + SDKROOT = iphoneos3.2; }; name = Debug; }; @@ -749,7 +764,7 @@ OTHER_CFLAGS = ""; PREBINDING = NO; PRELINK_LIBS = ""; - SDKROOT = iphoneos2.0; + SDKROOT = iphoneos3.2; }; name = Release; }; diff --git a/Xcode-iPhoneOS/Demos/src/fireworks.c b/Xcode-iPhoneOS/Demos/src/fireworks.c index 1b9378cb1..ba1949524 100644 --- a/Xcode-iPhoneOS/Demos/src/fireworks.c +++ b/Xcode-iPhoneOS/Demos/src/fireworks.c @@ -430,9 +430,7 @@ main(int argc, char *argv[]) done = 1; } if (event.type == SDL_MOUSEBUTTONDOWN) { - int which = event.button.which; int x, y; - SDL_SelectMouse(which); SDL_GetMouseState(&x, &y); spawnEmitterParticle(x, y); } diff --git a/Xcode-iPhoneOS/Demos/src/mixer.c b/Xcode-iPhoneOS/Demos/src/mixer.c index a8a25203f..f5808d62e 100644 --- a/Xcode-iPhoneOS/Demos/src/mixer.c +++ b/Xcode-iPhoneOS/Demos/src/mixer.c @@ -124,10 +124,9 @@ handleMouseButtonDown(SDL_Event * event) int x, y, mouseIndex, i, drumIndex; - mouseIndex = event->button.which; + mouseIndex = 0; drumIndex = -1; - SDL_SelectMouse(mouseIndex); SDL_GetMouseState(&x, &y); /* check if we hit any of the drum buttons */ for (i = 0; i < NUM_DRUMS; i++) { @@ -153,7 +152,7 @@ void handleMouseButtonUp(SDL_Event * event) { int i; - int mouseIndex = event->button.which; + int mouseIndex = 0; /* check if this should cause any of the buttons to become unpressed */ for (i = 0; i < NUM_DRUMS; i++) { if (buttons[i].touchIndex == mouseIndex) { diff --git a/Xcode-iPhoneOS/Demos/src/touch.c b/Xcode-iPhoneOS/Demos/src/touch.c index b171415d0..bdaf3b754 100644 --- a/Xcode-iPhoneOS/Demos/src/touch.c +++ b/Xcode-iPhoneOS/Demos/src/touch.c @@ -106,7 +106,6 @@ main(int argc, char *argv[]) done = 1; break; case SDL_MOUSEMOTION: - SDL_SelectMouse(event.motion.which); /* select 'mouse' (touch) that moved */ state = SDL_GetMouseState(&x, &y); /* get its location */ SDL_GetRelativeMouseState(&dx, &dy); /* find how much the mouse moved */ if (state & SDL_BUTTON_LMASK) { /* is the mouse (touch) down? */ diff --git a/Xcode-iPhoneOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj b/Xcode-iPhoneOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj index 6cf2ad995..dce7d25cb 100755 --- a/Xcode-iPhoneOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj +++ b/Xcode-iPhoneOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj @@ -287,6 +287,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 0466EE6F11E565E4000198A4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 006E982211955059001DE610 /* testsdl.app */; + remoteInfo = testsdl; + }; FD1B48B70E3131CA007AB34E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */; @@ -298,9 +305,7 @@ /* Begin PBXFileReference section */ 1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 56ED04F7118A8FCC00A56AA6 /* testpower-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testpower-Info.plist"; sourceTree = ""; }; 56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 56ED050F118A8FE400A56AA6 /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info copy.plist"; sourceTree = ""; }; 56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDLiPhoneOS.xcodeproj; path = ../SDL/SDLiPhoneOS.xcodeproj; sourceTree = SOURCE_ROOT; }; FDA8A7400E2D0F1600EA573E /* testalpha.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testalpha.c; path = ../../test/testalpha.c; sourceTree = SOURCE_ROOT; }; @@ -861,14 +866,11 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( - 56ED0510118A904200A56AA6 /* testpower.c */, FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */, FDA8AAD60E2D339A00EA573E /* Resources */, FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */, FDA8A73B0E2D0F0400EA573E /* src */, 19C28FACFE9D520D11CA2CBB /* Products */, - 56ED04F7118A8FCC00A56AA6 /* testpower-Info.plist */, - 56ED050F118A8FE400A56AA6 /* Info copy.plist */, ); name = CustomTemplate; sourceTree = ""; @@ -877,6 +879,7 @@ isa = PBXGroup; children = ( FD1B48B80E3131CA007AB34E /* libSDLiPhoneOS.a */, + 0466EE7011E565E4000198A4 /* testsdl.app */, ); name = Products; sourceTree = ""; @@ -910,6 +913,7 @@ FDA8A7540E2D0F1600EA573E /* testoverlay2.c */, FDA8A7550E2D0F1600EA573E /* testpalette.c */, FDA8A7560E2D0F1600EA573E /* testplatform.c */, + 56ED0510118A904200A56AA6 /* testpower.c */, FDA8A7570E2D0F1600EA573E /* testsem.c */, FDA8A7580E2D0F1600EA573E /* testsprite.c */, FDA8A7590E2D0F1600EA573E /* testsprite2.c */, @@ -1502,6 +1506,13 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + 0466EE7011E565E4000198A4 /* testsdl.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = testsdl.app; + remoteRef = 0466EE6F11E565E4000198A4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; FD1B48B80E3131CA007AB34E /* libSDLiPhoneOS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -2034,7 +2045,7 @@ ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos2.2.1; + SDKROOT = iphoneos3.2; }; name = Debug; }; @@ -2049,7 +2060,7 @@ HEADER_SEARCH_PATHS = ../../include; PREBINDING = NO; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos2.2.1; + SDKROOT = iphoneos3.2; }; name = Release; }; diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h index f9271766c..6e031114b 100644 --- a/include/SDL_config_iphoneos.h +++ b/include/SDL_config_iphoneos.h @@ -145,12 +145,9 @@ typedef unsigned long uintptr_t; #define SDL_POWER_UIKIT 1 /* enable iPhone keyboard support */ -#define SDL_IPHONE_KEYBOARD 0 +#define SDL_IPHONE_KEYBOARD 1 -/* Enable emulation of multiple mice through multi-touch */ -#define SDL_IPHONE_MULTIPLE_MICE 1 - -/* Set max recognized G-force from acceleromter +/* Set max recognized G-force from accelerometer See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed */ #define SDL_IPHONE_MAX_GFORCE 5.0 diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index f25bc6af8..a2687bd26 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -551,6 +551,10 @@ SDL_UCS4ToUTF8(Uint32 ch, char *dst) int SDL_KeyboardInit(void) { + SDL_Keyboard *keyboard = &SDL_keyboard; + + /* Set the default keymap */ + SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap)); return (0); } diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index b10984343..8d9839daf 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -26,6 +26,8 @@ #include "SDL_uikitwindow.h" #include "jumphack.h" #include "SDL_sysvideo.h" +#include "../../events/SDL_keyboard_c.h" +#include "../../events/SDL_mouse_c.h" #include "SDL_loadso.h" #include @@ -128,6 +130,7 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) /* Make this window the current mouse focus for touch input */ SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); return view; } diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index 341e1cbe3..ca7924b92 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -22,8 +22,6 @@ #import #include "SDL_stdinc.h" -#include "SDL_mouse.h" -#include "SDL_mouse_c.h" #include "SDL_events.h" #if SDL_IPHONE_MULTIPLE_MICE diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index f985f50a1..879ac0464 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -22,8 +22,10 @@ #import "SDL_uikitview.h" +#include "../../events/SDL_keyboard_c.h" +#include "../../events/SDL_mouse_c.h" + #if SDL_IPHONE_KEYBOARD -#import "SDL_keyboard_c.h" #import "keyinfotable.h" #import "SDL_uikitappdelegate.h" #import "SDL_uikitwindow.h" @@ -33,7 +35,6 @@ @implementation SDL_uikitview - (void)dealloc { #if SDL_IPHONE_KEYBOARD - SDL_DelKeyboard(0); [textField release]; #endif [super dealloc]; @@ -225,15 +226,6 @@ - (void)initializeKeyboard { keyboardVisible = NO; /* add the UITextField (hidden) to our view */ [self addSubview: textField]; - - /* create our SDL_Keyboard */ - SDL_Keyboard keyboard; - SDL_zero(keyboard); - SDL_AddKeyboard(&keyboard, 0); - SDLKey keymap[SDL_NUM_SCANCODES]; - SDL_GetDefaultKeymap(keymap); - SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES); - } /* reveal onscreen virtual keyboard */ @@ -253,8 +245,8 @@ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRan if ([string length] == 0) { /* it wants to replace text with nothing, ie a delete */ - SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_DELETE); - SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_DELETE); + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DELETE); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DELETE); } else { /* go through all the characters in the string we've been sent @@ -280,14 +272,14 @@ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRan if (mod & KMOD_SHIFT) { /* If character uses shift, press shift down */ - SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_LSHIFT); + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); } /* send a keydown and keyup even for the character */ - SDL_SendKeyboardKey( 0, SDL_PRESSED, code); - SDL_SendKeyboardKey( 0, SDL_RELEASED, code); + SDL_SendKeyboardKey(SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); if (mod & KMOD_SHIFT) { /* If character uses shift, press shift back up */ - SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_LSHIFT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); } } } From 13a96d8aab9b89c53b903e20aacbc25885582c9f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 21:35:44 -0700 Subject: [PATCH 25/44] Turn on blending if we're converting from a surface with colorkey enabled --- src/video/SDL_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 37740b2d4..16bce3c1b 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -851,7 +851,7 @@ SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format, /* Enable alpha blending by default if the new surface has an * alpha channel or alpha modulation */ if ((surface->format->Amask && format->Amask) || - (copy_flags & SDL_COPY_MODULATE_ALPHA)) { + (copy_flags & (SDL_COPY_COLORKEY|SDL_COPY_MODULATE_ALPHA))) { SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND); } if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) { From e3302d9b96dc701b26c4850e8aac95b003fa58cf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 21:36:09 -0700 Subject: [PATCH 26/44] Added SDL_FOURCC() --- include/SDL_pixels.h | 3 +-- include/SDL_stdinc.h | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/SDL_pixels.h b/include/SDL_pixels.h index 6934105aa..6024dcd0b 100644 --- a/include/SDL_pixels.h +++ b/include/SDL_pixels.h @@ -112,8 +112,7 @@ enum SDL_PACKEDLAYOUT_1010102 }; -#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \ - ((A) | ((B) << 8) | ((C) << 16) | ((D) << 24)) +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index c7e7edd57..ba1e5b5b2 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -101,6 +101,13 @@ #endif /*@}*//*Cast operators*/ +/* Define a four character code as a Uint32 */ +#define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + /** * \name Basic data types */ From 649871a333104fbb20c2329e67f139aba7fbe111 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 23:24:04 -0700 Subject: [PATCH 27/44] First pass at clipboard API, still very much in progress --- include/SDL.h | 1 + include/SDL_clipboard.h | 125 ++++++++++++++++++++++++++++++++++++++ src/video/SDL_clipboard.c | 101 ++++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 include/SDL_clipboard.h create mode 100644 src/video/SDL_clipboard.c diff --git a/include/SDL.h b/include/SDL.h index 21c0cbe62..349010d39 100644 --- a/include/SDL.h +++ b/include/SDL.h @@ -78,6 +78,7 @@ #include "SDL_stdinc.h" #include "SDL_atomic.h" #include "SDL_audio.h" +#include "SDL_clipboard.h" #include "SDL_cpuinfo.h" #include "SDL_endian.h" #include "SDL_error.h" diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h new file mode 100644 index 000000000..8cd51f30d --- /dev/null +++ b/include/SDL_clipboard.h @@ -0,0 +1,125 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/** + * \file SDL_clipboard.h + * + * Include file for SDL clipboard handling + */ + +#ifndef _SDL_clipboard_h +#define _SDL_clipboard_h + +#include "SDL_stdinc.h" +#include "SDL_surface.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/* Function prototypes */ + +/** + * \brief Put text into the clipboard + * + * \sa SDL_GetClipboardText() + */ +extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); + +/** + * \brief Get text from the clipboard, which must be freed with SDL_free() + * + * \sa SDL_SetClipboardText() + */ +extern DECLSPEC char * SDLCALL SDL_GetClipboardText(); + +/** + * \brief Returns whether the clipboard has text + * + * \sa SDL_GetClipboardText() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(); + +/** + * \brief Put an image into the clipboard + * + * \sa SDL_GetClipboardImage() + */ +extern DECLSPEC int SDLCALL SDL_SetClipboardImage(SDL_Surface *image); + +/** + * \brief Get image from the clipboard, which must be freed with SDL_FreeSurface() + * + * \sa SDL_SetClipboard() + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_GetClipboardImage(); + +/** + * \brief Returns whether the clipboard has data in the specified format + * + * \sa SDL_GetClipboardImage() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardImage(); + +/** + * \brief Set the data in the clipboard in the specified format + * + * \sa SDL_GetClipboard() + */ +extern DECLSPEC int SDLCALL SDL_SetClipboard(Uint32 format, void *data, size_t length); + +/** + * \brief Get the data in the clipboard in the specified format, which must be + * freed with SDL_free() + * + * \sa SDL_SetClipboard() + */ +extern DECLSPEC int SDLCALL SDL_GetClipboard(Uint32 format, void **data, size_t *length); + +/** + * \brief Returns whether the clipboard has data in the specified format + * + * \sa SDL_GetClipboard() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardFormat(Uint32 format); + +/** + * \brief Clear any data out of the clipboard, if possible. + */ +extern DECLSPEC void SDLCALL SDL_ClearClipboard(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_clipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c new file mode 100644 index 000000000..fe33216de --- /dev/null +++ b/src/video/SDL_clipboard.c @@ -0,0 +1,101 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include "SDL_clipboard.h" +#include "SDL_sysvideo.h" + +/* FOURCC values for text and image clipboard formats */ +#define TEXT_DATA SDL_FOURCC('T', 'E', 'X', 'T') +#define IMAGE_DATA SDL_FOURCC('B', 'M', 'P', ' ') + +int +SDL_SetClipboardText(const char *text) +{ + return SDL_SetClipboard(TEXT_DATA, text, SDL_strlen(text)+1); +} + +char * +SDL_GetClipboardText() +{ + void *data; + size_t length; + + if (SDL_GetClipboard(TEXT_DATA, &data, &length) == 0) { + return SDL_static_cast(char*, data); + } else { + return NULL; + } +} + +SDL_bool +SDL_HasClipboardText() +{ + return SDL_HasClipboardFormat(TEXT_DATA); +} + +int +SDL_SetClipboardImage(SDL_Surface *image) +{ + SDL_Unsupported(); + return -1; +} + +SDL_Surface * +SDL_GetClipboardImage() +{ + SDL_Unsupported(); + return NULL; +} + +SDL_bool +SDL_HasClipboardImage() +{ + return SDL_FALSE; +} + +int +SDL_SetClipboard(Uint32 format, void *data, size_t length) +{ + SDL_Unsupported(); + return -1; +} + +int +SDL_GetClipboard(Uint32 format, void **data, size_t *length) +{ + SDL_Unsupported(); + return -1; +} + +SDL_bool +SDL_HasClipboardFormat(Uint32 format) +{ + return SDL_FALSE; +} + +void +SDL_ClearClipboard(void) +{ +} + +/* vi: set ts=4 sw=4 expandtab: */ From d8a5b71e7edf19263e08ecdadddd26817740b0b4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 23:26:07 -0700 Subject: [PATCH 28/44] Whoops, updated the copyright date --- include/SDL_clipboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h index 8cd51f30d..872c465c3 100644 --- a/include/SDL_clipboard.h +++ b/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public From 3579eb6828cba28f053273f435510700ec271827 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 23:54:03 -0700 Subject: [PATCH 29/44] Simplified clipboard API for sanity's sake. A complete clipboard implementation would support multiple formats that could be queried at runtime, events for when the clipboard contents changed, support for HTML, images, etc. We're not going that crazy, at least for now. :) --- include/SDL_clipboard.h | 53 +------------------------- src/video/SDL_clipboard.c | 80 +++++++++++++-------------------------- src/video/SDL_sysvideo.h | 6 +++ src/video/SDL_video.c | 4 ++ 4 files changed, 38 insertions(+), 105 deletions(-) diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h index 872c465c3..848c21d12 100644 --- a/include/SDL_clipboard.h +++ b/include/SDL_clipboard.h @@ -30,7 +30,6 @@ #define _SDL_clipboard_h #include "SDL_stdinc.h" -#include "SDL_surface.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -43,14 +42,14 @@ extern "C" { /* Function prototypes */ /** - * \brief Put text into the clipboard + * \brief Put UTF-8 text into the clipboard * * \sa SDL_GetClipboardText() */ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); /** - * \brief Get text from the clipboard, which must be freed with SDL_free() + * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() * * \sa SDL_SetClipboardText() */ @@ -63,54 +62,6 @@ extern DECLSPEC char * SDLCALL SDL_GetClipboardText(); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(); -/** - * \brief Put an image into the clipboard - * - * \sa SDL_GetClipboardImage() - */ -extern DECLSPEC int SDLCALL SDL_SetClipboardImage(SDL_Surface *image); - -/** - * \brief Get image from the clipboard, which must be freed with SDL_FreeSurface() - * - * \sa SDL_SetClipboard() - */ -extern DECLSPEC SDL_Surface * SDLCALL SDL_GetClipboardImage(); - -/** - * \brief Returns whether the clipboard has data in the specified format - * - * \sa SDL_GetClipboardImage() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardImage(); - -/** - * \brief Set the data in the clipboard in the specified format - * - * \sa SDL_GetClipboard() - */ -extern DECLSPEC int SDLCALL SDL_SetClipboard(Uint32 format, void *data, size_t length); - -/** - * \brief Get the data in the clipboard in the specified format, which must be - * freed with SDL_free() - * - * \sa SDL_SetClipboard() - */ -extern DECLSPEC int SDLCALL SDL_GetClipboard(Uint32 format, void **data, size_t *length); - -/** - * \brief Returns whether the clipboard has data in the specified format - * - * \sa SDL_GetClipboard() - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardFormat(Uint32 format); - -/** - * \brief Clear any data out of the clipboard, if possible. - */ -extern DECLSPEC void SDLCALL SDL_ClearClipboard(void); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c index fe33216de..e459f6994 100644 --- a/src/video/SDL_clipboard.c +++ b/src/video/SDL_clipboard.c @@ -24,78 +24,50 @@ #include "SDL_clipboard.h" #include "SDL_sysvideo.h" -/* FOURCC values for text and image clipboard formats */ -#define TEXT_DATA SDL_FOURCC('T', 'E', 'X', 'T') -#define IMAGE_DATA SDL_FOURCC('B', 'M', 'P', ' ') int SDL_SetClipboardText(const char *text) { - return SDL_SetClipboard(TEXT_DATA, text, SDL_strlen(text)+1); + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + + if (_this->SetClipboardText) { + return _this->SetClipboardText(_this, text); + } else { + _this->clipboard_text = SDL_strdup(text); + return 0; + } } char * SDL_GetClipboardText() { - void *data; - size_t length; + SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (SDL_GetClipboard(TEXT_DATA, &data, &length) == 0) { - return SDL_static_cast(char*, data); + if (_this->GetClipboardText) { + return _this->GetClipboardText(_this); } else { - return NULL; + const char *text = _this->clipboard_text; + if (!text) { + text = ""; + } + return SDL_strdup(text); } } SDL_bool SDL_HasClipboardText() { - return SDL_HasClipboardFormat(TEXT_DATA); -} - -int -SDL_SetClipboardImage(SDL_Surface *image) -{ - SDL_Unsupported(); - return -1; -} - -SDL_Surface * -SDL_GetClipboardImage() -{ - SDL_Unsupported(); - return NULL; -} - -SDL_bool -SDL_HasClipboardImage() -{ - return SDL_FALSE; -} - -int -SDL_SetClipboard(Uint32 format, void *data, size_t length) -{ - SDL_Unsupported(); - return -1; -} - -int -SDL_GetClipboard(Uint32 format, void **data, size_t *length) -{ - SDL_Unsupported(); - return -1; -} + SDL_VideoDevice *_this = SDL_GetVideoDevice(); -SDL_bool -SDL_HasClipboardFormat(Uint32 format) -{ - return SDL_FALSE; -} - -void -SDL_ClearClipboard(void) -{ + if (_this->HasClipboardText) { + return _this->HasClipboardText(_this); + } else { + if (_this->clipboard_text) { + return SDL_TRUE; + } else { + return SDL_FALSE; + } + } } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 0a82717ec..91b2177cb 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -303,6 +303,11 @@ struct SDL_VideoDevice void (*StopTextInput) (_THIS); void (*SetTextInputRect) (_THIS, SDL_Rect *rect); + /* Clipboard */ + int (*SetClipboardText) (_THIS, const char *text); + char * (*GetClipboardText) (_THIS); + SDL_bool (*HasClipboardText) (_THIS); + /* * * */ /* Data common to all drivers */ SDL_bool suspend_screensaver; @@ -312,6 +317,7 @@ struct SDL_VideoDevice Uint8 window_magic; Uint8 texture_magic; Uint32 next_object_id; + char * clipboard_text; /* * * */ /* Data used by the GL drivers */ diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index db8b5d3cb..435f01696 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2833,6 +2833,10 @@ SDL_VideoQuit(void) SDL_free(_this->displays); _this->displays = NULL; } + if (_this->clipboard_text) { + SDL_free(_this->clipboard_text); + _this->clipboard_text = NULL; + } _this->free(_this); _this = NULL; } From 11ee36191d3bbcece9813bb550e7e4bc5af8762c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Jul 2010 23:59:20 -0700 Subject: [PATCH 30/44] Need to add new headers to Makefile.in --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 87df4de3d..705ec31f9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,7 +44,7 @@ EMBEDSPU = @EMBEDSPU@ 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 -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 +HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_clipboard.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 LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ From 5a5ce0cce08c3a66bab391dba2020fb7587eb866 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 00:00:07 -0700 Subject: [PATCH 31/44] Added simple clipboard test --- test/common.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/common.c b/test/common.c index 32d69e2fc..efbccd6f7 100644 --- a/test/common.c +++ b/test/common.c @@ -1050,6 +1050,25 @@ CommonEvent(CommonState * state, SDL_Event * event, int *done) case SDL_KEYDOWN: switch (event->key.keysym.sym) { /* Add hotkeys here */ + case SDLK_c: + if (event->key.keysym.mod & KMOD_CTRL) { + /* Ctrl-C copy awesome text! */ + SDL_SetClipboardText("SDL rocks!\nYou know it!"); + printf("Copied text to clipboard\n"); + } + break; + case SDLK_v: + if (event->key.keysym.mod & KMOD_CTRL) { + /* Ctrl-V paste awesome text! */ + char *text = SDL_GetClipboardText(); + if (*text) { + printf("Clipboard: %s\n", text); + } else { + printf("Clipboard is empty\n"); + } + SDL_free(text); + } + break; case SDLK_g: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-G toggle grab */ From dd773800a4480bfc4d44ea2cb2a45e843f30073c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 00:03:39 -0700 Subject: [PATCH 32/44] I missed the Objective C files when updating the copyright date... --- src/video/cocoa/SDL_cocoaevents.m | 2 +- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- src/video/cocoa/SDL_cocoamodes.m | 2 +- src/video/cocoa/SDL_cocoamouse.m | 2 +- src/video/cocoa/SDL_cocoaopengl.m | 2 +- src/video/cocoa/SDL_cocoavideo.m | 2 +- src/video/cocoa/SDL_cocoawindow.m | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index d833400e9..d1164e5c2 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 9fd89d15d..83e743f50 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index b26905bc9..4b120a68e 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index e3d70bfac..c0ac2feaf 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index e80e310b5..41ab75d98 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 86e19fda7..b537e8a83 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index be4045c89..af84bff2f 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga + Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public From eec5967425b99a40b5428710989540180a39b200 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 00:35:58 -0700 Subject: [PATCH 33/44] Added Mac OS X implementation of clipboard support --- src/video/cocoa/SDL_cocoaclipboard.h | 33 +++++++ src/video/cocoa/SDL_cocoaclipboard.m | 123 +++++++++++++++++++++++++++ src/video/cocoa/SDL_cocoavideo.h | 1 + src/video/cocoa/SDL_cocoavideo.m | 4 + 4 files changed, 161 insertions(+) create mode 100644 src/video/cocoa/SDL_cocoaclipboard.h create mode 100644 src/video/cocoa/SDL_cocoaclipboard.m diff --git a/src/video/cocoa/SDL_cocoaclipboard.h b/src/video/cocoa/SDL_cocoaclipboard.h new file mode 100644 index 000000000..8e4619b95 --- /dev/null +++ b/src/video/cocoa/SDL_cocoaclipboard.h @@ -0,0 +1,33 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_cocoaclipboard_h +#define _SDL_cocoaclipboard_h + +extern int Cocoa_SetClipboardText(_THIS, const char *text); +extern char *Cocoa_GetClipboardText(_THIS); +extern SDL_bool Cocoa_HasClipboardText(_THIS); + +#endif /* _SDL_cocoaclipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m new file mode 100644 index 000000000..ea86446a0 --- /dev/null +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -0,0 +1,123 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include "SDL_cocoavideo.h" + + +int +Cocoa_SetClipboardText(_THIS, const char *text) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + NSAutoreleasePool *pool; + NSPasteboard *pasteboard; + NSString *format; + + if (data->osversion >= 0x1060) { + format = NSPasteboardTypeString; + } else { + format = NSStringPboardType; + } + + pool = [[NSAutoreleasePool alloc] init]; + + pasteboard = [NSPasteboard generalPasteboard]; + [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; + [pasteboard setString:[NSString stringWithUTF8String:text] forType:format]; + + [pool release]; + + return 0; +} + +char * +Cocoa_GetClipboardText(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + NSAutoreleasePool *pool; + NSPasteboard *pasteboard; + NSString *format; + NSString *available; + char *text; + + if (data->osversion >= 0x1060) { + format = NSPasteboardTypeString; + } else { + format = NSStringPboardType; + } + + pool = [[NSAutoreleasePool alloc] init]; + + pasteboard = [NSPasteboard generalPasteboard]; + available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]]; + if ([available isEqualToString:format]) { + NSString* string; + const char *utf8; + + string = [pasteboard stringForType:format]; + if (string == nil) { + utf8 = ""; + } else { + utf8 = [string UTF8String]; + } + text = SDL_strdup(utf8); + } else { + text = SDL_strdup(""); + } + + [pool release]; + + return text; +} + +SDL_bool +Cocoa_HasClipboardText(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + NSAutoreleasePool *pool; + NSPasteboard *pasteboard; + NSString *format; + NSString *available; + SDL_bool result; + + if (data->osversion >= 0x1060) { + format = NSPasteboardTypeString; + } else { + format = NSStringPboardType; + } + + pool = [[NSAutoreleasePool alloc] init]; + + pasteboard = [NSPasteboard generalPasteboard]; + available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]]; + if ([available isEqualToString:format]) { + result = SDL_TRUE; + } else { + result = SDL_FALSE; + } + + [pool release]; + + return result; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 8f12dc056..402cdccb5 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -32,6 +32,7 @@ #include "SDL_keysym.h" #include "../SDL_sysvideo.h" +#include "SDL_cocoaclipboard.h" #include "SDL_cocoaevents.h" #include "SDL_cocoakeyboard.h" #include "SDL_cocoamodes.h" diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index b537e8a83..e4b58cb67 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -108,6 +108,10 @@ device->StopTextInput = Cocoa_StopTextInput; device->SetTextInputRect = Cocoa_SetTextInputRect; + device->SetClipboardText = Cocoa_SetClipboardText; + device->GetClipboardText = Cocoa_GetClipboardText; + device->HasClipboardText = Cocoa_HasClipboardText; + device->free = Cocoa_DeleteDevice; return device; From 1b9488e1016b78ee15bbc00d7aab02c52d78b003 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 05:43:34 -0700 Subject: [PATCH 34/44] Added Windows clipboard support --- VisualC/SDL/SDL_VS2005.vcproj | 16 +++ VisualC/SDL/SDL_VS2008.vcproj | 19 +++- VisualC/SDLmain/SDLmain_VS2008.vcproj | 3 - src/video/SDL_clipboard.c | 3 + src/video/win32/SDL_win32clipboard.c | 144 ++++++++++++++++++++++++++ src/video/win32/SDL_win32clipboard.h | 33 ++++++ src/video/win32/SDL_win32events.c | 13 --- src/video/win32/SDL_win32events.h | 1 - src/video/win32/SDL_win32video.c | 18 ++++ src/video/win32/SDL_win32video.h | 1 + src/video/win32/SDL_win32window.c | 12 +-- 11 files changed, 235 insertions(+), 28 deletions(-) create mode 100644 src/video/win32/SDL_win32clipboard.c create mode 100644 src/video/win32/SDL_win32clipboard.h diff --git a/VisualC/SDL/SDL_VS2005.vcproj b/VisualC/SDL/SDL_VS2005.vcproj index d58446605..0dfa9b77d 100644 --- a/VisualC/SDL/SDL_VS2005.vcproj +++ b/VisualC/SDL/SDL_VS2005.vcproj @@ -235,6 +235,10 @@ RelativePath="..\..\include\SDL_audio.h" > + + @@ -560,6 +564,10 @@ RelativePath="..\..\src\video\SDL_bmp.c" > + + @@ -940,6 +948,14 @@ RelativePath="..\..\src\audio\SDL_wave.h" > + + + + diff --git a/VisualC/SDL/SDL_VS2008.vcproj b/VisualC/SDL/SDL_VS2008.vcproj index 7cf5d4a1a..d616591fd 100644 --- a/VisualC/SDL/SDL_VS2008.vcproj +++ b/VisualC/SDL/SDL_VS2008.vcproj @@ -5,9 +5,6 @@ Name="SDL" ProjectGUID="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" RootNamespace="SDL" - SccProjectName="Perforce Project" - SccLocalPath="..\.." - SccProvider="MSSCCI:Perforce SCM" TargetFrameworkVersion="131072" > @@ -385,6 +382,10 @@ RelativePath="..\..\include\SDL_audio.h" > + + @@ -718,6 +719,10 @@ RelativePath="..\..\src\video\SDL_bmp.c" > + + @@ -1098,6 +1103,14 @@ RelativePath="..\..\src\audio\SDL_wave.h" > + + + + diff --git a/VisualC/SDLmain/SDLmain_VS2008.vcproj b/VisualC/SDLmain/SDLmain_VS2008.vcproj index ac482184a..94f4447fd 100644 --- a/VisualC/SDLmain/SDLmain_VS2008.vcproj +++ b/VisualC/SDLmain/SDLmain_VS2008.vcproj @@ -4,9 +4,6 @@ Version="9.00" Name="SDLmain" ProjectGUID="{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" - SccProjectName="Perforce Project" - SccLocalPath="..\.." - SccProvider="MSSCCI:Perforce SCM" TargetFrameworkVersion="131072" > diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c index e459f6994..fc7e5fbb6 100644 --- a/src/video/SDL_clipboard.c +++ b/src/video/SDL_clipboard.c @@ -30,6 +30,9 @@ SDL_SetClipboardText(const char *text) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (!text) { + text = ""; + } if (_this->SetClipboardText) { return _this->SetClipboardText(_this, text); } else { diff --git a/src/video/win32/SDL_win32clipboard.c b/src/video/win32/SDL_win32clipboard.c new file mode 100644 index 000000000..950bd444f --- /dev/null +++ b/src/video/win32/SDL_win32clipboard.c @@ -0,0 +1,144 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include "SDL_win32video.h" +#include "SDL_win32window.h" + + +#ifdef UNICODE +#define TEXT_FORMAT CF_UNICODETEXT +#else +#define TEXT_FORMAT CF_TEXT +#endif + + +/* Get any application owned window handle for clipboard association */ +static HWND +GetWindowHandle(_THIS) +{ + SDL_VideoDisplay *display; + SDL_Window *window; + + display = _this->displays; + if (display) { + window = display->windows; + if (window) { + return ((SDL_WindowData *) window->driverdata)->hwnd; + } + } + return NULL; +} + +int +WIN_SetClipboardText(_THIS, const char *text) +{ + int result = 0; + + if (OpenClipboard(GetWindowHandle(_this))) { + HANDLE hMem; + LPTSTR tstr; + SIZE_T i, size; + + /* Convert the text from UTF-8 to Windows Unicode */ + tstr = WIN_UTF8ToString(text); + if (!tstr) { + return -1; + } + + /* Find out the size of the data */ + for (size = 0, i = 0; tstr[i]; ++i, ++size) { + if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { + /* We're going to insert a carriage return */ + ++size; + } + } + size = (size+1)*sizeof(*tstr); + + /* Save the data to the clipboard */ + hMem = GlobalAlloc(GMEM_MOVEABLE, size); + if (hMem) { + LPTSTR dst = (LPTSTR)GlobalLock(hMem); + /* Copy the text over, adding carriage returns as necessary */ + for (i = 0; tstr[i]; ++i) { + if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { + *dst++ = '\r'; + } + *dst++ = tstr[i]; + } + *dst = 0; + GlobalUnlock(hMem); + + EmptyClipboard(); + if (!SetClipboardData(TEXT_FORMAT, hMem)) { + WIN_SetError("Couldn't set clipboard data"); + result = -1; + } + } + SDL_free(tstr); + + CloseClipboard(); + } else { + WIN_SetError("Couldn't open clipboard"); + result = -1; + } + return result; +} + +char * +WIN_GetClipboardText(_THIS) +{ + char *text; + + text = NULL; + if (IsClipboardFormatAvailable(TEXT_FORMAT) && + OpenClipboard(GetWindowHandle(_this))) { + HANDLE hMem; + LPTSTR tstr; + + hMem = GetClipboardData(TEXT_FORMAT); + if (hMem) { + tstr = (LPTSTR)GlobalLock(hMem); + text = WIN_StringToUTF8(tstr); + GlobalUnlock(hMem); + } else { + WIN_SetError("Couldn't get clipboard data"); + } + CloseClipboard(); + } + if (!text) { + text = SDL_strdup(""); + } + return text; +} + +SDL_bool +WIN_HasClipboardText(_THIS) +{ + if (IsClipboardFormatAvailable(TEXT_FORMAT)) { + return SDL_TRUE; + } else { + return SDL_FALSE; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32clipboard.h b/src/video/win32/SDL_win32clipboard.h new file mode 100644 index 000000000..36fb79823 --- /dev/null +++ b/src/video/win32/SDL_win32clipboard.h @@ -0,0 +1,33 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_win32clipboard_h +#define _SDL_win32clipboard_h + +extern int WIN_SetClipboardText(_THIS, const char *text); +extern char *WIN_GetClipboardText(_THIS); +extern SDL_bool WIN_HasClipboardText(_THIS); + +#endif /* _SDL_win32clipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32events.c b/src/video/win32/SDL_win32events.c index 1ea7e6c10..98affcc3c 100755 --- a/src/video/win32/SDL_win32events.c +++ b/src/video/win32/SDL_win32events.c @@ -585,17 +585,4 @@ SDL_UnregisterApp() } } -/* Sets an error message based on GetLastError() */ -void -WIN_SetError(const char *prefix) -{ - TCHAR buffer[1024]; - char *message; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, - buffer, SDL_arraysize(buffer), NULL); - message = WIN_StringToUTF8(buffer); - SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message); - SDL_free(message); -} - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32events.h b/src/video/win32/SDL_win32events.h index 8ba8e8ab1..18e880bf4 100644 --- a/src/video/win32/SDL_win32events.h +++ b/src/video/win32/SDL_win32events.h @@ -31,7 +31,6 @@ extern HINSTANCE SDL_Instance; extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern void WIN_PumpEvents(_THIS); -extern void WIN_SetError(const char *prefix); #endif /* _SDL_win32events_h */ diff --git a/src/video/win32/SDL_win32video.c b/src/video/win32/SDL_win32video.c index c93d4f72e..2c93885e2 100644 --- a/src/video/win32/SDL_win32video.c +++ b/src/video/win32/SDL_win32video.c @@ -28,6 +28,7 @@ #include "../SDL_pixels_c.h" #include "SDL_win32video.h" +#include "SDL_win32clipboard.h" #include "SDL_d3drender.h" #include "SDL_gdirender.h" @@ -35,6 +36,19 @@ static int WIN_VideoInit(_THIS); static void WIN_VideoQuit(_THIS); +/* Sets an error message based on GetLastError() */ +void +WIN_SetError(const char *prefix) +{ + TCHAR buffer[1024]; + char *message; + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, + buffer, SDL_arraysize(buffer), NULL); + message = WIN_StringToUTF8(buffer); + SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message); + SDL_free(message); +} + /* WIN32 driver bootstrap functions */ static int @@ -163,6 +177,10 @@ WIN_CreateDevice(int devindex) device->GL_DeleteContext = WIN_GL_DeleteContext; #endif + device->SetClipboardText = WIN_SetClipboardText; + device->GetClipboardText = WIN_GetClipboardText; + device->HasClipboardText = WIN_HasClipboardText; + device->free = WIN_DeleteDevice; return device; diff --git a/src/video/win32/SDL_win32video.h b/src/video/win32/SDL_win32video.h index 3cfb63219..117999dc9 100644 --- a/src/video/win32/SDL_win32video.h +++ b/src/video/win32/SDL_win32video.h @@ -60,6 +60,7 @@ #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1)) #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1) #endif +extern void WIN_SetError(const char *prefix); /* Private display data */ diff --git a/src/video/win32/SDL_win32window.c b/src/video/win32/SDL_win32window.c index c84d91568..0de0bbeb2 100644 --- a/src/video/win32/SDL_win32window.c +++ b/src/video/win32/SDL_win32window.c @@ -633,8 +633,7 @@ SDL_HelperWindowCreate(void) /* Register the class. */ SDL_HelperWindowClass = RegisterClass(&wce); if (SDL_HelperWindowClass == 0) { - SDL_SetError("Unable to create Helper Window Class: error %d.", - GetLastError()); + WIN_SetError("Unable to create Helper Window Class"); return -1; } @@ -652,8 +651,7 @@ SDL_HelperWindowCreate(void) hInstance, NULL); if (SDL_HelperWindow == NULL) { UnregisterClass(SDL_HelperWindowClassName, hInstance); - SDL_SetError("Unable to create Helper Window: error %d.", - GetLastError()); + WIN_SetError("Unable to create Helper Window"); return -1; } @@ -672,8 +670,7 @@ SDL_HelperWindowDestroy(void) /* Destroy the window. */ if (SDL_HelperWindow != NULL) { if (DestroyWindow(SDL_HelperWindow) == 0) { - SDL_SetError("Unable to destroy Helper Window: error %d.", - GetLastError()); + WIN_SetError("Unable to destroy Helper Window"); return; } SDL_HelperWindow = NULL; @@ -682,8 +679,7 @@ SDL_HelperWindowDestroy(void) /* Unregister the class. */ if (SDL_HelperWindowClass != 0) { if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) { - SDL_SetError("Unable to destroy Helper Window Class: error %d.", - GetLastError()); + WIN_SetError("Unable to destroy Helper Window Class"); return; } SDL_HelperWindowClass = 0; From 59ea7142b5a85e3a6add3981d296e7291ac33683 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 06:16:27 -0700 Subject: [PATCH 35/44] Updated Xcode project files for clipboard API Fixed generation of SDL_revision.h when hg is in the path set up in .bash_profile --- .../SDL/SDLiPhoneOS.xcodeproj/project.pbxproj | 22 +++++++--- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 34 ++++++++++++++- src/video/cocoa/SDL_cocoaclipboard.m | 42 ++++++++----------- 3 files changed, 67 insertions(+), 31 deletions(-) diff --git a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj index 9390f5939..1bbe2a820 100755 --- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj +++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj @@ -67,6 +67,9 @@ 043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; }; 043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; }; 04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB311E6069F0076F181 /* SDL_clipboard.h */; }; + 044E5FB611E6069F0076F181 /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB411E6069F0076F181 /* SDL_input.h */; }; + 044E5FB811E606EB0076F181 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 044E5FB711E606EB0076F181 /* SDL_clipboard.c */; }; 0463873F0F0B5B7D0041FD65 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387370F0B5B7D0041FD65 /* SDL_blendline.c */; }; 046387400F0B5B7D0041FD65 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */; }; 046387410F0B5B7D0041FD65 /* SDL_blendrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387390F0B5B7D0041FD65 /* SDL_blendrect.c */; }; @@ -313,6 +316,9 @@ 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; }; 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = ""; }; 04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; }; + 044E5FB311E6069F0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; }; + 044E5FB411E6069F0076F181 /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; }; + 044E5FB711E606EB0076F181 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = ""; }; 046387370F0B5B7D0041FD65 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = ""; }; 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = ""; }; 046387390F0B5B7D0041FD65 /* SDL_blendrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendrect.c; sourceTree = ""; }; @@ -826,19 +832,23 @@ FD99B8BC0DD52E5C00FB1D6B /* Public Headers */ = { isa = PBXGroup; children = ( - 04F2AF531104ABC300D6DDF7 /* SDL_assert.h */, - 04B2ECE61025CE4800F9BC5F /* SDL_atomic.h */, FD99B8CC0DD52EB400FB1D6B /* begin_code.h */, FD99B8CD0DD52EB400FB1D6B /* close_code.h */, + FD99B8F50DD52EB400FB1D6B /* SDL.h */, + 04F2AF531104ABC300D6DDF7 /* SDL_assert.h */, + 04B2ECE61025CE4800F9BC5F /* SDL_atomic.h */, FD99B8CF0DD52EB400FB1D6B /* SDL_audio.h */, + 044E5FB311E6069F0076F181 /* SDL_clipboard.h */, FD99B8D10DD52EB400FB1D6B /* SDL_compat.h */, - 04EC8B501025D12900431D42 /* SDL_config_iphoneos.h */, 04B2ED061025CF9E00F9BC5F /* SDL_config.h */, + 04EC8B501025D12900431D42 /* SDL_config_iphoneos.h */, FD99B8DA0DD52EB400FB1D6B /* SDL_copying.h */, FD99B8DB0DD52EB400FB1D6B /* SDL_cpuinfo.h */, + FD99B8F60DD52EB400FB1D6B /* SDL_endian.h */, FD99B8DC0DD52EB400FB1D6B /* SDL_error.h */, FD99B8DD0DD52EB400FB1D6B /* SDL_events.h */, 04461DED0EA76BA3006C462D /* SDL_haptic.h */, + 044E5FB411E6069F0076F181 /* SDL_input.h */, FD99B8DE0DD52EB400FB1D6B /* SDL_joystick.h */, FD99B8DF0DD52EB400FB1D6B /* SDL_keyboard.h */, FD99B8E00DD52EB400FB1D6B /* SDL_keysym.h */, @@ -865,8 +875,6 @@ FD99B8F20DD52EB400FB1D6B /* SDL_types.h */, FD99B8F30DD52EB400FB1D6B /* SDL_version.h */, FD99B8F40DD52EB400FB1D6B /* SDL_video.h */, - FD99B8F50DD52EB400FB1D6B /* SDL.h */, - FD99B8F60DD52EB400FB1D6B /* SDL_endian.h */, ); name = "Public Headers"; sourceTree = ""; @@ -1023,6 +1031,7 @@ FDA682420DF2374D00F98A1A /* video */ = { isa = PBXGroup; children = ( + 044E5FB711E606EB0076F181 /* SDL_clipboard.c */, FD689F090E26E5D900F90B21 /* uikit */, FDA685F40DF244C800F98A1A /* dummy */, 0495E6850E97408800152DFE /* SDL_glfuncs.h */, @@ -1173,6 +1182,8 @@ 043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */, 04F2AF541104ABC300D6DDF7 /* SDL_assert.h in Headers */, 006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */, + 044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */, + 044E5FB611E6069F0076F181 /* SDL_input.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1411,6 +1422,7 @@ 56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */, 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */, 006E9889119552DD001DE610 /* SDL_rwopsbundlesupport.m in Sources */, + 044E5FB811E606EB0076F181 /* SDL_clipboard.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 75f066373..d280af118 100755 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -438,6 +438,8 @@ 00D8DA281195093100638393 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA151195093100638393 /* SDL_at.c */; }; 00D8DA291195093100638393 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA181195093100638393 /* surface.c */; }; 00D8DA2A1195093100638393 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA1A1195093100638393 /* testsdl.c */; }; + 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; + 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; 046B91EC0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; 046B91ED0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; 046B92130A11B8AD00FB151C /* SDL_dlcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */; }; @@ -446,6 +448,14 @@ 04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; }; 04DB838E10FD8C81000519B5 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */; }; 04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; }; + 04DEA57111E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; }; + 04DEA57311E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; }; + 04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57411E6009000386CAC /* SDL_clipboard.c */; }; + 04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57411E6009000386CAC /* SDL_clipboard.c */; }; + 04DEA57911E600A600386CAC /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */; }; + 04DEA57A11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */; }; + 04DEA57B11E600A600386CAC /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */; }; + 04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */; }; 04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; 04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; @@ -795,10 +805,15 @@ 01538439006D7D947F000001 /* SDL_fatal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_fatal.c; path = ../../src/SDL_fatal.c; sourceTree = SOURCE_ROOT; }; 0153843C006D7D947F000001 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; 01538445006D7EC67F000001 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = ../../src/thread/SDL_thread.c; sourceTree = SOURCE_ROOT; }; + 044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; }; 046B91E90A11B53500FB151C /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = ""; }; 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_dlcompat.c; sourceTree = ""; }; 04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; }; 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = ""; }; + 04DEA56F11E6006A00386CAC /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; }; + 04DEA57411E6009000386CAC /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = ""; }; + 04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaclipboard.h; sourceTree = ""; }; + 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaclipboard.m; sourceTree = ""; }; 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; }; 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert.h; path = ../../include/SDL_assert.h; sourceTree = SOURCE_ROOT; }; 083E489D006D88D97F000001 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_joystick.c; sourceTree = ""; }; @@ -1033,6 +1048,8 @@ 00CFA703106B498A00758660 /* cocoa */ = { isa = PBXGroup; children = ( + 04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */, + 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */, 00CFA704106B498A00758660 /* SDL_cocoaevents.h */, 00CFA705106B498A00758660 /* SDL_cocoaevents.m */, 00CFA706106B498A00758660 /* SDL_cocoakeyboard.h */, @@ -1380,6 +1397,7 @@ 00CFA7FA106B49B600758660 /* SDL_blit.c */, 00CFA7FB106B49B600758660 /* SDL_blit.h */, 00CFA7FC106B49B600758660 /* SDL_bmp.c */, + 04DEA57411E6009000386CAC /* SDL_clipboard.c */, 00CFA7FD106B49B600758660 /* SDL_draw.h */, 00CFA7FE106B49B600758660 /* SDL_drawline.c */, 00CFA7FF106B49B600758660 /* SDL_drawpoint.c */, @@ -1420,12 +1438,13 @@ 0153844A006D81B07F000001 /* Public Headers */ = { isa = PBXGroup; children = ( - 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */, 0C5AF5E501191D2B7F000001 /* begin_code.h */, 0C5AF5E601191D2B7F000001 /* close_code.h */, 0C5AF5FF01191D2B7F000001 /* SDL.h */, + 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */, 00CFA67A106B44CE00758660 /* SDL_atomic.h */, 0C5AF5E801191D2B7F000001 /* SDL_audio.h */, + 044E5F8411E6051C0076F181 /* SDL_clipboard.h */, 00CFA67B106B44CE00758660 /* SDL_compat.h */, 00162D3709BD1FA90037C8D0 /* SDL_config.h */, 00162D3409BD1FA90037C8D0 /* SDL_config_macosx.h */, @@ -1435,6 +1454,7 @@ 0C5AF5ED01191D2B7F000001 /* SDL_error.h */, 0C5AF5EE01191D2B7F000001 /* SDL_events.h */, 00CFA67C106B44CE00758660 /* SDL_haptic.h */, + 04DEA56F11E6006A00386CAC /* SDL_input.h */, 0C5AF5F001191D2B7F000001 /* SDL_joystick.h */, 0C5AF5F101191D2B7F000001 /* SDL_keyboard.h */, 0C5AF5F201191D2B7F000001 /* SDL_keysym.h */, @@ -1743,6 +1763,9 @@ 00A6EBDA1078D569001EEA06 /* SDL_revision.h in Headers */, 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */, 006E95B011952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */, + 04DEA57111E6006A00386CAC /* SDL_input.h in Headers */, + 04DEA57911E600A600386CAC /* SDL_cocoaclipboard.h in Headers */, + 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1843,6 +1866,9 @@ 00A6EBDB1078D569001EEA06 /* SDL_revision.h in Headers */, 04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */, 006E95B211952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */, + 04DEA57311E6006A00386CAC /* SDL_input.h in Headers */, + 04DEA57B11E600A600386CAC /* SDL_cocoaclipboard.h in Headers */, + 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2035,7 +2061,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# The underlying scripts require calling hg to get revision info.\n# Since hg may not be in the standard Xcode path, I am sourcing .bashrc\n# But I don't know what to do if people are using other shells.\nsource ~/.bashrc\nsh ../../build-scripts/updaterev.sh\n"; + shellScript = "# The underlying scripts require calling hg to get revision info.\n# Since hg may not be in the standard Xcode path, I am sourcing .bashrc\n# But I don't know what to do if people are using other shells.\nif test -f ~/.bash_profile; then source ~/.bash_profile; fi\nif test -f ~/.bashrc; then source ~/.bashrc; fi\nsh ../../build-scripts/updaterev.sh\n"; }; 0083103E1072EA5700A531F1 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2202,6 +2228,8 @@ 04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */, 04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */, 006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, + 04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */, + 04DEA57A11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2318,6 +2346,8 @@ 04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */, 04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */, 006E95B311952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, + 04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */, + 04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index ea86446a0..77d30594d 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -23,20 +23,28 @@ #include "SDL_cocoavideo.h" - -int -Cocoa_SetClipboardText(_THIS, const char *text) +static NSString * +GetTextFormat(_THIS) { +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + return NSStringPboardType; +#else SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - NSAutoreleasePool *pool; - NSPasteboard *pasteboard; - NSString *format; if (data->osversion >= 0x1060) { - format = NSPasteboardTypeString; + return NSPasteboardTypeString; } else { - format = NSStringPboardType; + return NSStringPboardType; } +#endif +} + +int +Cocoa_SetClipboardText(_THIS, const char *text) +{ + NSAutoreleasePool *pool; + NSPasteboard *pasteboard; + NSString *format = GetTextFormat(_this); pool = [[NSAutoreleasePool alloc] init]; @@ -52,19 +60,12 @@ char * Cocoa_GetClipboardText(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; - NSString *format; + NSString *format = GetTextFormat(_this); NSString *available; char *text; - if (data->osversion >= 0x1060) { - format = NSPasteboardTypeString; - } else { - format = NSStringPboardType; - } - pool = [[NSAutoreleasePool alloc] init]; pasteboard = [NSPasteboard generalPasteboard]; @@ -92,19 +93,12 @@ SDL_bool Cocoa_HasClipboardText(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; - NSString *format; + NSString *format = GetTextFormat(_this); NSString *available; SDL_bool result; - if (data->osversion >= 0x1060) { - format = NSPasteboardTypeString; - } else { - format = NSStringPboardType; - } - pool = [[NSAutoreleasePool alloc] init]; pasteboard = [NSPasteboard generalPasteboard]; From 83adffdcdc5ce0ed9d71ab52f981081e14e446c8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 06:21:48 -0700 Subject: [PATCH 36/44] Made the new public headers public --- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index d280af118..f9219d47b 100755 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -438,7 +438,7 @@ 00D8DA281195093100638393 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA151195093100638393 /* SDL_at.c */; }; 00D8DA291195093100638393 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA181195093100638393 /* surface.c */; }; 00D8DA2A1195093100638393 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA1A1195093100638393 /* testsdl.c */; }; - 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; + 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; 046B91EC0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; 046B91ED0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; @@ -448,7 +448,7 @@ 04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; }; 04DB838E10FD8C81000519B5 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */; }; 04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; }; - 04DEA57111E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; }; + 04DEA57111E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04DEA57311E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; }; 04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57411E6009000386CAC /* SDL_clipboard.c */; }; 04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57411E6009000386CAC /* SDL_clipboard.c */; }; @@ -458,7 +458,7 @@ 04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */; }; 04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; 04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; - 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; + 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; BECDF62E0761BA81005FE872 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538330006D78D67F000001 /* SDL_audio.c */; }; BECDF62F0761BA81005FE872 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538331006D78D67F000001 /* SDL_audiocvt.c */; }; From 2c7aa1ba8ea9534c641964d4c614c12dda44c6d7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 22:54:03 -0700 Subject: [PATCH 37/44] Added an event when the clipboard is updated, triggered after the window gains the keyboard focus. --- .../SDL/SDLiPhoneOS.xcodeproj/project.pbxproj | 8 ++++ Xcode/SDL/SDL.xcodeproj/project.pbxproj | 48 +++++++++++++++++++ include/SDL_events.h | 3 ++ src/events/SDL_clipboardevents.c | 47 ++++++++++++++++++ src/events/SDL_clipboardevents_c.h | 31 ++++++++++++ src/video/cocoa/SDL_cocoaclipboard.h | 4 ++ src/video/cocoa/SDL_cocoaclipboard.m | 25 +++++++++- src/video/cocoa/SDL_cocoavideo.h | 1 + src/video/cocoa/SDL_cocoawindow.m | 3 ++ test/common.c | 3 ++ 10 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 src/events/SDL_clipboardevents.c create mode 100644 src/events/SDL_clipboardevents_c.h diff --git a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj index 1bbe2a820..96ada2e15 100755 --- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj +++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj @@ -62,6 +62,8 @@ 0098A5631195B4D900343137 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5621195B4D900343137 /* OpenGLES.framework */; }; 0098A5651195B4D900343137 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5641195B4D900343137 /* UIKit.framework */; }; 0098A5851195B5E200343137 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5841195B5E200343137 /* QuartzCore.framework */; }; + 0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; }; + 0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; }; 043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */; }; 043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; }; 043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; }; @@ -311,6 +313,8 @@ 0098A5621195B4D900343137 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 0098A5641195B4D900343137 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 0098A5841195B5E200343137 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = ""; }; + 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = ""; }; 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = ""; }; 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = ""; }; 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; }; @@ -958,6 +962,8 @@ FD99B9900DD52EDC00FB1D6B /* scancodes_linux.h */, FD99B9910DD52EDC00FB1D6B /* scancodes_win32.h */, FD99B9920DD52EDC00FB1D6B /* scancodes_xfree86.h */, + 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */, + 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */, FD99B9930DD52EDC00FB1D6B /* SDL_events.c */, FD99B9940DD52EDC00FB1D6B /* SDL_events_c.h */, FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */, @@ -1184,6 +1190,7 @@ 006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */, 044E5FB611E6069F0076F181 /* SDL_input.h in Headers */, + 0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1423,6 +1430,7 @@ 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */, 006E9889119552DD001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 044E5FB811E606EB0076F181 /* SDL_clipboard.c in Sources */, + 0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index f9219d47b..8202a4c62 100755 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -438,6 +438,22 @@ 00D8DA281195093100638393 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA151195093100638393 /* SDL_at.c */; }; 00D8DA291195093100638393 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA181195093100638393 /* surface.c */; }; 00D8DA2A1195093100638393 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA1A1195093100638393 /* testsdl.c */; }; + 0420496111E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */; }; + 0420496211E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */; }; + 0420496311E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */; }; + 0420496411E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */; }; + 0420497A11E6F052007E7EC9 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497411E6F052007E7EC9 /* blank_cursor.h */; }; + 0420497B11E6F052007E7EC9 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497511E6F052007E7EC9 /* default_cursor.h */; }; + 0420497C11E6F052007E7EC9 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497611E6F052007E7EC9 /* scancodes_darwin.h */; }; + 0420497D11E6F052007E7EC9 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497711E6F052007E7EC9 /* scancodes_linux.h */; }; + 0420497E11E6F052007E7EC9 /* scancodes_win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497811E6F052007E7EC9 /* scancodes_win32.h */; }; + 0420497F11E6F052007E7EC9 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */; }; + 0420498011E6F052007E7EC9 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497411E6F052007E7EC9 /* blank_cursor.h */; }; + 0420498111E6F052007E7EC9 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497511E6F052007E7EC9 /* default_cursor.h */; }; + 0420498211E6F052007E7EC9 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497611E6F052007E7EC9 /* scancodes_darwin.h */; }; + 0420498311E6F052007E7EC9 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497711E6F052007E7EC9 /* scancodes_linux.h */; }; + 0420498411E6F052007E7EC9 /* scancodes_win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497811E6F052007E7EC9 /* scancodes_win32.h */; }; + 0420498511E6F052007E7EC9 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */; }; 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; 046B91EC0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; @@ -805,6 +821,14 @@ 01538439006D7D947F000001 /* SDL_fatal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_fatal.c; path = ../../src/SDL_fatal.c; sourceTree = SOURCE_ROOT; }; 0153843C006D7D947F000001 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; 01538445006D7EC67F000001 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = ../../src/thread/SDL_thread.c; sourceTree = SOURCE_ROOT; }; + 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = ""; }; + 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = ""; }; + 0420497411E6F052007E7EC9 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blank_cursor.h; sourceTree = ""; }; + 0420497511E6F052007E7EC9 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_cursor.h; sourceTree = ""; }; + 0420497611E6F052007E7EC9 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_darwin.h; sourceTree = ""; }; + 0420497711E6F052007E7EC9 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_linux.h; sourceTree = ""; }; + 0420497811E6F052007E7EC9 /* scancodes_win32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_win32.h; sourceTree = ""; }; + 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_xfree86.h; sourceTree = ""; }; 044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; }; 046B91E90A11B53500FB151C /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = ""; }; 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_dlcompat.c; sourceTree = ""; }; @@ -1329,6 +1353,14 @@ 01538367006D79147F000001 /* events */ = { isa = PBXGroup; children = ( + 0420497411E6F052007E7EC9 /* blank_cursor.h */, + 0420497511E6F052007E7EC9 /* default_cursor.h */, + 0420497611E6F052007E7EC9 /* scancodes_darwin.h */, + 0420497711E6F052007E7EC9 /* scancodes_linux.h */, + 0420497811E6F052007E7EC9 /* scancodes_win32.h */, + 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */, + 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */, + 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */, 00CFA6C2106B480800758660 /* SDL_events_c.h */, 01538369006D79147F000001 /* SDL_events.c */, 00CFA6C3106B480800758660 /* SDL_keyboard_c.h */, @@ -1766,6 +1798,13 @@ 04DEA57111E6006A00386CAC /* SDL_input.h in Headers */, 04DEA57911E600A600386CAC /* SDL_cocoaclipboard.h in Headers */, 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */, + 0420496111E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */, + 0420497A11E6F052007E7EC9 /* blank_cursor.h in Headers */, + 0420497B11E6F052007E7EC9 /* default_cursor.h in Headers */, + 0420497C11E6F052007E7EC9 /* scancodes_darwin.h in Headers */, + 0420497D11E6F052007E7EC9 /* scancodes_linux.h in Headers */, + 0420497E11E6F052007E7EC9 /* scancodes_win32.h in Headers */, + 0420497F11E6F052007E7EC9 /* scancodes_xfree86.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1869,6 +1908,13 @@ 04DEA57311E6006A00386CAC /* SDL_input.h in Headers */, 04DEA57B11E600A600386CAC /* SDL_cocoaclipboard.h in Headers */, 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */, + 0420496311E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */, + 0420498011E6F052007E7EC9 /* blank_cursor.h in Headers */, + 0420498111E6F052007E7EC9 /* default_cursor.h in Headers */, + 0420498211E6F052007E7EC9 /* scancodes_darwin.h in Headers */, + 0420498311E6F052007E7EC9 /* scancodes_linux.h in Headers */, + 0420498411E6F052007E7EC9 /* scancodes_win32.h in Headers */, + 0420498511E6F052007E7EC9 /* scancodes_xfree86.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2230,6 +2276,7 @@ 006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */, 04DEA57A11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */, + 0420496211E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2348,6 +2395,7 @@ 006E95B311952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */, 04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */, + 0420496411E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/include/SDL_events.h b/include/SDL_events.h index 91bdd8624..50a0cb7c3 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -90,6 +90,9 @@ typedef enum SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ SDL_JOYBUTTONUP, /**< Joystick button released */ + /* Clipboard events */ + SDL_CLIPBOARDUPDATE = 0x700, /**< The clipboard changed */ + /* Obsolete events */ SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */ SDL_EVENT_COMPAT2, diff --git a/src/events/SDL_clipboardevents.c b/src/events/SDL_clipboardevents.c new file mode 100644 index 000000000..7f8820047 --- /dev/null +++ b/src/events/SDL_clipboardevents.c @@ -0,0 +1,47 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Clipboard event handling code for SDL */ + +#include "SDL_events.h" +#include "SDL_events_c.h" +#include "SDL_clipboardevents_c.h" + + +int +SDL_SendClipboardUpdate() +{ + int posted; + + /* Post the event, if desired */ + posted = 0; + if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) { + SDL_Event event; + event.type = SDL_CLIPBOARDUPDATE; + + posted = (SDL_PushEvent(&event) > 0); + } + return (posted); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/SDL_clipboardevents_c.h b/src/events/SDL_clipboardevents_c.h new file mode 100644 index 000000000..4d6a1f19a --- /dev/null +++ b/src/events/SDL_clipboardevents_c.h @@ -0,0 +1,31 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_clipboardevents_c_h +#define _SDL_clipboardevents_c_h + +extern int SDL_SendClipboardUpdate(); + +#endif /* _SDL_clipboardevents_c_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoaclipboard.h b/src/video/cocoa/SDL_cocoaclipboard.h index 8e4619b95..9746e7eb5 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.h +++ b/src/video/cocoa/SDL_cocoaclipboard.h @@ -24,9 +24,13 @@ #ifndef _SDL_cocoaclipboard_h #define _SDL_cocoaclipboard_h +/* Forward declaration */ +struct SDL_VideoData; + extern int Cocoa_SetClipboardText(_THIS, const char *text); extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); +extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); #endif /* _SDL_cocoaclipboard_h */ diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index 77d30594d..01ff40a89 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -22,6 +22,7 @@ #include "SDL_config.h" #include "SDL_cocoavideo.h" +#include "../../events/SDL_clipboardevents_c.h" static NSString * GetTextFormat(_THIS) @@ -42,6 +43,7 @@ int Cocoa_SetClipboardText(_THIS, const char *text) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; NSString *format = GetTextFormat(_this); @@ -49,7 +51,7 @@ pool = [[NSAutoreleasePool alloc] init]; pasteboard = [NSPasteboard generalPasteboard]; - [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; + data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; [pasteboard setString:[NSString stringWithUTF8String:text] forType:format]; [pool release]; @@ -114,4 +116,25 @@ return result; } +void +Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) +{ + NSAutoreleasePool *pool; + NSPasteboard *pasteboard; + NSInteger count; + + pool = [[NSAutoreleasePool alloc] init]; + + pasteboard = [NSPasteboard generalPasteboard]; + count = [pasteboard changeCount]; + if (count != data->clipboard_count) { + if (data->clipboard_count) { + SDL_SendClipboardUpdate(); + } + data->clipboard_count = count; + } + + [pool release]; +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 402cdccb5..890624bfb 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -60,6 +60,7 @@ typedef struct SDL_VideoData unsigned int modifierFlags; void *key_layout; SDLTranslatorResponder *fieldEdit; + NSInteger clipboard_count; Uint32 screensaver_activity; } SDL_VideoData; diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index af84bff2f..be4840b82 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -128,6 +128,9 @@ - (void)windowDidBecomeKey:(NSNotification *)aNotification { /* We're going to get keyboard events, since we're key. */ SDL_SetKeyboardFocus(_data->window); + + /* Check to see if someone updated the clipboard */ + Cocoa_CheckClipboardUpdate(_data->videodata); } - (void)windowDidResignKey:(NSNotification *)aNotification diff --git a/test/common.c b/test/common.c index efbccd6f7..845a7460e 100644 --- a/test/common.c +++ b/test/common.c @@ -1017,6 +1017,9 @@ PrintEvent(SDL_Event * event) fprintf(stderr, "Joystick %d: button %d released", event->jbutton.which, event->jbutton.button); break; + case SDL_CLIPBOARDUPDATE: + fprintf(stderr, "Clipboard updated"); + break; case SDL_QUIT: fprintf(stderr, "Quit requested"); break; From 5a6774ae6876250f1d91542b08ac54631f99ccbe Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Jul 2010 23:07:34 -0700 Subject: [PATCH 38/44] Amazingly the Windows code is almost identical to the Mac OS X code. :) --- VisualC/SDL/SDL_VS2005.vcproj | 8 ++++++++ VisualC/SDL/SDL_VS2008.vcproj | 8 ++++++++ src/video/cocoa/SDL_cocoaclipboard.m | 8 ++++---- src/video/win32/SDL_win32clipboard.c | 17 +++++++++++++++++ src/video/win32/SDL_win32clipboard.h | 4 ++++ src/video/win32/SDL_win32events.c | 5 ++++- src/video/win32/SDL_win32video.c | 1 - src/video/win32/SDL_win32video.h | 3 +++ 8 files changed, 48 insertions(+), 6 deletions(-) diff --git a/VisualC/SDL/SDL_VS2005.vcproj b/VisualC/SDL/SDL_VS2005.vcproj index 0dfa9b77d..6be80978f 100644 --- a/VisualC/SDL/SDL_VS2005.vcproj +++ b/VisualC/SDL/SDL_VS2005.vcproj @@ -568,6 +568,14 @@ RelativePath="..\..\src\video\SDL_clipboard.c" > + + + + diff --git a/VisualC/SDL/SDL_VS2008.vcproj b/VisualC/SDL/SDL_VS2008.vcproj index d616591fd..439cbd1bc 100644 --- a/VisualC/SDL/SDL_VS2008.vcproj +++ b/VisualC/SDL/SDL_VS2008.vcproj @@ -723,6 +723,14 @@ RelativePath="..\..\src\video\SDL_clipboard.c" > + + + + diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index 01ff40a89..26f6aeed2 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -45,7 +45,7 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; - NSPasteboard *pasteboard; + NSPasteboard *pasteboard; NSString *format = GetTextFormat(_this); pool = [[NSAutoreleasePool alloc] init]; @@ -63,7 +63,7 @@ Cocoa_GetClipboardText(_THIS) { NSAutoreleasePool *pool; - NSPasteboard *pasteboard; + NSPasteboard *pasteboard; NSString *format = GetTextFormat(_this); NSString *available; char *text; @@ -96,7 +96,7 @@ Cocoa_HasClipboardText(_THIS) { NSAutoreleasePool *pool; - NSPasteboard *pasteboard; + NSPasteboard *pasteboard; NSString *format = GetTextFormat(_this); NSString *available; SDL_bool result; @@ -120,7 +120,7 @@ Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) { NSAutoreleasePool *pool; - NSPasteboard *pasteboard; + NSPasteboard *pasteboard; NSInteger count; pool = [[NSAutoreleasePool alloc] init]; diff --git a/src/video/win32/SDL_win32clipboard.c b/src/video/win32/SDL_win32clipboard.c index 950bd444f..22d54a682 100644 --- a/src/video/win32/SDL_win32clipboard.c +++ b/src/video/win32/SDL_win32clipboard.c @@ -23,6 +23,7 @@ #include "SDL_win32video.h" #include "SDL_win32window.h" +#include "../../events/SDL_clipboardevents_c.h" #ifdef UNICODE @@ -52,6 +53,7 @@ GetWindowHandle(_THIS) int WIN_SetClipboardText(_THIS, const char *text) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; int result = 0; if (OpenClipboard(GetWindowHandle(_this))) { @@ -93,6 +95,7 @@ WIN_SetClipboardText(_THIS, const char *text) WIN_SetError("Couldn't set clipboard data"); result = -1; } + data->clipboard_count = GetClipboardSequenceNumber(); } SDL_free(tstr); @@ -141,4 +144,18 @@ WIN_HasClipboardText(_THIS) } } +void +WIN_CheckClipboardUpdate(struct SDL_VideoData * data) +{ + DWORD count; + + count = GetClipboardSequenceNumber(); + if (count != data->clipboard_count) { + if (data->clipboard_count) { + SDL_SendClipboardUpdate(); + } + data->clipboard_count = count; + } +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/win32/SDL_win32clipboard.h b/src/video/win32/SDL_win32clipboard.h index 36fb79823..ab2fb17a7 100644 --- a/src/video/win32/SDL_win32clipboard.h +++ b/src/video/win32/SDL_win32clipboard.h @@ -24,9 +24,13 @@ #ifndef _SDL_win32clipboard_h #define _SDL_win32clipboard_h +/* Forward declaration */ +struct SDL_VideoData; + extern int WIN_SetClipboardText(_THIS, const char *text); extern char *WIN_GetClipboardText(_THIS); extern SDL_bool WIN_HasClipboardText(_THIS); +extern void WIN_CheckClipboardUpdate(struct SDL_VideoData * data); #endif /* _SDL_win32clipboard_h */ diff --git a/src/video/win32/SDL_win32events.c b/src/video/win32/SDL_win32events.c index 98affcc3c..d03b672c6 100755 --- a/src/video/win32/SDL_win32events.c +++ b/src/video/win32/SDL_win32events.c @@ -162,7 +162,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (SDL_GetKeyboardFocus() != data->window) { SDL_SetKeyboardFocus(data->window); } - /* FIXME: Update keyboard state */ + /* + * FIXME: Update keyboard state + */ + WIN_CheckClipboardUpdate(data->videodata); } else { if (SDL_GetKeyboardFocus() == data->window) { SDL_SetKeyboardFocus(NULL); diff --git a/src/video/win32/SDL_win32video.c b/src/video/win32/SDL_win32video.c index 2c93885e2..2c5d3146d 100644 --- a/src/video/win32/SDL_win32video.c +++ b/src/video/win32/SDL_win32video.c @@ -28,7 +28,6 @@ #include "../SDL_pixels_c.h" #include "SDL_win32video.h" -#include "SDL_win32clipboard.h" #include "SDL_d3drender.h" #include "SDL_gdirender.h" diff --git a/src/video/win32/SDL_win32video.h b/src/video/win32/SDL_win32video.h index 117999dc9..6911f49b8 100644 --- a/src/video/win32/SDL_win32video.h +++ b/src/video/win32/SDL_win32video.h @@ -45,6 +45,7 @@ #include "ddraw.h" #endif +#include "SDL_win32clipboard.h" #include "SDL_win32events.h" #include "SDL_win32gamma.h" #include "SDL_win32keyboard.h" @@ -75,6 +76,8 @@ typedef struct SDL_VideoData IDirectDraw *ddraw; #endif + DWORD clipboard_count; + const SDL_scancode *key_layout; } SDL_VideoData; From 150a13c0c2404f2e15dc4c2389d07c4dc8a4dc59 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 12 Jul 2010 00:33:24 -0700 Subject: [PATCH 39/44] Fixed compiler warning --- src/video/x11/SDL_x11window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 699740418..9fd1350e6 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -289,9 +289,9 @@ X11_CreateWindow(_THIS, SDL_Window * window) Sint32 r, g, b; /* Is the colormap we need already registered in SDL? */ - if (colormap = + if ((colormap = X11_LookupColormap(data->display, - displaydata->screen, visual->visualid)) { + displaydata->screen, visual->visualid))) { xattr.colormap = colormap; /* printf("found existing colormap\n"); */ } else { From 5c3d68df92caec24a4b056e3b6d9775e8b3525ce Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 12 Jul 2010 00:35:14 -0700 Subject: [PATCH 40/44] Fixed compile warnings --- include/SDL_clipboard.h | 4 ++-- src/events/SDL_clipboardevents.c | 2 +- src/events/SDL_clipboardevents_c.h | 2 +- src/video/SDL_clipboard.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h index 848c21d12..bc9e348db 100644 --- a/include/SDL_clipboard.h +++ b/include/SDL_clipboard.h @@ -53,14 +53,14 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * * \sa SDL_SetClipboardText() */ -extern DECLSPEC char * SDLCALL SDL_GetClipboardText(); +extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * \brief Returns whether the clipboard has text * * \sa SDL_GetClipboardText() */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(); +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); /* Ends C function definitions when using C++ */ diff --git a/src/events/SDL_clipboardevents.c b/src/events/SDL_clipboardevents.c index 7f8820047..2d5a2c48d 100644 --- a/src/events/SDL_clipboardevents.c +++ b/src/events/SDL_clipboardevents.c @@ -29,7 +29,7 @@ int -SDL_SendClipboardUpdate() +SDL_SendClipboardUpdate(void) { int posted; diff --git a/src/events/SDL_clipboardevents_c.h b/src/events/SDL_clipboardevents_c.h index 4d6a1f19a..9e35a5aba 100644 --- a/src/events/SDL_clipboardevents_c.h +++ b/src/events/SDL_clipboardevents_c.h @@ -24,7 +24,7 @@ #ifndef _SDL_clipboardevents_c_h #define _SDL_clipboardevents_c_h -extern int SDL_SendClipboardUpdate(); +extern int SDL_SendClipboardUpdate(void); #endif /* _SDL_clipboardevents_c_h */ diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c index fc7e5fbb6..a414fa5ec 100644 --- a/src/video/SDL_clipboard.c +++ b/src/video/SDL_clipboard.c @@ -42,7 +42,7 @@ SDL_SetClipboardText(const char *text) } char * -SDL_GetClipboardText() +SDL_GetClipboardText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -58,7 +58,7 @@ SDL_GetClipboardText() } SDL_bool -SDL_HasClipboardText() +SDL_HasClipboardText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); From 1920aee3fbe52ff8390e7527caff66fb73af6da2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 12 Jul 2010 00:35:24 -0700 Subject: [PATCH 41/44] Fixed compile warnings --- src/audio/SDL_audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e3b02cf94..d115de7ee 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -287,6 +287,7 @@ SDL_StreamLength(SDL_AudioStreamer * stream) } /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */ +#if 0 static int SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) { @@ -305,6 +306,7 @@ SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) return 0; } +#endif /* Deinitialize the stream simply by freeing the buffer */ static void From aa600ee842e8501bff0299f54a3d06a79579c295 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 12 Jul 2010 00:36:55 -0700 Subject: [PATCH 42/44] Added X11 clipboard support. As far as I know there isn't any real way to tell when the clipboard contents have changed without polling them, so I didn't implement the clipboard update event on X11. --- src/video/x11/SDL_x11clipboard.c | 152 +++++++++++++++++++++++++++++++ src/video/x11/SDL_x11clipboard.h | 33 +++++++ src/video/x11/SDL_x11events.c | 52 +++++++++++ src/video/x11/SDL_x11sym.h | 11 ++- src/video/x11/SDL_x11video.c | 6 ++ src/video/x11/SDL_x11video.h | 2 + 6 files changed, 252 insertions(+), 4 deletions(-) create mode 100644 src/video/x11/SDL_x11clipboard.c create mode 100644 src/video/x11/SDL_x11clipboard.h diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c new file mode 100644 index 000000000..cbf7a6de7 --- /dev/null +++ b/src/video/x11/SDL_x11clipboard.c @@ -0,0 +1,152 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include /* For INT_MAX */ + +#include "SDL_events.h" +#include "SDL_x11video.h" + + +/* Get any application owned window handle for clipboard association */ +static Window +GetWindow(_THIS) +{ + SDL_VideoDisplay *display; + SDL_Window *window; + + display = _this->displays; + if (display) { + window = display->windows; + if (window) { + return ((SDL_WindowData *) window->driverdata)->xwindow; + } + } + return None; +} + +int +X11_SetClipboardText(_THIS, const char *text) +{ + Display *display = ((SDL_VideoData *) _this->driverdata)->display; + Atom format; + Window window; + + /* Get the SDL window that will own the selection */ + window = GetWindow(_this); + if (window == None) { + SDL_SetError("Couldn't find a window to own the selection"); + return -1; + } + + /* If you don't support UTF-8, you might use XA_STRING here */ + format = XInternAtom(display, "UTF8_STRING", False); + XChangeProperty(display, DefaultRootWindow(display), + XA_CUT_BUFFER0, format, 8, PropModeReplace, + (const unsigned char *)text, SDL_strlen(text)); + + if (XGetSelectionOwner(display, XA_PRIMARY) != window) { + XSetSelectionOwner(display, XA_PRIMARY, window, CurrentTime); + } + return 0; +} + +char * +X11_GetClipboardText(_THIS) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + Display *display = videodata->display; + Atom format; + Window window; + Window owner; + Atom selection; + Atom seln_type; + int seln_format; + unsigned long nbytes; + unsigned long overflow; + unsigned char *src; + char *text; + + text = NULL; + + /* Get the SDL window that will own the selection */ + window = GetWindow(_this); + + /* If you don't support UTF-8, you might use XA_STRING here */ + format = XInternAtom(display, "UTF8_STRING", False); + + owner = XGetSelectionOwner(display, XA_PRIMARY); + if ((owner == None) || (owner == window)) { + owner = DefaultRootWindow(display); + selection = XA_CUT_BUFFER0; + } else { + /* Request that the selection owner copy the data to our window */ + owner = window; + selection = XInternAtom(display, "SDL_SELECTION", False); + XConvertSelection(display, XA_PRIMARY, format, selection, owner, + CurrentTime); + + /* FIXME: Should we have a timeout here? */ + videodata->selection_waiting = SDL_TRUE; + while (videodata->selection_waiting) { + SDL_PumpEvents(); + } + } + + if (XGetWindowProperty(display, owner, selection, 0, INT_MAX/4, False, + format, &seln_type, &seln_format, &nbytes, &overflow, &src) + == Success) { + if (seln_type == format) { + text = (char *)SDL_malloc(nbytes+1); + if (text) { + SDL_memcpy(text, src, nbytes); + text[nbytes] = '\0'; + } + } + XFree(src); + } + + if (!text) { + text = SDL_strdup(""); + } + return text; +} + +SDL_bool +X11_HasClipboardText(_THIS) +{ + /* Not an easy way to tell with X11, as far as I know... */ + char *text; + SDL_bool retval; + + text = X11_GetClipboardText(_this); + if (*text) { + retval = SDL_TRUE; + } else { + retval = SDL_FALSE; + } + SDL_free(text); + + return retval; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11clipboard.h b/src/video/x11/SDL_x11clipboard.h new file mode 100644 index 000000000..6d9bbb085 --- /dev/null +++ b/src/video/x11/SDL_x11clipboard.h @@ -0,0 +1,33 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_x11clipboard_h +#define _SDL_x11clipboard_h + +extern int X11_SetClipboardText(_THIS, const char *text); +extern char *X11_GetClipboardText(_THIS); +extern SDL_bool X11_HasClipboardText(_THIS); + +#endif /* _SDL_x11clipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 147dc626d..e4d51bc6b 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -25,6 +25,7 @@ #include #include #include +#include /* For INT_MAX */ #include "SDL_x11video.h" #include "../../events/SDL_events_c.h" @@ -33,6 +34,8 @@ #include "SDL_timer.h" #include "SDL_syswm.h" +/*#define DEBUG_XEVENTS*/ + static void X11_DispatchEvent(_THIS) { @@ -286,6 +289,55 @@ X11_DispatchEvent(_THIS) } break; + /* Copy the selection from XA_CUT_BUFFER0 to the requested property */ + case SelectionRequest: { + Display *display = videodata->display; + XSelectionRequestEvent *req; + XEvent sevent; + int seln_format; + unsigned long nbytes; + unsigned long overflow; + unsigned char *seln_data; + + req = &xevent.xselectionrequest; +#ifdef DEBUG_XEVENTS + printf("SelectionRequest (requestor = %ld, target = %ld)\n", + req->requestor, req->target); +#endif + + sevent.xselection.type = SelectionNotify; + sevent.xselection.display = req->display; + sevent.xselection.selection = req->selection; + sevent.xselection.target = None; + sevent.xselection.property = None; + sevent.xselection.requestor = req->requestor; + sevent.xselection.time = req->time; + if (XGetWindowProperty(display, DefaultRootWindow(display), + XA_CUT_BUFFER0, 0, INT_MAX/4, False, req->target, + &sevent.xselection.target, &seln_format, &nbytes, + &overflow, &seln_data) == Success) { + if (sevent.xselection.target == req->target) { + XChangeProperty(display, req->requestor, req->property, + sevent.xselection.target, seln_format, PropModeReplace, + seln_data, nbytes); + sevent.xselection.property = req->property; + } + XFree(seln_data); + } + XSendEvent(display, req->requestor, False, 0, &sevent); + XSync(display, False); + } + break; + + case SelectionNotify: { +#ifdef DEBUG_XEVENTS + printf("SelectionNotify (requestor = %ld, target = %ld)\n", + xevent.xselection.requestor, xevent.xselection.target); +#endif + videodata->selection_waiting = SDL_FALSE; + } + break; + default:{ #ifdef DEBUG_XEVENTS printf("Unhandled event %d\n", xevent.type); diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index 0cdcfe8dc..01dc8f6a0 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -37,6 +37,7 @@ SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSe SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return) SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return) SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return) +SDL_X11_SYM(int,XConvertSelection,(Display* a,Atom b,Atom c,Atom d,Window e,Time f),(a,b,c,d,e,f),return) SDL_X11_SYM(int,XCopyArea,(Display* a,Drawable b,Drawable c,GC d,int e,int f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) @@ -71,10 +72,11 @@ SDL_X11_SYM(XImage*,XGetImage,(Display* a,Drawable b,int c,int d,unsigned int e, SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return) SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return) SDL_X11_SYM(int,XGetRGBColormaps,(Display* a,Window b,XStandardColormap **c,int *d,Atom e),(a,b,c,d,e),return) +SDL_X11_SYM(Window,XGetSelectionOwner,(Display* a,Atom b),(a,b),return) SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return) -SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return) SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return) SDL_X11_SYM(int,XGetWindowProperty,(Display* a,Window b,Atom c,long d,long e,Bool f,Atom g,Atom* h,int* i,unsigned long* j,unsigned long *k,unsigned char **l),(a,b,c,d,e,f,g,h,i,j,k,l),return) +SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return) SDL_X11_SYM(int,XGrabKeyboard,(Display* a,Window b,Bool c,int d,int e,Time f),(a,b,c,d,e,f),return) SDL_X11_SYM(int,XGrabPointer,(Display* a,Window b,Bool c,unsigned int d,int e,int f,Window g,Cursor h,Time i),(a,b,c,d,e,f,g,h,i),return) SDL_X11_SYM(int,XGrabServer,(Display* a),(a),return) @@ -114,14 +116,15 @@ SDL_X11_SYM(int,XSetForeground,(Display* a,GC b,unsigned long c),(a,b,c),return) SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return) SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return) SDL_X11_SYM(void,XSetRGBColormaps,( Display *a,Window b,XStandardColormap *c,int d,Atom e),(a,b,c,d,e),return) +SDL_X11_SYM(int,XSetSelectionOwner,(Display* a,Atom b,Window c,Time d),(a,b,c,d),return) SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return) -SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return) SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),) -SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),) -SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return) SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return) SDL_X11_SYM(int,XSetWindowBackgroundPixmap,(Display* a,Window b,Pixmap c),(a,b,c),return) SDL_X11_SYM(int,XSetWindowColormap,(Display* a,Window b,Colormap c),(a,b,c),return) +SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return) +SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),) +SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return) SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return) SDL_X11_SYM(Status,XStringListToTextProperty,(char** a,int b,XTextProperty* c),(a,b,c),return) SDL_X11_SYM(int,XSync,(Display* a,Bool b),(a,b),return) diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 86a9e7db9..a3a8d2c72 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -21,6 +21,8 @@ */ #include "SDL_config.h" +#include /* For getpid() and readlink() */ + #include "SDL_video.h" #include "SDL_mouse.h" #include "../SDL_sysvideo.h" @@ -225,6 +227,10 @@ X11_CreateDevice(int devindex) device->GL_DeleteContext = X11_GLES_DeleteContext; #endif + device->SetClipboardText = X11_SetClipboardText; + device->GetClipboardText = X11_GetClipboardText; + device->HasClipboardText = X11_HasClipboardText; + device->free = X11_DeleteDevice; return device; diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index a550f8485..34647ca51 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -48,6 +48,7 @@ #include "SDL_x11dyn.h" +#include "SDL_x11clipboard.h" #include "SDL_x11events.h" #include "SDL_x11gamma.h" #include "SDL_x11keyboard.h" @@ -69,6 +70,7 @@ typedef struct SDL_VideoData int windowlistlength; Atom WM_DELETE_WINDOW; SDL_scancode key_layout[256]; + SDL_bool selection_waiting; } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); From cc416b6bfb333fecd2fe0ed9eaa276210694b831 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 12 Jul 2010 00:49:26 -0700 Subject: [PATCH 43/44] Made it possible to switch the text format in one place --- src/video/x11/SDL_x11clipboard.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c index cbf7a6de7..ddd8cdc41 100644 --- a/src/video/x11/SDL_x11clipboard.c +++ b/src/video/x11/SDL_x11clipboard.c @@ -27,6 +27,13 @@ #include "SDL_x11video.h" +/* If you don't support UTF-8, you might use XA_STRING here */ +#if 1 +#define TEXT_FORMAT XInternAtom(display, "UTF8_STRING", False) +#else +#define TEXT_FORMAT XA_STRING +#endif + /* Get any application owned window handle for clipboard association */ static Window GetWindow(_THIS) @@ -58,8 +65,8 @@ X11_SetClipboardText(_THIS, const char *text) return -1; } - /* If you don't support UTF-8, you might use XA_STRING here */ - format = XInternAtom(display, "UTF8_STRING", False); + /* Save the selection on the root window */ + format = TEXT_FORMAT; XChangeProperty(display, DefaultRootWindow(display), XA_CUT_BUFFER0, format, 8, PropModeReplace, (const unsigned char *)text, SDL_strlen(text)); @@ -88,12 +95,9 @@ X11_GetClipboardText(_THIS) text = NULL; - /* Get the SDL window that will own the selection */ + /* Get the window that holds the selection */ window = GetWindow(_this); - - /* If you don't support UTF-8, you might use XA_STRING here */ - format = XInternAtom(display, "UTF8_STRING", False); - + format = TEXT_FORMAT; owner = XGetSelectionOwner(display, XA_PRIMARY); if ((owner == None) || (owner == window)) { owner = DefaultRootWindow(display); From 111d7b44914dcbe9b1b134a3ca523f81a992f9c7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 12 Jul 2010 01:20:57 -0700 Subject: [PATCH 44/44] Implemented X11 system window manager info for SDL 1.3. It's simple. Really. --- include/SDL_syswm.h | 18 ------------------ src/video/x11/SDL_x11window.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 56ef7f6d2..4f7d00720 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -106,24 +106,6 @@ struct SDL_SysWMinfo { Display *display; /**< The X11 display */ Window window; /**< The X11 display window */ - /** - * These locking functions should be called around - * any X11 functions using the display variable. - * They lock the event thread, so should not be - * called around event functions or from event filters. - */ - /*@{*/ - void (*lock_func) (void); - void (*unlock_func) (void); - /*@}*/ - - /** - * Introduced in SDL 1.0.2. - */ - /*@{*/ - Window fswindow; /**< The X11 fullscreen window */ - Window wmwindow; /**< The X11 managed input window */ - /*@}*/ } x11; } info; }; diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 9fd1350e6..78d94dab2 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -1014,8 +1014,14 @@ X11_DestroyWindow(_THIS, SDL_Window * window) SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { - if (info->version.major <= SDL_MAJOR_VERSION) { - /* FIXME! */ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; + + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { + info->subsystem = SDL_SYSWM_X11; + info->info.x11.display = display; + info->info.x11.window = data->xwindow; return SDL_TRUE; } else { SDL_SetError("Application not compiled with SDL %d.%d\n",