Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
a4a0897a
Commit
a4a0897a
authored
Jul 29, 2010
by
Jim Grandpre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevented SDL_SendDown from sending on nonexistent touch devices.
parent
73db548d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
SDL_touch.c
src/events/SDL_touch.c
+19
-2
SDL_cocoawindow.m
src/video/cocoa/SDL_cocoawindow.m
+1
-1
No files found.
src/events/SDL_touch.c
View file @
a4a0897a
...
@@ -312,6 +312,10 @@ SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressu
...
@@ -312,6 +312,10 @@ SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressu
int
posted
;
int
posted
;
SDL_Touch
*
touch
=
SDL_GetTouch
(
id
);
SDL_Touch
*
touch
=
SDL_GetTouch
(
id
);
if
(
!
touch
)
{
return
SDL_TouchNotFoundError
(
id
);
}
if
(
down
)
{
if
(
down
)
{
SDL_Finger
*
finger
=
SDL_GetFinger
(
touch
,
fingerid
);
SDL_Finger
*
finger
=
SDL_GetFinger
(
touch
,
fingerid
);
if
(
finger
==
NULL
)
{
if
(
finger
==
NULL
)
{
...
@@ -374,7 +378,10 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
...
@@ -374,7 +378,10 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
int
yrel
;
int
yrel
;
int
x_max
=
0
,
y_max
=
0
;
int
x_max
=
0
,
y_max
=
0
;
if
(
!
touch
||
touch
->
flush_motion
)
{
if
(
!
touch
)
{
return
SDL_TouchNotFoundError
(
id
);
}
if
(
touch
->
flush_motion
)
{
return
0
;
return
0
;
}
}
...
@@ -459,8 +466,9 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
...
@@ -459,8 +466,9 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
int
posted
;
int
posted
;
Uint32
type
;
Uint32
type
;
if
(
!
touch
)
{
if
(
!
touch
)
{
return
0
;
return
SDL_TouchNotFoundError
(
id
)
;
}
}
/* Figure out which event to perform */
/* Figure out which event to perform */
...
@@ -510,4 +518,13 @@ SDL_GetTouchName(int id)
...
@@ -510,4 +518,13 @@ SDL_GetTouchName(int id)
return
touch
->
name
;
return
touch
->
name
;
}
}
int
SDL_TouchNotFoundError
(
int
id
)
{
printf
(
"ERROR: Cannot send touch on non-existent device with id: %i make sure SDL_AddTouch has been called
\n
"
,
id
);
printf
(
"ERROR: There are %i touches installed with Id's:
\n
"
,
SDL_num_touch
);
int
i
;
for
(
i
=
0
;
i
<
SDL_num_touch
;
i
++
)
{
printf
(
"ERROR: %i
\n
"
,
SDL_touchPads
[
i
]
->
id
);
}
return
0
;
}
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
src/video/cocoa/SDL_cocoawindow.m
View file @
a4a0897a
...
@@ -313,7 +313,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
...
@@ -313,7 +313,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
touch
.
pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
touch
.
pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
if
(
SDL_AddTouch
(
&
touch
,
""
)
<
0
)
{
if
(
SDL_AddTouch
(
&
touch
,
""
)
<
0
)
{
return
;
continue
;
}
}
}
}
float
x
=
[
touch
normalizedPosition
].
x
;
float
x
=
[
touch
normalizedPosition
].
x
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment