Author: mordante
Date: Sun Nov 22 20:11:59 2009
New Revision: 39883

URL: http://svn.gna.org/viewcvs/wesnoth?rev=39883&view=rev
Log:
Fix the resizing of the lobby with the preferences.

Now it always forces an update when the dialog is closed, might not be
needed but this a simple work-around.

Modified:
    trunk/src/gui/dialogs/lobby_main.cpp
    trunk/src/multiplayer.cpp

Modified: trunk/src/gui/dialogs/lobby_main.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/lobby_main.cpp?rev=39883&r1=39882&r2=39883&view=diff
==============================================================================
--- trunk/src/gui/dialogs/lobby_main.cpp (original)
+++ trunk/src/gui/dialogs/lobby_main.cpp Sun Nov 22 20:11:59 2009
@@ -1272,10 +1272,18 @@
 }
 
 
-void tlobby_main::show_preferences_button_callback(gui2::twindow& /*window*/)
+void tlobby_main::show_preferences_button_callback(gui2::twindow& window)
 {
        if (preferences_callback_) {
                preferences_callback_();
+
+               /**
+                * The screen size might have changed force an update of the 
size.
+                *
+                * @todo This might no longer be needed when gui2 is done.
+                */
+               window.invalidate_layout();
+
                network::send_data(config("refresh_lobby"), 0, true);
        }
 }

Modified: trunk/src/multiplayer.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer.cpp?rev=39883&r1=39882&r2=39883&view=diff
==============================================================================
--- trunk/src/multiplayer.cpp (original)
+++ trunk/src/multiplayer.cpp Sun Nov 22 20:11:59 2009
@@ -21,6 +21,7 @@
 #include "gui/dialogs/message.hpp"
 #include "gui/dialogs/mp_connect.hpp"
 #include "gui/dialogs/mp_create_game.hpp"
+#include "gui/widgets/settings.hpp"
 #include "gui/widgets/window.hpp"
 #include "hash.hpp"
 #include "multiplayer.hpp"
@@ -498,6 +499,19 @@
 {
        const preferences::display_manager disp_manager(&disp);
        preferences::show_preferences_dialog(disp,game_config);
+
+       /**
+        * The screen size might have changed force an update of the size.
+        *
+        * @todo This might no longer be needed when gui2 is done.
+        */
+       const SDL_Rect rect = screen_area();
+       preferences::set_resolution(disp.video(), rect.w, rect.h);
+
+       gui2::settings::gamemap_width += rect.w - gui2::settings::screen_width ;
+       gui2::settings::gamemap_height += rect.h - 
gui2::settings::screen_height ;
+       gui2::settings::screen_width = rect.w;
+       gui2::settings::screen_height = rect.h;
 }
 
 static void enter_lobby_mode(game_display& disp, const config& game_config, 
mp::chat& chat, config& gamelist)


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to