Caps/Num/Scroll LED states are now displayed
This commit is contained in:
@@ -72,9 +72,9 @@ static int keydelay[512];
|
|||||||
#endif
|
#endif
|
||||||
static scancode *scan_table; /* scancode table for keyboard */
|
static scancode *scan_table; /* scancode table for keyboard */
|
||||||
|
|
||||||
static uint8_t caps_lock = 0;
|
static volatile uint8_t caps_lock = 0;
|
||||||
static uint8_t num_lock = 0;
|
static volatile uint8_t num_lock = 0;
|
||||||
static uint8_t scroll_lock = 0;
|
static volatile uint8_t scroll_lock = 0;
|
||||||
static uint8_t shift = 0;
|
static uint8_t shift = 0;
|
||||||
|
|
||||||
static int key5576mode = 0;
|
static int key5576mode = 0;
|
||||||
@@ -318,13 +318,16 @@ keyboard_input(int down, uint16_t scan)
|
|||||||
shift &= ~0x80;
|
shift &= ~0x80;
|
||||||
break;
|
break;
|
||||||
case 0x03a: /* Caps Lock */
|
case 0x03a: /* Caps Lock */
|
||||||
caps_lock ^= 1;
|
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
|
||||||
|
caps_lock ^= 1;
|
||||||
break;
|
break;
|
||||||
case 0x045:
|
case 0x045:
|
||||||
num_lock ^= 1;
|
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
|
||||||
|
num_lock ^= 1;
|
||||||
break;
|
break;
|
||||||
case 0x046:
|
case 0x046:
|
||||||
scroll_lock ^= 1;
|
if (!(machine_has_bus(machine, MACHINE_AT) > 0))
|
||||||
|
scroll_lock ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -3476,6 +3476,7 @@ keyboard_at_bat(void *priv)
|
|||||||
|
|
||||||
keyboard_scan = 1;
|
keyboard_scan = 1;
|
||||||
|
|
||||||
|
keyboard_update_states(0, 0, 0);
|
||||||
kbc_at_dev_queue_add(dev, 0xaa, 0);
|
kbc_at_dev_queue_add(dev, 0xaa, 0);
|
||||||
} else {
|
} else {
|
||||||
bat_counter--;
|
bat_counter--;
|
||||||
@@ -3510,6 +3511,7 @@ keyboard_at_write(void *priv)
|
|||||||
switch (dev->command) {
|
switch (dev->command) {
|
||||||
case 0xed: /* Set/reset LEDs */
|
case 0xed: /* Set/reset LEDs */
|
||||||
kbc_at_dev_queue_add(dev, 0xfa, 0);
|
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);
|
keyboard_at_log("%s: Set/reset LEDs [%02X]\n", dev->name, val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3762,6 +3764,7 @@ keyboard_at_init(const device_t *info)
|
|||||||
|
|
||||||
if (dev->port != NULL) {
|
if (dev->port != NULL) {
|
||||||
kbc_at_dev_reset(dev, 0);
|
kbc_at_dev_reset(dev, 0);
|
||||||
|
keyboard_update_states(0, 0, 0);
|
||||||
bat_counter = 0x0000;
|
bat_counter = 0x0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -184,6 +184,32 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->menuEGA_S_VGA_settings->menuAction()->setMenuRole(QAction::NoRole);
|
ui->menuEGA_S_VGA_settings->menuAction()->setMenuRole(QAction::NoRole);
|
||||||
ui->stackedWidget->setMouseTracking(true);
|
ui->stackedWidget->setMouseTracking(true);
|
||||||
statusBar()->setVisible(!hide_status_bar);
|
statusBar()->setVisible(!hide_status_bar);
|
||||||
|
|
||||||
|
num_label = new QLabel;
|
||||||
|
num_label->setText(" NUM ");
|
||||||
|
statusBar()->addPermanentWidget(num_label);
|
||||||
|
|
||||||
|
scroll_label = new QLabel;
|
||||||
|
scroll_label->setText(" SCRL ");
|
||||||
|
statusBar()->addPermanentWidget(scroll_label);
|
||||||
|
|
||||||
|
caps_label = new QLabel;
|
||||||
|
caps_label->setText(" CAPS ");
|
||||||
|
statusBar()->addPermanentWidget(caps_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);
|
||||||
|
|
||||||
|
num_label->setStyleSheet(num ? "QLabel { background: green; }" : "");
|
||||||
|
caps_label->setStyleSheet(caps ? "QLabel { background: green; }" : "");
|
||||||
|
scroll_label->setStyleSheet(scroll ? "QLabel { background: green; }" : "");
|
||||||
|
});
|
||||||
|
ledKeyboardTimer->start();
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
util::setWin11RoundedCorners(this->winId(), (hide_status_bar ? false : true));
|
util::setWin11RoundedCorners(this->winId(), (hide_status_bar ? false : true));
|
||||||
#endif
|
#endif
|
||||||
@@ -211,6 +237,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
|
|
||||||
connect(this, &MainWindow::hardResetCompleted, this, [this]() {
|
connect(this, &MainWindow::hardResetCompleted, this, [this]() {
|
||||||
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
|
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
|
||||||
|
num_label->setVisible(machine_has_bus(machine, MACHINE_AT) > 0);
|
||||||
|
scroll_label->setVisible(machine_has_bus(machine, MACHINE_AT) > 0);
|
||||||
|
caps_label->setVisible(machine_has_bus(machine, MACHINE_AT) > 0);
|
||||||
while (QApplication::overrideCursor())
|
while (QApplication::overrideCursor())
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#ifdef USE_WACOM
|
#ifdef USE_WACOM
|
||||||
@@ -1306,6 +1335,10 @@ MainWindow::refreshMediaMenu()
|
|||||||
status->refresh(ui->statusbar);
|
status->refresh(ui->statusbar);
|
||||||
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
|
ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA));
|
||||||
ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled);
|
ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled);
|
||||||
|
|
||||||
|
num_label->setVisible(machine_has_bus(machine, MACHINE_AT) > 0);
|
||||||
|
scroll_label->setVisible(machine_has_bus(machine, MACHINE_AT) > 0);
|
||||||
|
caps_label->setVisible(machine_has_bus(machine, MACHINE_AT) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <array>
|
#include <array>
|
||||||
@@ -184,6 +185,8 @@ private:
|
|||||||
friend class RendererStack; // For UI variable access by non-primary renderer windows.
|
friend class RendererStack; // For UI variable access by non-primary renderer windows.
|
||||||
friend class WindowsRawInputFilter; // Needed to reload renderers on style sheet changes.
|
friend class WindowsRawInputFilter; // Needed to reload renderers on style sheet changes.
|
||||||
|
|
||||||
|
QLabel *caps_label, *scroll_label, *num_label;
|
||||||
|
|
||||||
|
|
||||||
bool isShowMessage = false;
|
bool isShowMessage = false;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user