Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
d5b57f39
Commit
d5b57f39
authored
Dec 12, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Dec 12, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Move mouse & keyboard user data format to base class.
parent
1d314d54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
61 deletions
+11
-61
keyboard.c
dlls/dinput/keyboard.c
+4
-1
mouse.c
dlls/dinput/mouse.c
+7
-60
No files found.
dlls/dinput/keyboard.c
View file @
d5b57f39
...
...
@@ -196,7 +196,10 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInpu
newDevice
->
dinput
=
dinput
;
InitializeCriticalSection
(
&
newDevice
->
base
.
crit
);
return
newDevice
;
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIKeyboard
;
if
(
create_DataFormat
(
&
c_dfDIKeyboard
,
&
c_dfDIKeyboard
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
return
newDevice
;
return
NULL
;
}
...
...
dlls/dinput/mouse.c
View file @
d5b57f39
...
...
@@ -112,10 +112,6 @@ struct SysMouseImpl
IDirectInputImpl
*
dinput
;
/* The current data format and the conversion between internal
and external data formats */
DIDATAFORMAT
*
df
;
/* SysMouseAImpl */
BYTE
absolute
;
/* Previous position for relative moves */
...
...
@@ -240,23 +236,10 @@ static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputIm
InitializeCriticalSection
(
&
newDevice
->
base
.
crit
);
newDevice
->
dinput
=
dinput
;
newDevice
->
df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
Wine_InternalMouseFormat
.
dwSize
);
if
(
!
newDevice
->
df
)
goto
FAILED
;
memcpy
(
newDevice
->
df
,
&
Wine_InternalMouseFormat
,
Wine_InternalMouseFormat
.
dwSize
);
/* copy default objects */
newDevice
->
df
->
rgodf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
Wine_InternalMouseFormat
.
dwNumObjs
*
Wine_InternalMouseFormat
.
dwObjSize
);
if
(
!
newDevice
->
df
->
rgodf
)
goto
FAILED
;
memcpy
(
newDevice
->
df
->
rgodf
,
Wine_InternalMouseFormat
.
rgodf
,
Wine_InternalMouseFormat
.
dwNumObjs
*
Wine_InternalMouseFormat
.
dwObjSize
);
if
(
create_DataFormat
(
&
Wine_InternalMouseFormat
,
newDevice
->
df
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
newDevice
->
base
.
data_format
.
wine_df
=
&
Wine_InternalMouseFormat
;
if
(
create_DataFormat
(
&
Wine_InternalMouseFormat
,
&
Wine_InternalMouseFormat
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
return
newDevice
;
FAILED:
if
(
newDevice
->
df
)
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
df
->
rgodf
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
df
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
NULL
;
}
...
...
@@ -328,50 +311,14 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
/* Free the data queue */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
base
.
data_queue
);
release_DataFormat
(
&
This
->
base
.
data_format
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
/* Free the DataFormat */
if
(
This
->
df
!=
&
(
Wine_InternalMouseFormat
))
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
df
->
rgodf
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
df
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
/******************************************************************************
* SetDataFormat : the application can choose the format of the data
* the device driver sends back with GetDeviceState.
*
* For the moment, only the "standard" configuration (c_dfDIMouse) is supported
* in absolute and relative mode.
*/
static
HRESULT
WINAPI
SysMouseAImpl_SetDataFormat
(
LPDIRECTINPUTDEVICE8A
iface
,
LPCDIDATAFORMAT
df
)
{
SysMouseImpl
*
This
=
(
SysMouseImpl
*
)
iface
;
TRACE
(
"(this=%p,%p)
\n
"
,
This
,
df
);
_dump_DIDATAFORMAT
(
df
);
/* Tests under windows show that a call to SetDataFormat always sets the mouse
in relative mode whatever the dwFlags value (DIDF_ABSAXIS/DIDF_RELAXIS).
To switch in absolute mode, SetProperty must be used. */
This
->
absolute
=
0
;
/* Store the new data format */
This
->
df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
df
->
dwSize
);
memcpy
(
This
->
df
,
df
,
df
->
dwSize
);
This
->
df
->
rgodf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
df
->
dwNumObjs
*
df
->
dwObjSize
);
memcpy
(
This
->
df
->
rgodf
,
df
->
rgodf
,
df
->
dwNumObjs
*
df
->
dwObjSize
);
/* Prepare all the data-conversion filters */
return
create_DataFormat
(
&
Wine_InternalMouseFormat
,
This
->
df
,
&
This
->
base
.
data_format
);
}
/* low-level mouse hook */
static
LRESULT
CALLBACK
dinput_mouse_hook
(
int
code
,
WPARAM
wparam
,
LPARAM
lparam
)
{
...
...
@@ -949,7 +896,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt =
SysMouseAImpl_Unacquire
,
SysMouseAImpl_GetDeviceState
,
SysMouseAImpl_GetDeviceData
,
SysMouse
AImpl_SetDataFormat
,
IDirectInputDevice2
AImpl_SetDataFormat
,
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2AImpl_GetObjectInfo
,
...
...
@@ -991,7 +938,7 @@ static const IDirectInputDevice8WVtbl SysMouseWvt =
XCAST
(
Unacquire
)
SysMouseAImpl_Unacquire
,
XCAST
(
GetDeviceState
)
SysMouseAImpl_GetDeviceState
,
XCAST
(
GetDeviceData
)
SysMouseAImpl_GetDeviceData
,
XCAST
(
SetDataFormat
)
SysMouse
AImpl_SetDataFormat
,
XCAST
(
SetDataFormat
)
IDirectInputDevice2
AImpl_SetDataFormat
,
XCAST
(
SetEventNotification
)
IDirectInputDevice2AImpl_SetEventNotification
,
XCAST
(
SetCooperativeLevel
)
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2WImpl_GetObjectInfo
,
...
...
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