[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 hid {
|
||||
|
||||
InputDriver::InputDriver(xe::ui::Window* window) : window_(window) {}
|
||||
|
||||
InputDriver::InputDriver() = default;
|
||||
InputDriver::~InputDriver() = default;
|
||||
|
||||
} // namespace hid
|
||||
|
|
|
@ -26,6 +26,7 @@ class InputSystem;
|
|||
|
||||
class InputDriver {
|
||||
public:
|
||||
InputDriver();
|
||||
virtual ~InputDriver();
|
||||
|
||||
virtual X_STATUS Setup() = 0;
|
||||
|
@ -37,11 +38,6 @@ class InputDriver {
|
|||
X_INPUT_VIBRATION* vibration) = 0;
|
||||
virtual X_RESULT GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||
X_INPUT_KEYSTROKE* out_keystroke) = 0;
|
||||
|
||||
protected:
|
||||
explicit InputDriver(xe::ui::Window* window);
|
||||
|
||||
xe::ui::Window* window_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace hid
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
#include "xenia/hid/input_driver.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
class Window;
|
||||
} // namespace ui
|
||||
} // namespace xe
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace xe {
|
|||
namespace hid {
|
||||
namespace nop {
|
||||
|
||||
std::unique_ptr<InputDriver> Create(xe::ui::Window* window) {
|
||||
return std::make_unique<NopInputDriver>(window);
|
||||
std::unique_ptr<InputDriver> Create() {
|
||||
return std::make_unique<NopInputDriver>();
|
||||
}
|
||||
|
||||
} // namespace nop
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace xe {
|
|||
namespace hid {
|
||||
namespace nop {
|
||||
|
||||
std::unique_ptr<InputDriver> Create(xe::ui::Window* window);
|
||||
std::unique_ptr<InputDriver> Create();
|
||||
|
||||
} // namespace nop
|
||||
} // namespace hid
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace xe {
|
|||
namespace hid {
|
||||
namespace nop {
|
||||
|
||||
NopInputDriver::NopInputDriver(xe::ui::Window* window) : InputDriver(window) {}
|
||||
NopInputDriver::NopInputDriver() {}
|
||||
|
||||
NopInputDriver::~NopInputDriver() = default;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace nop {
|
|||
|
||||
class NopInputDriver : public InputDriver {
|
||||
public:
|
||||
explicit NopInputDriver(xe::ui::Window* window);
|
||||
NopInputDriver();
|
||||
~NopInputDriver() override;
|
||||
|
||||
X_STATUS Setup() override;
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace hid {
|
|||
namespace winkey {
|
||||
|
||||
WinKeyInputDriver::WinKeyInputDriver(xe::ui::Window* window)
|
||||
: InputDriver(window), packet_number_(1) {
|
||||
: window_(window), packet_number_(1) {
|
||||
// Register a key listener.
|
||||
window_->on_key_down.AddListener([this](ui::KeyEvent* evt) {
|
||||
auto global_lock = global_critical_region_.Acquire();
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
#include "xenia/hid/input_driver.h"
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
class Window;
|
||||
} // namespace ui
|
||||
|
||||
namespace hid {
|
||||
namespace winkey {
|
||||
|
||||
|
@ -41,6 +45,7 @@ class WinKeyInputDriver : public InputDriver {
|
|||
bool prev_state = false; // down(true) or up(false)
|
||||
};
|
||||
|
||||
xe::ui::Window* window_ = nullptr;
|
||||
xe::global_critical_region global_critical_region_;
|
||||
std::queue<KeyEvent> key_events_;
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace xe {
|
|||
namespace hid {
|
||||
namespace xinput {
|
||||
|
||||
std::unique_ptr<InputDriver> Create(xe::ui::Window* window) {
|
||||
return std::make_unique<XInputInputDriver>(window);
|
||||
std::unique_ptr<InputDriver> Create() {
|
||||
return std::make_unique<XInputInputDriver>();
|
||||
}
|
||||
|
||||
} // namespace xinput
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace xinput {
|
|||
|
||||
class XInputInputDriver : public InputDriver {
|
||||
public:
|
||||
explicit XInputInputDriver(xe::ui::Window* window);
|
||||
XInputInputDriver();
|
||||
~XInputInputDriver() override;
|
||||
|
||||
X_STATUS Setup() override;
|
||||
|
|
Loading…
Reference in New Issue