Fixed warnings in SDL_pen.c
This commit is contained in:
@@ -485,7 +485,7 @@ static void event_setup(const SDL_Pen *pen, const SDL_Window *window, Uint64 tim
|
|||||||
event->pmotion.timestamp = timestamp;
|
event->pmotion.timestamp = timestamp;
|
||||||
event->pmotion.windowID = window ? window->id : 0;
|
event->pmotion.windowID = window ? window->id : 0;
|
||||||
event->pmotion.which = pen->header.id;
|
event->pmotion.which = pen->header.id;
|
||||||
event->pmotion.pen_state = (Uint16)last_buttons | PEN_GET_PUBLIC_STATUS_MASK(pen);
|
event->pmotion.pen_state = last_buttons | PEN_GET_PUBLIC_STATUS_MASK(pen);
|
||||||
event->pmotion.x = status->x;
|
event->pmotion.x = status->x;
|
||||||
event->pmotion.y = status->y;
|
event->pmotion.y = status->y;
|
||||||
SDL_memcpy(event->pmotion.axes, status->axes, SDL_PEN_NUM_AXES * sizeof(float));
|
SDL_memcpy(event->pmotion.axes, status->axes, SDL_PEN_NUM_AXES * sizeof(float));
|
||||||
@@ -563,7 +563,7 @@ int SDL_SendPenMotion(Uint64 timestamp,
|
|||||||
case PEN_MOUSE_STATELESS:
|
case PEN_MOUSE_STATELESS:
|
||||||
/* Report mouse event but don't update mouse state */
|
/* Report mouse event but don't update mouse state */
|
||||||
if (SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION)) {
|
if (SDL_EventEnabled(SDL_EVENT_MOUSE_MOTION)) {
|
||||||
event.motion.windowID = event.pmotion.windowID;
|
event.motion.windowID = window->id;
|
||||||
event.motion.timestamp = timestamp;
|
event.motion.timestamp = timestamp;
|
||||||
event.motion.which = SDL_PEN_MOUSEID;
|
event.motion.which = SDL_PEN_MOUSEID;
|
||||||
event.motion.type = SDL_EVENT_MOUSE_MOTION;
|
event.motion.type = SDL_EVENT_MOUSE_MOTION;
|
||||||
@@ -589,7 +589,7 @@ int SDL_SendPenTipEvent(Uint64 timestamp, SDL_PenID instance_id, Uint8 state)
|
|||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_bool posted = SDL_FALSE;
|
SDL_bool posted = SDL_FALSE;
|
||||||
SDL_PenStatusInfo *last = &pen->last;
|
SDL_PenStatusInfo *last = &pen->last;
|
||||||
int mouse_button = SDL_BUTTON_LEFT;
|
Uint8 mouse_button = SDL_BUTTON_LEFT;
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
|
|
||||||
if (!pen) {
|
if (!pen) {
|
||||||
@@ -627,7 +627,7 @@ int SDL_SendPenTipEvent(Uint64 timestamp, SDL_PenID instance_id, Uint8 state)
|
|||||||
if (pen_delay_mouse_button_mode) {
|
if (pen_delay_mouse_button_mode) {
|
||||||
/* Send button events when pen touches / leaves surface */
|
/* Send button events when pen touches / leaves surface */
|
||||||
mouse_button = pen->last_mouse_button;
|
mouse_button = pen->last_mouse_button;
|
||||||
if (0 == mouse_button) {
|
if (mouse_button == 0) {
|
||||||
mouse_button = SDL_BUTTON_LEFT; /* No current button? Instead report left mouse button */
|
mouse_button = SDL_BUTTON_LEFT; /* No current button? Instead report left mouse button */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -668,7 +668,7 @@ int SDL_SendPenButton(Uint64 timestamp,
|
|||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_bool posted = SDL_FALSE;
|
SDL_bool posted = SDL_FALSE;
|
||||||
SDL_PenStatusInfo *last = &pen->last;
|
SDL_PenStatusInfo *last = &pen->last;
|
||||||
int mouse_button = button + 1; /* For mouse emulation, PEN_DOWN counts as button 1, so the first actual button is mouse button 2 */
|
Uint8 mouse_button = button + 1; /* For mouse emulation, PEN_DOWN counts as button 1, so the first actual button is mouse button 2 */
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
|
|
||||||
if (!pen) {
|
if (!pen) {
|
||||||
@@ -1043,9 +1043,9 @@ void SDL_PenUpdateGUIDForWacom(SDL_GUID *guid, Uint32 wacom_devicetype_id, Uint3
|
|||||||
int SDL_PenModifyForWacomID(SDL_Pen *pen, Uint32 wacom_devicetype_id, Uint32 *axis_flags)
|
int SDL_PenModifyForWacomID(SDL_Pen *pen, Uint32 wacom_devicetype_id, Uint32 *axis_flags)
|
||||||
{
|
{
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
int num_buttons;
|
int num_buttons = 0;
|
||||||
int tool_type;
|
int tool_type = 0;
|
||||||
int axes;
|
int axes = 0;
|
||||||
|
|
||||||
#if SDL_PEN_DEBUG_UNKNOWN_WACOM
|
#if SDL_PEN_DEBUG_UNKNOWN_WACOM
|
||||||
wacom_devicetype_id = PEN_WACOM_ID_INVALID; /* force detection to fail */
|
wacom_devicetype_id = PEN_WACOM_ID_INVALID; /* force detection to fail */
|
||||||
@@ -1079,7 +1079,7 @@ int SDL_PenModifyForWacomID(SDL_Pen *pen, Uint32 wacom_devicetype_id, Uint32 *ax
|
|||||||
|
|
||||||
/* Override defaults */
|
/* Override defaults */
|
||||||
if (pen->info.num_buttons == SDL_PEN_INFO_UNKNOWN) {
|
if (pen->info.num_buttons == SDL_PEN_INFO_UNKNOWN) {
|
||||||
pen->info.num_buttons = num_buttons;
|
pen->info.num_buttons = (Sint8)SDL_min(num_buttons, SDL_MAX_SINT8);
|
||||||
}
|
}
|
||||||
if (pen->type == SDL_PEN_TYPE_PEN) {
|
if (pen->type == SDL_PEN_TYPE_PEN) {
|
||||||
pen->type = (SDL_PenSubtype)tool_type;
|
pen->type = (SDL_PenSubtype)tool_type;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ typedef struct SDL_PenStatusInfo
|
|||||||
{
|
{
|
||||||
float x, y;
|
float x, y;
|
||||||
float axes[SDL_PEN_NUM_AXES];
|
float axes[SDL_PEN_NUM_AXES];
|
||||||
Uint32 buttons; /* SDL_BUTTON(1) | SDL_BUTTON(2) | ... | SDL_PEN_DOWN_MASK */
|
Uint16 buttons; /* SDL_BUTTON(1) | SDL_BUTTON(2) | ... | SDL_PEN_DOWN_MASK */
|
||||||
} SDL_PenStatusInfo;
|
} SDL_PenStatusInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user