Rémi Bernon : joy.cpl: Refresh joystick FF device list when activated.
Alexandre Julliard
julliard at winehq.org
Thu Sep 23 15:35:05 CDT 2021
Module: wine
Branch: master
Commit: a6f7f2dcfbf1f6fb9555f0324e53194f24d56115
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a6f7f2dcfbf1f6fb9555f0324e53194f24d56115
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Thu Sep 23 14:01:54 2021 +0200
joy.cpl: Refresh joystick FF device list when activated.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/joy.cpl/main.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index 3dee30a4b5b..d5272990df3 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -642,12 +642,9 @@ static void initialize_effects_list(HWND hwnd, struct Joystick* joy)
static void ff_handle_joychange(HWND hwnd, struct JoystickData *data)
{
- int sel;
-
if (data->num_ff == 0) return;
- sel = SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_GETCURSEL, 0, 0);
- data->chosen_joystick = SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_GETITEMDATA, sel, 0);
+ data->chosen_joystick = SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_GETCURSEL, 0, 0);
initialize_effects_list(hwnd, &data->joysticks[data->chosen_joystick]);
}
@@ -808,6 +805,14 @@ static BOOL CALLBACK ff_effects_callback(const DIEFFECTINFOW *pdei, void *pvRef)
* ff_dlgproc [internal]
*
*/
+static void refresh_ff_joystick_list(HWND hwnd, struct JoystickData *data)
+{
+ struct Joystick *joy, *joy_end;
+ SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_RESETCONTENT, 0, 0);
+ for (joy = data->joysticks, joy_end = joy + data->num_joysticks; joy != joy_end; ++joy)
+ SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM)joy->instance.tszInstanceName);
+}
+
static INT_PTR CALLBACK ff_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
static HANDLE thread;
@@ -818,24 +823,9 @@ static INT_PTR CALLBACK ff_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
{
case WM_INITDIALOG:
{
- int i, cur = 0;
-
data = (struct JoystickData*) ((PROPSHEETPAGEW*)lparam)->lParam;
- /* Add joysticks with FF support to the combobox and get the effects */
- for (i = 0; i < data->num_joysticks; i++)
- {
- struct Joystick *joy = &data->joysticks[i];
-
- if (joy->forcefeedback)
- {
- SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM) joy->instance.tszInstanceName);
- SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_SETITEMDATA, cur, i);
-
- cur++;
- }
- }
-
+ refresh_ff_joystick_list(hwnd, data);
draw_ff_axis(hwnd, data);
return TRUE;
@@ -861,6 +851,8 @@ static INT_PTR CALLBACK ff_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
switch(((LPNMHDR)lparam)->code)
{
case PSN_SETACTIVE:
+ refresh_ff_joystick_list(hwnd, data);
+
if (data->num_ff > 0)
{
DWORD tid;
More information about the wine-cvs
mailing list