summaryrefslogtreecommitdiff
path: root/src/citra_qt/bootmanager.cpp
diff options
context:
space:
mode:
authorGravatar wwylele2017-01-21 11:53:03 +0200
committerGravatar wwylele2017-03-01 23:30:57 +0200
commit38e800f70d122051e12ac9f22e23d84b97fec424 (patch)
tree0f52b5731a4fd8e9f2a39e8e75d1fa18ce8b9107 /src/citra_qt/bootmanager.cpp
parentHID: use AnalogDevice (diff)
downloadyuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.gz
yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.tar.xz
yuzu-38e800f70d122051e12ac9f22e23d84b97fec424.zip
InputCommon: add Keyboard
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
-rw-r--r--src/citra_qt/bootmanager.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 69d18cf0c..66c883d9a 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -13,7 +13,8 @@
13#include "common/scm_rev.h" 13#include "common/scm_rev.h"
14#include "common/string_util.h" 14#include "common/string_util.h"
15#include "core/core.h" 15#include "core/core.h"
16#include "core/frontend/key_map.h" 16#include "input_common/keyboard.h"
17#include "input_common/main.h"
17#include "video_core/debug_utils/debug_utils.h" 18#include "video_core/debug_utils/debug_utils.h"
18#include "video_core/video_core.h" 19#include "video_core/video_core.h"
19 20
@@ -99,14 +100,17 @@ private:
99}; 100};
100 101
101GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) 102GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread)
102 : QWidget(parent), child(nullptr), keyboard_id(0), emu_thread(emu_thread) { 103 : QWidget(parent), child(nullptr), emu_thread(emu_thread) {
103 104
104 std::string window_title = Common::StringFromFormat("Citra %s| %s-%s", Common::g_build_name, 105 std::string window_title = Common::StringFromFormat("Citra %s| %s-%s", Common::g_build_name,
105 Common::g_scm_branch, Common::g_scm_desc); 106 Common::g_scm_branch, Common::g_scm_desc);
106 setWindowTitle(QString::fromStdString(window_title)); 107 setWindowTitle(QString::fromStdString(window_title));
107 108
108 keyboard_id = KeyMap::NewDeviceId(); 109 InputCommon::Init();
109 ReloadSetKeymaps(); 110}
111
112GRenderWindow::~GRenderWindow() {
113 InputCommon::Shutdown();
110} 114}
111 115
112void GRenderWindow::moveContext() { 116void GRenderWindow::moveContext() {
@@ -197,11 +201,11 @@ void GRenderWindow::closeEvent(QCloseEvent* event) {
197} 201}
198 202
199void GRenderWindow::keyPressEvent(QKeyEvent* event) { 203void GRenderWindow::keyPressEvent(QKeyEvent* event) {
200 KeyMap::PressKey(*this, {event->key(), keyboard_id}); 204 InputCommon::GetKeyboard()->PressKey(event->key());
201} 205}
202 206
203void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { 207void GRenderWindow::keyReleaseEvent(QKeyEvent* event) {
204 KeyMap::ReleaseKey(*this, {event->key(), keyboard_id}); 208 InputCommon::GetKeyboard()->ReleaseKey(event->key());
205} 209}
206 210
207void GRenderWindow::mousePressEvent(QMouseEvent* event) { 211void GRenderWindow::mousePressEvent(QMouseEvent* event) {
@@ -230,14 +234,7 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
230 motion_emu->EndTilt(); 234 motion_emu->EndTilt();
231} 235}
232 236
233void GRenderWindow::ReloadSetKeymaps() { 237void GRenderWindow::ReloadSetKeymaps() {}
234 KeyMap::ClearKeyMapping(keyboard_id);
235 for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
236 KeyMap::SetKeyMapping(
237 {Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id},
238 KeyMap::mapping_targets[i]);
239 }
240}
241 238
242void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) { 239void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
243 NotifyClientAreaSizeChanged(std::make_pair(width, height)); 240 NotifyClientAreaSizeChanged(std::make_pair(width, height));