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
2a8820a2
Commit
2a8820a2
authored
Aug 01, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed sending motion and finger up events
parent
b7caec8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
SDL_cocoawindow.m
src/video/cocoa/SDL_cocoawindow.m
+21
-8
No files found.
src/video/cocoa/SDL_cocoawindow.m
View file @
2a8820a2
...
@@ -291,14 +291,28 @@ static __inline__ void ConvertNSRect(NSRect *r)
...
@@ -291,14 +291,28 @@ static __inline__ void ConvertNSRect(NSRect *r)
-
(
void
)
handleTouches
:
(
cocoaTouchType
)
type
withEvent
:
(
NSEvent
*
)
event
-
(
void
)
handleTouches
:
(
cocoaTouchType
)
type
withEvent
:
(
NSEvent
*
)
event
{
{
NSSet
*
touches
=
[
event
touchesMatchingPhase
:
NSTouchPhaseBegan
inView
:
nil
];
NSSet
*
touches
=
0
;
NSEnumerator
*
enumerator
;
NSTouch
*
touch
;
NSEnumerator
*
enumerator
=
[
touches
objectEnumerator
];
switch
(
type
)
{
NSTouch
*
touch
=
(
NSTouch
*
)[
enumerator
nextObject
];
case
COCOA_TOUCH_DOWN
:
touches
=
[
event
touchesMatchingPhase
:
NSTouchPhaseBegan
inView
:
nil
];
break
;
case
COCOA_TOUCH_UP
:
case
COCOA_TOUCH_CANCELLED
:
touches
=
[
event
touchesMatchingPhase
:
NSTouchPhaseEnded
inView
:
nil
];
break
;
case
COCOA_TOUCH_MOVE
:
touches
=
[
event
touchesMatchingPhase
:
NSTouchPhaseMoved
inView
:
nil
];
break
;
}
enumerator
=
[
touches
objectEnumerator
];
touch
=
(
NSTouch
*
)[
enumerator
nextObject
];
while
(
touch
)
{
while
(
touch
)
{
long
touchId
=
(
long
)[
touch
device
];
SDL_TouchID
touchId
=
(
SDL_TouchID
)[
touch
device
];
if
(
!
SDL_GetTouch
(
touchId
))
{
if
(
!
SDL_GetTouch
(
touchId
))
{
printf
(
"Adding touch: %li
\n
"
,
touchId
);
SDL_Touch
touch
;
SDL_Touch
touch
;
touch
.
id
=
touchId
;
touch
.
id
=
touchId
;
...
@@ -313,13 +327,12 @@ static __inline__ void ConvertNSRect(NSRect *r)
...
@@ -313,13 +327,12 @@ static __inline__ void ConvertNSRect(NSRect *r)
touch
.
native_pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
touch
.
native_pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
if
(
SDL_AddTouch
(
&
touch
,
""
)
<
0
)
{
if
(
SDL_AddTouch
(
&
touch
,
""
)
<
0
)
{
continue
;
return
;
}
}
printf
(
"Success, added touch: %li
\n
"
,
touchId
);
}
}
float
x
=
[
touch
normalizedPosition
].
x
;
float
x
=
[
touch
normalizedPosition
].
x
;
float
y
=
[
touch
normalizedPosition
].
y
;
float
y
=
[
touch
normalizedPosition
].
y
;
long
fingerId
=
(
long
)[
touch
identity
];
SDL_FingerID
fingerId
=
(
SDL_FingerID
)[
touch
identity
];
switch
(
type
)
{
switch
(
type
)
{
case
COCOA_TOUCH_DOWN
:
case
COCOA_TOUCH_DOWN
:
SDL_SendFingerDown
(
touchId
,
fingerId
,
SDL_TRUE
,
x
,
y
,
1
);
SDL_SendFingerDown
(
touchId
,
fingerId
,
SDL_TRUE
,
x
,
y
,
1
);
...
...
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