diff --git a/src/mouse.c b/src/mouse.c index 4e21a1556..768de4b62 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -11,13 +11,13 @@ * TODO: Add the Genius bus- and serial mouse. * Remove the '3-button' flag from mouse types. * - * Version: @(#)mouse.c 1.0.18 2017/12/14 + * Version: @(#)mouse.c 1.0.19 2018/01/26 * * Authors: Miran Grca, * Fred N. van Kempen, * - * Copyright 2016,2017 Miran Grca. - * Copyright 2017 Fred N. van Kempen. + * Copyright 2016-2018 Miran Grca. + * Copyright 2017,2018 Fred N. van Kempen. */ #include #include @@ -198,6 +198,15 @@ mouse_get_from_internal_name(char *s) } +int +mouse_has_config(int mouse) +{ + if (mouse_devices[mouse].device == NULL) return(0); + + return(mouse_devices[mouse].device->config ? 1 : 0); +} + + device_t * mouse_get_device(int mouse) { diff --git a/src/mouse.h b/src/mouse.h index 00fc6da3a..287aae9a0 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -8,13 +8,13 @@ * * Definitions for the mouse driver. * - * Version: @(#)mouse.h 1.0.11 2017/12/09 + * Version: @(#)mouse.h 1.0.12 2018/01/26 * * Authors: Miran Grca, * Fred N. van Kempen, * - * Copyright 2016,2017 Miran Grca. - * Copyright 2017 Fred N. van Kempen. + * Copyright 2016-2018 Miran Grca. + * Copyright 2017,2018 Fred N. van Kempen. */ #ifndef EMU_MOUSE_H # define EMU_MOUSE_H @@ -69,6 +69,7 @@ extern void mouse_poll(void); extern char *mouse_get_name(int mouse); extern char *mouse_get_internal_name(int mouse); extern int mouse_get_from_internal_name(char *s); +extern int mouse_has_config(int mouse); extern int mouse_get_type(int mouse); extern int mouse_get_ndev(void); extern int mouse_get_buttons(void); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 940a22b77..a081f6729 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Windows 86Box Settings dialog handler. * - * Version: @(#)win_settings.c 1.0.33 2018/01/24 + * Version: @(#)win_settings.c 1.0.34 2018/01/26 * * Author: Miran Grca, * @@ -859,7 +859,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) gfx = video_card_getid(stransi); h = GetDlgItem(hdlg, IDC_CONFIGURE_VID); - if (video_card_has_config(gfx)) + if (video_card_has_config(temp_gfxcard)) { EnableWindow(h, TRUE); } @@ -996,8 +996,16 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) } SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse], 0); + h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE); - EnableWindow(h, TRUE); + if (mouse_has_config(temp_mouse)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); c = 0; @@ -1023,6 +1031,21 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD(wParam)) { + case IDC_COMBO_MOUSE: + h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); + temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; + + h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE); + if (mouse_has_config(temp_mouse)) + { + EnableWindow(h, TRUE); + } + else + { + EnableWindow(h, FALSE); + } + break; + case IDC_CONFIGURE_MOUSE: h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];