joy.cpl: Refresh joystick test device list when activated.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-23 14:01:53 +02:00 committed by Alexandre Julliard
parent 5fad09d246
commit 95cc64aa73

View file

@ -533,6 +533,14 @@ static void draw_joystick_axes(HWND hwnd, struct JoystickData* data)
* test_dlgproc [internal]
*
*/
static void refresh_test_joystick_list(HWND hwnd, struct JoystickData *data)
{
struct Joystick *joy, *joy_end;
SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_RESETCONTENT, 0, 0);
for (joy = data->joysticks, joy_end = joy + data->num_joysticks; joy != joy_end; ++joy)
SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM)joy->instance.tszInstanceName);
}
static INT_PTR CALLBACK test_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
static HANDLE thread;
@ -543,17 +551,9 @@ static INT_PTR CALLBACK test_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
{
case WM_INITDIALOG:
{
int i;
data = (struct JoystickData*) ((PROPSHEETPAGEW*)lparam)->lParam;
/* Add enumerated joysticks to the combobox */
for (i = 0; i < data->num_joysticks; i++)
{
struct Joystick *joy = &data->joysticks[i];
SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM) joy->instance.tszInstanceName);
}
refresh_test_joystick_list(hwnd, data);
draw_joystick_buttons(hwnd, data);
draw_joystick_axes(hwnd, data);
@ -576,6 +576,8 @@ static INT_PTR CALLBACK test_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
{
DWORD tid;
refresh_test_joystick_list(hwnd, data);
/* Initialize input thread */
if (data->num_joysticks > 0)
{