mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[HID] Remove ui::Window reference from drivers that don't need it
This commit is contained in:
parent
7f9ed83844
commit
b97a4bbf17
|
|
@ -12,8 +12,7 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace hid {
|
namespace hid {
|
||||||
|
|
||||||
InputDriver::InputDriver(xe::ui::Window* window) : window_(window) {}
|
InputDriver::InputDriver() = default;
|
||||||
|
|
||||||
InputDriver::~InputDriver() = default;
|
InputDriver::~InputDriver() = default;
|
||||||
|
|
||||||
} // namespace hid
|
} // namespace hid
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class InputSystem;
|
||||||
|
|
||||||
class InputDriver {
|
class InputDriver {
|
||||||
public:
|
public:
|
||||||
|
InputDriver();
|
||||||
virtual ~InputDriver();
|
virtual ~InputDriver();
|
||||||
|
|
||||||
virtual X_STATUS Setup() = 0;
|
virtual X_STATUS Setup() = 0;
|
||||||
|
|
@ -37,11 +38,6 @@ class InputDriver {
|
||||||
X_INPUT_VIBRATION* vibration) = 0;
|
X_INPUT_VIBRATION* vibration) = 0;
|
||||||
virtual X_RESULT GetKeystroke(uint32_t user_index, uint32_t flags,
|
virtual X_RESULT GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||||
X_INPUT_KEYSTROKE* out_keystroke) = 0;
|
X_INPUT_KEYSTROKE* out_keystroke) = 0;
|
||||||
|
|
||||||
protected:
|
|
||||||
explicit InputDriver(xe::ui::Window* window);
|
|
||||||
|
|
||||||
xe::ui::Window* window_ = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace hid
|
} // namespace hid
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,6 @@
|
||||||
#include "xenia/hid/input_driver.h"
|
#include "xenia/hid/input_driver.h"
|
||||||
#include "xenia/xbox.h"
|
#include "xenia/xbox.h"
|
||||||
|
|
||||||
namespace xe {
|
|
||||||
namespace ui {
|
|
||||||
class Window;
|
|
||||||
} // namespace ui
|
|
||||||
} // namespace xe
|
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace hid {
|
namespace hid {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace xe {
|
||||||
namespace hid {
|
namespace hid {
|
||||||
namespace nop {
|
namespace nop {
|
||||||
|
|
||||||
std::unique_ptr<InputDriver> Create(xe::ui::Window* window) {
|
std::unique_ptr<InputDriver> Create() {
|
||||||
return std::make_unique<NopInputDriver>(window);
|
return std::make_unique<NopInputDriver>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nop
|
} // namespace nop
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace xe {
|
||||||
namespace hid {
|
namespace hid {
|
||||||
namespace nop {
|
namespace nop {
|
||||||
|
|
||||||
std::unique_ptr<InputDriver> Create(xe::ui::Window* window);
|
std::unique_ptr<InputDriver> Create();
|
||||||
|
|
||||||
} // namespace nop
|
} // namespace nop
|
||||||
} // namespace hid
|
} // namespace hid
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace xe {
|
||||||
namespace hid {
|
namespace hid {
|
||||||
namespace nop {
|
namespace nop {
|
||||||
|
|
||||||
NopInputDriver::NopInputDriver(xe::ui::Window* window) : InputDriver(window) {}
|
NopInputDriver::NopInputDriver() {}
|
||||||
|
|
||||||
NopInputDriver::~NopInputDriver() = default;
|
NopInputDriver::~NopInputDriver() = default;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace nop {
|
||||||
|
|
||||||
class NopInputDriver : public InputDriver {
|
class NopInputDriver : public InputDriver {
|
||||||
public:
|
public:
|
||||||
explicit NopInputDriver(xe::ui::Window* window);
|
NopInputDriver();
|
||||||
~NopInputDriver() override;
|
~NopInputDriver() override;
|
||||||
|
|
||||||
X_STATUS Setup() override;
|
X_STATUS Setup() override;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace hid {
|
||||||
namespace winkey {
|
namespace winkey {
|
||||||
|
|
||||||
WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window)
|
WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window)
|
||||||
: InputDriver(window), packet_number_(1) {
|
: window_(window), packet_number_(1) {
|
||||||
// Register a key listener.
|
// 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();
|
auto global_lock = global_critical_region_.Acquire();
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
#include "xenia/hid/input_driver.h"
|
#include "xenia/hid/input_driver.h"
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
|
namespace ui {
|
||||||
|
class Window;
|
||||||
|
} // namespace ui
|
||||||
|
|
||||||
namespace hid {
|
namespace hid {
|
||||||
namespace winkey {
|
namespace winkey {
|
||||||
|
|
||||||
|
|
@ -41,6 +45,7 @@ class WinKeyInputDriver : public InputDriver {
|
||||||
bool prev_state = false; // down(true) or up(false)
|
bool prev_state = false; // down(true) or up(false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xe::ui::Window* window_ = nullptr;
|
||||||
xe::global_critical_region global_critical_region_;
|
xe::global_critical_region global_critical_region_;
|
||||||
std::queue<KeyEvent> key_events_;
|
std::queue<KeyEvent> key_events_;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace xe {
|
||||||
namespace hid {
|
namespace hid {
|
||||||
namespace xinput {
|
namespace xinput {
|
||||||
|
|
||||||
std::unique_ptr<InputDriver> Create(xe::ui::Window* window) {
|
std::unique_ptr<InputDriver> Create() {
|
||||||
return std::make_unique<XInputInputDriver>(window);
|
return std::make_unique<XInputInputDriver>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xinput
|
} // namespace xinput
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace xinput {
|
||||||
|
|
||||||
class XInputInputDriver : public InputDriver {
|
class XInputInputDriver : public InputDriver {
|
||||||
public:
|
public:
|
||||||
explicit XInputInputDriver(xe::ui::Window* window);
|
XInputInputDriver();
|
||||||
~XInputInputDriver() override;
|
~XInputInputDriver() override;
|
||||||
|
|
||||||
X_STATUS Setup() override;
|
X_STATUS Setup() override;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue