Mouse changes - mice are now regular devices with config options.

This commit is contained in:
waltje
2017-12-10 02:08:37 -05:00
parent 50cf53515c
commit d52846d3be
12 changed files with 142 additions and 98 deletions

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.21 2017/11/25
* Version: @(#)86Box.rc 1.0.22 2017/12/09
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -314,8 +314,9 @@ STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
LTEXT "Mouse :",IDT_1709,7,8,57,10
COMBOBOX IDC_COMBO_MOUSE,71,7,189,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
COMBOBOX IDC_COMBO_MOUSE,71,7,140,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_MOUSE,214,7,46,12
LTEXT "Joystick :",IDT_1710,7,26,58,10
COMBOBOX IDC_COMBO_JOYSTICK,71,25,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.14 2017/11/18
* Version: @(#)resource.h 1.0.15 2017/12/09
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -115,6 +115,7 @@
#define IDC_COMBO_MOUSE 1051
#define IDC_COMBO_JOYSTICK 1052
#define IDC_COMBO_JOY 1053
#define IDC_CONFIGURE_MOUSE 1054
#define IDC_SOUND 1070 /* sound config */
#define IDC_COMBO_SOUND 1071

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.25 2017/11/24
* Version: @(#)win_settings.c 1.0.26 2017/12/09
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -911,17 +911,15 @@ static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wPa
}
static int mouse_valid(int type, int machine)
static int mouse_valid(int num, int m)
{
type &= MOUSE_TYPE_MASK;
device_t *dev;
if ((type == MOUSE_TYPE_INTERNAL) &&
!(machines[machine].flags & MACHINE_MOUSE)) return(0);
if ((num == MOUSE_TYPE_INTERNAL) &&
!(machines[m].flags & MACHINE_MOUSE)) return(0);
if ((type == MOUSE_TYPE_PS2) &&
!(machines[machine].flags & MACHINE_PS2)) return(0);
return(1);
dev = mouse_get_device(num);
return(device_is_valid(dev, machines[m].flags));
}
@@ -931,7 +929,6 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa
HWND h;
int c = 0;
int d = 0;
int type;
switch (message)
{
@@ -940,11 +937,9 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa
c = d = 0;
for (c = 0; c < mouse_get_ndev(); c++)
{
type = mouse_get_type(c);
settings_mouse_to_list[c] = d;
if (mouse_valid(type, temp_machine))
if (mouse_valid(c, temp_machine))
{
mbstowcs(str, mouse_get_name(c), sizeof_w(str));
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)str);
@@ -955,6 +950,8 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa
}
SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE);
EnableWindow(h, TRUE);
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
c = 0;
@@ -980,6 +977,12 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_CONFIGURE_MOUSE:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)mouse_get_device(temp_mouse));
break;
case IDC_COMBO_JOYSTICK:
if (HIWORD(wParam) == CBN_SELCHANGE)
{

View File

@@ -8,7 +8,7 @@
*
* user Interface module for WinAPI on Windows.
*
* Version: @(#)win_ui.c 1.0.6 2017/11/28
* Version: @(#)win_ui.c 1.0.7 2017/12/09
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -534,7 +534,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_MBUTTONUP:
if (!(mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON))
if (mouse_get_buttons() == 2)
plat_mouse_capture(0);
break;