mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 00:30:26 +00:00
Reimplement preference flag event handling in member function hook
This commit is contained in:
parent
c425bd8b15
commit
02b992821a
@ -445,12 +445,15 @@ void pump()
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
info.resize_dimensions.first = event.window.data1;
|
||||
info.resize_dimensions.second = event.window.data2;
|
||||
|
||||
preferences::_set_resolution(
|
||||
std::make_pair(event.window.data1,event.window.data2));
|
||||
break;
|
||||
}
|
||||
|
||||
// Hook into preferences event handling
|
||||
// This probably isn't the right place for this but I really don't
|
||||
// know where else to put it.
|
||||
// - Vultraz, 12/28/2015
|
||||
preferences::handle_event(event);
|
||||
|
||||
break;
|
||||
#else
|
||||
case SDL_ACTIVEEVENT: {
|
||||
|
@ -91,6 +91,21 @@ base_manager::~base_manager()
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
/*
|
||||
* Hook for setting window state variables on window resize and maximize
|
||||
* events. Since there is no fullscreen window event, that setter is called
|
||||
* from the CVideo function instead.
|
||||
*/
|
||||
void handle_event(const SDL_Event& event)
|
||||
{
|
||||
switch(event.window.event) {
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
_set_resolution(std::make_pair(event.window.data1,event.window.data2));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void write_preferences()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
@ -22,6 +22,8 @@ class display;
|
||||
|
||||
#include "terrain_translation.hpp"
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace hotkey {
|
||||
@ -37,6 +39,8 @@ namespace preferences {
|
||||
~base_manager();
|
||||
};
|
||||
|
||||
void handle_event(const SDL_Event& event);
|
||||
|
||||
void write_preferences();
|
||||
|
||||
void set(const std::string& key, const std::string &value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user