SDL_mouse_c.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
#ifndef _SDL_mouse_c_h
#define _SDL_mouse_c_h
#include "SDL_mouse.h"
typedef Uint32 SDL_MouseID;
struct SDL_Cursor
{
struct SDL_Cursor *next;
void *driverdata;
};
typedef struct
{
int last_x, last_y;
Uint32 last_timestamp;
Uint8 click_count;
} SDL_MouseClickState;
typedef struct
{
/* Create a cursor from a surface */
SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
/* Create a system cursor */
SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id);
/* 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) within a window */
void (*WarpMouse) (SDL_Window * window, int x, int y);
/* Warp the mouse to (x,y) in screen space */
int (*WarpMouseGlobal) (int x, int y);
/* Set relative mode */
int (*SetRelativeMouseMode) (SDL_bool enabled);
/* Set mouse capture */
int (*CaptureMouse) (SDL_Window * window);
/* Get absolute mouse coordinates. (x) and (y) are never NULL and set to zero before call. */
Uint32 (*GetGlobalMouseState) (int *x, int *y);
/* Data common to all mice */
SDL_MouseID mouseID;
SDL_Window *focus;
int x;
int y;
int xdelta;
int ydelta;
int last_x, last_y; /* the last reported x and y coordinates */
Uint32 buttonstate;
SDL_bool relative_mode;
SDL_bool relative_mode_warp;
/* Data for double-click tracking */
int num_clickstates;
SDL_MouseClickState *clickstate;
SDL_Cursor *cursors;
SDL_Cursor *def_cursor;
SDL_Cursor *cur_cursor;
SDL_bool cursor_shown;
/* Driver-dependent data. */
void *driverdata;
} SDL_Mouse;
/* Initialize the mouse subsystem */
extern int SDL_MouseInit(void);
/* Get the mouse state structure */
SDL_Mouse *SDL_GetMouse(void);
/* Set the default double-click interval */
extern void SDL_SetDoubleClickTime(Uint32 interval);
/* Set the default mouse cursor */
extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
/* Set the mouse focus window */
extern void SDL_SetMouseFocus(SDL_Window * window);
/* Send a mouse motion event */
extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
/* Send a mouse button event */
extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button);
/* Send a mouse wheel event */
extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction);
/* Shutdown the mouse subsystem */
extern void SDL_MouseQuit(void);
#endif /* _SDL_mouse_c_h */
/* vi: set ts=4 sw=4 expandtab: */
SDL_SendMouseWheel
int SDL_SendMouseWheel(SDL_Window *window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction)
Definition: SDL_mouse.c:406
SDL_SendMouseMotion
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
Definition: SDL_mouse.c:188
SDL_MouseQuit
void SDL_MouseQuit(void)
Definition: SDL_mouse.c:435
id
GLuint id
Definition: SDL_opengl_glext.h:528
SDL_Mouse::y
int y
Definition: SDL_mouse_c.h:79
SDL_Mouse::last_y
int last_y
Definition: SDL_mouse_c.h:82
SDL_SetDoubleClickTime
void SDL_SetDoubleClickTime(Uint32 interval)
Definition: SDL_mouse.c:72
button
SDL_Texture * button
Definition: testgamecontroller.c:67
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_MouseClickState::last_timestamp
Uint32 last_timestamp
Definition: SDL_mouse_c.h:39
SDL_Mouse::buttonstate
Uint32 buttonstate
Definition: SDL_mouse_c.h:83
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_Mouse::relative_mode_warp
SDL_bool relative_mode_warp
Definition: SDL_mouse_c.h:85
SDL_Mouse::focus
SDL_Window * focus
Definition: SDL_mouse_c.h:77
window
SDL_Window * window
Definition: testautomation_render.c:26
state
struct xkb_state * state
Definition: SDL_waylandsym.h:94
SDL_Mouse::clickstate
SDL_MouseClickState * clickstate
Definition: SDL_mouse_c.h:89
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_Cursor
Definition: SDL_mouse_c.h:30
SDL_Mouse::num_clickstates
int num_clickstates
Definition: SDL_mouse_c.h:88
SDL_MouseInit
int SDL_MouseInit(void)
Definition: SDL_mouse.c:45
SDL_Mouse::ydelta
int ydelta
Definition: SDL_mouse_c.h:81
SDL_Mouse::cursors
SDL_Cursor * cursors
Definition: SDL_mouse_c.h:91
SDL_Mouse::mouseID
SDL_MouseID mouseID
Definition: SDL_mouse_c.h:76
SDL_MouseID
Uint32 SDL_MouseID
Definition: SDL_mouse_c.h:28
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_MouseClickState::click_count
Uint8 click_count
Definition: SDL_mouse_c.h:40
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:66
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
SDL_mouse.h
SDL_SetDefaultCursor
void SDL_SetDefaultCursor(SDL_Cursor *cursor)
Definition: SDL_mouse.c:55
SDL_Mouse::cursor_shown
SDL_bool cursor_shown
Definition: SDL_mouse_c.h:94
SDL_Mouse::relative_mode
SDL_bool relative_mode
Definition: SDL_mouse_c.h:84
SDL_SystemCursor
SDL_SystemCursor
Cursor types for SDL_CreateSystemCursor.
Definition: SDL_mouse.h:46
cursor
SDL_Cursor * cursor
Definition: testwm2.c:40
enabled
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: SDL_opengl_glext.h:2479
SDL_Mouse::x
int x
Definition: SDL_mouse_c.h:78
SDL_Cursor::next
struct SDL_Cursor * next
Definition: SDL_mouse_c.h:32
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
SDL_Mouse::xdelta
int xdelta
Definition: SDL_mouse_c.h:80
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
SDL_Mouse
Definition: SDL_mouse_c.h:43
SDL_SendMouseButton
int SDL_SendMouseButton(SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
Definition: SDL_mouse.c:326
SDL_MouseClickState::last_y
int last_y
Definition: SDL_mouse_c.h:38
SDL_MouseClickState
Definition: SDL_mouse_c.h:36
SDL_Mouse::cur_cursor
SDL_Cursor * cur_cursor
Definition: SDL_mouse_c.h:93
SDL_Mouse::driverdata
void * driverdata
Definition: SDL_mouse_c.h:97
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:103
SDL_Cursor::driverdata
void * driverdata
Definition: SDL_mouse_c.h:33
SDL_MouseWheelDirection
SDL_MouseWheelDirection
Scroll direction types for the Scroll event.
Definition: SDL_mouse.h:66
SDL_Mouse::def_cursor
SDL_Cursor * def_cursor
Definition: SDL_mouse_c.h:92