mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 06:21:15 +00:00
joy.cpl: Read the number of buttons instead of storing it.
This commit is contained in:
parent
b53df5dffb
commit
7e854933cd
|
@ -78,8 +78,6 @@ struct effect
|
||||||
struct Joystick
|
struct Joystick
|
||||||
{
|
{
|
||||||
IDirectInputDevice8W *device;
|
IDirectInputDevice8W *device;
|
||||||
int num_buttons;
|
|
||||||
int num_axes;
|
|
||||||
BOOL forcefeedback;
|
BOOL forcefeedback;
|
||||||
BOOL is_xinput;
|
BOOL is_xinput;
|
||||||
BOOL has_override;
|
BOOL has_override;
|
||||||
|
@ -249,8 +247,6 @@ static BOOL CALLBACK enum_callback(const DIDEVICEINSTANCEW *instance, void *cont
|
||||||
caps.dwSize = sizeof(caps);
|
caps.dwSize = sizeof(caps);
|
||||||
IDirectInputDevice8_GetCapabilities(joystick->device, &caps);
|
IDirectInputDevice8_GetCapabilities(joystick->device, &caps);
|
||||||
|
|
||||||
joystick->num_buttons = caps.dwButtons;
|
|
||||||
joystick->num_axes = caps.dwAxes;
|
|
||||||
joystick->forcefeedback = caps.dwFlags & DIDC_FORCEFEEDBACK;
|
joystick->forcefeedback = caps.dwFlags & DIDC_FORCEFEEDBACK;
|
||||||
|
|
||||||
IDirectInputDevice8_GetProperty(joystick->device, DIPROP_GUIDANDPATH, &prop_guid_path.diph);
|
IDirectInputDevice8_GetProperty(joystick->device, DIPROP_GUIDANDPATH, &prop_guid_path.diph);
|
||||||
|
@ -668,15 +664,15 @@ static DWORD WINAPI input_thread(void *param)
|
||||||
|
|
||||||
static void test_handle_joychange(HWND hwnd, struct JoystickData *data)
|
static void test_handle_joychange(HWND hwnd, struct JoystickData *data)
|
||||||
{
|
{
|
||||||
|
DIDEVCAPS caps = {.dwSize = sizeof(DIDEVCAPS)};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (data->num_joysticks == 0) return;
|
if (data->num_joysticks == 0) return;
|
||||||
|
|
||||||
data->chosen_joystick = SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_GETCURSEL, 0, 0);
|
data->chosen_joystick = SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_GETCURSEL, 0, 0);
|
||||||
|
if (FAILED(IDirectInputDevice8_GetCapabilities( data->joysticks[data->chosen_joystick].device, &caps ))) return;
|
||||||
|
|
||||||
/* Enable only buttons present in the device */
|
for (i = 0; i < TEST_MAX_BUTTONS; i++) ShowWindow( data->graphics.buttons[i], i < caps.dwButtons );
|
||||||
for (i = 0; i < TEST_MAX_BUTTONS; i++)
|
|
||||||
ShowWindow(data->graphics.buttons[i], i < data->joysticks[data->chosen_joystick].num_buttons);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
Loading…
Reference in a new issue