diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index a1cc3be0c..f42537e17 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -22,8 +22,8 @@ * PC200: CGA with some NMI stuff. But we don't need that as it's only * used for TV and LCD displays, and we're emulating a CRT. * - * TODO: This module is not complete yet: - * + * TODO: This module is not complete yet: + * * PC1512: The BIOS assumes 512K RAM, because I cannot figure out how to * read the status of the LK4 jumper on the mainboard, which is * somehow linked to the bus gate array on the NDMACS line... @@ -32,7 +32,7 @@ * in alpha mode, but in highres ("ECD350") mode, it displays * some semi-random junk. Video-memory pointer maybe? * - * Version: @(#)m_amstrad.c 1.0.4 2017/11/24 + * Version: @(#)m_amstrad.c 1.0.5 2017/12/09 * * Authors: Sarah Walker, * Miran Grca, @@ -934,7 +934,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv) { amstrad_t *ams = (amstrad_t *)priv; #ifdef WALTJE - int i = 0; + int i = 0; #endif #if ENABLE_KEYBOARD_LOG @@ -1250,7 +1250,7 @@ machine_amstrad_init(machine_t *model) case ROM_MEGAPC: device_add(¶dise_wd90c11_megapc_device); break; - } + } /* Initialize the (custom) keyboard/mouse interface. */ ams->wantirq = 0; @@ -1262,7 +1262,7 @@ machine_amstrad_init(machine_t *model) keyboard_scan = 1; /* Tell mouse driver about our internal mouse. */ - mouse_setpoll(ms_poll, ams); + mouse_set_poll(ms_poll, ams); if (joystick_type != 7) device_add(&gameport_device); diff --git a/src/machine/m_olivetti_m24.c b/src/machine/m_olivetti_m24.c index c02236ecf..bde58fa96 100644 --- a/src/machine/m_olivetti_m24.c +++ b/src/machine/m_olivetti_m24.c @@ -8,7 +8,7 @@ * * Emulation of the Olivetti M24. * - * Version: @(#)m_olivetti_m24.c 1.0.6 2017/11/24 + * Version: @(#)m_olivetti_m24.c 1.0.7 2017/12/09 * * Authors: Sarah Walker, * Miran Grca, @@ -832,7 +832,7 @@ machine_olim24_init(machine_t *model) timer_add(kbd_poll, &keyboard_delay, TIMER_ALWAYS_ENABLED, m24); /* Tell mouse driver about our internal mouse. */ - mouse_setpoll(ms_poll, m24); + mouse_set_poll(ms_poll, m24); if (joystick_type != 7) device_add(&gameport_device); diff --git a/src/mouse.c b/src/mouse.c index 4eb62471e..9791f8101 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -11,7 +11,7 @@ * TODO: Add the Genius bus- and serial mouse. * Remove the '3-button' flag from mouse types. * - * Version: @(#)mouse.c 1.0.17 2017/12/03 + * Version: @(#)mouse.c 1.0.17 2017/12/09 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -70,13 +70,13 @@ static mouse_t mouse_devices[] = { { "lserial", &mouse_lserial_device }, { "mswheel", &mouse_mswheel_device }, { "ps2", &mouse_ps2_device }, - { "intellimouse", &mouse_ps2ms_device }, { NULL, NULL } }; static device_t *mouse_curr; static void *mouse_priv; +static int mouse_nbut; /* Initialize the mouse module. */ @@ -90,6 +90,7 @@ mouse_init(void) mouse_type = MOUSE_TYPE_NONE; mouse_curr = NULL; mouse_priv = NULL; + mouse_nbut = 0; } @@ -103,13 +104,15 @@ mouse_close(void) mouse_curr = NULL; mouse_priv = NULL; + mouse_nbut = 0; } void mouse_reset(void) { - pclog("MOUSE: reset(type=%d)\n", mouse_type); + pclog("MOUSE: reset(type=%d, '%s')\n", + mouse_type, mouse_devices[mouse_type].device->name); /* Close previous mouse, if open. */ mouse_close(); @@ -128,6 +131,14 @@ mouse_reset(void) } +/* Callback from the hardware driver. */ +void +mouse_set_buttons(int buttons) +{ + mouse_nbut = buttons; +} + + void mouse_process(void) { @@ -151,7 +162,7 @@ mouse_process(void) void -mouse_setpoll(int (*func)(int,int,int,int,void *), void *arg) +mouse_set_poll(int (*func)(int,int,int,int,void *), void *arg) { if (mouse_type != MOUSE_TYPE_INTERNAL) return; @@ -190,10 +201,17 @@ mouse_get_from_internal_name(char *s) } -int -mouse_get_type(int mouse) +device_t * +mouse_get_device(int mouse) { - return(mouse_devices[mouse].device->local); + return(mouse_devices[mouse].device); +} + + +int +mouse_get_buttons(void) +{ + return(mouse_nbut); } diff --git a/src/mouse.h b/src/mouse.h index 1ce72aa9e..00fc6da3a 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -8,7 +8,7 @@ * * Definitions for the mouse driver. * - * Version: @(#)mouse.h 1.0.10 2017/12/03 + * Version: @(#)mouse.h 1.0.11 2017/12/09 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -31,11 +31,7 @@ #define MOUSE_TYPE_MICROSOFT 6 /* Microsoft Serial Mouse */ #define MOUSE_TYPE_LOGITECH 7 /* Logitech Serial Mouse */ #define MOUSE_TYPE_MSWHEEL 8 /* Serial Wheel Mouse */ -#define MOUSE_TYPE_PS2 9 /* IBM PS/2 series Bus Mouse */ -#define MOUSE_TYPE_PS2_MS 10 /* Microsoft Intellimouse PS/2 */ - -#define MOUSE_TYPE_MASK 0x0f -#define MOUSE_TYPE_3BUTTON (1<<7) /* device has 3+ buttons */ +#define MOUSE_TYPE_PS2 9 /* PS/2 series Bus Mouse */ #ifdef __cplusplus @@ -48,6 +44,9 @@ extern int mouse_buttons; #ifdef EMU_DEVICE_H +extern device_t *mouse_get_device(int mouse); +extern void *mouse_ps2_init(device_t *); + extern device_t mouse_logibus_device; extern device_t mouse_msinport_device; #if 0 @@ -58,22 +57,21 @@ extern device_t mouse_msserial_device; extern device_t mouse_lserial_device; extern device_t mouse_mswheel_device; extern device_t mouse_ps2_device; -extern device_t mouse_ps2ms_device; - -extern void *mouse_ps2_init(device_t *); #endif extern void mouse_init(void); extern void mouse_reset(void); +extern void mouse_set_buttons(int buttons); extern void mouse_process(void); +extern void mouse_set_poll(int (*f)(int,int,int,int,void *), void *); extern void mouse_poll(void); -extern void mouse_setpoll(int (*f)(int,int,int,int,void *), 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_get_type(int mouse); extern int mouse_get_ndev(void); +extern int mouse_get_buttons(void); #ifdef __cplusplus } diff --git a/src/mouse_bus.c b/src/mouse_bus.c index 106fd76dd..ec72b4187 100644 --- a/src/mouse_bus.c +++ b/src/mouse_bus.c @@ -43,13 +43,17 @@ * Microsoft Windows NT 3.1 * Microsoft Windows NT 3.51 * + * The polling frequency for InPort controllers has to + * be changed to programmable. Microsoft uses 30Hz, + * but ATIXL ports are programmable 30-200Hz. + * * Based on an early driver for MINIX 1.5. * * TODO: Re-integrate the InPort part. Currently, * only the Logitech part is considered to * be OK. * - * Version: @(#)mouse_bus.c 1.0.26 2017/12/08 + * Version: @(#)mouse_bus.c 1.0.27 2017/12/09 * * Authors: Fred N. van Kempen, * @@ -71,6 +75,7 @@ #define MOUSE_PORT 0x023c /* default */ #define MOUSE_IRQ 5 /* default */ +#define MOUSE_BUTTONS 2 /* default */ #define MOUSE_DEBUG 0 @@ -243,6 +248,9 @@ ms_read(mouse_t *dev, uint16_t port) ret |= 0x04; if (dev->but & 0x02) /* RIGHT */ ret |= 0x01; + if (dev->flags & FLAG_3BTN) + if (dev->but & 0x04) /*MIDDLE*/ + ret |= 0x02; break; case MSCTRL_RD_X: @@ -584,25 +592,22 @@ static void * bm_init(device_t *info) { mouse_t *dev; + int i; dev = (mouse_t *)malloc(sizeof(mouse_t)); memset(dev, 0x00, sizeof(mouse_t)); dev->name = info->name; dev->type = info->local; -#if NOTYET dev->irq = device_get_config_int("irq"); -#else - dev->irq = config_get_int((char *)info->name, "irq", 0); -#endif - if (dev->irq == 0) - dev->irq = MOUSE_IRQ; + i = device_get_config_int("buttons"); + if (i > 2) + dev->flags |= FLAG_3BTN; - pclog("%s: I/O=%04x, IRQ=%d\n", dev->name, MOUSE_PORT, dev->irq); + pclog("%s: I/O=%04x, IRQ=%d, buttons=%d\n", + dev->name, MOUSE_PORT, dev->irq, i); - switch(dev->type & MOUSE_TYPE_MASK) { + switch(dev->type) { case MOUSE_TYPE_LOGIBUS: - if (dev->type & MOUSE_TYPE_3BUTTON) - dev->flags |= FLAG_3BTN; lt_reset(dev); /* Initialize I/O handlers. */ @@ -626,6 +631,9 @@ bm_init(device_t *info) io_sethandler(MOUSE_PORT, 4, bm_read, NULL, NULL, bm_write, NULL, NULL, dev); + /* Tell them how many buttons we have. */ + mouse_set_buttons((dev->flags & FLAG_3BTN) ? 3 : 2); + /* Return our private data to the I/O layer. */ return(dev); } @@ -633,7 +641,7 @@ bm_init(device_t *info) static device_config_t bm_config[] = { { - "irq", "IRQ", CONFIG_SELECTION, "", 2, { + "irq", "IRQ", CONFIG_SELECTION, "", MOUSE_IRQ, { { "IRQ 2", 2 }, @@ -651,6 +659,19 @@ static device_config_t bm_config[] = { } } }, + { + "buttons", "Buttons", CONFIG_SELECTION, "", MOUSE_BUTTONS, { + { + "Two", 2 + }, + { + "Three", 3 + }, + { + "" + } + } + }, { "", "", -1 } @@ -660,7 +681,7 @@ static device_config_t bm_config[] = { device_t mouse_logibus_device = { "Logitech Bus Mouse", DEVICE_ISA, - MOUSE_TYPE_LOGIBUS | MOUSE_TYPE_3BUTTON, + MOUSE_TYPE_LOGIBUS, bm_init, bm_close, NULL, bm_poll, NULL, NULL, NULL, bm_config diff --git a/src/mouse_ps2.c b/src/mouse_ps2.c index d77b44a71..312038883 100644 --- a/src/mouse_ps2.c +++ b/src/mouse_ps2.c @@ -8,7 +8,7 @@ * * Implementation of PS/2 series Mouse devices. * - * Version: @(#)mouse_ps2.c 1.0.2 2017/12/03 + * Version: @(#)mouse_ps2.c 1.0.3 2017/12/09 * * Authors: Fred N. van Kempen, */ @@ -227,6 +227,7 @@ void * mouse_ps2_init(device_t *info) { mouse_t *dev; + int i; dev = (mouse_t *)malloc(sizeof(mouse_t)); memset(dev, 0x00, sizeof(mouse_t)); @@ -234,14 +235,18 @@ mouse_ps2_init(device_t *info) dev->type = info->local; dev->mode = MODE_STREAM; - if (dev->type & MOUSE_TYPE_3BUTTON) - dev->flags |= FLAG_INTELLI; + i = device_get_config_int("buttons"); + if (i > 2) + dev->flags |= FLAG_INTELLI; /* Hook into the general AT Keyboard driver. */ keyboard_at_set_mouse(ps2_write, dev); pclog("%s: buttons=%d\n", dev->name, (dev->flags & FLAG_INTELLI)? 3 : 2); + /* Tell them how many buttons we have. */ + mouse_set_buttons((dev->flags & FLAG_INTELLI) ? 3 : 2); + /* Return our private data to the I/O layer. */ return(dev); } @@ -252,6 +257,9 @@ ps2_close(void *priv) { mouse_t *dev = (mouse_t *)priv; + /* Unhook from the general AT Keyboard driver. */ + keyboard_at_set_mouse(NULL, NULL); + free(dev); } @@ -280,19 +288,10 @@ static device_config_t ps2_config[] = { device_t mouse_ps2_device = { - "Standard 2-button PS/2 Mouse", + "Standard PS/2 Mouse", 0, MOUSE_TYPE_PS2, mouse_ps2_init, ps2_close, NULL, ps2_poll, NULL, NULL, NULL, ps2_config }; - -device_t mouse_ps2ms_device = { - "Microsoft 3-button PS/2 Mouse", - 0, - MOUSE_TYPE_PS2 | MOUSE_TYPE_3BUTTON, - mouse_ps2_init, ps2_close, NULL, - ps2_poll, NULL, NULL, NULL, - ps2_config -}; diff --git a/src/mouse_serial.c b/src/mouse_serial.c index 0d8d4a586..c723d3ae0 100644 --- a/src/mouse_serial.c +++ b/src/mouse_serial.c @@ -10,7 +10,7 @@ * * TODO: Add the Genius Serial Mouse. * - * Version: @(#)mouse_serial.c 1.0.15 2017/12/05 + * Version: @(#)mouse_serial.c 1.0.16 2017/12/09 * * Author: Fred N. van Kempen, */ @@ -73,7 +73,7 @@ sermouse_timer(void *priv) if (dev->pos != -1) return; dev->pos = 0; - switch(dev->type & MOUSE_TYPE_MASK) { + switch(dev->type) { case MOUSE_TYPE_MSYSTEMS: /* Identifies Mouse Systems serial mouse. */ serial_write_fifo(dev->serial, 'H'); @@ -123,7 +123,7 @@ sermouse_poll(int x, int y, int z, int b, void *priv) if (y <- 128) y = -128; len = 0; - switch(dev->type & MOUSE_TYPE_MASK) { + switch(dev->type) { case MOUSE_TYPE_MSYSTEMS: buff[0] = 0x80; buff[0] |= (b & 0x01) ? 0x00 : 0x04; /* left button */ @@ -213,17 +213,17 @@ static void * sermouse_init(device_t *info) { mouse_t *dev; + int i; dev = (mouse_t *)malloc(sizeof(mouse_t)); memset(dev, 0x00, sizeof(mouse_t)); dev->name = info->name; dev->type = info->local; -#if NOTYET dev->port = device_get_config_int("port"); -#else - dev->port = config_get_int((char *)info->name, "port", SERMOUSE_PORT); -#endif + i = device_get_config_int("buttons"); + if (i > 2) + dev->flags |= FLAG_3BTN; /* Attach a serial port to the mouse. */ if (dev->port == 0) @@ -237,12 +237,28 @@ sermouse_init(device_t *info) timer_add(sermouse_timer, &dev->delay, &dev->delay, dev); + /* Tell them how many buttons we have. */ + mouse_set_buttons((dev->flags & FLAG_3BTN) ? 3 : 2); + /* Return our private data to the I/O layer. */ return(dev); } static device_config_t sermouse_config[] = { + { + "port", "Serial Port", CONFIG_SELECTION, "", 0, { + { + "COM1", 0 + }, + { + "COM2", 1 + }, + { + "" + } + } + }, { "buttons", "Buttons", CONFIG_SELECTION, "", 2, { { @@ -259,19 +275,6 @@ static device_config_t sermouse_config[] = { } } }, - { - "port", "Serial Port", CONFIG_SELECTION, "", 0, { - { - "COM1", 0 - }, - { - "COM2", 1 - }, - { - "" - } - } - }, { "", "", -1 } @@ -281,14 +284,14 @@ static device_config_t sermouse_config[] = { device_t mouse_mssystems_device = { "Mouse Systems Serial Mouse", 0, - MOUSE_TYPE_MSYSTEMS | MOUSE_TYPE_3BUTTON, + MOUSE_TYPE_MSYSTEMS, sermouse_init, sermouse_close, NULL, sermouse_poll, NULL, NULL, NULL, sermouse_config }; device_t mouse_msserial_device = { - "Microsoft 2-button Serial Mouse", + "Microsoft Serial Mouse", 0, MOUSE_TYPE_MICROSOFT, sermouse_init, sermouse_close, NULL, @@ -297,9 +300,9 @@ device_t mouse_msserial_device = { }; device_t mouse_lserial_device = { - "Logitech 3-button Serial Mouse", + "Logitech Serial Mouse", 0, - MOUSE_TYPE_LOGITECH | MOUSE_TYPE_3BUTTON, + MOUSE_TYPE_LOGITECH, sermouse_init, sermouse_close, NULL, sermouse_poll, NULL, NULL, NULL, sermouse_config @@ -308,7 +311,7 @@ device_t mouse_lserial_device = { device_t mouse_mswheel_device = { "Microsoft Serial Wheel Mouse", 0, - MOUSE_TYPE_MSWHEEL | MOUSE_TYPE_3BUTTON, + MOUSE_TYPE_MSWHEEL, sermouse_init, sermouse_close, NULL, sermouse_poll, NULL, NULL, NULL, sermouse_config diff --git a/src/pc.c b/src/pc.c index 2132ffebc..947d0474d 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Main emulator module where most things are controlled. * - * Version: @(#)pc.c 1.0.48 2017/12/05 + * Version: @(#)pc.c 1.0.49 2017/12/09 * * Authors: Sarah Walker, * Miran Grca, @@ -737,8 +737,8 @@ pc_reset_hard_init(void) cpu_set(); mem_resize(); io_init(); - device_init(); timer_reset(); + device_init(); midi_device_init(); inital(); @@ -1055,7 +1055,7 @@ pc_thread(void *param) L"%ls v%ls - %i%% - %ls - %ls - %ls", EMU_NAME_W,EMU_VERSION_W,fps,wmachine,wcpu, (!mouse_capture) ? plat_get_string(IDS_2077) - : ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079))); + : (mouse_get_buttons() > 2) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079)); ui_window_title(temp); diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 4e07f443b..50d5922fc 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -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, * Fred N. van Kempen, @@ -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 diff --git a/src/win/resource.h b/src/win/resource.h index eceb71025..00f99f1ba 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -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, * Miran Grca, @@ -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 diff --git a/src/win/win_settings.c b/src/win/win_settings.c index f251295cb..00a1ae890 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.25 2017/11/24 + * Version: @(#)win_settings.c 1.0.26 2017/12/09 * * Author: Miran Grca, * @@ -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) { diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 3738f5a2d..159b69207 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -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, * Miran Grca, @@ -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;