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
7ab5cda6
Commit
7ab5cda6
authored
Aug 05, 2011
by
Ryan C. Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X11 touch handling fixed for one device (LPC32xx Touchscreen).
parent
961d8e70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
24 deletions
+31
-24
SDL_x11events.c
src/video/x11/SDL_x11events.c
+27
-20
SDL_x11touch.c
src/video/x11/SDL_x11touch.c
+4
-4
No files found.
src/video/x11/SDL_x11events.c
View file @
7ab5cda6
...
...
@@ -549,6 +549,7 @@ X11_PumpEvents(_THIS)
struct
input_event
ev
[
64
];
int
size
=
sizeof
(
struct
input_event
);
/* !!! FIXME: clean the tabstops out of here. */
for
(
i
=
0
;
i
<
SDL_GetNumTouch
();
++
i
)
{
SDL_Touch
*
touch
=
SDL_GetTouchIndex
(
i
);
if
(
!
touch
)
printf
(
"Touch %i/%i DNE
\n
"
,
i
,
SDL_GetNumTouch
());
...
...
@@ -561,12 +562,10 @@ X11_PumpEvents(_THIS)
if
(
data
->
eventStream
<=
0
)
printf
(
"Error: Couldn't open stream
\n
"
);
rd
=
read
(
data
->
eventStream
,
ev
,
size
*
64
);
//printf("Got %i/%i bytes\n",rd,size);
if
(
rd
>=
size
)
{
for
(
i
=
0
;
i
<
rd
/
sizeof
(
struct
input_event
);
i
++
)
{
switch
(
ev
[
i
].
type
)
{
case
EV_ABS
:
//printf("Got position x: %i!\n",data->x);
switch
(
ev
[
i
].
code
)
{
case
ABS_X
:
data
->
x
=
ev
[
i
].
value
;
...
...
@@ -585,29 +584,37 @@ X11_PumpEvents(_THIS)
}
break
;
case
EV_MSC
:
if
(
ev
[
i
].
code
==
MSC_SERIAL
)
data
->
finger
=
ev
[
i
].
value
;
break
;
if
(
ev
[
i
].
code
==
MSC_SERIAL
)
data
->
finger
=
ev
[
i
].
value
;
break
;
case
EV_KEY
:
if
(
ev
[
i
].
code
==
BTN_TOUCH
)
if
(
ev
[
i
].
value
==
0
)
data
->
up
=
SDL_TRUE
;
break
;
case
EV_SYN
:
//printf("Id: %i\n",touch->id);
if
(
data
->
up
)
{
if
(
!
data
->
down
)
{
data
->
down
=
SDL_TRUE
;
SDL_SendFingerDown
(
touch
->
id
,
data
->
finger
,
SDL_FALSE
,
data
->
x
,
data
->
y
,
data
->
pressure
);
data
->
down
,
data
->
x
,
data
->
y
,
data
->
pressure
);
}
else
if
(
data
->
x
>=
0
||
data
->
y
>=
0
)
else
if
(
!
data
->
up
)
SDL_SendTouchMotion
(
touch
->
id
,
data
->
finger
,
SDL_FALSE
,
data
->
x
,
data
->
y
,
SDL_FALSE
,
data
->
x
,
data
->
y
,
data
->
pressure
);
//printf("Synched: %i tx: %i, ty: %i\n",
// data->finger,data->x,data->y);
data
->
x
=
-
1
;
data
->
y
=
-
1
;
data
->
pressure
=
-
1
;
data
->
finger
=
0
;
data
->
up
=
SDL_FALSE
;
else
{
data
->
down
=
SDL_FALSE
;
SDL_SendFingerDown
(
touch
->
id
,
data
->
finger
,
data
->
down
,
data
->
x
,
data
->
y
,
data
->
pressure
);
data
->
x
=
-
1
;
data
->
y
=
-
1
;
data
->
pressure
=
-
1
;
data
->
finger
=
0
;
data
->
up
=
SDL_FALSE
;
}
break
;
}
}
...
...
src/video/x11/SDL_x11touch.c
View file @
7ab5cda6
...
...
@@ -47,10 +47,9 @@ X11_InitTouch(_THIS)
while
(
!
feof
(
fd
))
{
if
(
fgets
(
line
,
256
,
fd
)
<=
0
)
continue
;
if
(
line
[
0
]
==
'\n'
)
{
if
(
vendor
==
1386
){
/*printf("Wacom... Assuming it is a touch device\n");*/
/*sprintf(tstr,"/dev/input/event%i",event);*/
/*printf("At location: %s\n",tstr);*/
if
(
vendor
==
1386
||
vendor
==
1
){
sprintf
(
tstr
,
"/dev/input/event%i"
,
event
);
SDL_Touch
touch
;
touch
.
pressure_max
=
0
;
...
...
@@ -66,6 +65,7 @@ X11_InitTouch(_THIS)
data
->
pressure
=
-
1
;
data
->
finger
=
0
;
data
->
up
=
SDL_FALSE
;
data
->
down
=
SDL_FALSE
;
data
->
eventStream
=
open
(
tstr
,
...
...
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