Merge lp:~widelands-dev/widelands/fix_some_resizing_bugs into lp:widelands

Proposed by SirVer
Status: Merged
Merged at revision: 7277
Proposed branch: lp:~widelands-dev/widelands/fix_some_resizing_bugs
Merge into: lp:widelands
Diff against target: 644 lines (+154/-171)
13 files modified
src/editor/editorinteractive.cc (+1/-1)
src/graphic/graphic.cc (+79/-73)
src/graphic/graphic.h (+26/-11)
src/graphic/text/test/render_richtext.cc (+1/-2)
src/logic/map_info.cc (+1/-2)
src/logic/ware_descr.cc (+1/-1)
src/notifications/note_ids.h (+2/-0)
src/wlapplication.cc (+18/-60)
src/wlapplication.h (+1/-6)
src/wui/interactive_base.cc (+14/-10)
src/wui/interactive_base.h (+8/-3)
src/wui/interactive_player.cc (+1/-1)
src/wui/interactive_spectator.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/fix_some_resizing_bugs
Reviewer Review Type Date Requested Status
Tino Approve
Review via email: mp+242593@code.launchpad.net

Description of the change

- Make fullscreen toggle work. Fullscreen is now always at the native resolution
  so that we do not switch the resolution any more.
- Never destroy g_gr. This fixes tons of bugs and makes the surface_cache
  (nearly) unneeded. It also fixes crashes when switching resolution in the
  options.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

- Removes the fallback settings. Now, switching to fullscreen should always give you a stable mode to work with (the one your system is already running).

Revision history for this message
Tino (tino79) wrote :

Windows approves: Does build and toggling fullscreen with "f" works.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/editor/editorinteractive.cc'
2--- src/editor/editorinteractive.cc 2014-11-22 10:18:20 +0000
3+++ src/editor/editorinteractive.cc 2014-11-23 14:42:44 +0000
4@@ -422,7 +422,7 @@
5 break;
6
7 case SDLK_f:
8- g_gr->toggle_fullscreen();
9+ g_gr->set_fullscreen(!g_gr->fullscreen());
10 handled = true;
11 break;
12
13
14=== modified file 'src/graphic/graphic.cc'
15--- src/graphic/graphic.cc 2014-11-22 21:31:21 +0000
16+++ src/graphic/graphic.cc 2014-11-23 14:42:44 +0000
17@@ -46,6 +46,7 @@
18 #include "io/filesystem/layered_filesystem.h"
19 #include "io/streamwrite.h"
20 #include "logic/roadtype.h"
21+#include "notifications/notifications.h"
22 #include "ui_basic/progresswindow.h"
23
24 using namespace std;
25@@ -58,9 +59,6 @@
26 /// These are all surfaces that are not loaded from disk.
27 const uint32_t TRANSIENT_SURFACE_CACHE_SIZE = 160 << 20; // shifting converts to MB
28
29-constexpr int kFallbackGraphicsWidth = 800;
30-constexpr int kFallbackGraphicsHeight = 600;
31-
32 // Sets the icon for the application.
33 void set_icon(SDL_Window* sdl_window) {
34 #ifndef _WIN32
35@@ -78,49 +76,30 @@
36 /**
37 * Initialize the SDL video mode.
38 */
39-Graphic::Graphic()
40- :
41- m_fallback_settings_in_effect(false),
42- m_update(true),
43- surface_cache_(create_surface_cache(TRANSIENT_SURFACE_CACHE_SIZE)),
44- image_cache_(new ImageCache(surface_cache_.get())),
45- animation_manager_(new AnimationManager())
46+Graphic::Graphic(int window_mode_w, int window_mode_h, bool fullscreen)
47+ : m_window_mode_width(window_mode_w),
48+ m_window_mode_height(window_mode_h),
49+ m_update(true),
50+ surface_cache_(create_surface_cache(TRANSIENT_SURFACE_CACHE_SIZE)),
51+ image_cache_(new ImageCache(surface_cache_.get())),
52+ animation_manager_(new AnimationManager())
53 {
54 ImageTransformations::initialize();
55
56- m_sdl_window = nullptr;
57- m_glcontext = nullptr;
58-}
59-
60-void Graphic::initialize(int32_t w, int32_t h, bool fullscreen) {
61- cleanup();
62-
63 // Request an OpenGL 2 context with double buffering.
64 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
65 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
66 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
67
68- int32_t flags = SDL_WINDOW_OPENGL;
69- if (fullscreen) {
70- flags |= SDL_WINDOW_FULLSCREEN;
71- log("Graphics: Trying FULLSCREEN\n");
72- }
73-
74- log("Graphics: Try to set Videomode %ux%u\n", w, h);
75- m_sdl_window = SDL_CreateWindow(
76- "Widelands Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags);
77- if (!m_sdl_window) {
78- log("Graphics: Could not set Videomode: %s, trying minimum graphics settings\n",
79- SDL_GetError());
80- flags &= ~SDL_WINDOW_FULLSCREEN;
81- m_sdl_window = SDL_CreateWindow("Widelands Window",
82- SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
83- kFallbackGraphicsWidth, kFallbackGraphicsHeight, flags);
84- m_fallback_settings_in_effect = true;
85- if (!m_sdl_window) {
86- throw wexception("Graphics: could not set video mode: %s", SDL_GetError());
87- }
88- }
89+ log("Graphics: Try to set Videomode %ux%u\n", m_window_mode_width, m_window_mode_height);
90+ m_sdl_window = SDL_CreateWindow("Widelands Window",
91+ SDL_WINDOWPOS_UNDEFINED,
92+ SDL_WINDOWPOS_UNDEFINED,
93+ m_window_mode_width,
94+ m_window_mode_height,
95+ SDL_WINDOW_OPENGL);
96+ resolution_changed();
97+ set_fullscreen(fullscreen);
98
99 SDL_SetWindowTitle(m_sdl_window, ("Widelands " + build_id() + '(' + build_type() + ')').c_str());
100 set_icon(m_sdl_window);
101@@ -162,8 +141,6 @@
102
103 SDL_GL_SwapWindow(m_sdl_window);
104
105- screen_.reset(new GLSurfaceScreen(w, h));
106-
107 /* Information about the video capabilities. */
108 {
109 SDL_DisplayMode disp_mode;
110@@ -180,18 +157,12 @@
111 assert(SDL_BYTESPERPIXEL(disp_mode.format) == 4);
112 }
113
114- m_rendertarget.reset(new RenderTarget(screen_.get()));
115-
116 pic_road_normal_.reset(load_image("world/pics/roadt_normal.png"));
117 pic_road_busy_.reset(load_image("world/pics/roadt_busy.png"));
118 }
119
120-bool Graphic::check_fallback_settings_in_effect()
121+Graphic::~Graphic()
122 {
123- return m_fallback_settings_in_effect;
124-}
125-
126-void Graphic::cleanup() {
127 m_maptextures.clear();
128 surface_cache_->flush();
129 // TODO(unknown): this should really not be needed, but currently is :(
130@@ -208,15 +179,10 @@
131 }
132 }
133
134-Graphic::~Graphic()
135-{
136- cleanup();
137-}
138-
139 /**
140 * Return the screen x resolution
141 */
142-int32_t Graphic::get_xres()
143+int Graphic::get_xres()
144 {
145 return screen_->width();
146 }
147@@ -224,14 +190,31 @@
148 /**
149 * Return the screen x resolution
150 */
151-int32_t Graphic::get_yres()
152+int Graphic::get_yres()
153 {
154 return screen_->height();
155 }
156
157-bool Graphic::is_fullscreen()
158-{
159- return SDL_GetWindowFlags(m_sdl_window) & SDL_WINDOW_FULLSCREEN;
160+void Graphic::change_resolution(int w, int h) {
161+ m_window_mode_width = w;
162+ m_window_mode_height = h;
163+
164+ if (!fullscreen()) {
165+ SDL_SetWindowSize(m_sdl_window, w, h);
166+ resolution_changed();
167+ }
168+}
169+
170+void Graphic::resolution_changed() {
171+ int new_w, new_h;
172+ SDL_GetWindowSize(m_sdl_window, &new_w, &new_h);
173+
174+ screen_.reset(new GLSurfaceScreen(new_w, new_h));
175+ m_rendertarget.reset(new RenderTarget(screen_.get()));
176+
177+ Notifications::publish(GraphicResolutionChanged{new_w, new_h});
178+
179+ update();
180 }
181
182 /**
183@@ -240,27 +223,39 @@
184 RenderTarget * Graphic::get_render_target()
185 {
186 m_rendertarget->reset();
187-
188 return m_rendertarget.get();
189 }
190
191-/**
192- * Switch from fullscreen to windowed mode or vice-versa
193-*/
194-void Graphic::toggle_fullscreen()
195-{
196- // TODO(unknown): implement proper fullscreening here. The way it can work is to
197- // recreate SurfaceCache but keeping ImageCache around. Then exiting and
198- // reinitalizing the SDL Video Mode should just work: all surface are
199- // recreated dynamically and correctly.
200- // Note: Not all Images are cached in the ImageCache, at time of me writing
201- // this, only InMemoryImage does not safe itself in the ImageCache. And this
202- // should only be a problem for Images loaded from maps.
203- if (SDL_GetWindowFlags(m_sdl_window) & SDL_WINDOW_FULLSCREEN) {
204+bool Graphic::fullscreen()
205+{
206+ uint32_t flags = SDL_GetWindowFlags(m_sdl_window);
207+ return (flags & SDL_WINDOW_FULLSCREEN) || (flags & SDL_WINDOW_FULLSCREEN_DESKTOP);
208+}
209+
210+void Graphic::set_fullscreen(const bool value)
211+{
212+ if (value == fullscreen()) {
213+ return;
214+ }
215+
216+ // Widelands is not resolution agnostic, so when we set fullscreen, we want
217+ // it at the full resolution of the desktop and we want to know about the
218+ // true resolution (SDL supports hiding the true resolution from the
219+ // application). Since SDL ignores requests to change the size of the window
220+ // whet fullscreen, we do it when in windowed mode.
221+ if (value) {
222+ SDL_DisplayMode display_mode;
223+ SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(m_sdl_window), &display_mode);
224+ SDL_SetWindowSize(m_sdl_window, display_mode.w, display_mode.h);
225+
226+ SDL_SetWindowFullscreen(m_sdl_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
227+ } else {
228 SDL_SetWindowFullscreen(m_sdl_window, 0);
229- } else {
230- SDL_SetWindowFullscreen(m_sdl_window, SDL_WINDOW_FULLSCREEN);
231+
232+ // Next line does not work. See comment in refresh().
233+ SDL_SetWindowSize(m_sdl_window, m_window_mode_width, m_window_mode_height);
234 }
235+ resolution_changed();
236 }
237
238
239@@ -283,6 +278,17 @@
240 */
241 void Graphic::refresh()
242 {
243+ // Setting the window size immediately after going out of fullscreen does
244+ // not work properly. We work around this issue by resizing the window in
245+ // refresh() when in window mode.
246+ if (!fullscreen()) {
247+ int true_width, true_height;
248+ SDL_GetWindowSize(m_sdl_window, &true_width, &true_height);
249+ if (true_width != m_window_mode_width || true_height != m_window_mode_height) {
250+ SDL_SetWindowSize(m_sdl_window, m_window_mode_width, m_window_mode_height);
251+ }
252+ }
253+
254 SDL_GL_SwapWindow(m_sdl_window);
255 m_update = false;
256 }
257
258=== modified file 'src/graphic/graphic.h'
259--- src/graphic/graphic.h 2014-11-22 18:36:33 +0000
260+++ src/graphic/graphic.h 2014-11-23 14:42:44 +0000
261@@ -28,6 +28,8 @@
262
263 #include "base/rect.h"
264 #include "graphic/image_cache.h"
265+#include "notifications/notifications.h"
266+#include "notifications/note_ids.h"
267
268 #define MAX_RECTS 20
269
270@@ -38,6 +40,15 @@
271 class StreamWrite;
272 struct Texture;
273
274+// Will be send whenever the resolution changes.
275+struct GraphicResolutionChanged {
276+ CAN_BE_SEND_AS_NOTE(NoteId::GraphicResolutionChanged)
277+
278+ // New width and height in pixels.
279+ int width;
280+ int height;
281+};
282+
283 /**
284 * This class is a kind of Swiss Army knife for your graphics need. It
285 * initializes the graphic system and provides access to resolutions. It has an
286@@ -46,18 +57,21 @@
287 */
288 class Graphic {
289 public:
290- Graphic();
291+ // Creates a new graphic mode with the given resolution if fullscreen is
292+ // false, otherwise a window that fills the screen.
293+ Graphic(int window_mode_w, int window_mode_height, bool fullscreen);
294 ~Graphic();
295
296- // Initialize or reinitialize the graphics system. Throws on error.
297- void initialize(int32_t w, int32_t h, bool fullscreen);
298+ // Gets and sets the resolution.
299+ void change_resolution(int w, int h);
300+ int get_xres();
301+ int get_yres();
302
303- int32_t get_xres();
304- int32_t get_yres();
305- bool is_fullscreen();
306+ // Changes the window to be fullscreen or not.
307+ bool fullscreen();
308+ void set_fullscreen(bool);
309
310 RenderTarget * get_render_target();
311- void toggle_fullscreen();
312 void update();
313 bool need_update() const;
314 void refresh();
315@@ -79,12 +93,13 @@
316
317 Surface& get_road_texture(int32_t roadtex);
318
319- bool check_fallback_settings_in_effect();
320-
321 private:
322- void cleanup();
323+ // Called when the resolution (might) have changed.
324+ void resolution_changed();
325
326- bool m_fallback_settings_in_effect;
327+ // The height & width of the window should we be in window mode.
328+ int m_window_mode_width;
329+ int m_window_mode_height;
330
331 /// This is the main screen Surface.
332 /// A RenderTarget for this can be retrieved with get_render_target()
333
334=== modified file 'src/graphic/text/test/render_richtext.cc'
335--- src/graphic/text/test/render_richtext.cc 2014-11-23 10:13:14 +0000
336+++ src/graphic/text/test/render_richtext.cc 2014-11-23 14:42:44 +0000
337@@ -98,8 +98,7 @@
338 g_fs = new LayeredFileSystem();
339 g_fs->add_file_system(&FileSystem::create(INSTALL_DATADIR));
340
341- g_gr = new Graphic();
342- g_gr->initialize(1, 1, false);
343+ g_gr = new Graphic(1, 1, false);
344 }
345
346 } // namespace
347
348=== modified file 'src/logic/map_info.cc'
349--- src/logic/map_info.cc 2014-11-22 21:31:21 +0000
350+++ src/logic/map_info.cc 2014-11-23 14:42:44 +0000
351@@ -49,8 +49,7 @@
352 g_fs = new LayeredFileSystem();
353 g_fs->add_file_system(&FileSystem::create(INSTALL_DATADIR));
354
355- g_gr = new Graphic();
356- g_gr->initialize(1, 1, false);
357+ g_gr = new Graphic(1, 1, false);
358 }
359
360 } // namespace
361
362=== modified file 'src/logic/ware_descr.cc'
363--- src/logic/ware_descr.cc 2014-09-10 08:55:04 +0000
364+++ src/logic/ware_descr.cc 2014-11-23 14:42:44 +0000
365@@ -36,7 +36,7 @@
366 m_tribe (gtribe),
367 m_helptext (global_s.get_string("help", "")),
368 m_icon_fname (directory + "/menu.png"),
369- m_icon(g_gr ? g_gr->images().get("pics/but0.png") : nullptr) // because of dedicated
370+ m_icon(g_gr->images().get("pics/but0.png"))
371 {
372 m_default_target_quantity =
373 global_s.get_positive("default_target_quantity", std::numeric_limits<uint32_t>::max());
374
375=== modified file 'src/notifications/note_ids.h'
376--- src/notifications/note_ids.h 2014-09-10 19:54:01 +0000
377+++ src/notifications/note_ids.h 2014-11-23 14:42:44 +0000
378@@ -32,6 +32,8 @@
379 FieldPossession,
380 FieldTransformed,
381 ProductionSiteOutOfResources,
382+
383+ GraphicResolutionChanged,
384 };
385
386 #endif // end of include guard: WL_NOTIFICATIONS_NOTE_IDS_H
387
388=== modified file 'src/wlapplication.cc'
389--- src/wlapplication.cc 2014-11-22 18:36:33 +0000
390+++ src/wlapplication.cc 2014-11-23 14:42:44 +0000
391@@ -244,7 +244,6 @@
392 m_homedir = m_commandline["homedir"];
393 m_commandline.erase("homedir");
394 }
395- bool dedicated = m_commandline.count("dedicated");
396 #ifdef REDIRECT_OUTPUT
397 if (!redirect_output())
398 redirect_output(m_homedir);
399@@ -259,18 +258,15 @@
400 init_language(); // search paths must already be set up
401 cleanup_replays();
402
403- if (!dedicated) {
404- // handling of graphics
405- init_hardware();
406-
407- if (TTF_Init() == -1)
408- throw wexception
409- ("True Type library did not initialize: %s\n", TTF_GetError());
410-
411- UI::g_fh = new UI::FontHandler();
412- UI::g_fh1 = UI::create_fonthandler(g_gr);
413- } else
414- g_gr = nullptr;
415+ // handling of graphics
416+ init_hardware();
417+
418+ if (TTF_Init() == -1)
419+ throw wexception
420+ ("True Type library did not initialize: %s\n", TTF_GetError());
421+
422+ UI::g_fh = new UI::FontHandler();
423+ UI::g_fh1 = UI::create_fonthandler(g_gr);
424
425 if (SDLNet_Init() == -1)
426 throw wexception("SDLNet_Init failed: %s\n", SDLNet_GetError());
427@@ -440,9 +436,6 @@
428
429 g_sound_handler.change_music("menu", 1000);
430 mainmenu();
431-
432- delete g_gr;
433- g_gr = nullptr;
434 }
435
436 g_sound_handler.stop_music(500);
437@@ -671,38 +664,14 @@
438 }
439 }
440
441-/**
442- * Initialize the graphics subsystem (or shutdown, if w and h are 0)
443- * with the given resolution.
444- * Throws an exception on failure.
445- */
446-void WLApplication::init_graphics(int32_t w, int32_t h, bool fullscreen)
447-{
448- if (!w && !h) { // shutdown.
449- delete g_gr;
450- g_gr = nullptr;
451- return;
452- }
453- assert(w > 0 && h > 0);
454-
455- if (!g_gr) {
456- g_gr = new Graphic();
457- g_gr->initialize(w, h, fullscreen);
458- } else {
459- if (g_gr->get_xres() != w || g_gr->get_yres() != h || g_gr->is_fullscreen() != fullscreen) {
460- g_gr->initialize(w, h, fullscreen);
461- }
462- }
463-}
464-
465 void WLApplication::refresh_graphics()
466 {
467 Section & s = g_options.pull_section("global");
468
469- // Switch to the new graphics system now, if necessary.
470- init_graphics(s.get_int("xres", DEFAULT_RESOLUTION_W),
471- s.get_int("yres", DEFAULT_RESOLUTION_H),
472- s.get_bool("fullscreen", false));
473+ g_gr->change_resolution(
474+ s.get_int("xres", DEFAULT_RESOLUTION_W), s.get_int("yres", DEFAULT_RESOLUTION_H));
475+ g_gr->set_fullscreen(s.get_bool("fullscreen", false));
476+
477 // does only work with a window
478 set_input_grab(s.get_bool("inputgrab", false));
479 }
480@@ -827,7 +796,9 @@
481
482 SDL_ShowCursor(SDL_DISABLE);
483
484- refresh_graphics();
485+ g_gr = new Graphic(s.get_int("xres", DEFAULT_RESOLUTION_W),
486+ s.get_int("yres", DEFAULT_RESOLUTION_H),
487+ s.get_bool("fullscreen", false));
488
489 // Start the audio subsystem
490 // must know the locale before calling this!
491@@ -838,14 +809,9 @@
492
493 void WLApplication::shutdown_hardware()
494 {
495- if (g_gr)
496- wout
497- <<
498- "WARNING: Hardware shutting down although graphics system is still "
499- "alive!"
500- << std::endl;
501+ delete g_gr;
502+ g_gr = nullptr;
503
504- init_graphics(0, 0, false);
505 SDL_QuitSubSystem(SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_JOYSTICK);
506
507 #ifndef _WIN32
508@@ -1049,14 +1015,6 @@
509 std::string messagetitle;
510 std::string message;
511
512- if (g_gr->check_fallback_settings_in_effect())
513- {
514- messagetitle = "Fallback settings in effect";
515- message = _
516- ("Your video settings could not be enabled, and fallback settings are in effect. "
517- "Please check the graphics options!");
518- }
519-
520 for (;;) {
521 // Refresh graphics system in case we just changed resolution.
522 refresh_graphics();
523
524=== modified file 'src/wlapplication.h'
525--- src/wlapplication.h 2014-11-22 18:36:33 +0000
526+++ src/wlapplication.h 2014-11-23 14:42:44 +0000
527@@ -164,13 +164,8 @@
528 void set_mouse_lock(const bool locked) {m_mouse_locked = locked;}
529 //@}
530
531- void init_graphics(int32_t w, int32_t h, bool fullscreen);
532
533- /**
534- * Refresh the graphics from the latest options.
535- *
536- * \note See caveats for \ref init_graphics()
537- */
538+ // Refresh the graphics settings with the latest options.
539 void refresh_graphics();
540
541 void handle_input(InputCallback const *);
542
543=== modified file 'src/wui/interactive_base.cc'
544--- src/wui/interactive_base.cc 2014-11-22 10:18:20 +0000
545+++ src/wui/interactive_base.cc 2014-11-23 14:42:44 +0000
546@@ -79,12 +79,7 @@
547 };
548
549 InteractiveBase::InteractiveBase(EditorGameBase& the_egbase, Section& global_s)
550- : MapView(nullptr,
551- 0,
552- 0,
553- global_s.get_int("xres", DEFAULT_RESOLUTION_W),
554- global_s.get_int("yres", DEFAULT_RESOLUTION_H),
555- *this),
556+ : MapView(nullptr, 0, 0, g_gr->get_xres(), g_gr->get_yres(), *this),
557 // Initialize chatoveraly before the toolbar so it is below
558 m_show_workarea_preview(global_s.get_bool("workareapreview", true)),
559 m_chatOverlay(new ChatOverlay(this, 10, 25, get_w() / 2, get_h() - 25)),
560@@ -107,10 +102,19 @@
561 m_label_speed(this, get_w(), 1, std::string(), UI::Align_TopRight),
562 unique_window_handler_(new UniqueWindowHandler()),
563 // Start at idx 0 for 2 enhancements, idx 3 for 1, idx 5 if none
564- m_workarea_pics
565- {g_gr->images().get("pics/workarea123.png"), g_gr->images().get("pics/workarea23.png"),
566- g_gr->images().get("pics/workarea3.png"), g_gr->images().get("pics/workarea12.png"),
567- g_gr->images().get("pics/workarea2.png"), g_gr->images().get("pics/workarea1.png")} {
568+ m_workarea_pics{g_gr->images().get("pics/workarea123.png"),
569+ g_gr->images().get("pics/workarea23.png"),
570+ g_gr->images().get("pics/workarea3.png"),
571+ g_gr->images().get("pics/workarea12.png"),
572+ g_gr->images().get("pics/workarea2.png"),
573+ g_gr->images().get("pics/workarea1.png")} {
574+
575+ graphic_resolution_changed_subscriber_ = Notifications::subscribe<GraphicResolutionChanged>(
576+ [this](const GraphicResolutionChanged& message) {
577+ set_size(message.width, message.height);
578+ adjust_toolbar_position();
579+ });
580+
581 m_toolbar.set_layout_toplevel(true);
582 m->quicknavigation->set_setview
583 (boost::bind(&MapView::set_viewpoint, this, _1, true));
584
585=== modified file 'src/wui/interactive_base.h'
586--- src/wui/interactive_base.h 2014-10-14 06:30:20 +0000
587+++ src/wui/interactive_base.h 2014-11-23 14:42:44 +0000
588@@ -24,15 +24,17 @@
589
590 #include <SDL_keycode.h>
591
592+#include "graphic/graphic.h"
593 #include "logic/editor_game_base.h"
594 #include "logic/map.h"
595+#include "notifications/notifications.h"
596+#include "ui_basic/box.h"
597+#include "ui_basic/textarea.h"
598+#include "ui_basic/unique_window.h"
599 #include "wui/chatoverlay.h"
600 #include "wui/debugconsole.h"
601 #include "wui/mapview.h"
602 #include "wui/overlay_manager.h"
603-#include "ui_basic/box.h"
604-#include "ui_basic/textarea.h"
605-#include "ui_basic/unique_window.h"
606
607 namespace Widelands {struct CoordPath;}
608
609@@ -179,6 +181,9 @@
610 } m_sel;
611
612 std::unique_ptr<InteractiveBaseInternals> m;
613+
614+ std::unique_ptr<Notifications::Subscriber<GraphicResolutionChanged>>
615+ graphic_resolution_changed_subscriber_;
616 Widelands::EditorGameBase & m_egbase;
617 uint32_t m_display_flags;
618 uint32_t m_lastframe; // system time (milliseconds)
619
620=== modified file 'src/wui/interactive_player.cc'
621--- src/wui/interactive_player.cc 2014-11-22 10:18:20 +0000
622+++ src/wui/interactive_player.cc 2014-11-23 14:42:44 +0000
623@@ -402,7 +402,7 @@
624 return true;
625
626 case SDLK_f:
627- g_gr->toggle_fullscreen();
628+ g_gr->set_fullscreen(!g_gr->fullscreen());
629 return true;
630
631 case SDLK_KP_7:
632
633=== modified file 'src/wui/interactive_spectator.cc'
634--- src/wui/interactive_spectator.cc 2014-11-22 10:18:20 +0000
635+++ src/wui/interactive_spectator.cc 2014-11-23 14:42:44 +0000
636@@ -264,7 +264,7 @@
637 return true;
638
639 case SDLK_f:
640- g_gr->toggle_fullscreen();
641+ g_gr->set_fullscreen(!g_gr->fullscreen());
642 return true;
643
644 case SDLK_RETURN:

Subscribers

People subscribed via source and target branches

to status/vote changes: