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
b0dfa932
Commit
b0dfa932
authored
Sep 01, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Sep 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Working CANCEL and RESET buttons in ConfigureDevices dialog.
parent
67682c24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
config.c
dlls/dinput/config.c
+38
-3
No files found.
dlls/dinput/config.c
View file @
b0dfa932
...
...
@@ -40,6 +40,7 @@ typedef struct {
typedef
struct
{
IDirectInput8W
*
lpDI
;
LPDIACTIONFORMATW
lpdiaf
;
LPDIACTIONFORMATW
original_lpdiaf
;
DIDevicesData
devices_data
;
int
display_only
;
}
ConfigureDevicesData
;
...
...
@@ -201,16 +202,21 @@ static void init_devices(HWND dialog, IDirectInput8W *lpDI, DIDevicesData *data,
SendDlgItemMessageW
(
dialog
,
IDC_CONTROLLERCOMBO
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
data
->
devices
[
i
].
ddi
.
tszProductName
);
}
static
void
destroy_d
evices
(
HWND
dialog
)
static
void
destroy_d
ata
(
HWND
dialog
)
{
int
i
;
ConfigureDevicesData
*
data
=
(
ConfigureDevicesData
*
)
GetWindowLongPtrW
(
dialog
,
DWLP_USER
);
DIDevicesData
*
devices_data
=
&
data
->
devices_data
;
/* Free the devices */
for
(
i
=
0
;
i
<
devices_data
->
ndevices
;
i
++
)
IDirectInputDevice8_Release
(
devices_data
->
devices
[
i
].
lpdid
);
HeapFree
(
GetProcessHeap
(),
0
,
devices_data
->
devices
);
/* Free the backup LPDIACTIONFORMATW */
HeapFree
(
GetProcessHeap
(),
0
,
data
->
original_lpdiaf
->
rgoAction
);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
original_lpdiaf
);
}
static
void
fill_device_object_list
(
HWND
dialog
)
...
...
@@ -323,6 +329,26 @@ static void assign_action(HWND dialog)
lv_set_action
(
dialog
,
obj
,
action
,
lpdiaf
);
}
static
void
copy_actions
(
LPDIACTIONFORMATW
to
,
LPDIACTIONFORMATW
from
)
{
int
i
;
for
(
i
=
0
;
i
<
from
->
dwNumActions
;
i
++
)
{
to
->
rgoAction
[
i
].
guidInstance
=
from
->
rgoAction
[
i
].
guidInstance
;
to
->
rgoAction
[
i
].
dwObjID
=
from
->
rgoAction
[
i
].
dwObjID
;
to
->
rgoAction
[
i
].
dwHow
=
from
->
rgoAction
[
i
].
dwHow
;
to
->
rgoAction
[
i
].
lptszActionName
=
from
->
rgoAction
[
i
].
lptszActionName
;
}
}
static
void
reset_actions
(
HWND
dialog
)
{
ConfigureDevicesData
*
data
=
(
ConfigureDevicesData
*
)
GetWindowLongPtrW
(
dialog
,
DWLP_USER
);
LPDIACTIONFORMATW
to
=
data
->
lpdiaf
,
from
=
data
->
original_lpdiaf
;
copy_actions
(
to
,
from
);
}
static
INT_PTR
CALLBACK
ConfigureDevicesDlgProc
(
HWND
dialog
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
uMsg
)
...
...
@@ -339,6 +365,12 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
init_listview_columns
(
dialog
);
/* Create a backup action format for CANCEL and RESET operations */
data
->
original_lpdiaf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
LPDIACTIONFORMATW
));
data
->
original_lpdiaf
->
dwNumActions
=
data
->
lpdiaf
->
dwNumActions
;
data
->
original_lpdiaf
->
rgoAction
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DIACTIONW
)
*
data
->
lpdiaf
->
dwNumActions
);
copy_actions
(
data
->
original_lpdiaf
,
data
->
lpdiaf
);
break
;
}
...
...
@@ -383,15 +415,18 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
case
IDOK
:
EndDialog
(
dialog
,
0
);
destroy_d
evices
(
dialog
);
destroy_d
ata
(
dialog
);
break
;
case
IDCANCEL
:
reset_actions
(
dialog
);
EndDialog
(
dialog
,
0
);
destroy_d
evices
(
dialog
);
destroy_d
ata
(
dialog
);
break
;
case
IDC_RESET
:
reset_actions
(
dialog
);
fill_device_object_list
(
dialog
);
break
;
}
break
;
...
...
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