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
263d5ce1
Commit
263d5ce1
authored
Dec 28, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Dec 29, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Move keyboard to using new EnumObjects from base class.
parent
7d37e8e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
57 deletions
+35
-57
device.c
dlls/dinput/device.c
+4
-0
keyboard.c
dlls/dinput/keyboard.c
+31
-57
No files found.
dlls/dinput/device.c
View file @
263d5ce1
...
...
@@ -835,6 +835,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_XAxis
))
strcpy
(
ddoi
.
tszName
,
"X-Axis"
);
else
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_YAxis
))
strcpy
(
ddoi
.
tszName
,
"Y-Axis"
);
else
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_ZAxis
))
strcpy
(
ddoi
.
tszName
,
"Z-Axis"
);
else
if
(
IsEqualGUID
(
&
ddoi
.
guidType
,
&
GUID_Key
))
GetKeyNameTextA
((
DIDFT_GETINSTANCE
(
odf
->
dwType
)
&
0x80
)
<<
17
|
(
DIDFT_GETINSTANCE
(
odf
->
dwType
)
&
0x7f
)
<<
16
,
ddoi
.
tszName
,
sizeof
(
ddoi
.
tszName
));
else
if
(
type
&
DIDFT_AXIS
)
wsprintfA
(
ddoi
.
tszName
,
"%d-Axis"
,
axis
-
1
);
else
if
(
type
&
DIDFT_BUTTON
)
wsprintfA
(
ddoi
.
tszName
,
"Button %d"
,
button
-
1
);
else
FIXME
(
"no name
\n
"
);
...
...
dlls/dinput/keyboard.c
View file @
263d5ce1
...
...
@@ -188,6 +188,8 @@ static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI
static
SysKeyboardImpl
*
alloc_device
(
REFGUID
rguid
,
const
void
*
kvt
,
IDirectInputImpl
*
dinput
)
{
SysKeyboardImpl
*
newDevice
;
LPDIDATAFORMAT
df
=
NULL
;
int
i
,
idx
=
0
;
newDevice
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
SysKeyboardImpl
));
newDevice
->
base
.
lpVtbl
=
kvt
;
...
...
@@ -196,13 +198,30 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, const void *kvt, IDirectInpu
newDevice
->
dinput
=
dinput
;
InitializeCriticalSection
(
&
newDevice
->
base
.
crit
);
newDevice
->
base
.
data_format
.
wine_df
=
&
c_dfDIKeyboard
;
if
(
create_DataFormat
(
&
c_dfDIKeyboard
,
&
newDevice
->
base
.
data_format
)
==
DI_OK
)
/* Create copy of default data format */
if
(
!
(
df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
c_dfDIKeyboard
.
dwSize
)))
goto
failed
;
memcpy
(
df
,
&
c_dfDIKeyboard
,
c_dfDIKeyboard
.
dwSize
);
if
(
!
(
df
->
rgodf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
df
->
dwNumObjs
*
df
->
dwObjSize
)))
goto
failed
;
for
(
i
=
0
;
i
<
df
->
dwNumObjs
;
i
++
)
{
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
return
newDevice
;
char
buf
[
MAX_PATH
];
if
(
!
GetKeyNameTextA
(((
i
&
0x7f
)
<<
16
)
|
((
i
&
0x80
)
<<
17
),
buf
,
sizeof
(
buf
)))
continue
;
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIKeyboard
.
rgodf
[
i
],
df
->
dwObjSize
);
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
i
)
|
DIDFT_PSHBUTTON
;
}
df
->
dwNumObjs
=
idx
;
newDevice
->
base
.
data_format
.
wine_df
=
df
;
IDirectInput_AddRef
((
LPDIRECTINPUTDEVICE8A
)
newDevice
->
dinput
);
return
newDevice
;
failed:
if
(
df
)
HeapFree
(
GetProcessHeap
(),
0
,
df
->
rgodf
);
HeapFree
(
GetProcessHeap
(),
0
,
df
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
NULL
;
}
...
...
@@ -265,6 +284,11 @@ static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
set_dinput_hook
(
WH_KEYBOARD_LL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
base
.
data_queue
);
/* Free data format */
HeapFree
(
GetProcessHeap
(),
0
,
(
LPVOID
)
This
->
base
.
data_format
.
wine_df
);
release_DataFormat
(
&
This
->
base
.
data_format
);
IDirectInput_Release
((
LPDIRECTINPUTDEVICE8A
)
This
->
dinput
);
DeleteCriticalSection
(
&
This
->
base
.
crit
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
...
...
@@ -301,56 +325,6 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
return
DI_OK
;
}
static
HRESULT
WINAPI
SysKeyboardAImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKA
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
{
SysKeyboardImpl
*
This
=
(
SysKeyboardImpl
*
)
iface
;
DIDEVICEOBJECTINSTANCEA
ddoi
;
int
i
;
TRACE
(
"(this=%p,%p,%p,%08x)
\n
"
,
This
,
lpCallback
,
lpvRef
,
dwFlags
);
if
(
TRACE_ON
(
dinput
))
{
TRACE
(
" - flags = "
);
_dump_EnumObjects_flags
(
dwFlags
);
TRACE
(
"
\n
"
);
}
/* Only the fields till dwFFMaxForce are relevant */
memset
(
&
ddoi
,
0
,
sizeof
(
ddoi
));
ddoi
.
dwSize
=
FIELD_OFFSET
(
DIDEVICEOBJECTINSTANCEA
,
dwFFMaxForce
);
for
(
i
=
0
;
i
<
This
->
base
.
data_format
.
wine_df
->
dwNumObjs
;
i
++
)
{
if
(
!
GetKeyNameTextA
(((
i
&
0x7f
)
<<
16
)
|
((
i
&
0x80
)
<<
17
),
ddoi
.
tszName
,
sizeof
(
ddoi
.
tszName
)))
continue
;
ddoi
.
guidType
=
GUID_Key
;
ddoi
.
dwOfs
=
i
;
ddoi
.
dwType
=
DIDFT_MAKEINSTANCE
(
i
)
|
DIDFT_BUTTON
;
_dump_OBJECTINSTANCEA
(
&
ddoi
);
if
(
lpCallback
(
&
ddoi
,
lpvRef
)
!=
DIENUM_CONTINUE
)
return
DI_OK
;
}
return
DI_OK
;
}
static
HRESULT
WINAPI
SysKeyboardWImpl_EnumObjects
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIENUMDEVICEOBJECTSCALLBACKW
lpCallback
,
LPVOID
lpvRef
,
DWORD
dwFlags
)
{
SysKeyboardImpl
*
This
=
(
SysKeyboardImpl
*
)
iface
;
device_enumobjects_AtoWcb_data
data
;
data
.
lpCallBack
=
lpCallback
;
data
.
lpvRef
=
lpvRef
;
return
SysKeyboardAImpl_EnumObjects
((
LPDIRECTINPUTDEVICE8A
)
This
,
(
LPDIENUMDEVICEOBJECTSCALLBACKA
)
DIEnumDevicesCallbackAtoW
,
(
LPVOID
)
&
data
,
dwFlags
);
}
static
HRESULT
WINAPI
SysKeyboardAImpl_Unacquire
(
LPDIRECTINPUTDEVICE8A
iface
);
static
HRESULT
WINAPI
SysKeyboardAImpl_Acquire
(
LPDIRECTINPUTDEVICE8A
iface
)
...
...
@@ -417,7 +391,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
else
devcaps
.
dwDevType
=
DIDEVTYPE_KEYBOARD
|
(
DIDEVTYPEKEYBOARD_UNKNOWN
<<
8
);
devcaps
.
dwAxes
=
0
;
devcaps
.
dwButtons
=
WINE_DINPUT_KEYBOARD_MAX_KEYS
;
devcaps
.
dwButtons
=
This
->
base
.
data_format
.
wine_df
->
dwNumObjs
;
devcaps
.
dwPOVs
=
0
;
devcaps
.
dwFFSamplePeriod
=
0
;
devcaps
.
dwFFMinTimeResolution
=
0
;
...
...
@@ -555,7 +529,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice2AImpl_AddRef
,
SysKeyboardAImpl_Release
,
SysKeyboardAImpl_GetCapabilities
,
SysKeyboard
AImpl_EnumObjects
,
IDirectInputDevice2
AImpl_EnumObjects
,
IDirectInputDevice2AImpl_GetProperty
,
IDirectInputDevice2AImpl_SetProperty
,
SysKeyboardAImpl_Acquire
,
...
...
@@ -597,7 +571,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
XCAST
(
AddRef
)
IDirectInputDevice2AImpl_AddRef
,
XCAST
(
Release
)
SysKeyboardAImpl_Release
,
XCAST
(
GetCapabilities
)
SysKeyboardAImpl_GetCapabilities
,
SysKeyboard
WImpl_EnumObjects
,
IDirectInputDevice2
WImpl_EnumObjects
,
XCAST
(
GetProperty
)
IDirectInputDevice2AImpl_GetProperty
,
XCAST
(
SetProperty
)
IDirectInputDevice2AImpl_SetProperty
,
XCAST
(
Acquire
)
SysKeyboardAImpl_Acquire
,
...
...
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