aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common/emu_window.h
diff options
context:
space:
mode:
authorGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-10-12 22:46:33 +0200
committerGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-11-18 13:09:01 +0100
commit722ce2258949c5edf81c946faedfd040efeb38a6 (patch)
treeb935bde50743dd5638ea6fa2774db25ad3c174e1 /src/common/emu_window.h
parentbd8f491e4c08e9b9a7b852de0b50c144da8ac8c8 (diff)
EmuWindow: Add support for specifying minimal client area sizes.
Diffstat (limited to 'src/common/emu_window.h')
-rw-r--r--src/common/emu_window.h34
1 files changed, 26 insertions, 8 deletions
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<unsigned,unsigned> 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<unsigned,unsigned> NotifyFramebufferSizeChanged(const std::pair<unsigned,unsigned>& size) {
framebuffer_size = size;
}
- void NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned> size) {
+ void NotifyClientAreaSizeChanged(const std::pair<unsigned,unsigned>& size) {
client_area_width = size.first;
client_area_height = size.second;
}
private:
+ virtual void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) {
+ }
+
std::string window_title; ///< Current window title, should be used by window impl.
std::pair<unsigned,unsigned> 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
};