Reverted the previous approach and switched to the new, non-hacky approach of getting rid of the accelerator and instead handling enter full screen the same way exit full screen is handled.
This commit is contained in:
@@ -300,11 +300,30 @@ keyboard_recv(uint16_t key)
|
|||||||
return recv_key[key];
|
return recv_key[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do we have Control-Alt-PgDn in the keyboard buffer? */
|
||||||
|
int
|
||||||
|
keyboard_isfsenter(void)
|
||||||
|
{
|
||||||
|
return ((recv_key[0x01d] || recv_key[0x11d]) && (recv_key[0x038] || recv_key[0x138]) && (recv_key[0x049] || recv_key[0x149]));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
keyboard_isfsenter_down(void)
|
||||||
|
{
|
||||||
|
return (!recv_key[0x01d] && !recv_key[0x11d] && !recv_key[0x038] && !recv_key[0x138] && !recv_key[0x049] && !recv_key[0x149]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Do we have Control-Alt-PgDn in the keyboard buffer? */
|
/* Do we have Control-Alt-PgDn in the keyboard buffer? */
|
||||||
int
|
int
|
||||||
keyboard_isfsexit(void)
|
keyboard_isfsexit(void)
|
||||||
{
|
{
|
||||||
return ((recv_key[0x01D] || recv_key[0x11D]) && (recv_key[0x038] || recv_key[0x138]) && (recv_key[0x051] || recv_key[0x151]));
|
return ((recv_key[0x01d] || recv_key[0x11d]) && (recv_key[0x038] || recv_key[0x138]) && (recv_key[0x051] || recv_key[0x151]));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
keyboard_isfsexit_down(void)
|
||||||
|
{
|
||||||
|
return (!recv_key[0x01d] && !recv_key[0x11d] && !recv_key[0x038] && !recv_key[0x138] && !recv_key[0x051] && !recv_key[0x151]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we have F8-F12 in the keyboard buffer? */
|
/* Do we have F8-F12 in the keyboard buffer? */
|
||||||
|
|||||||
@@ -194,7 +194,10 @@ extern uint8_t keyboard_get_shift(void);
|
|||||||
extern void keyboard_get_states(uint8_t *cl, uint8_t *nl, uint8_t *sl);
|
extern void keyboard_get_states(uint8_t *cl, uint8_t *nl, uint8_t *sl);
|
||||||
extern void keyboard_set_states(uint8_t cl, uint8_t nl, uint8_t sl);
|
extern void keyboard_set_states(uint8_t cl, uint8_t nl, uint8_t sl);
|
||||||
extern int keyboard_recv(uint16_t key);
|
extern int keyboard_recv(uint16_t key);
|
||||||
|
extern int keyboard_isfsenter(void);
|
||||||
|
extern int keyboard_isfsenter_down(void);
|
||||||
extern int keyboard_isfsexit(void);
|
extern int keyboard_isfsexit(void);
|
||||||
|
extern int keyboard_isfsexit_down(void);
|
||||||
extern int keyboard_ismsexit(void);
|
extern int keyboard_ismsexit(void);
|
||||||
extern void keyboard_set_is_amstrad(int ams);
|
extern void keyboard_set_is_amstrad(int ams);
|
||||||
|
|
||||||
|
|||||||
25
src/io.c
25
src/io.c
@@ -56,6 +56,7 @@ typedef struct {
|
|||||||
int initialized = 0;
|
int initialized = 0;
|
||||||
io_t *io[NPORTS], *io_last[NPORTS];
|
io_t *io[NPORTS], *io_last[NPORTS];
|
||||||
|
|
||||||
|
// #define ENABLE_IO_LOG 1
|
||||||
#ifdef ENABLE_IO_LOG
|
#ifdef ENABLE_IO_LOG
|
||||||
int io_do_log = ENABLE_IO_LOG;
|
int io_do_log = ENABLE_IO_LOG;
|
||||||
|
|
||||||
@@ -310,7 +311,9 @@ inb(uint16_t port)
|
|||||||
/* if (port == 0x1ed)
|
/* if (port == 0x1ed)
|
||||||
ret = 0xfe; */
|
ret = 0xfe; */
|
||||||
|
|
||||||
io_log("[%04X:%08X] (%i, %i, %04i) in b(%04X) = %02X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret);
|
if (port == 0x92) {
|
||||||
|
io_log("[%04X:%08X] (%i, %i, %04i) in b(%04X) = %02X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@@ -341,7 +344,9 @@ outb(uint16_t port, uint8_t val)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
io_log("[%04X:%08X] (%i, %i, %04i) outb(%04X, %02X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val);
|
if (port == 0x92) {
|
||||||
|
io_log("[%04X:%08X] (%i, %i, %04i) outb(%04X, %02X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -395,7 +400,9 @@ inw(uint16_t port)
|
|||||||
if (!found)
|
if (!found)
|
||||||
cycles -= io_delay;
|
cycles -= io_delay;
|
||||||
|
|
||||||
io_log("[%04X:%08X] (%i, %i, %04i) in w(%04X) = %04X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret);
|
if (port == 0x92) {
|
||||||
|
io_log("[%04X:%08X] (%i, %i, %04i) in w(%04X) = %04X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -440,7 +447,9 @@ outw(uint16_t port, uint16_t val)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
io_log("[%04X:%08X] (%i, %i, %04i) outw(%04X, %04X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val);
|
if (port == 0x92) {
|
||||||
|
io_log("[%04X:%08X] (%i, %i, %04i) outw(%04X, %04X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -522,7 +531,9 @@ inl(uint16_t port)
|
|||||||
if (!found)
|
if (!found)
|
||||||
cycles -= io_delay;
|
cycles -= io_delay;
|
||||||
|
|
||||||
io_log("[%04X:%08X] (%i, %i, %04i) in l(%04X) = %08X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret);
|
if (port == 0x92) {
|
||||||
|
io_log("[%04X:%08X] (%i, %i, %04i) in l(%04X) = %08X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -582,7 +593,9 @@ outl(uint16_t port, uint32_t val)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
io_log("[%04X:%08X] (%i, %i, %04i) outl(%04X, %08X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val);
|
if (port == 0x92) {
|
||||||
|
io_log("[%04X:%08X] (%i, %i, %04i) outl(%04X, %08X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -541,6 +541,7 @@ void
|
|||||||
pic_kbd_latch(int enable)
|
pic_kbd_latch(int enable)
|
||||||
{
|
{
|
||||||
pic_log("PIC keyboard latch now %sabled\n", enable ? "en" : "dis");
|
pic_log("PIC keyboard latch now %sabled\n", enable ? "en" : "dis");
|
||||||
|
pclog("PIC keyboard latch now %sabled\n", enable ? "en" : "dis");
|
||||||
|
|
||||||
if (!!(enable | mouse_latch) != !!(kbd_latch | mouse_latch))
|
if (!!(enable | mouse_latch) != !!(kbd_latch | mouse_latch))
|
||||||
io_handler(!!(enable | mouse_latch), 0x0060, 0x0001, pic_latch_read, NULL, NULL, NULL, NULL, NULL, NULL);
|
io_handler(!!(enable | mouse_latch), 0x0060, 0x0001, pic_latch_read, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
@@ -555,6 +556,7 @@ void
|
|||||||
pic_mouse_latch(int enable)
|
pic_mouse_latch(int enable)
|
||||||
{
|
{
|
||||||
pic_log("PIC mouse latch now %sabled\n", enable ? "en" : "dis");
|
pic_log("PIC mouse latch now %sabled\n", enable ? "en" : "dis");
|
||||||
|
pclog("PIC mouse latch now %sabled\n", enable ? "en" : "dis");
|
||||||
|
|
||||||
if (!!(kbd_latch | enable) != !!(kbd_latch | mouse_latch))
|
if (!!(kbd_latch | enable) != !!(kbd_latch | mouse_latch))
|
||||||
io_handler(!!(kbd_latch | enable), 0x0060, 0x0001, pic_latch_read, NULL, NULL, NULL, NULL, NULL, NULL);
|
io_handler(!!(kbd_latch | enable), 0x0060, 0x0001, pic_latch_read, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|||||||
@@ -156,6 +156,8 @@ extern "C" void qt_blit(int x, int y, int w, int h, int monitor_index);
|
|||||||
|
|
||||||
extern MainWindow *main_window;
|
extern MainWindow *main_window;
|
||||||
|
|
||||||
|
static int fs_on_signal = 0, fs_off_signal = 0;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
@@ -580,7 +582,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
ui->actionFullscreen->setShortcutVisibleInContextMenu(true);
|
|
||||||
ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true);
|
ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true);
|
||||||
ui->actionTake_screenshot->setShortcutVisibleInContextMenu(true);
|
ui->actionTake_screenshot->setShortcutVisibleInContextMenu(true);
|
||||||
#endif
|
#endif
|
||||||
@@ -1241,13 +1242,14 @@ MainWindow::keyPressEvent(QKeyEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((video_fullscreen > 0) && keyboard_isfsexit()) {
|
if (!fs_off_signal && (video_fullscreen > 0) && keyboard_isfsexit())
|
||||||
ui->actionFullscreen->trigger();
|
fs_off_signal = 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (keyboard_ismsexit()) {
|
if (!fs_on_signal && (video_fullscreen == 0) && keyboard_isfsenter())
|
||||||
|
fs_on_signal = 1;
|
||||||
|
|
||||||
|
if (keyboard_ismsexit())
|
||||||
plat_mouse_capture(0);
|
plat_mouse_capture(0);
|
||||||
}
|
|
||||||
|
|
||||||
if ((video_fullscreen > 0) && (keyboard_recv(0x1D) || keyboard_recv(0x11D))) {
|
if ((video_fullscreen > 0) && (keyboard_recv(0x1D) || keyboard_recv(0x11D))) {
|
||||||
if (keyboard_recv(0x57))
|
if (keyboard_recv(0x57))
|
||||||
@@ -1279,6 +1281,17 @@ MainWindow::keyReleaseEvent(QKeyEvent *event)
|
|||||||
plat_pause(dopause ^ 1);
|
plat_pause(dopause ^ 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fs_off_signal && (video_fullscreen > 0) && keyboard_isfsexit_down()) {
|
||||||
|
ui->actionFullscreen->trigger();
|
||||||
|
fs_off_signal = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs_on_signal && (video_fullscreen == 0) && keyboard_isfsenter_down()) {
|
||||||
|
ui->actionFullscreen->trigger();
|
||||||
|
fs_on_signal = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!send_keyboard_input)
|
if (!send_keyboard_input)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -362,12 +362,6 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Fullscreen</string>
|
<string>&Fullscreen</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+Alt+PgUp</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcutVisibleInContextMenu">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSoftware_Renderer">
|
<action name="actionSoftware_Renderer">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
|
|||||||
@@ -172,8 +172,7 @@ void
|
|||||||
WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
||||||
{
|
{
|
||||||
USHORT scancode;
|
USHORT scancode;
|
||||||
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0, recv_lctrl = 0, recv_rctrl = 0;
|
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0;
|
||||||
static int recv_npgup = 0, recv_pgup = 0;
|
|
||||||
|
|
||||||
RAWKEYBOARD rawKB = raw->data.keyboard;
|
RAWKEYBOARD rawKB = raw->data.keyboard;
|
||||||
scancode = rawKB.MakeCode;
|
scancode = rawKB.MakeCode;
|
||||||
@@ -223,148 +222,17 @@ WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
|||||||
is not captured, suppress the ALT and send a TAB key up. */
|
is not captured, suppress the ALT and send a TAB key up. */
|
||||||
keyboard_input(0, 0x00f);
|
keyboard_input(0, 0x00f);
|
||||||
recv_tab = 0;
|
recv_tab = 0;
|
||||||
} else if (((scancode == 0x049) || (scancode == 0x149)) && !(rawKB.Flags & RI_KEY_BREAK) && (recv_lalt || recv_ralt) && (recv_lctrl || recv_rctrl) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received a NumPad Page Up or Page Up while CTRL+ALT was pressed, while the keyboard
|
|
||||||
is captured, suppress the Page Up and send an CTRL+ALT key up. */
|
|
||||||
if (recv_lctrl) {
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x01d);
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
recv_lctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_rctrl) {
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x11d);
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
recv_rctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
} else if (((scancode == 0x038) || (scancode == 0x138)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_npgup && (recv_lctrl || recv_rctrl) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an ALT while CTRL+NumPad Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lctrl) {
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x01d);
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
recv_lctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_rctrl) {
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x11d);
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
recv_rctrl = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x049);
|
|
||||||
recv_npgup = 0;
|
|
||||||
} else if (((scancode == 0x01d) || (scancode == 0x11d)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_npgup && (recv_lalt || recv_ralt) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an CTRL while ALT+NumPad Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x049);
|
|
||||||
recv_npgup = 0;
|
|
||||||
} else if (((scancode == 0x038) || (scancode == 0x138)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_pgup && (recv_lctrl || recv_rctrl) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an ALT while CTRL+Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x149);
|
|
||||||
recv_pgup = 0;
|
|
||||||
} else if (((scancode == 0x01d) || (scancode == 0x11d)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_pgup && (recv_lalt || recv_ralt) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an CTRL while ALT+Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lctrl) {
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x01d);
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
recv_lctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_rctrl) {
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x11d);
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
recv_rctrl = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x149);
|
|
||||||
recv_pgup = 0;
|
|
||||||
} else {
|
} else {
|
||||||
switch (scancode) {
|
switch (scancode) {
|
||||||
case 0x00f:
|
case 0x00f:
|
||||||
recv_tab = !(rawKB.Flags & RI_KEY_BREAK);
|
recv_tab = !(rawKB.Flags & RI_KEY_BREAK);
|
||||||
break;
|
break;
|
||||||
case 0x01d:
|
|
||||||
recv_lctrl = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x049:
|
|
||||||
recv_npgup = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x038:
|
case 0x038:
|
||||||
recv_lalt = !(rawKB.Flags & RI_KEY_BREAK);
|
recv_lalt = !(rawKB.Flags & RI_KEY_BREAK);
|
||||||
break;
|
break;
|
||||||
case 0x11d:
|
|
||||||
recv_rctrl = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x138:
|
case 0x138:
|
||||||
recv_ralt = !(rawKB.Flags & RI_KEY_BREAK);
|
recv_ralt = !(rawKB.Flags & RI_KEY_BREAK);
|
||||||
break;
|
break;
|
||||||
case 0x149:
|
|
||||||
recv_pgup = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate right CTRL to left ALT if the user has so
|
/* Translate right CTRL to left ALT if the user has so
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ BEGIN
|
|||||||
#ifdef MTR_ENABLED
|
#ifdef MTR_ENABLED
|
||||||
"T", IDM_ACTION_TRACE, CONTROL, VIRTKEY
|
"T", IDM_ACTION_TRACE, CONTROL, VIRTKEY
|
||||||
#endif
|
#endif
|
||||||
VK_PRIOR,IDM_VID_FULLSCREEN, VIRTKEY, CONTROL , ALT
|
// VK_PRIOR,IDM_VID_FULLSCREEN, VIRTKEY, CONTROL , ALT
|
||||||
VK_F11, IDM_ACTION_SCREENSHOT, VIRTKEY, CONTROL
|
VK_F11, IDM_ACTION_SCREENSHOT, VIRTKEY, CONTROL
|
||||||
VK_F12, IDM_ACTION_RESET_CAD, VIRTKEY, CONTROL
|
VK_F12, IDM_ACTION_RESET_CAD, VIRTKEY, CONTROL
|
||||||
VK_PAUSE,IDM_ACTION_PAUSE, VIRTKEY
|
VK_PAUSE,IDM_ACTION_PAUSE, VIRTKEY
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ void
|
|||||||
keyboard_handle(PRAWINPUT raw)
|
keyboard_handle(PRAWINPUT raw)
|
||||||
{
|
{
|
||||||
USHORT scancode;
|
USHORT scancode;
|
||||||
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0, recv_lctrl = 0, recv_rctrl = 0;
|
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0;
|
||||||
static int recv_npgup = 0, recv_pgup = 0;
|
|
||||||
|
|
||||||
RAWKEYBOARD rawKB = raw->data.keyboard;
|
RAWKEYBOARD rawKB = raw->data.keyboard;
|
||||||
scancode = rawKB.MakeCode;
|
scancode = rawKB.MakeCode;
|
||||||
@@ -158,148 +157,17 @@ keyboard_handle(PRAWINPUT raw)
|
|||||||
is not captured, suppress the ALT and send a TAB key up. */
|
is not captured, suppress the ALT and send a TAB key up. */
|
||||||
keyboard_input(0, 0x00f);
|
keyboard_input(0, 0x00f);
|
||||||
recv_tab = 0;
|
recv_tab = 0;
|
||||||
} else if (((scancode == 0x049) || (scancode == 0x149)) && !(rawKB.Flags & RI_KEY_BREAK) && (recv_lalt || recv_ralt) && (recv_lctrl || recv_rctrl) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received a NumPad Page Up or Page Up while CTRL+ALT was pressed, while the keyboard
|
|
||||||
is captured, suppress the Page Up and send an CTRL+ALT key up. */
|
|
||||||
if (recv_lctrl) {
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x01d);
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
recv_lctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_rctrl) {
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x11d);
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
recv_rctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
} else if (((scancode == 0x038) || (scancode == 0x138)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_npgup && (recv_lctrl || recv_rctrl) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an ALT while CTRL+NumPad Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lctrl) {
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x01d);
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
recv_lctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_rctrl) {
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x11d);
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
recv_rctrl = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x049);
|
|
||||||
recv_npgup = 0;
|
|
||||||
} else if (((scancode == 0x01d) || (scancode == 0x11d)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_npgup && (recv_lalt || recv_ralt) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an CTRL while ALT+NumPad Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x049);
|
|
||||||
recv_npgup = 0;
|
|
||||||
} else if (((scancode == 0x038) || (scancode == 0x138)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_pgup && (recv_lctrl || recv_rctrl) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an ALT while CTRL+Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lalt) {
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x038);
|
|
||||||
keyboard_input(0, 0x038);
|
|
||||||
recv_lalt = 0;
|
|
||||||
}
|
|
||||||
if (recv_ralt) {
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x138);
|
|
||||||
keyboard_input(0, 0x138);
|
|
||||||
recv_ralt = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x149);
|
|
||||||
recv_pgup = 0;
|
|
||||||
} else if (((scancode == 0x01d) || (scancode == 0x11d)) && !(rawKB.Flags & RI_KEY_BREAK) && recv_pgup && (recv_lalt || recv_ralt) && (!kbd_req_capture || mouse_capture)) {
|
|
||||||
/* We received an CTRL while ALT+Page Up was pressed, while the mouse
|
|
||||||
is not captured, suppress the ALT and send a TAB key up. */
|
|
||||||
if (recv_lctrl) {
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x01d);
|
|
||||||
keyboard_input(0, 0x01d);
|
|
||||||
recv_lctrl = 0;
|
|
||||||
}
|
|
||||||
if (recv_rctrl) {
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
/* Extra key press and release so the guest is not stuck in the
|
|
||||||
menu bar. */
|
|
||||||
keyboard_input(1, 0x11d);
|
|
||||||
keyboard_input(0, 0x11d);
|
|
||||||
recv_rctrl = 0;
|
|
||||||
}
|
|
||||||
keyboard_input(0, 0x149);
|
|
||||||
recv_pgup = 0;
|
|
||||||
} else {
|
} else {
|
||||||
switch (scancode) {
|
switch (scancode) {
|
||||||
case 0x00f:
|
case 0x00f:
|
||||||
recv_tab = !(rawKB.Flags & RI_KEY_BREAK);
|
recv_tab = !(rawKB.Flags & RI_KEY_BREAK);
|
||||||
break;
|
break;
|
||||||
case 0x01d:
|
|
||||||
recv_lctrl = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x049:
|
|
||||||
recv_npgup = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x038:
|
case 0x038:
|
||||||
recv_lalt = !(rawKB.Flags & RI_KEY_BREAK);
|
recv_lalt = !(rawKB.Flags & RI_KEY_BREAK);
|
||||||
break;
|
break;
|
||||||
case 0x11d:
|
|
||||||
recv_rctrl = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
case 0x138:
|
case 0x138:
|
||||||
recv_ralt = !(rawKB.Flags & RI_KEY_BREAK);
|
recv_ralt = !(rawKB.Flags & RI_KEY_BREAK);
|
||||||
break;
|
break;
|
||||||
case 0x149:
|
|
||||||
recv_pgup = !(rawKB.Flags & RI_KEY_BREAK);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate right CTRL to left ALT if the user has so
|
/* Translate right CTRL to left ALT if the user has so
|
||||||
|
|||||||
@@ -1183,6 +1183,7 @@ ui_init(int nCmdShow)
|
|||||||
{IDCANCEL, MAKEINTRESOURCE(IDS_2120)}
|
{IDCANCEL, MAKEINTRESOURCE(IDS_2120)}
|
||||||
};
|
};
|
||||||
uint32_t helper_lang;
|
uint32_t helper_lang;
|
||||||
|
static int fs_on_signal = 0, fs_off_signal = 0;
|
||||||
|
|
||||||
/* Load DPI related Windows 10 APIs */
|
/* Load DPI related Windows 10 APIs */
|
||||||
user32_handle = dynld_module("user32.dll", user32_imports);
|
user32_handle = dynld_module("user32.dll", user32_imports);
|
||||||
@@ -1461,9 +1462,20 @@ ui_init(int nCmdShow)
|
|||||||
plat_mouse_capture(0);
|
plat_mouse_capture(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video_fullscreen && keyboard_isfsexit()) {
|
if (!fs_off_signal && video_fullscreen && keyboard_isfsexit()) {
|
||||||
/* Signal "exit fullscreen mode". */
|
/* Signal "exit fullscreen mode". */
|
||||||
|
fs_off_signal = 1;
|
||||||
|
} else if (fs_off_signal && video_fullscreen && keyboard_isfsexit_down()) {
|
||||||
plat_setfullscreen(0);
|
plat_setfullscreen(0);
|
||||||
|
fs_off_signal = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs_on_signal && !video_fullscreen && keyboard_isfsenter()) {
|
||||||
|
/* Signal "enter fullscreen mode". */
|
||||||
|
fs_on_signal = 1;
|
||||||
|
} else if (fs_on_signal && !video_fullscreen && keyboard_isfsenter_down()) {
|
||||||
|
plat_setfullscreen(1);
|
||||||
|
fs_on_signal = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISCORD
|
#ifdef DISCORD
|
||||||
|
|||||||
Reference in New Issue
Block a user