Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
f5790913
Commit
f5790913
authored
12 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
winex11: Store XInput2 device info in the thread data.
parent
f881dcf7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/winex11.drv/mouse.c
+28
-30
28 additions, 30 deletions
dlls/winex11.drv/mouse.c
dlls/winex11.drv/x11drv.h
+3
-0
3 additions, 0 deletions
dlls/winex11.drv/x11drv.h
with
31 additions
and
30 deletions
dlls/winex11.drv/mouse.c
+
28
−
30
View file @
f5790913
...
...
@@ -130,9 +130,6 @@ static Cursor create_cursor( HANDLE handle );
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
static
BOOL
xinput2_available
;
static
int
xinput2_core_pointer
;
static
int
xinput2_device_count
;
static
XIDeviceInfo
*
xinput2_devices
;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
MAKE_FUNCPTR
(
XIFreeDeviceInfo
);
MAKE_FUNCPTR
(
XIQueryDevice
);
...
...
@@ -258,6 +255,7 @@ static void enable_xinput2(void)
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
struct
x11drv_thread_data
*
data
=
x11drv_thread_data
();
XIEventMask
mask
;
XIDeviceInfo
*
devices
;
unsigned
char
mask_bits
[
XIMaskLen
(
XI_LASTEVENT
)];
int
i
,
j
;
...
...
@@ -276,19 +274,19 @@ static void enable_xinput2(void)
if
(
data
->
xi2_state
==
xi_unavailable
)
return
;
wine_tsx11_lock
();
if
(
xinput
2_devices
)
pXIFreeDeviceInfo
(
xinput
2_devices
);
xinput2_
devices
=
pXIQueryDevice
(
data
->
display
,
XIAllDevices
,
&
xinput
2_device_count
);
for
(
i
=
0
;
i
<
xinput
2_device_count
;
++
i
)
if
(
data
->
xi
2_devices
)
pXIFreeDeviceInfo
(
data
->
xi
2_devices
);
data
->
xi2_devices
=
devices
=
pXIQueryDevice
(
data
->
display
,
XIAllDevices
,
&
data
->
xi
2_device_count
);
for
(
i
=
0
;
i
<
data
->
xi
2_device_count
;
++
i
)
{
if
(
xinput2_
devices
[
i
].
use
!=
XIMasterPointer
)
continue
;
for
(
j
=
0
;
j
<
xinput2_
devices
[
i
].
num_classes
;
j
++
)
if
(
devices
[
i
].
use
!=
XIMasterPointer
)
continue
;
for
(
j
=
0
;
j
<
devices
[
i
].
num_classes
;
j
++
)
{
XIValuatorClassInfo
*
class
=
(
XIValuatorClassInfo
*
)
xinput2_
devices
[
i
].
classes
[
j
];
XIValuatorClassInfo
*
class
=
(
XIValuatorClassInfo
*
)
devices
[
i
].
classes
[
j
];
if
(
xinput2_
devices
[
i
].
classes
[
j
]
->
type
!=
XIValuatorClass
)
continue
;
if
(
devices
[
i
].
classes
[
j
]
->
type
!=
XIValuatorClass
)
continue
;
if
(
class
->
number
!=
0
&&
class
->
number
!=
1
)
continue
;
TRACE
(
"Device %u (%s) class %u num %u %f,%f res %u mode %u
\n
"
,
xinput2_
devices
[
i
].
deviceid
,
debugstr_a
(
xinput2_
devices
[
i
].
name
),
devices
[
i
].
deviceid
,
debugstr_a
(
devices
[
i
].
name
),
j
,
class
->
number
,
class
->
min
,
class
->
max
,
class
->
resolution
,
class
->
mode
);
if
(
class
->
mode
==
XIModeAbsolute
)
{
...
...
@@ -297,8 +295,8 @@ static void enable_xinput2(void)
}
}
TRACE
(
"Using %u (%s) as core pointer
\n
"
,
xinput2_
devices
[
i
].
deviceid
,
debugstr_a
(
xinput2_
devices
[
i
].
name
)
);
xinput
2_core_pointer
=
xinput2_
devices
[
i
].
deviceid
;
devices
[
i
].
deviceid
,
debugstr_a
(
devices
[
i
].
name
)
);
data
->
xi
2_core_pointer
=
devices
[
i
].
deviceid
;
break
;
}
...
...
@@ -308,14 +306,13 @@ static void enable_xinput2(void)
XISetMask
(
mask_bits
,
XI_RawMotion
);
XISetMask
(
mask_bits
,
XI_ButtonPress
);
for
(
i
=
0
;
i
<
xinput
2_device_count
;
++
i
)
for
(
i
=
0
;
i
<
data
->
xi
2_device_count
;
++
i
)
{
if
(
xinput2_devices
[
i
].
use
==
XISlavePointer
&&
xinput2_devices
[
i
].
attachment
==
xinput2_core_pointer
)
if
(
devices
[
i
].
use
==
XISlavePointer
&&
devices
[
i
].
attachment
==
data
->
xi2_core_pointer
)
{
TRACE
(
"Device %u (%s) is attached to the core pointer
\n
"
,
xinput2_
devices
[
i
].
deviceid
,
debugstr_a
(
xinput2_
devices
[
i
].
name
)
);
mask
.
deviceid
=
xinput2_
devices
[
i
].
deviceid
;
devices
[
i
].
deviceid
,
debugstr_a
(
devices
[
i
].
name
)
);
mask
.
deviceid
=
devices
[
i
].
deviceid
;
pXISelectEvents
(
data
->
display
,
DefaultRootWindow
(
data
->
display
),
&
mask
,
1
);
data
->
xi2_state
=
xi_enabled
;
}
...
...
@@ -333,6 +330,7 @@ static void disable_xinput2(void)
{
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
struct
x11drv_thread_data
*
data
=
x11drv_thread_data
();
XIDeviceInfo
*
devices
=
data
->
xi2_devices
;
XIEventMask
mask
;
int
i
;
...
...
@@ -345,18 +343,17 @@ static void disable_xinput2(void)
mask
.
mask_len
=
0
;
wine_tsx11_lock
();
for
(
i
=
0
;
i
<
xinput
2_device_count
;
++
i
)
for
(
i
=
0
;
i
<
data
->
xi
2_device_count
;
++
i
)
{
if
(
xinput2_devices
[
i
].
use
==
XISlavePointer
&&
xinput2_devices
[
i
].
attachment
==
xinput2_core_pointer
)
if
(
devices
[
i
].
use
==
XISlavePointer
&&
devices
[
i
].
attachment
==
data
->
xi2_core_pointer
)
{
mask
.
deviceid
=
xinput2_
devices
[
i
].
deviceid
;
mask
.
deviceid
=
devices
[
i
].
deviceid
;
pXISelectEvents
(
data
->
display
,
DefaultRootWindow
(
data
->
display
),
&
mask
,
1
);
}
}
pXIFreeDeviceInfo
(
xinput2_
devices
);
xinput
2_devices
=
NULL
;
xinput
2_device_count
=
0
;
pXIFreeDeviceInfo
(
devices
);
data
->
xi
2_devices
=
NULL
;
data
->
xi
2_device_count
=
0
;
wine_tsx11_unlock
();
#endif
}
...
...
@@ -1517,6 +1514,7 @@ static void X11DRV_RawMotion( XGenericEventCookie *xev )
int
i
,
j
;
double
dx
=
0
,
dy
=
0
;
struct
x11drv_thread_data
*
thread_data
=
x11drv_thread_data
();
XIDeviceInfo
*
devices
=
thread_data
->
xi2_devices
;
if
(
!
event
->
valuators
.
mask_len
)
return
;
if
(
thread_data
->
xi2_state
!=
xi_enabled
)
return
;
...
...
@@ -1532,14 +1530,14 @@ static void X11DRV_RawMotion( XGenericEventCookie *xev )
input
.
u
.
mi
.
dy
=
dy
;
wine_tsx11_lock
();
for
(
i
=
0
;
i
<
xinput
2_device_count
;
++
i
)
for
(
i
=
0
;
i
<
thread_data
->
xi
2_device_count
;
++
i
)
{
if
(
xinput2_
devices
[
i
].
deviceid
!=
event
->
deviceid
)
continue
;
for
(
j
=
0
;
j
<
xinput2_
devices
[
i
].
num_classes
;
j
++
)
if
(
devices
[
i
].
deviceid
!=
event
->
deviceid
)
continue
;
for
(
j
=
0
;
j
<
devices
[
i
].
num_classes
;
j
++
)
{
XIValuatorClassInfo
*
class
=
(
XIValuatorClassInfo
*
)
xinput2_
devices
[
i
].
classes
[
j
];
XIValuatorClassInfo
*
class
=
(
XIValuatorClassInfo
*
)
devices
[
i
].
classes
[
j
];
if
(
xinput2_
devices
[
i
].
classes
[
j
]
->
type
!=
XIValuatorClass
)
continue
;
if
(
devices
[
i
].
classes
[
j
]
->
type
!=
XIValuatorClass
)
continue
;
if
(
class
->
min
>=
class
->
max
)
continue
;
if
(
class
->
number
==
0
)
input
.
u
.
mi
.
dx
=
dx
*
(
virtual_screen_rect
.
right
-
virtual_screen_rect
.
left
)
...
...
This diff is collapsed.
Click to expand it.
dlls/winex11.drv/x11drv.h
+
3
−
0
View file @
f5790913
...
...
@@ -327,6 +327,9 @@ struct x11drv_thread_data
DWORD
clip_reset
;
/* time when clipping was last reset */
HKL
kbd_layout
;
/* active keyboard layout */
enum
{
xi_unavailable
=
-
1
,
xi_unknown
,
xi_disabled
,
xi_enabled
}
xi2_state
;
/* XInput2 state */
void
*
xi2_devices
;
/* list of XInput2 devices (valid when state is enabled) */
int
xi2_device_count
;
int
xi2_core_pointer
;
/* XInput2 core pointer id */
};
extern
struct
x11drv_thread_data
*
x11drv_init_thread_data
(
void
)
DECLSPEC_HIDDEN
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment