diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/emu_window.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 72c40c6a4..baacc6da2 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h | |||
| @@ -20,6 +20,7 @@ public: | |||
| 20 | bool fullscreen; | 20 | bool fullscreen; |
| 21 | int res_width; | 21 | int res_width; |
| 22 | int res_height; | 22 | int res_height; |
| 23 | std::pair<unsigned,unsigned> min_client_area_size; | ||
| 23 | }; | 24 | }; |
| 24 | 25 | ||
| 25 | /// Swap buffers to display the next frame | 26 | /// Swap buffers to display the next frame |
| @@ -42,8 +43,8 @@ public: | |||
| 42 | /// Signals a key release action to the HID module | 43 | /// Signals a key release action to the HID module |
| 43 | static void KeyReleased(KeyMap::HostDeviceKey key); | 44 | static void KeyReleased(KeyMap::HostDeviceKey key); |
| 44 | 45 | ||
| 45 | WindowConfig GetConfig() const { | 46 | const WindowConfig& GetActiveConfig() const { |
| 46 | return config; | 47 | return active_config; |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | void SetConfig(const WindowConfig& val) { | 50 | void SetConfig(const WindowConfig& val) { |
| @@ -72,24 +73,40 @@ public: | |||
| 72 | window_title = val; | 73 | window_title = val; |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 76 | // Only call this from the GUI thread! | ||
| 77 | void ProcessConfigurationChanges() { | ||
| 78 | // TODO: For proper thread safety, we should eventually implement a proper | ||
| 79 | // multiple-writer/single-reader queue... | ||
| 80 | |||
| 81 | if (config.min_client_area_size != active_config.min_client_area_size) { | ||
| 82 | OnMinimalClientAreaChangeRequest(config.min_client_area_size); | ||
| 83 | config.min_client_area_size = active_config.min_client_area_size; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 75 | protected: | 87 | protected: |
| 76 | EmuWindow() : // TODO: What the hell... -.- - don't hardcode dimensions here without applying them in a sensible manner... | 88 | EmuWindow() : |
| 77 | window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc)) | 89 | window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc)) |
| 78 | m_client_area_width(640), | 90 | { |
| 79 | m_client_area_height(480), | 91 | // TODO |
| 80 | {} | 92 | config.min_client_area_size = std::make_pair(300u, 500u); |
| 93 | active_config = config; | ||
| 94 | } | ||
| 81 | virtual ~EmuWindow() {} | 95 | virtual ~EmuWindow() {} |
| 82 | 96 | ||
| 83 | std::pair<unsigned,unsigned> NotifyFramebufferSizeChanged(const std::pair<unsigned,unsigned>& size) { | 97 | std::pair<unsigned,unsigned> NotifyFramebufferSizeChanged(const std::pair<unsigned,unsigned>& size) { |
| 84 | framebuffer_size = size; | 98 | framebuffer_size = size; |
| 85 | } | 99 | } |
| 86 | 100 | ||
| 87 | void NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned> size) { | 101 | void NotifyClientAreaSizeChanged(const std::pair<unsigned,unsigned>& size) { |
| 88 | client_area_width = size.first; | 102 | client_area_width = size.first; |
| 89 | client_area_height = size.second; | 103 | client_area_height = size.second; |
| 90 | } | 104 | } |
| 91 | 105 | ||
| 92 | private: | 106 | private: |
| 107 | virtual void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { | ||
| 108 | } | ||
| 109 | |||
| 93 | std::string window_title; ///< Current window title, should be used by window impl. | 110 | std::string window_title; ///< Current window title, should be used by window impl. |
| 94 | 111 | ||
| 95 | std::pair<unsigned,unsigned> framebuffer_size; | 112 | std::pair<unsigned,unsigned> framebuffer_size; |
| @@ -97,5 +114,6 @@ private: | |||
| 97 | unsigned client_area_width; ///< Current client width, should be set by window impl. | 114 | unsigned client_area_width; ///< Current client width, should be set by window impl. |
| 98 | unsigned client_area_height; ///< Current client height, should be set by window impl. | 115 | unsigned client_area_height; ///< Current client height, should be set by window impl. |
| 99 | 116 | ||
| 100 | WindowConfig config; ///< Internal configuration | 117 | WindowConfig config; ///< Internal configuration (changes pending for being applied in ProcessConfigurationChanges) |
| 118 | WindowConfig active_config; ///< Internal active configuration | ||
| 101 | }; | 119 | }; |