← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~borim/widelands/np-keys into lp:widelands

 

Borim has proposed merging lp:~borim/widelands/np-keys into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #791421 in widelands: "Editor: Map Options Editbox Keyboard Input"
  https://bugs.launchpad.net/widelands/+bug/791421

For more details, see:
https://code.launchpad.net/~borim/widelands/np-keys/+merge/77798

related to Bug #791421:

the numpad keys starts the key handler of the equivalent "normal" key.

this way it is possible to use speed acceleration on notebooks where these keys only exists in the numpad. for uniformity reason home,del and the arrow keys are also included.
-- 
https://code.launchpad.net/~borim/widelands/np-keys/+merge/77798
Your team Widelands Developers is requested to review the proposed merge of lp:~borim/widelands/np-keys into lp:widelands.
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc	2011-02-20 20:55:17 +0000
+++ src/ui_basic/editbox.cc	2011-10-01 21:45:23 +0000
@@ -249,6 +249,7 @@
 			okid.call(m->id);
 			return true;
 
+		case SDLK_KP_PERIOD:
 		case SDLK_DELETE:
 			if (m->caret < m->text.size()) {
 				while ((m->text[++m->caret] & 0xc0) == 0x80) {};
@@ -268,6 +269,7 @@
 			}
 			return true;
 
+		case SDLK_KP4:
 		case SDLK_LEFT:
 			if (m->caret > 0) {
 				while ((m->text[--m->caret] & 0xc0) == 0x80) {};
@@ -282,6 +284,7 @@
 			}
 			return true;
 
+		case SDLK_KP6:
 		case SDLK_RIGHT:
 			if (m->caret < m->text.size()) {
 				while ((m->text[++m->caret] & 0xc0) == 0x80) {};
@@ -301,6 +304,7 @@
 			}
 			return true;
 
+		case SDLK_KP7:
 		case SDLK_HOME:
 			if (m->caret != 0) {
 				m->caret = 0;
@@ -310,6 +314,7 @@
 			}
 			return true;
 
+		case SDLK_KP1:
 		case SDLK_END:
 			if (m->caret != m->text.size()) {
 				m->caret = m->text.size();
@@ -318,6 +323,7 @@
 			}
 			return true;
 
+		case SDLK_KP8:
 		case SDLK_UP:
 			// Load entry from history if active and text is not empty
 			if (m_history_active) {
@@ -332,6 +338,7 @@
 			}
 			return true;
 
+		case SDLK_KP2:
 		case SDLK_DOWN:
 			// Load entry from history if active and text is not equivalent to the current one
 			if (m_history_active) {

=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc	2011-02-19 22:05:46 +0000
+++ src/ui_basic/multilineeditbox.cc	2011-10-01 21:45:23 +0000
@@ -252,6 +252,7 @@
 {
 	if (down) {
 		switch (code.sym) {
+		case SDLK_KP_PERIOD:
 		case SDLK_DELETE:
 			if (d->cursor_pos < d->text.size()) {
 				d->erase_bytes(d->cursor_pos, d->next_char(d->cursor_pos));
@@ -266,6 +267,7 @@
 			}
 			break;
 
+		case SDLK_KP4:
 		case SDLK_LEFT: {
 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
 				uint32_t newpos = d->prev_char(d->cursor_pos);
@@ -284,6 +286,7 @@
 			break;
 		}
 
+		case SDLK_KP6:
 		case SDLK_RIGHT:
 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
 				uint32_t newpos = d->next_char(d->cursor_pos);
@@ -297,6 +300,7 @@
 			}
 			break;
 
+		case SDLK_KP2:
 		case SDLK_DOWN:
 			if (d->cursor_pos < d->text.size()) {
 				d->refresh_ww();
@@ -321,6 +325,7 @@
 			}
 			break;
 
+		case SDLK_KP8:
 		case SDLK_UP:
 			if (d->cursor_pos > 0) {
 				d->refresh_ww();
@@ -343,6 +348,7 @@
 			}
 			break;
 
+		case SDLK_KP7:
 		case SDLK_HOME:
 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
 				d->set_cursor_pos(0);
@@ -356,6 +362,7 @@
 			}
 			break;
 
+		case SDLK_KP1:
 		case SDLK_END:
 			if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
 				d->set_cursor_pos(d->text.size());

=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc	2011-02-21 20:49:35 +0000
+++ src/wui/game_message_menu.cc	2011-10-01 21:45:23 +0000
@@ -200,6 +200,7 @@
 				center_main_mapview_on_location.clicked();
 			return true;
 
+		case SDLK_KP0:
 		case SDLK_DELETE:
 			do_delete();
 			return true;

=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc	2011-06-10 09:32:37 +0000
+++ src/wui/interactive_base.cc	2011-10-01 21:45:23 +0000
@@ -320,13 +320,13 @@
 	const uint32_t scrollval = 10;
 
 	if (keyboard_free() && Panel::allow_user_input()) {
-		if (get_key_state(SDLK_UP))
+		if (get_key_state(SDLK_UP) || get_key_state(SDLK_KP8))
 			set_rel_viewpoint(Point(0, -scrollval), false);
-		if (get_key_state(SDLK_DOWN))
+		if (get_key_state(SDLK_DOWN) || get_key_state(SDLK_KP2))
 			set_rel_viewpoint(Point(0,  scrollval), false);
-		if (get_key_state(SDLK_LEFT))
+		if (get_key_state(SDLK_LEFT) || get_key_state(SDLK_KP4))
 			set_rel_viewpoint(Point(-scrollval, 0), false);
-		if (get_key_state(SDLK_RIGHT))
+		if (get_key_state(SDLK_RIGHT) || get_key_state(SDLK_KP6))
 			set_rel_viewpoint(Point (scrollval, 0), false);
 	}
 
@@ -858,6 +858,7 @@
 		return true;
 
 	switch (code.sym) {
+	case SDLK_KP9:
 	case SDLK_PAGEUP:
 		if (!get_display_flag(dfSpeed))
 			break;
@@ -875,6 +876,7 @@
 					ctrl->togglePaused();
 		return true;
 
+	case SDLK_KP3:
 	case SDLK_PAGEDOWN:
 		if (!get_display_flag(dfSpeed))
 			break;

=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc	2011-06-10 09:33:34 +0000
+++ src/wui/interactive_player.cc	2011-10-01 21:45:23 +0000
@@ -427,6 +427,7 @@
 			g_gr->toggle_fullscreen();
 			return true;
 
+		case SDLK_KP7:
 		case SDLK_HOME:
 			move_view_to(game().map().get_starting_pos(m_player_number));
 			return true;


Follow ups