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
afe32505
Commit
afe32505
authored
Sep 28, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
============================================================
parent
90ff13a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
47 deletions
+45
-47
SDL_x11touch.c
src/video/x11/SDL_x11touch.c
+45
-47
No files found.
src/video/x11/SDL_x11touch.c
View file @
afe32505
...
...
@@ -38,7 +38,7 @@ X11_InitTouch(_THIS)
#ifdef SDL_INPUT_LINUXEV
FILE
*
fd
;
fd
=
fopen
(
"/proc/bus/input/devices"
,
"r"
);
char
c
;
int
i
=
0
;
char
line
[
256
];
...
...
@@ -47,46 +47,44 @@ X11_InitTouch(_THIS)
while
(
!
feof
(
fd
))
{
if
(
fgets
(
line
,
256
,
fd
)
<=
0
)
continue
;
if
(
line
[
0
]
==
'\n'
)
{
if
(
vendor
==
1386
||
vendor
==
1
){
sprintf
(
tstr
,
"/dev/input/event%i"
,
event
);
SDL_Touch
touch
;
touch
.
pressure_max
=
0
;
touch
.
pressure_min
=
0
;
touch
.
id
=
event
;
touch
.
driverdata
=
SDL_malloc
(
sizeof
(
EventTouchData
));
EventTouchData
*
data
=
(
EventTouchData
*
)(
touch
.
driverdata
);
data
->
x
=
-
1
;
data
->
y
=
-
1
;
data
->
pressure
=
-
1
;
data
->
finger
=
0
;
data
->
up
=
SDL_FALSE
;
data
->
down
=
SDL_FALSE
;
data
->
eventStream
=
open
(
tstr
,
O_RDONLY
|
O_NONBLOCK
);
ioctl
(
data
->
eventStream
,
EVIOCGNAME
(
sizeof
(
tstr
)),
tstr
);
int
abs
[
5
];
ioctl
(
data
->
eventStream
,
EVIOCGABS
(
0
),
abs
);
touch
.
x_min
=
abs
[
1
];
touch
.
x_max
=
abs
[
2
];
touch
.
native_xres
=
touch
.
x_max
-
touch
.
x_min
;
ioctl
(
data
->
eventStream
,
EVIOCGABS
(
ABS_Y
),
abs
);
touch
.
y_min
=
abs
[
1
];
touch
.
y_max
=
abs
[
2
];
touch
.
native_yres
=
touch
.
y_max
-
touch
.
y_min
;
ioctl
(
data
->
eventStream
,
EVIOCGABS
(
ABS_PRESSURE
),
abs
);
touch
.
pressure_min
=
abs
[
1
];
touch
.
pressure_max
=
abs
[
2
];
touch
.
native_pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
SDL_AddTouch
(
&
touch
,
tstr
);
if
(
vendor
==
1386
||
vendor
==
1
)
{
sprintf
(
tstr
,
"/dev/input/event%i"
,
event
);
SDL_Touch
touch
;
touch
.
pressure_max
=
0
;
touch
.
pressure_min
=
0
;
touch
.
id
=
event
;
touch
.
driverdata
=
SDL_malloc
(
sizeof
(
EventTouchData
));
EventTouchData
*
data
=
(
EventTouchData
*
)(
touch
.
driverdata
);
data
->
x
=
-
1
;
data
->
y
=
-
1
;
data
->
pressure
=
-
1
;
data
->
finger
=
0
;
data
->
up
=
SDL_FALSE
;
data
->
down
=
SDL_FALSE
;
data
->
eventStream
=
open
(
tstr
,
O_RDONLY
|
O_NONBLOCK
);
ioctl
(
data
->
eventStream
,
EVIOCGNAME
(
sizeof
(
tstr
)),
tstr
);
int
abs
[
5
];
ioctl
(
data
->
eventStream
,
EVIOCGABS
(
0
),
abs
);
touch
.
x_min
=
abs
[
1
];
touch
.
x_max
=
abs
[
2
];
touch
.
native_xres
=
touch
.
x_max
-
touch
.
x_min
;
ioctl
(
data
->
eventStream
,
EVIOCGABS
(
ABS_Y
),
abs
);
touch
.
y_min
=
abs
[
1
];
touch
.
y_max
=
abs
[
2
];
touch
.
native_yres
=
touch
.
y_max
-
touch
.
y_min
;
ioctl
(
data
->
eventStream
,
EVIOCGABS
(
ABS_PRESSURE
),
abs
);
touch
.
pressure_min
=
abs
[
1
];
touch
.
pressure_max
=
abs
[
2
];
touch
.
native_pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
SDL_AddTouch
(
&
touch
,
tstr
);
}
vendor
=
-
1
;
product
=
-
1
;
...
...
@@ -95,20 +93,20 @@ X11_InitTouch(_THIS)
else
if
(
line
[
0
]
==
'I'
)
{
i
=
1
;
while
(
line
[
i
])
{
sscanf
(
&
line
[
i
],
"Vendor=%x"
,
&
vendor
);
sscanf
(
&
line
[
i
],
"Product=%x"
,
&
product
);
i
++
;
sscanf
(
&
line
[
i
],
"Vendor=%x"
,
&
vendor
);
sscanf
(
&
line
[
i
],
"Product=%x"
,
&
product
);
i
++
;
}
}
else
if
(
line
[
0
]
==
'H'
)
{
i
=
1
;
while
(
line
[
i
])
{
sscanf
(
&
line
[
i
],
"event%d"
,
&
event
);
i
++
;
sscanf
(
&
line
[
i
],
"event%d"
,
&
event
);
i
++
;
}
}
}
close
(
fd
);
#endif
}
...
...
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