25 #define _VLC_MOUSE_H 1
35 MOUSE_BUTTON_WHEEL_UP,
36 MOUSE_BUTTON_WHEEL_DOWN,
37 MOUSE_BUTTON_WHEEL_LEFT,
38 MOUSE_BUTTON_WHEEL_RIGHT,
56 static inline void vlc_mouse_Init(
vlc_mouse_t *p_mouse )
60 p_mouse->i_pressed = 0;
61 p_mouse->b_double_click =
false;
65 static inline void vlc_mouse_SetPressed(
vlc_mouse_t *p_mouse,
68 p_mouse->i_pressed |= 1 << i_button;
70 static inline void vlc_mouse_SetReleased(
vlc_mouse_t *p_mouse,
73 p_mouse->i_pressed &= ~(1 << i_button);
75 static inline void vlc_mouse_SetPosition(
vlc_mouse_t *p_mouse,
83 static inline bool vlc_mouse_IsPressed(
const vlc_mouse_t *p_mouse,
86 return ( p_mouse->i_pressed & (1 << i_button) ) != 0;
88 static inline bool vlc_mouse_IsLeftPressed(
const vlc_mouse_t *p_mouse )
90 return vlc_mouse_IsPressed( p_mouse, MOUSE_BUTTON_LEFT );
92 static inline bool vlc_mouse_IsCenterPressed(
const vlc_mouse_t *p_mouse )
94 return vlc_mouse_IsPressed( p_mouse, MOUSE_BUTTON_CENTER );
96 static inline bool vlc_mouse_IsRightPressed(
const vlc_mouse_t *p_mouse )
98 return vlc_mouse_IsPressed( p_mouse, MOUSE_BUTTON_RIGHT );
100 static inline bool vlc_mouse_IsWheelUpPressed(
const vlc_mouse_t *p_mouse )
102 return vlc_mouse_IsPressed( p_mouse, MOUSE_BUTTON_WHEEL_UP );
104 static inline bool vlc_mouse_IsWheelDownPressed(
const vlc_mouse_t *p_mouse )
106 return vlc_mouse_IsPressed( p_mouse, MOUSE_BUTTON_WHEEL_DOWN );
108 static inline void vlc_mouse_GetMotion(
int *pi_x,
int *pi_y,
112 *pi_x = p_new->i_x - p_old->i_x;
113 *pi_y = p_new->i_y - p_old->i_y;
117 static inline bool vlc_mouse_HasChanged(
const vlc_mouse_t *p_old,
120 return p_old->i_x != p_new->i_x || p_old->i_y != p_new->i_y ||
121 p_old->i_pressed != p_new->i_pressed;
123 static inline bool vlc_mouse_HasMoved(
const vlc_mouse_t *p_old,
126 return p_old->i_x != p_new->i_x || p_old->i_y != p_new->i_y;
128 static inline bool vlc_mouse_HasButton(
const vlc_mouse_t *p_old,
131 return p_old->i_pressed != p_new->i_pressed;
133 static inline bool vlc_mouse_HasPressed(
const vlc_mouse_t *p_old,
137 const int i_mask = 1 << i_button;
138 return (p_old->i_pressed & i_mask) == 0 && (p_new->i_pressed & i_mask);
140 static inline bool vlc_mouse_HasReleased(
const vlc_mouse_t *p_old,
144 const int i_mask = 1 << i_button;
145 return (p_old->i_pressed & i_mask) && (p_new->i_pressed & i_mask) == 0;
Definition: vlc_mouse.h:45