Merge pull request #5393 from Cacodemon345/qt-scroll-states
Caps/Num/Scroll LED states are now displayed
@@ -64,10 +64,10 @@ static int keydelay[512];
|
||||
#endif
|
||||
static scancode *scan_table; /* scancode table for keyboard */
|
||||
|
||||
static uint8_t caps_lock = 0;
|
||||
static uint8_t num_lock = 0;
|
||||
static uint8_t scroll_lock = 0;
|
||||
static uint8_t shift = 0;
|
||||
static volatile uint8_t caps_lock = 0;
|
||||
static volatile uint8_t num_lock = 0;
|
||||
static volatile uint8_t scroll_lock = 0;
|
||||
static uint8_t shift = 0;
|
||||
|
||||
static int key5576mode = 0;
|
||||
|
||||
@@ -310,13 +310,16 @@ keyboard_input(int down, uint16_t scan)
|
||||
shift &= ~0x80;
|
||||
break;
|
||||
case 0x03a: /* Caps Lock */
|
||||
caps_lock ^= 1;
|
||||
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
|
||||
caps_lock ^= 1;
|
||||
break;
|
||||
case 0x045:
|
||||
num_lock ^= 1;
|
||||
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
|
||||
num_lock ^= 1;
|
||||
break;
|
||||
case 0x046:
|
||||
scroll_lock ^= 1;
|
||||
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
|
||||
scroll_lock ^= 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -3476,6 +3476,7 @@ keyboard_at_bat(void *priv)
|
||||
|
||||
keyboard_scan = 1;
|
||||
|
||||
keyboard_update_states(0, 0, 0);
|
||||
kbc_at_dev_queue_add(dev, 0xaa, 0);
|
||||
} else {
|
||||
bat_counter--;
|
||||
@@ -3510,6 +3511,7 @@ keyboard_at_write(void *priv)
|
||||
switch (dev->command) {
|
||||
case 0xed: /* Set/reset LEDs */
|
||||
kbc_at_dev_queue_add(dev, 0xfa, 0);
|
||||
keyboard_update_states(!!(val & 0x4), !!(val & 0x2), val & 0x1);
|
||||
keyboard_at_log("%s: Set/reset LEDs [%02X]\n", dev->name, val);
|
||||
break;
|
||||
|
||||
@@ -3767,6 +3769,7 @@ keyboard_at_init(const device_t *info)
|
||||
|
||||
keyboard_send = add_data_kbd;
|
||||
SavedKbd = dev;
|
||||
keyboard_update_states(0, 0, 0);
|
||||
|
||||
inv_cmd_response = (dev->type & FLAG_PS2) ? 0xfe : 0xfa;
|
||||
|
||||
@@ -3785,6 +3788,8 @@ keyboard_at_close(void *priv)
|
||||
/* Disable the scancode maps. */
|
||||
keyboard_set_table(NULL);
|
||||
|
||||
keyboard_update_states(0, 0, 0);
|
||||
|
||||
SavedKbd = NULL;
|
||||
|
||||
free(dev);
|
||||
|
||||
BIN
src/qt/icons/caps_lock_off.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/caps_lock_on.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/kana_lock_off.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/kana_lock_on.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/num_lock_off.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/num_lock_on.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/scroll_lock_off.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
src/qt/icons/scroll_lock_on.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
@@ -186,6 +186,43 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->menuEGA_S_VGA_settings->menuAction()->setMenuRole(QAction::NoRole);
|
||||
ui->stackedWidget->setMouseTracking(true);
|
||||
statusBar()->setVisible(!hide_status_bar);
|
||||
|
||||
num_icon = QIcon(":/settings/qt/icons/num_lock_on.ico");
|
||||
num_icon_off = QIcon(":/settings/qt/icons/num_lock_off.ico");
|
||||
scroll_icon = QIcon(":/settings/qt/icons/scroll_lock_on.ico");
|
||||
scroll_icon_off = QIcon(":/settings/qt/icons/scroll_lock_off.ico");
|
||||
caps_icon = QIcon(":/settings/qt/icons/caps_lock_on.ico");
|
||||
caps_icon_off = QIcon(":/settings/qt/icons/caps_lock_off.ico");
|
||||
/* TODO: Add Kana indicator here after the keyboard type work is done. */
|
||||
|
||||
num_label = new QLabel;
|
||||
num_label->setPixmap(num_icon_off.pixmap(QSize(16, 16)));
|
||||
statusBar()->addPermanentWidget(num_label);
|
||||
|
||||
caps_label = new QLabel;
|
||||
caps_label->setPixmap(caps_icon_off.pixmap(QSize(16, 16)));
|
||||
statusBar()->addPermanentWidget(caps_label);
|
||||
|
||||
scroll_label = new QLabel;
|
||||
scroll_label->setPixmap(scroll_icon_off.pixmap(QSize(16, 16)));
|
||||
statusBar()->addPermanentWidget(scroll_label);
|
||||
|
||||
QTimer* ledKeyboardTimer = new QTimer(this);
|
||||
ledKeyboardTimer->setTimerType(Qt::CoarseTimer);
|
||||
ledKeyboardTimer->setInterval(1);
|
||||
connect(ledKeyboardTimer, &QTimer::timeout, this, [this] () {
|
||||
uint8_t caps, num, scroll;
|
||||
keyboard_get_states(&caps, &num, &scroll);
|
||||
|
||||
if (num_label->isVisible())
|
||||
num_label->setPixmap(num ? this->num_icon.pixmap(QSize(16, 16)) : this->num_icon_off.pixmap(QSize(16, 16)));
|
||||
if (caps_label->isVisible())
|
||||
caps_label->setPixmap(caps ? this->caps_icon.pixmap(QSize(16, 16)) : this->caps_icon_off.pixmap(QSize(16, 16)));
|
||||
if (scroll_label->isVisible())
|
||||
scroll_label->setPixmap(scroll ? this->scroll_icon.pixmap(QSize(16, 16)) : this->scroll_icon_off.pixmap(QSize(16, 16)));
|
||||
});
|
||||
ledKeyboardTimer->start();
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
util::setWin11RoundedCorners(this->winId(), (hide_status_bar ? false : true));
|
||||
#endif
|
||||
@@ -213,6 +250,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
connect(this, &MainWindow::hardResetCompleted, this, [this]() {
|
||||
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
|
||||
num_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
scroll_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
caps_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
while (QApplication::overrideCursor())
|
||||
QApplication::restoreOverrideCursor();
|
||||
#ifdef USE_WACOM
|
||||
@@ -1455,6 +1495,10 @@ MainWindow::refreshMediaMenu()
|
||||
status->refresh(ui->statusbar);
|
||||
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
|
||||
ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled);
|
||||
|
||||
num_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
scroll_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
caps_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
#include <QFocusEvent>
|
||||
#include <QLabel>
|
||||
#include <QShortcut>
|
||||
#include <QIcon>
|
||||
|
||||
#include <memory>
|
||||
#include <array>
|
||||
@@ -189,6 +191,10 @@ private:
|
||||
friend class RendererStack; // For UI variable access by non-primary renderer windows.
|
||||
friend class WindowsRawInputFilter; // Needed to reload renderers on style sheet changes.
|
||||
|
||||
QLabel *caps_label, *scroll_label, *num_label;
|
||||
QIcon caps_icon, scroll_icon, num_icon;
|
||||
QIcon caps_icon_off, scroll_icon_off, num_icon_off;
|
||||
|
||||
bool isShowMessage = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,6 +34,14 @@
|
||||
<file>qt/icons/86Box-green.ico</file>
|
||||
<file>qt/icons/86Box-red.ico</file>
|
||||
<file>qt/icons/86Box-yellow.ico</file>
|
||||
<file>qt/icons/caps_lock_off.ico</file>
|
||||
<file>qt/icons/caps_lock_on.ico</file>
|
||||
<file>qt/icons/kana_lock_off.ico</file>
|
||||
<file>qt/icons/kana_lock_on.ico</file>
|
||||
<file>qt/icons/num_lock_off.ico</file>
|
||||
<file>qt/icons/num_lock_on.ico</file>
|
||||
<file>qt/icons/scroll_lock_off.ico</file>
|
||||
<file>qt/icons/scroll_lock_on.ico</file>
|
||||
</qresource>
|
||||
<qresource prefix="/menuicons">
|
||||
<file>qt/icons/acpi_shutdown.ico</file>
|
||||
|
||||