Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
6ef7cd4e
Commit
6ef7cd4e
authored
Dec 21, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Dec 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Fix the build when XInput2 headers are not present.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
110e68eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
76 deletions
+79
-76
mouse.c
dlls/winex11.drv/mouse.c
+79
-76
No files found.
dlls/winex11.drv/mouse.c
View file @
6ef7cd4e
...
...
@@ -275,7 +275,6 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
thread_data
->
x_valuator
.
value
=
0
;
thread_data
->
y_valuator
.
value
=
0
;
}
#endif
/***********************************************************************
...
...
@@ -283,7 +282,6 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
*/
static
void
enable_xinput2
(
void
)
{
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
struct
x11drv_thread_data
*
data
=
x11drv_thread_data
();
XIEventMask
mask
;
XIDeviceInfo
*
pointer_info
;
...
...
@@ -330,9 +328,10 @@ static void enable_xinput2(void)
data
->
xi2_current_slave
=
0
;
data
->
xi2_state
=
xi_enabled
;
#endif
}
#endif
/***********************************************************************
* disable_xinput2
*/
...
...
@@ -371,6 +370,7 @@ static void disable_xinput2(void)
*/
static
BOOL
grab_clipping_window
(
const
RECT
*
clip
)
{
#if HAVE_X11_EXTENSIONS_XINPUT2_H
static
const
WCHAR
messageW
[]
=
{
'M'
,
'e'
,
's'
,
's'
,
'a'
,
'g'
,
'e'
,
0
};
struct
x11drv_thread_data
*
data
=
x11drv_thread_data
();
Window
clip_window
;
...
...
@@ -441,6 +441,10 @@ static BOOL grab_clipping_window( const RECT *clip )
data
->
clip_hwnd
=
msg_hwnd
;
SendNotifyMessageW
(
GetDesktopWindow
(),
WM_X11DRV_CLIP_CURSOR_NOTIFY
,
0
,
(
LPARAM
)
msg_hwnd
);
return
TRUE
;
#else
WARN
(
"XInput2 was not available at compile time
\n
"
);
return
FALSE
;
#endif
}
/***********************************************************************
...
...
@@ -628,79 +632,6 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x
input
->
u
.
mi
.
dy
=
pt
.
y
;
}
static
BOOL
map_raw_event_coords
(
XIRawEvent
*
event
,
INPUT
*
input
)
{
struct
x11drv_thread_data
*
thread_data
=
x11drv_thread_data
();
XIValuatorClassInfo
*
x
=
&
thread_data
->
x_valuator
,
*
y
=
&
thread_data
->
y_valuator
;
double
x_value
=
0
,
y_value
=
0
,
x_scale
,
y_scale
;
const
double
*
values
=
event
->
valuators
.
values
;
RECT
virtual_rect
;
int
i
;
if
(
x
->
number
<
0
||
y
->
number
<
0
)
return
FALSE
;
if
(
!
event
->
valuators
.
mask_len
)
return
FALSE
;
if
(
thread_data
->
xi2_state
!=
xi_enabled
)
return
FALSE
;
/* If there is no slave currently detected, no previous motion nor device
* change events were received. Look it up now on the device list in this
* case.
*/
if
(
!
thread_data
->
xi2_current_slave
)
{
XIDeviceInfo
*
devices
=
thread_data
->
xi2_devices
;
for
(
i
=
0
;
i
<
thread_data
->
xi2_device_count
;
i
++
)
{
if
(
devices
[
i
].
use
!=
XISlavePointer
)
continue
;
if
(
devices
[
i
].
deviceid
!=
event
->
deviceid
)
continue
;
if
(
devices
[
i
].
attachment
!=
thread_data
->
xi2_core_pointer
)
continue
;
thread_data
->
xi2_current_slave
=
event
->
deviceid
;
break
;
}
}
if
(
event
->
deviceid
!=
thread_data
->
xi2_current_slave
)
return
FALSE
;
virtual_rect
=
get_virtual_screen_rect
();
if
(
x
->
max
<=
x
->
min
)
x_scale
=
1
;
else
x_scale
=
(
virtual_rect
.
right
-
virtual_rect
.
left
)
/
(
x
->
max
-
x
->
min
);
if
(
y
->
max
<=
y
->
min
)
y_scale
=
1
;
else
y_scale
=
(
virtual_rect
.
bottom
-
virtual_rect
.
top
)
/
(
y
->
max
-
y
->
min
);
for
(
i
=
0
;
i
<=
max
(
x
->
number
,
y
->
number
);
i
++
)
{
if
(
!
XIMaskIsSet
(
event
->
valuators
.
mask
,
i
))
continue
;
if
(
i
==
x
->
number
)
{
x_value
=
*
values
;
x
->
value
+=
x_value
*
x_scale
;
}
if
(
i
==
y
->
number
)
{
y_value
=
*
values
;
y
->
value
+=
y_value
*
y_scale
;
}
values
++
;
}
input
->
u
.
mi
.
dx
=
round
(
x
->
value
);
input
->
u
.
mi
.
dy
=
round
(
y
->
value
);
TRACE
(
"event %f,%f value %f,%f input %d,%d
\n
"
,
x_value
,
y_value
,
x
->
value
,
y
->
value
,
input
->
u
.
mi
.
dx
,
input
->
u
.
mi
.
dy
);
x
->
value
-=
input
->
u
.
mi
.
dx
;
y
->
value
-=
input
->
u
.
mi
.
dy
;
if
(
!
input
->
u
.
mi
.
dx
&&
!
input
->
u
.
mi
.
dy
)
{
TRACE
(
"accumulating motion
\n
"
);
return
FALSE
;
}
return
TRUE
;
}
/***********************************************************************
* send_mouse_input
*
...
...
@@ -1887,6 +1818,78 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
return
TRUE
;
}
static
BOOL
map_raw_event_coords
(
XIRawEvent
*
event
,
INPUT
*
input
)
{
struct
x11drv_thread_data
*
thread_data
=
x11drv_thread_data
();
XIValuatorClassInfo
*
x
=
&
thread_data
->
x_valuator
,
*
y
=
&
thread_data
->
y_valuator
;
double
x_value
=
0
,
y_value
=
0
,
x_scale
,
y_scale
;
const
double
*
values
=
event
->
valuators
.
values
;
RECT
virtual_rect
;
int
i
;
if
(
x
->
number
<
0
||
y
->
number
<
0
)
return
FALSE
;
if
(
!
event
->
valuators
.
mask_len
)
return
FALSE
;
if
(
thread_data
->
xi2_state
!=
xi_enabled
)
return
FALSE
;
/* If there is no slave currently detected, no previous motion nor device
* change events were received. Look it up now on the device list in this
* case.
*/
if
(
!
thread_data
->
xi2_current_slave
)
{
XIDeviceInfo
*
devices
=
thread_data
->
xi2_devices
;
for
(
i
=
0
;
i
<
thread_data
->
xi2_device_count
;
i
++
)
{
if
(
devices
[
i
].
use
!=
XISlavePointer
)
continue
;
if
(
devices
[
i
].
deviceid
!=
event
->
deviceid
)
continue
;
if
(
devices
[
i
].
attachment
!=
thread_data
->
xi2_core_pointer
)
continue
;
thread_data
->
xi2_current_slave
=
event
->
deviceid
;
break
;
}
}
if
(
event
->
deviceid
!=
thread_data
->
xi2_current_slave
)
return
FALSE
;
virtual_rect
=
get_virtual_screen_rect
();
if
(
x
->
max
<=
x
->
min
)
x_scale
=
1
;
else
x_scale
=
(
virtual_rect
.
right
-
virtual_rect
.
left
)
/
(
x
->
max
-
x
->
min
);
if
(
y
->
max
<=
y
->
min
)
y_scale
=
1
;
else
y_scale
=
(
virtual_rect
.
bottom
-
virtual_rect
.
top
)
/
(
y
->
max
-
y
->
min
);
for
(
i
=
0
;
i
<=
max
(
x
->
number
,
y
->
number
);
i
++
)
{
if
(
!
XIMaskIsSet
(
event
->
valuators
.
mask
,
i
))
continue
;
if
(
i
==
x
->
number
)
{
x_value
=
*
values
;
x
->
value
+=
x_value
*
x_scale
;
}
if
(
i
==
y
->
number
)
{
y_value
=
*
values
;
y
->
value
+=
y_value
*
y_scale
;
}
values
++
;
}
input
->
u
.
mi
.
dx
=
round
(
x
->
value
);
input
->
u
.
mi
.
dy
=
round
(
y
->
value
);
TRACE
(
"event %f,%f value %f,%f input %d,%d
\n
"
,
x_value
,
y_value
,
x
->
value
,
y
->
value
,
input
->
u
.
mi
.
dx
,
input
->
u
.
mi
.
dy
);
x
->
value
-=
input
->
u
.
mi
.
dx
;
y
->
value
-=
input
->
u
.
mi
.
dy
;
if
(
!
input
->
u
.
mi
.
dx
&&
!
input
->
u
.
mi
.
dy
)
{
TRACE
(
"accumulating motion
\n
"
);
return
FALSE
;
}
return
TRUE
;
}
/***********************************************************************
* X11DRV_RawMotion
*/
...
...
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