SDL_mouse_c.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 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 */
float accumulated_wheel_x;
float accumulated_wheel_y;
Uint32 buttonstate;
SDL_bool has_position;
SDL_bool relative_mode;
SDL_bool relative_mode_warp;
float normal_speed_scale;
float relative_speed_scale;
float scale_accum_x;
float scale_accum_y;
SDL_bool touch_mouse_events;
/* 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 button event with a click count */
extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks);
/* Send a mouse wheel event */
extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float 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_SendMouseMotion
int SDL_SendMouseMotion(SDL_Window *window, SDL_MouseID mouseID, int relative, int x, int y)
Definition: SDL_mouse.c:237
SDL_MouseQuit
void SDL_MouseQuit(void)
Definition: SDL_mouse.c:566
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:118
button
SDL_Texture * button
Definition: testgamecontroller.c:67
SDL_Mouse::has_position
SDL_bool has_position
Definition: SDL_mouse_c.h:86
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_MouseClickState::last_timestamp
Uint32 last_timestamp
Definition: SDL_mouse_c.h:39
SDL_Mouse::buttonstate
Uint32 buttonstate
Definition: SDL_mouse_c.h:85
SDL_Mouse::relative_mode_warp
SDL_bool relative_mode_warp
Definition: SDL_mouse_c.h:88
SDL_SendMouseWheel
int SDL_SendMouseWheel(SDL_Window *window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction)
Definition: SDL_mouse.c:512
SDL_Mouse::focus
SDL_Window * focus
Definition: SDL_mouse_c.h:77
state
struct xkb_state * state
Definition: SDL_waylandsym.h:113
SDL_Mouse::scale_accum_y
float scale_accum_y
Definition: SDL_mouse_c.h:92
surface
EGLSurface surface
Definition: eglext.h:248
SDL_Mouse::clickstate
SDL_MouseClickState * clickstate
Definition: SDL_mouse_c.h:97
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:96
SDL_MouseInit
int SDL_MouseInit(void)
Definition: SDL_mouse.c:80
SDL_Mouse::ydelta
int ydelta
Definition: SDL_mouse_c.h:81
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
SDL_SendMouseButtonClicks
int SDL_SendMouseButtonClicks(SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks)
Definition: SDL_mouse.c:499
SDL_Mouse::cursors
SDL_Cursor * cursors
Definition: SDL_mouse_c.h:99
SDL_Mouse::mouseID
SDL_MouseID mouseID
Definition: SDL_mouse_c.h:76
SDL_MouseID
Uint32 SDL_MouseID
Definition: SDL_mouse_c.h:28
SDL_MouseClickState::click_count
Uint8 click_count
Definition: SDL_mouse_c.h:40
SDL_GetMouse
SDL_Mouse * SDL_GetMouse(void)
Definition: SDL_mouse.c:112
SDL_Mouse::touch_mouse_events
SDL_bool touch_mouse_events
Definition: SDL_mouse_c.h:93
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
SDL_mouse.h
SDL_Mouse::accumulated_wheel_y
float accumulated_wheel_y
Definition: SDL_mouse_c.h:84
SDL_SetDefaultCursor
void SDL_SetDefaultCursor(SDL_Cursor *cursor)
Definition: SDL_mouse.c:101
SDL_Mouse::cursor_shown
SDL_bool cursor_shown
Definition: SDL_mouse_c.h:102
SDL_Mouse::relative_mode
SDL_bool relative_mode
Definition: SDL_mouse_c.h:87
SDL_SystemCursor
SDL_SystemCursor
Cursor types for SDL_CreateSystemCursor().
Definition: SDL_mouse.h:46
SDL_Mouse::scale_accum_x
float scale_accum_x
Definition: SDL_mouse_c.h:91
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
enabled
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: SDL_opengl_glext.h:2479
cursor
SDL_Cursor * cursor
Definition: testcustomcursor.c:119
SDL_Mouse::x
int x
Definition: SDL_mouse_c.h:78
SDL_Mouse::normal_speed_scale
float normal_speed_scale
Definition: SDL_mouse_c.h:89
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDL_Cursor::next
struct SDL_Cursor * next
Definition: SDL_mouse_c.h:32
SDL_Mouse::xdelta
int xdelta
Definition: SDL_mouse_c.h:80
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
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:89
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:73
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:506
SDL_MouseClickState::last_y
int last_y
Definition: SDL_mouse_c.h:38
SDL_MouseClickState
Definition: SDL_mouse_c.h:36
SDL_Mouse::accumulated_wheel_x
float accumulated_wheel_x
Definition: SDL_mouse_c.h:83
SDL_Mouse::cur_cursor
SDL_Cursor * cur_cursor
Definition: SDL_mouse_c.h:101
SDL_Mouse::driverdata
void * driverdata
Definition: SDL_mouse_c.h:105
SDL_SetMouseFocus
void SDL_SetMouseFocus(SDL_Window *window)
Definition: SDL_mouse.c:151
SDL_Cursor::driverdata
void * driverdata
Definition: SDL_mouse_c.h:33
SDL_Mouse::relative_speed_scale
float relative_speed_scale
Definition: SDL_mouse_c.h:90
SDL_MouseWheelDirection
SDL_MouseWheelDirection
Scroll direction types for the Scroll event.
Definition: SDL_mouse.h:66
hot_x
int uint32_t uint32_t uint32_t uint32_t uint32_t int drmModeModeInfoPtr mode int uint32_t uint32_t uint32_t uint32_t int32_t hot_x
Definition: SDL_kmsdrmsym.h:55
SDL_Mouse::def_cursor
SDL_Cursor * def_cursor
Definition: SDL_mouse_c.h:100