Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed multi-mouse / multi-keyboard support in anticipation of a rea…
…l multi-mouse and multi-touch API.

Plus, this lets me start implementing cursor support.
  • Loading branch information
slouken committed May 10, 2010
1 parent 1b0384f commit 5475302
Show file tree
Hide file tree
Showing 36 changed files with 504 additions and 2,976 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -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@
Expand Down
50 changes: 10 additions & 40 deletions include/SDL_events.h
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;

Expand All @@ -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 */
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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.*)
*/
Expand Down Expand Up @@ -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 */
/*@{*/
Expand Down
88 changes: 88 additions & 0 deletions 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: */
28 changes: 8 additions & 20 deletions include/SDL_keyboard.h
Expand Up @@ -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++ */
Expand All @@ -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.
*
Expand All @@ -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.
*
Expand Down

0 comments on commit 5475302

Please sign in to comment.