From 38064acd517e6dec29acf19f9b975107729f6ea1 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Tue, 18 Aug 2015 18:45:35 -0500 Subject: [PATCH] UI KeyEvent previous state and repeat count --- src/xenia/ui/ui_event.h | 13 +++++++++++-- src/xenia/ui/window_win.cc | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/xenia/ui/ui_event.h b/src/xenia/ui/ui_event.h index 3fdce231c..11881a6cb 100644 --- a/src/xenia/ui/ui_event.h +++ b/src/xenia/ui/ui_event.h @@ -28,8 +28,11 @@ class UIEvent { class KeyEvent : public UIEvent { public: - KeyEvent(Window* target, int key_code) - : UIEvent(target), key_code_(key_code) {} + KeyEvent(Window* target, int key_code, int repeat_count, bool prev_state) + : UIEvent(target), + key_code_(key_code), + repeat_count_(repeat_count), + prev_state_(prev_state) {} ~KeyEvent() override = default; bool is_handled() const { return handled_; } @@ -37,9 +40,15 @@ class KeyEvent : public UIEvent { int key_code() const { return key_code_; } + int repeat_count() const { return repeat_count_; } + bool prev_state() const { return prev_state_; } + private: bool handled_ = false; int key_code_ = 0; + + int repeat_count_ = 0; + bool prev_state_ = false; // Key previously down(true) or up(false) }; class MouseEvent : public UIEvent { diff --git a/src/xenia/ui/window_win.cc b/src/xenia/ui/window_win.cc index 57558caf5..f45631bf3 100644 --- a/src/xenia/ui/window_win.cc +++ b/src/xenia/ui/window_win.cc @@ -503,7 +503,8 @@ bool Win32Window::HandleMouse(UINT message, WPARAM wParam, LPARAM lParam) { } bool Win32Window::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) { - auto e = KeyEvent(this, static_cast(wParam)); + auto e = KeyEvent(this, static_cast(wParam), lParam & 0xFFFF, + !!(lParam & 0x00000002)); switch (message) { case WM_KEYDOWN: OnKeyDown(&e);