← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~peter-waller-gmail/widelands/menu-fullscreen-hotkey into lp:widelands

 

pwaller has proposed merging lp:~peter-waller-gmail/widelands/menu-fullscreen-hotkey into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #682351 in widelands: "wishlist: Fullscreen toogle under Linux also in Menu"
  https://bugs.launchpad.net/widelands/+bug/682351

For more details, see:
https://code.launchpad.net/~peter-waller-gmail/widelands/menu-fullscreen-hotkey/+merge/102973

Added a handle_key function to Fullscreen_Menu_Base which just handles "SLDK_f" when the key is pressed down.

(tested) This provides the ability to toggle fullscreen from all of the widelands fullscreen menus.

There is some discussion about the SDL_WM_ToggleFullScreen function going away in SDL 1.3, in which case Graphics::toggle_fullscreen will need to be modified. But for the moment this just gives the same functionality in the menu as ingame.
-- 
https://code.launchpad.net/~peter-waller-gmail/widelands/menu-fullscreen-hotkey/+merge/102973
Your team Widelands Developers is requested to review the proposed merge of lp:~peter-waller-gmail/widelands/menu-fullscreen-hotkey into lp:widelands.
=== modified file 'src/ui_fsmenu/base.cc'
--- src/ui_fsmenu/base.cc	2012-03-02 13:21:49 +0000
+++ src/ui_fsmenu/base.cc	2012-04-21 15:18:20 +0000
@@ -101,6 +101,19 @@
 }
 
 
+bool Fullscreen_Menu_Base::handle_key(bool const down, SDL_keysym const code)
+{
+	if (down)
+		switch (code.sym) {
+		case SDLK_f:
+			g_gr->toggle_fullscreen();
+			return true;
+		default:
+			return false;
+		}
+	return false;
+}
+
 uint32_t Fullscreen_Menu_Base::gr_x() {
 	return g_options.pull_section("global").get_int("xres", XRES);
 }

=== modified file 'src/ui_fsmenu/base.h'
--- src/ui_fsmenu/base.h	2012-02-15 21:25:34 +0000
+++ src/ui_fsmenu/base.h	2012-04-21 15:18:20 +0000
@@ -40,6 +40,7 @@
 	~Fullscreen_Menu_Base();
 
 	virtual void draw(RenderTarget &);
+	virtual bool handle_key(bool down, SDL_keysym code);
 
 public:
 	///\return the size for texts fitting to current resolution