summaryrefslogtreecommitdiff
path: root/src/citra
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-10-12 22:46:33 +0200
committerGravatar Tony Wasserka2014-11-18 13:09:01 +0100
commit722ce2258949c5edf81c946faedfd040efeb38a6 (patch)
treeb935bde50743dd5638ea6fa2774db25ad3c174e1 /src/citra
parentFixup EmuWindow interface and implementations thereof. (diff)
downloadyuzu-722ce2258949c5edf81c946faedfd040efeb38a6.tar.gz
yuzu-722ce2258949c5edf81c946faedfd040efeb38a6.tar.xz
yuzu-722ce2258949c5edf81c946faedfd040efeb38a6.zip
EmuWindow: Add support for specifying minimal client area sizes.
Diffstat (limited to 'src/citra')
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp21
-rw-r--r--src/citra/emu_window/emu_window_glfw.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 28aa3450c..7e1e1c9a6 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -46,6 +46,15 @@ void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int hei
46 _dbg_assert_(GUI, width > 0); 46 _dbg_assert_(GUI, width > 0);
47 _dbg_assert_(GUI, height > 0); 47 _dbg_assert_(GUI, height > 0);
48 48
49 // TODO: It's actually more interesting to us what the framebuffer size ends up being.
50 int adjusted_width = std::max<unsigned>(width, GetEmuWindow(win)->GetActiveConfig().min_client_area_size.first);
51 int adjusted_height = std::max<unsigned>(height, GetEmuWindow(win)->GetActiveConfig().min_client_area_size.second);
52
53 if (adjusted_width != width || adjusted_height != height) {
54 glfwSetWindowSize(win, adjusted_width, adjusted_height);
55 return;
56 }
57
49 GetEmuWindow(win)->NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(width, height)); 58 GetEmuWindow(win)->NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(width, height));
50} 59}
51 60
@@ -136,3 +145,15 @@ void EmuWindow_GLFW::ReloadSetKeymaps() {
136 KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP); 145 KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP);
137 KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN); 146 KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN);
138} 147}
148
149void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) {
150 std::pair<int,int> current_size;
151 glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second);
152
153 _dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
154 int new_width = std::max(current_size.first, (int)minimal_size.first);
155 int new_height = std::max(current_size.second, (int)minimal_size.second);
156
157 if (current_size != std::make_pair(new_width, new_height))
158 glfwSetWindowSize(m_render_window, new_width, new_height);
159}
diff --git a/src/citra/emu_window/emu_window_glfw.h b/src/citra/emu_window/emu_window_glfw.h
index 0da688a54..61cef4e65 100644
--- a/src/citra/emu_window/emu_window_glfw.h
+++ b/src/citra/emu_window/emu_window_glfw.h
@@ -37,6 +37,8 @@ public:
37 void ReloadSetKeymaps() override; 37 void ReloadSetKeymaps() override;
38 38
39private: 39private:
40 void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override;
41
40 static EmuWindow_GLFW* GetEmuWindow(GLFWwindow* win); 42 static EmuWindow_GLFW* GetEmuWindow(GLFWwindow* win);
41 43
42 GLFWwindow* m_render_window; ///< Internal GLFW render window 44 GLFWwindow* m_render_window; ///< Internal GLFW render window