Added the ability for keyboard to require capture, in order for 86Box keyboard input to operate like VMWare, closes #829.
This commit is contained in:
@@ -513,6 +513,7 @@ load_general(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sound_gain = config_get_int(cat, "sound_gain", 0);
|
sound_gain = config_get_int(cat, "sound_gain", 0);
|
||||||
|
kbd_req_capture = config_get_int(cat, "kbd_req_capture", 0);
|
||||||
|
|
||||||
confirm_reset = config_get_int(cat, "confirm_reset", 1);
|
confirm_reset = config_get_int(cat, "confirm_reset", 1);
|
||||||
confirm_exit = config_get_int(cat, "confirm_exit", 1);
|
confirm_exit = config_get_int(cat, "confirm_exit", 1);
|
||||||
@@ -1811,6 +1812,7 @@ config_load(void)
|
|||||||
#ifdef USE_LANGUAGE
|
#ifdef USE_LANGUAGE
|
||||||
plat_langid = 0x0409;
|
plat_langid = 0x0409;
|
||||||
#endif
|
#endif
|
||||||
|
kbd_req_capture = 0;
|
||||||
scale = 1;
|
scale = 1;
|
||||||
machine = machine_get_machine_from_internal_name("ibmpc");
|
machine = machine_get_machine_from_internal_name("ibmpc");
|
||||||
fpu_type = fpu_get_type(cpu_f, cpu, "none");
|
fpu_type = fpu_get_type(cpu_f, cpu, "none");
|
||||||
@@ -1970,6 +1972,11 @@ save_general(void)
|
|||||||
else
|
else
|
||||||
config_delete_var(cat, "sound_gain");
|
config_delete_var(cat, "sound_gain");
|
||||||
|
|
||||||
|
if (kbd_req_capture != 0)
|
||||||
|
config_set_int(cat, "kbd_req_capture", kbd_req_capture);
|
||||||
|
else
|
||||||
|
config_delete_var(cat, "kbd_req_capture");
|
||||||
|
|
||||||
if (confirm_reset != 1)
|
if (confirm_reset != 1)
|
||||||
config_set_int(cat, "confirm_reset", confirm_reset);
|
config_set_int(cat, "confirm_reset", confirm_reset);
|
||||||
else
|
else
|
||||||
|
@@ -80,6 +80,8 @@ extern int update_icons;
|
|||||||
extern int unscaled_size_x, /* current unscaled size X */
|
extern int unscaled_size_x, /* current unscaled size X */
|
||||||
unscaled_size_y; /* current unscaled size Y */
|
unscaled_size_y; /* current unscaled size Y */
|
||||||
|
|
||||||
|
extern int kbd_req_capture;
|
||||||
|
|
||||||
/* System-related functions. */
|
/* System-related functions. */
|
||||||
extern char *fix_exe_path(char *str);
|
extern char *fix_exe_path(char *str);
|
||||||
extern FILE *plat_fopen(const char *path, const char *mode);
|
extern FILE *plat_fopen(const char *path, const char *mode);
|
||||||
|
@@ -285,17 +285,18 @@
|
|||||||
|
|
||||||
#define IDM_ABOUT 40001
|
#define IDM_ABOUT 40001
|
||||||
#define IDC_ABOUT_ICON 65535
|
#define IDC_ABOUT_ICON 65535
|
||||||
#define IDM_ACTION_RCTRL_IS_LALT 40010
|
#define IDM_ACTION_KBD_REQ_CAPTURE 40010
|
||||||
#define IDM_ACTION_SCREENSHOT 40011
|
#define IDM_ACTION_RCTRL_IS_LALT 40011
|
||||||
#define IDM_ACTION_HRESET 40012
|
#define IDM_ACTION_SCREENSHOT 40012
|
||||||
#define IDM_ACTION_RESET_CAD 40013
|
#define IDM_ACTION_HRESET 40013
|
||||||
#define IDM_ACTION_EXIT 40014
|
#define IDM_ACTION_RESET_CAD 40014
|
||||||
#define IDM_ACTION_CTRL_ALT_ESC 40015
|
#define IDM_ACTION_EXIT 40015
|
||||||
#define IDM_ACTION_PAUSE 40016
|
#define IDM_ACTION_CTRL_ALT_ESC 40016
|
||||||
|
#define IDM_ACTION_PAUSE 40017
|
||||||
#ifdef MTR_ENABLED
|
#ifdef MTR_ENABLED
|
||||||
#define IDM_ACTION_BEGIN_TRACE 40017
|
#define IDM_ACTION_BEGIN_TRACE 40018
|
||||||
#define IDM_ACTION_END_TRACE 40018
|
#define IDM_ACTION_END_TRACE 40019
|
||||||
#define IDM_ACTION_TRACE 40019
|
#define IDM_ACTION_TRACE 40020
|
||||||
#endif
|
#endif
|
||||||
#define IDM_CONFIG 40020
|
#define IDM_CONFIG 40020
|
||||||
#define IDM_CONFIG_LOAD 40021
|
#define IDM_CONFIG_LOAD 40021
|
||||||
|
@@ -45,6 +45,7 @@ MainMenu MENU DISCARDABLE
|
|||||||
BEGIN
|
BEGIN
|
||||||
POPUP "&Action"
|
POPUP "&Action"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
MENUITEM "&Keyboard requires capture", IDM_ACTION_KBD_REQ_CAPTURE
|
||||||
MENUITEM "&Right CTRL is left ALT", IDM_ACTION_RCTRL_IS_LALT
|
MENUITEM "&Right CTRL is left ALT", IDM_ACTION_RCTRL_IS_LALT
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "&Hard Reset", IDM_ACTION_HRESET
|
MENUITEM "&Hard Reset", IDM_ACTION_HRESET
|
||||||
|
@@ -116,6 +116,9 @@ keyboard_handle(PRAWINPUT raw)
|
|||||||
RAWKEYBOARD rawKB = raw->data.keyboard;
|
RAWKEYBOARD rawKB = raw->data.keyboard;
|
||||||
scancode = rawKB.MakeCode;
|
scancode = rawKB.MakeCode;
|
||||||
|
|
||||||
|
if (kbd_req_capture && !mouse_capture && !video_fullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
/* If it's not a scan code that starts with 0xE1 */
|
/* If it's not a scan code that starts with 0xE1 */
|
||||||
if (!(rawKB.Flags & RI_KEY_E1)) {
|
if (!(rawKB.Flags & RI_KEY_E1)) {
|
||||||
if (rawKB.Flags & RI_KEY_E0)
|
if (rawKB.Flags & RI_KEY_E0)
|
||||||
|
@@ -67,6 +67,7 @@ int infocus = 1, button_down = 0;
|
|||||||
int rctrl_is_lalt = 0;
|
int rctrl_is_lalt = 0;
|
||||||
int user_resize = 0;
|
int user_resize = 0;
|
||||||
int fixed_size_x = 0, fixed_size_y = 0;
|
int fixed_size_x = 0, fixed_size_y = 0;
|
||||||
|
int kbd_req_capture = 0;
|
||||||
|
|
||||||
extern char openfilestring[512];
|
extern char openfilestring[512];
|
||||||
extern WCHAR wopenfilestring[512];
|
extern WCHAR wopenfilestring[512];
|
||||||
@@ -82,8 +83,6 @@ static int manager_wm = 0;
|
|||||||
static int save_window_pos = 0, pause_state = 0;
|
static int save_window_pos = 0, pause_state = 0;
|
||||||
static int dpi = 96;
|
static int dpi = 96;
|
||||||
static int padded_frame = 0;
|
static int padded_frame = 0;
|
||||||
|
|
||||||
|
|
||||||
static int vis = -1;
|
static int vis = -1;
|
||||||
|
|
||||||
/* Per Monitor DPI Aware v2 APIs, Windows 10 v1703+ */
|
/* Per Monitor DPI Aware v2 APIs, Windows 10 v1703+ */
|
||||||
@@ -263,6 +262,7 @@ ResetAllMenus(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, MF_UNCHECKED);
|
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, MF_UNCHECKED);
|
||||||
|
CheckMenuItem(menuMain, IDM_ACTION_KBD_REQ_CAPTURE, MF_UNCHECKED);
|
||||||
|
|
||||||
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, MF_UNCHECKED);
|
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, MF_UNCHECKED);
|
||||||
|
|
||||||
@@ -328,6 +328,7 @@ ResetAllMenus(void)
|
|||||||
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+4, MF_UNCHECKED);
|
CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+4, MF_UNCHECKED);
|
||||||
|
|
||||||
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(menuMain, IDM_ACTION_RCTRL_IS_LALT, rctrl_is_lalt ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
CheckMenuItem(menuMain, IDM_ACTION_KBD_REQ_CAPTURE, kbd_req_capture ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
|
||||||
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, update_icons ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(menuMain, IDM_UPDATE_ICONS, update_icons ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
|
||||||
@@ -406,7 +407,8 @@ LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
BOOL bControlKeyDown;
|
BOOL bControlKeyDown;
|
||||||
KBDLLHOOKSTRUCT *p;
|
KBDLLHOOKSTRUCT *p;
|
||||||
|
|
||||||
if (nCode < 0 || nCode != HC_ACTION || (!mouse_capture && !video_fullscreen))
|
if (nCode < 0 || nCode != HC_ACTION ||
|
||||||
|
(!mouse_capture && !video_fullscreen) || (kbd_req_capture && !mouse_capture && !video_fullscreen))
|
||||||
return(CallNextHookEx(hKeyboardHook, nCode, wParam, lParam));
|
return(CallNextHookEx(hKeyboardHook, nCode, wParam, lParam));
|
||||||
|
|
||||||
p = (KBDLLHOOKSTRUCT*)lParam;
|
p = (KBDLLHOOKSTRUCT*)lParam;
|
||||||
@@ -671,6 +673,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
config_save();
|
config_save();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDM_ACTION_KBD_REQ_CAPTURE:
|
||||||
|
kbd_req_capture ^= 1;
|
||||||
|
CheckMenuItem(hmenu, IDM_ACTION_KBD_REQ_CAPTURE, kbd_req_capture ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
config_save();
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_ACTION_PAUSE:
|
case IDM_ACTION_PAUSE:
|
||||||
plat_pause(dopause ^ 1);
|
plat_pause(dopause ^ 1);
|
||||||
CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);
|
||||||
@@ -1688,7 +1696,7 @@ plat_mouse_capture(int on)
|
|||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
if (mouse_type == MOUSE_TYPE_NONE)
|
if (!kbd_req_capture && (mouse_type == MOUSE_TYPE_NONE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (on && !mouse_capture) {
|
if (on && !mouse_capture) {
|
||||||
|
Reference in New Issue
Block a user