Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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
wine
wine-cw
Commits
30e2fbcb
Commit
30e2fbcb
authored
Jan 05, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jan 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Fix mouse to use proper offset when queuing new events. Add handling of X-buttons.
We should use instance IDs instead of sequential numbers to get correct offset.
parent
9d10c66d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
45 deletions
+54
-45
device.c
dlls/dinput/device.c
+10
-2
device_private.h
dlls/dinput/device_private.h
+1
-0
mouse.c
dlls/dinput/mouse.c
+43
-43
No files found.
dlls/dinput/device.c
View file @
30e2fbcb
...
...
@@ -493,7 +493,7 @@ int offset_to_object(LPCDIDATAFORMAT df, int offset)
int
i
;
for
(
i
=
0
;
i
<
df
->
dwNumObjs
;
i
++
)
if
(
d
f
->
rgodf
[
i
].
dwOfs
==
offset
)
if
(
d
ataformat_to_odf
(
df
,
i
)
->
dwOfs
==
offset
)
return
i
;
return
-
1
;
...
...
@@ -503,13 +503,21 @@ static int id_to_object(LPCDIDATAFORMAT df, int id)
{
int
i
;
id
&=
0x00ffffff
;
for
(
i
=
0
;
i
<
df
->
dwNumObjs
;
i
++
)
if
((
d
f
->
rgodf
[
i
].
dwType
&
0x00ffffff
)
==
(
id
&
0x00ffffff
)
)
if
((
d
ataformat_to_odf
(
df
,
i
)
->
dwType
&
0x00ffffff
)
==
id
)
return
i
;
return
-
1
;
}
int
id_to_offset
(
DataFormat
*
df
,
int
id
)
{
int
obj
=
id_to_object
(
df
->
wine_df
,
id
);
return
obj
>=
0
&&
df
->
offsets
?
df
->
offsets
[
obj
]
:
-
1
;
}
int
find_property
(
LPCDIDATAFORMAT
df
,
LPCDIPROPHEADER
ph
)
{
switch
(
ph
->
dwHow
)
...
...
dlls/dinput/device_private.h
View file @
30e2fbcb
...
...
@@ -74,6 +74,7 @@ extern void release_DataFormat(DataFormat *df) ;
extern
void
queue_event
(
LPDIRECTINPUTDEVICE8A
iface
,
int
ofs
,
DWORD
data
,
DWORD
time
,
DWORD
seq
);
/* Helper functions to work with data format */
extern
int
offset_to_object
(
LPCDIDATAFORMAT
df
,
int
offset
);
extern
int
id_to_offset
(
DataFormat
*
df
,
int
id
);
extern
int
find_property
(
LPCDIDATAFORMAT
df
,
LPCDIPROPHEADER
ph
);
/**
...
...
dlls/dinput/mouse.c
View file @
30e2fbcb
...
...
@@ -42,18 +42,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
/* Wine mouse driver object instances */
#define WINE_MOUSE_X_AXIS_INSTANCE 0
#define WINE_MOUSE_Y_AXIS_INSTANCE 1
/* ------------------------------- */
/* Wine mouse internal data format */
/* ------------------------------- */
/* Constants used to access the offset array */
#define WINE_MOUSE_X_POSITION 0
#define WINE_MOUSE_Y_POSITION 1
#define WINE_MOUSE_Z_POSITION 2
#define WINE_MOUSE_L_POSITION 3
#define WINE_MOUSE_R_POSITION 4
#define WINE_MOUSE_M_POSITION 5
#define WINE_MOUSE_Z_AXIS_INSTANCE 2
#define WINE_MOUSE_BUTTONS_INSTANCE 3
static
const
IDirectInputDevice8AVtbl
SysMouseAvt
;
static
const
IDirectInputDevice8WVtbl
SysMouseWvt
;
...
...
@@ -298,7 +288,7 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
MSLLHOOKSTRUCT
*
hook
=
(
MSLLHOOKSTRUCT
*
)
lparam
;
SysMouseImpl
*
This
=
(
SysMouseImpl
*
)
current_lock
;
DWORD
dwCoop
;
int
wdata
;
int
wdata
=
0
,
inst_id
=
-
1
;
if
(
code
!=
HC_ACTION
)
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
...
...
@@ -322,58 +312,68 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
pt1
=
pt
;
if
(
pt
.
x
)
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_X_POSITION
],
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
id_to_offset
(
&
This
->
base
.
data_format
,
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_X_AXIS_INSTANCE
)
|
DIDFT_RELAXIS
),
pt1
.
x
,
hook
->
time
,
This
->
dinput
->
evsequence
);
if
(
pt
.
y
)
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_Y_POSITION
],
pt1
.
y
,
hook
->
time
,
This
->
dinput
->
evsequence
);
{
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_Y_AXIS_INSTANCE
)
|
DIDFT_RELAXIS
;
wdata
=
pt1
.
y
;
}
This
->
need_warp
=
(
pt
.
x
||
pt
.
y
)
&&
dwCoop
&
DISCL_EXCLUSIVE
;
break
;
}
case
WM_MOUSEWHEEL
:
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_Z_AXIS_INSTANCE
)
|
DIDFT_RELAXIS
;
This
->
m_state
.
lZ
+=
wdata
=
(
short
)
HIWORD
(
hook
->
mouseData
);
break
;
case
WM_LBUTTONDOWN
:
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_L_POSITION
],
0x80
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
rgbButtons
[
0
]
=
0x80
;
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
0
)
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
0
]
=
wdata
=
0x80
;
break
;
case
WM_LBUTTONUP
:
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_L_POSITION
],
0x00
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
rgbButtons
[
0
]
=
0x00
;
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
0
)
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
0
]
=
wdata
=
0x00
;
break
;
case
WM_RBUTTONDOWN
:
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_R_POSITION
],
0x80
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
rgbButtons
[
1
]
=
0x80
;
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
1
)
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
1
]
=
wdata
=
0x80
;
break
;
case
WM_RBUTTONUP
:
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_R_POSITION
],
0x00
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
rgbButtons
[
1
]
=
0x00
;
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
1
)
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
1
]
=
wdata
=
0x00
;
break
;
case
WM_MBUTTONDOWN
:
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_M_POSITION
],
0x80
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
rgbButtons
[
2
]
=
0x80
;
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
2
)
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
2
]
=
wdata
=
0x80
;
break
;
case
WM_MBUTTONUP
:
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_M_POSITION
],
0x00
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
rgbButtons
[
2
]
=
0x00
;
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
2
)
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
2
]
=
wdata
=
0x00
;
break
;
case
WM_MOUSEWHEEL
:
wdata
=
(
short
)
HIWORD
(
hook
->
mouseData
);
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
This
->
base
.
data_format
.
offsets
[
WINE_MOUSE_Z_POSITION
],
wdata
,
hook
->
time
,
This
->
dinput
->
evsequence
);
This
->
m_state
.
lZ
+=
wdata
;
case
WM_XBUTTONDOWN
:
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
2
+
HIWORD
(
hook
->
mouseData
))
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
2
+
HIWORD
(
hook
->
mouseData
)]
=
wdata
=
0x80
;
break
;
case
WM_XBUTTONUP
:
inst_id
=
DIDFT_MAKEINSTANCE
(
WINE_MOUSE_BUTTONS_INSTANCE
+
2
+
HIWORD
(
hook
->
mouseData
))
|
DIDFT_PSHBUTTON
;
This
->
m_state
.
rgbButtons
[
2
+
HIWORD
(
hook
->
mouseData
)]
=
wdata
=
0x00
;
break
;
}
TRACE
(
"msg %x @ (%d %d): (X: %d - Y: %d L: %02x M: %02x R: %02x)
\n
"
,
wparam
,
hook
->
pt
.
x
,
hook
->
pt
.
y
,
This
->
m_state
.
lX
,
This
->
m_state
.
lY
,
This
->
m_state
.
rgbButtons
[
0
],
This
->
m_state
.
rgbButtons
[
2
],
This
->
m_state
.
rgbButtons
[
1
])
;
if
(
TRACE_ON
(
dinput
))
{
int
i
;
This
->
dinput
->
evsequence
++
;
TRACE
(
"msg %x @ (%d %d): (X: %d Y: %d Z: %d
\n
"
,
wparam
,
hook
->
pt
.
x
,
hook
->
pt
.
y
,
This
->
m_state
.
lX
,
This
->
m_state
.
lY
,
This
->
m_state
.
lZ
);
for
(
i
=
0
;
i
<
5
;
i
++
)
TRACE
(
" B%d: %02x"
,
i
,
This
->
m_state
.
rgbButtons
[
i
]);
TRACE
(
")
\n
"
);
}
if
(
inst_id
!=
-
1
)
queue_event
((
LPDIRECTINPUTDEVICE8A
)
This
,
id_to_offset
(
&
This
->
base
.
data_format
,
inst_id
),
wdata
,
hook
->
time
,
This
->
dinput
->
evsequence
++
);
/* Mouse moved -> send event if asked */
if
(
This
->
base
.
hEvent
)
SetEvent
(
This
->
base
.
hEvent
);
...
...
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