← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug1204144 into lp:widelands

 

cghislai has proposed merging lp:~widelands-dev/widelands/bug1204144 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1204144 in widelands: "Cursor Key Navigation in table not complete"
  https://bugs.launchpad.net/widelands/+bug/1204144

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug1204144/+merge/176688

This allow tables and lists to get focus upon mouse press. This allows for key navigation. This means that, as it was already the case with the message window, the key events are sent to the table in place of the map view if one has the focus. The mapview can't be scrolled with keyboard in such case.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug1204144/+merge/176688
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug1204144 into lp:widelands.
=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc	2013-07-23 14:49:48 +0000
+++ src/logic/editor_game_base.cc	2013-07-24 13:38:27 +0000
@@ -302,7 +302,7 @@
 {
 	Player & plr = player(owner);
 	const Tribe_Descr & tribe = plr.tribe();
-	return 
+	return
 		tribe.get_building_descr(idx)->create
 			(*this, plr, c, false, true, former_buildings);
 }

=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc	2013-07-21 08:25:22 +0000
+++ src/ui_basic/listselect.cc	2013-07-24 13:38:27 +0000
@@ -78,8 +78,10 @@
 		if (pic_h > m_lineheight)
 			m_lineheight = pic_h;
 	}
-	else
+	else {
 		m_max_pic_width = 0;
+	}
+	set_can_focus(true);
 }
 
 

=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc	2013-07-21 08:25:22 +0000
+++ src/ui_basic/panel.cc	2013-07-24 13:38:27 +0000
@@ -758,8 +758,9 @@
 	// can't. but focus is called recursivly
 	// assert(get_can_focus());
 
-	if (!_parent || this == _modal)
+	if (!_parent || this == _modal) {
 		return;
+	}
 	if (_parent->_focus == this)
 		return;
 
@@ -947,9 +948,12 @@
  * Returns whether the event was processed.
  */
 bool Panel::do_mousepress(const Uint8 btn, int32_t x, int32_t y) {
-	if (not _g_allow_user_input)
+	if (not _g_allow_user_input) {
 		return true;
-
+	}
+	if (get_can_focus()) {
+		focus();
+	}
 	x -= _lborder;
 	y -= _tborder;
 	if (_flags & pf_top_on_click)
@@ -971,8 +975,10 @@
 			(Panel * child = _fchild;
 			 (child = child_at_mouse_cursor(x, y, child));
 			 child = child->_next)
-			if (child->do_mousepress(btn, x - child->_x, y - child->_y))
-				return true;
+			{
+				if (child->do_mousepress(btn, x - child->_x, y - child->_y))
+					return true;
+			}
 	return handle_mousepress(btn, x, y);
 }
 bool Panel::do_mouserelease(const Uint8 btn, int32_t x, int32_t y) {

=== modified file 'src/ui_basic/progressbar.cc'
--- src/ui_basic/progressbar.cc	2013-07-16 10:28:53 +0000
+++ src/ui_basic/progressbar.cc	2013-07-24 13:38:27 +0000
@@ -81,10 +81,10 @@
 	assert(0 <= fraction);
 	assert     (fraction <= 1);
 
-	const RGBColor color = fraction <= 0.15 ?
+	const RGBColor color = fraction <= 0.33 ?
 		RGBColor(255, 0, 0)
 		:
-		fraction <= 0.5 ? RGBColor(255, 255, 0) : RGBColor(0, 255, 0);
+		fraction <= 0.67 ? RGBColor(255, 255, 0) : RGBColor(0, 255, 0);
 
 	// Draw the actual bar
 	if (m_orientation == Horizontal)

=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc	2013-07-21 14:36:52 +0000
+++ src/ui_basic/table.cc	2013-07-24 13:38:27 +0000
@@ -63,6 +63,7 @@
 	m_sort_descending (descending)
 {
 	set_think(false);
+	set_can_focus(true);
 }
 
 

=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc	2013-07-20 11:02:27 +0000
+++ src/ui_basic/window.cc	2013-07-24 13:38:27 +0000
@@ -433,9 +433,6 @@
  */
 bool Window::handle_mousepress(const Uint8 btn, int32_t mx, int32_t my)
 {
-	if (get_can_focus())
-		focus();
-
 	//  FIXME This code is erroneous. It checks the current key state. What it
 	//  FIXME needs is the key state at the time the mouse was clicked. See the
 	//  FIXME usage comment for get_key_state.

=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc	2013-07-20 10:15:23 +0000
+++ src/ui_fsmenu/mapselect.cc	2013-07-24 13:38:27 +0000
@@ -191,6 +191,7 @@
 		m_label_load_map_as_scenario.set_visible(false);
 	}
 
+	m_table.focus();
 	fill_list();
 }
 
@@ -200,6 +201,7 @@
 		m_ctrl->think();
 }
 
+
 bool Fullscreen_Menu_MapSelect::compare_maprows
 	(uint32_t rowa, uint32_t rowb)
 {

=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc	2013-02-10 19:36:24 +0000
+++ src/wui/building_statistics_menu.cc	2013-07-24 13:38:27 +0000
@@ -58,7 +58,7 @@
 #define UNPRODUCTIVE_Y       (IN_BUILD_Y           + 24)
 #define FLAG_POINT           Point(125, WINDOW_HEIGHT - 8)
 
-#define LOW_PROD 25
+#define LOW_PROD 33
 
 #define UPDATE_TIME 1000  //  1 second, gametime
 


Follow ups