[HID] Pass 'is active' callback to input drivers.

This commit is contained in:
gibbed
2020-11-27 05:20:17 -06:00
committed by Rick Gibbed
parent f8e6ac4108
commit dd25e69e66
8 changed files with 39 additions and 13 deletions

View File

@@ -21,7 +21,7 @@ namespace winkey {
WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window)
: InputDriver(window), packet_number_(1) {
// Register a key listener.
window_->on_key_down.AddListener([this](ui::KeyEvent* evt) {
window->on_key_down.AddListener([this](ui::KeyEvent* evt) {
auto global_lock = global_critical_region_.Acquire();
KeyEvent key;
@@ -31,7 +31,7 @@ WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window)
key.repeat_count = evt->repeat_count();
key_events_.push(key);
});
window_->on_key_up.AddListener([this](ui::KeyEvent* evt) {
window->on_key_up.AddListener([this](ui::KeyEvent* evt) {
auto global_lock = global_critical_region_.Acquire();
KeyEvent key;
@@ -88,7 +88,7 @@ X_RESULT WinKeyInputDriver::GetState(uint32_t user_index,
int16_t thumb_rx = 0;
int16_t thumb_ry = 0;
if (window_->has_focus()) {
if (window()->has_focus()) {
if (IS_KEY_TOGGLED(VK_CAPITAL) || IS_KEY_DOWN(VK_SHIFT)) {
// dpad toggled
if (IS_KEY_DOWN('A')) {