diff options
Diffstat (limited to '')
-rw-r--r-- | src/citra/emu_window/emu_window_glfw.cpp | 21 | ||||
-rw-r--r-- | src/citra/emu_window/emu_window_glfw.h | 2 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 7 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.hxx | 2 |
4 files changed, 32 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 _dbg_assert_(GUI, width > 0); _dbg_assert_(GUI, height > 0); + // TODO: It's actually more interesting to us what the framebuffer size ends up being. + int adjusted_width = std::max<unsigned>(width, GetEmuWindow(win)->GetActiveConfig().min_client_area_size.first); + int adjusted_height = std::max<unsigned>(height, GetEmuWindow(win)->GetActiveConfig().min_client_area_size.second); + + if (adjusted_width != width || adjusted_height != height) { + glfwSetWindowSize(win, adjusted_width, adjusted_height); + return; + } + GetEmuWindow(win)->NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(width, height)); } @@ -136,3 +145,15 @@ void EmuWindow_GLFW::ReloadSetKeymaps() { KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP); KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN); } + +void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { + std::pair<int,int> current_size; + glfwGetWindowSize(m_render_window, ¤t_size.first, ¤t_size.second); + + _dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0); + int new_width = std::max(current_size.first, (int)minimal_size.first); + int new_height = std::max(current_size.second, (int)minimal_size.second); + + if (current_size != std::make_pair(new_width, new_height)) + glfwSetWindowSize(m_render_window, new_width, new_height); +} 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: void ReloadSetKeymaps() override; private: + void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; + static EmuWindow_GLFW* GetEmuWindow(GLFWwindow* win); GLFWwindow* m_render_window; ///< Internal GLFW render window diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 34a79b306..8c12cb228 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -129,6 +129,9 @@ GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this setLayout(layout); connect(&emu_thread, SIGNAL(started()), this, SLOT(moveContext())); + setMinimumSize(GetActiveConfig().min_client_area_size.first, + GetActiveConfig().min_client_area_size.second); + OnFramebufferSizeChanged(); NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(child->width(), child->height())); @@ -275,3 +278,7 @@ void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) { NotifyClientAreaSizeChanged(std::make_pair(width, height)); } + +void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { + setMinimumSize(minimal_size.first, minimal_size.second); +} diff --git a/src/citra_qt/bootmanager.hxx b/src/citra_qt/bootmanager.hxx index 3a18f98fd..3eec1668e 100644 --- a/src/citra_qt/bootmanager.hxx +++ b/src/citra_qt/bootmanager.hxx @@ -121,6 +121,8 @@ public slots: void moveContext(); // overridden private: + void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; + QGLWidget* child; EmuThread emu_thread; |