mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 16:32:46 +00:00
Small fixup/cleanup to the handling of window flags
* Merged the resolution keys into one pair * Don't flag maximized off when switching to fullscreen. This fixes a case where toggling back from fullscreen on a maximized window wouldn't return to maximized * Fixed a typo in the maximized getter
This commit is contained in:
parent
dc8e937164
commit
becdecd0f5
@ -129,7 +129,7 @@ void prefs_event_handler::handle_window_event(const SDL_Event& event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_RESTORED:
|
case SDL_WINDOWEVENT_RESTORED:
|
||||||
_set_maximized(false);
|
_set_maximized(fullscreen() || false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -362,8 +362,7 @@ int min_allowed_height()
|
|||||||
|
|
||||||
std::pair<int,int> resolution()
|
std::pair<int,int> resolution()
|
||||||
{
|
{
|
||||||
const std::string postfix = fullscreen() ? "resolution" : "windowsize";
|
const std::string& x = prefs["xresolution"], y = prefs["yresolution"];
|
||||||
std::string x = prefs['x' + postfix], y = prefs['y' + postfix];
|
|
||||||
|
|
||||||
if (!x.empty() && !y.empty()) {
|
if (!x.empty() && !y.empty()) {
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
@ -376,7 +375,7 @@ std::pair<int,int> resolution()
|
|||||||
|
|
||||||
bool maximized()
|
bool maximized()
|
||||||
{
|
{
|
||||||
return get("maximized", (fullscreen() & true));
|
return get("maximized", !fullscreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fullscreen()
|
bool fullscreen()
|
||||||
@ -386,9 +385,8 @@ bool fullscreen()
|
|||||||
|
|
||||||
void _set_resolution(const std::pair<int, int>& res)
|
void _set_resolution(const std::pair<int, int>& res)
|
||||||
{
|
{
|
||||||
const std::string postfix = fullscreen() ? "resolution" : "windowsize";
|
preferences::set("xresolution", lexical_cast<std::string>(res.first));
|
||||||
preferences::set('x' + postfix, lexical_cast<std::string>(res.first));
|
preferences::set("yresolution", lexical_cast<std::string>(res.second));
|
||||||
preferences::set('y' + postfix, lexical_cast<std::string>(res.second));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _set_maximized(bool ison)
|
void _set_maximized(bool ison)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user