From 722ce2258949c5edf81c946faedfd040efeb38a6 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 12 Oct 2014 22:46:33 +0200 Subject: EmuWindow: Add support for specifying minimal client area sizes. --- src/common/emu_window.h | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/common/emu_window.h') diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 72c40c6a..baacc6da 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -20,6 +20,7 @@ public: bool fullscreen; int res_width; int res_height; + std::pair min_client_area_size; }; /// Swap buffers to display the next frame @@ -42,8 +43,8 @@ public: /// Signals a key release action to the HID module static void KeyReleased(KeyMap::HostDeviceKey key); - WindowConfig GetConfig() const { - return config; + const WindowConfig& GetActiveConfig() const { + return active_config; } void SetConfig(const WindowConfig& val) { @@ -72,24 +73,40 @@ public: window_title = val; } + // Only call this from the GUI thread! + void ProcessConfigurationChanges() { + // TODO: For proper thread safety, we should eventually implement a proper + // multiple-writer/single-reader queue... + + if (config.min_client_area_size != active_config.min_client_area_size) { + OnMinimalClientAreaChangeRequest(config.min_client_area_size); + config.min_client_area_size = active_config.min_client_area_size; + } + } + protected: - EmuWindow() : // TODO: What the hell... -.- - don't hardcode dimensions here without applying them in a sensible manner... + EmuWindow() : window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc)) - m_client_area_width(640), - m_client_area_height(480), - {} + { + // TODO + config.min_client_area_size = std::make_pair(300u, 500u); + active_config = config; + } virtual ~EmuWindow() {} std::pair NotifyFramebufferSizeChanged(const std::pair& size) { framebuffer_size = size; } - void NotifyClientAreaSizeChanged(std::pair size) { + void NotifyClientAreaSizeChanged(const std::pair& size) { client_area_width = size.first; client_area_height = size.second; } private: + virtual void OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { + } + std::string window_title; ///< Current window title, should be used by window impl. std::pair framebuffer_size; @@ -97,5 +114,6 @@ private: unsigned client_area_width; ///< Current client width, should be set by window impl. unsigned client_area_height; ///< Current client height, should be set by window impl. - WindowConfig config; ///< Internal configuration + WindowConfig config; ///< Internal configuration (changes pending for being applied in ProcessConfigurationChanges) + WindowConfig active_config; ///< Internal active configuration }; -- cgit v1.2.3