another attempt to fix bug#9734 for the linux people
(works on my system so just stabbing in the dark)
This commit is contained in:
parent
54230a40db
commit
b058ecda17
6 changed files with 24 additions and 19 deletions
|
@ -91,6 +91,7 @@ int main(int argc, char** argv)
|
|||
const font::manager font_manager;
|
||||
const preferences::base_manager prefs_manager;
|
||||
const image::manager image_manager;
|
||||
resize_monitor resize_monitor_;
|
||||
binary_paths_manager paths_manager;
|
||||
std::string filename = "";
|
||||
std::string mapdata;
|
||||
|
|
|
@ -142,6 +142,8 @@ private:
|
|||
const events::event_context main_event_context_;
|
||||
const hotkey::manager hotkey_manager_;
|
||||
const upload_log::manager upload_log_manager_;
|
||||
sound::music_thinker music_thinker_;
|
||||
resize_monitor resize_monitor_;
|
||||
binary_paths_manager paths_manager_;
|
||||
|
||||
bool test_mode_, multiplayer_mode_, no_gui_;
|
||||
|
|
|
@ -464,16 +464,11 @@ void stop_UI_sound() {
|
|||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
class music_thinker : public events::pump_monitor {
|
||||
void process(events::pump_info &/*info*/) {
|
||||
if(preferences::music_on()) {
|
||||
think_about_music();
|
||||
}
|
||||
}
|
||||
};
|
||||
void music_thinker::process(events::pump_info &/*info*/) {
|
||||
if(preferences::music_on()) {
|
||||
think_about_music();
|
||||
}
|
||||
}
|
||||
music_thinker mthink;
|
||||
|
||||
void think_about_music(void)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,11 @@ void play_UI_sound(const std::string& files);
|
|||
// Called from event loop to see if we need new music track.
|
||||
void think_about_music(void);
|
||||
|
||||
// A class to automate the call to think_about_music()
|
||||
class music_thinker : public events::pump_monitor {
|
||||
void process(events::pump_info &/*info*/);
|
||||
};
|
||||
|
||||
// Save music playlist for snapshot
|
||||
void write_music_play_list(config& snapshot);
|
||||
|
||||
|
|
|
@ -76,17 +76,14 @@ int main( int argc, char** argv )
|
|||
namespace {
|
||||
bool fullScreen = false;
|
||||
int disallow_resize = 0;
|
||||
class resize_monitor : public events::pump_monitor {
|
||||
void process(events::pump_info &info) {
|
||||
if(info.resize_dimensions.first >= min_allowed_width
|
||||
&& info.resize_dimensions.second >= min_allowed_height
|
||||
&& disallow_resize == 0) {
|
||||
preferences::set_resolution(info.resize_dimensions);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
resize_monitor resize_mon;
|
||||
void resize_monitor::process(events::pump_info &info) {
|
||||
if(info.resize_dimensions.first >= min_allowed_width
|
||||
&& info.resize_dimensions.second >= min_allowed_height
|
||||
&& disallow_resize == 0) {
|
||||
preferences::set_resolution(info.resize_dimensions);
|
||||
}
|
||||
}
|
||||
|
||||
resize_lock::resize_lock()
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#ifndef VIDEO_HPP_INCLUDED
|
||||
#define VIDEO_HPP_INCLUDED
|
||||
|
||||
#include "events.hpp"
|
||||
#include "SDL.h"
|
||||
#include "sdl_utils.hpp"
|
||||
|
||||
|
@ -135,6 +136,10 @@ private:
|
|||
bool unlock;
|
||||
};
|
||||
|
||||
class resize_monitor : public events::pump_monitor {
|
||||
void process(events::pump_info &info);
|
||||
};
|
||||
|
||||
//an object which prevents resizing of the screen occuring during
|
||||
//its lifetime.
|
||||
struct resize_lock {
|
||||
|
|
Loading…
Add table
Reference in a new issue