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

Proposed by Borim
Status: Merged
Merged at revision: 6006
Proposed branch: lp:~borim/widelands/np-keys
Merge into: lp:widelands
Diff against target: 181 lines (+22/-4)
5 files modified
src/ui_basic/editbox.cc (+7/-0)
src/ui_basic/multilineeditbox.cc (+7/-0)
src/wui/game_message_menu.cc (+1/-0)
src/wui/interactive_base.cc (+6/-4)
src/wui/interactive_player.cc (+1/-0)
To merge this branch: bzr merge lp:~borim/widelands/np-keys
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+77798@code.launchpad.net

Description of the change

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.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui_basic/editbox.cc'
2--- src/ui_basic/editbox.cc 2011-02-20 20:55:17 +0000
3+++ src/ui_basic/editbox.cc 2011-10-01 21:45:23 +0000
4@@ -249,6 +249,7 @@
5 okid.call(m->id);
6 return true;
7
8+ case SDLK_KP_PERIOD:
9 case SDLK_DELETE:
10 if (m->caret < m->text.size()) {
11 while ((m->text[++m->caret] & 0xc0) == 0x80) {};
12@@ -268,6 +269,7 @@
13 }
14 return true;
15
16+ case SDLK_KP4:
17 case SDLK_LEFT:
18 if (m->caret > 0) {
19 while ((m->text[--m->caret] & 0xc0) == 0x80) {};
20@@ -282,6 +284,7 @@
21 }
22 return true;
23
24+ case SDLK_KP6:
25 case SDLK_RIGHT:
26 if (m->caret < m->text.size()) {
27 while ((m->text[++m->caret] & 0xc0) == 0x80) {};
28@@ -301,6 +304,7 @@
29 }
30 return true;
31
32+ case SDLK_KP7:
33 case SDLK_HOME:
34 if (m->caret != 0) {
35 m->caret = 0;
36@@ -310,6 +314,7 @@
37 }
38 return true;
39
40+ case SDLK_KP1:
41 case SDLK_END:
42 if (m->caret != m->text.size()) {
43 m->caret = m->text.size();
44@@ -318,6 +323,7 @@
45 }
46 return true;
47
48+ case SDLK_KP8:
49 case SDLK_UP:
50 // Load entry from history if active and text is not empty
51 if (m_history_active) {
52@@ -332,6 +338,7 @@
53 }
54 return true;
55
56+ case SDLK_KP2:
57 case SDLK_DOWN:
58 // Load entry from history if active and text is not equivalent to the current one
59 if (m_history_active) {
60
61=== modified file 'src/ui_basic/multilineeditbox.cc'
62--- src/ui_basic/multilineeditbox.cc 2011-02-19 22:05:46 +0000
63+++ src/ui_basic/multilineeditbox.cc 2011-10-01 21:45:23 +0000
64@@ -252,6 +252,7 @@
65 {
66 if (down) {
67 switch (code.sym) {
68+ case SDLK_KP_PERIOD:
69 case SDLK_DELETE:
70 if (d->cursor_pos < d->text.size()) {
71 d->erase_bytes(d->cursor_pos, d->next_char(d->cursor_pos));
72@@ -266,6 +267,7 @@
73 }
74 break;
75
76+ case SDLK_KP4:
77 case SDLK_LEFT: {
78 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
79 uint32_t newpos = d->prev_char(d->cursor_pos);
80@@ -284,6 +286,7 @@
81 break;
82 }
83
84+ case SDLK_KP6:
85 case SDLK_RIGHT:
86 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
87 uint32_t newpos = d->next_char(d->cursor_pos);
88@@ -297,6 +300,7 @@
89 }
90 break;
91
92+ case SDLK_KP2:
93 case SDLK_DOWN:
94 if (d->cursor_pos < d->text.size()) {
95 d->refresh_ww();
96@@ -321,6 +325,7 @@
97 }
98 break;
99
100+ case SDLK_KP8:
101 case SDLK_UP:
102 if (d->cursor_pos > 0) {
103 d->refresh_ww();
104@@ -343,6 +348,7 @@
105 }
106 break;
107
108+ case SDLK_KP7:
109 case SDLK_HOME:
110 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
111 d->set_cursor_pos(0);
112@@ -356,6 +362,7 @@
113 }
114 break;
115
116+ case SDLK_KP1:
117 case SDLK_END:
118 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
119 d->set_cursor_pos(d->text.size());
120
121=== modified file 'src/wui/game_message_menu.cc'
122--- src/wui/game_message_menu.cc 2011-02-21 20:49:35 +0000
123+++ src/wui/game_message_menu.cc 2011-10-01 21:45:23 +0000
124@@ -200,6 +200,7 @@
125 center_main_mapview_on_location.clicked();
126 return true;
127
128+ case SDLK_KP0:
129 case SDLK_DELETE:
130 do_delete();
131 return true;
132
133=== modified file 'src/wui/interactive_base.cc'
134--- src/wui/interactive_base.cc 2011-06-10 09:32:37 +0000
135+++ src/wui/interactive_base.cc 2011-10-01 21:45:23 +0000
136@@ -320,13 +320,13 @@
137 const uint32_t scrollval = 10;
138
139 if (keyboard_free() && Panel::allow_user_input()) {
140- if (get_key_state(SDLK_UP))
141+ if (get_key_state(SDLK_UP) || get_key_state(SDLK_KP8))
142 set_rel_viewpoint(Point(0, -scrollval), false);
143- if (get_key_state(SDLK_DOWN))
144+ if (get_key_state(SDLK_DOWN) || get_key_state(SDLK_KP2))
145 set_rel_viewpoint(Point(0, scrollval), false);
146- if (get_key_state(SDLK_LEFT))
147+ if (get_key_state(SDLK_LEFT) || get_key_state(SDLK_KP4))
148 set_rel_viewpoint(Point(-scrollval, 0), false);
149- if (get_key_state(SDLK_RIGHT))
150+ if (get_key_state(SDLK_RIGHT) || get_key_state(SDLK_KP6))
151 set_rel_viewpoint(Point (scrollval, 0), false);
152 }
153
154@@ -858,6 +858,7 @@
155 return true;
156
157 switch (code.sym) {
158+ case SDLK_KP9:
159 case SDLK_PAGEUP:
160 if (!get_display_flag(dfSpeed))
161 break;
162@@ -875,6 +876,7 @@
163 ctrl->togglePaused();
164 return true;
165
166+ case SDLK_KP3:
167 case SDLK_PAGEDOWN:
168 if (!get_display_flag(dfSpeed))
169 break;
170
171=== modified file 'src/wui/interactive_player.cc'
172--- src/wui/interactive_player.cc 2011-06-10 09:33:34 +0000
173+++ src/wui/interactive_player.cc 2011-10-01 21:45:23 +0000
174@@ -427,6 +427,7 @@
175 g_gr->toggle_fullscreen();
176 return true;
177
178+ case SDLK_KP7:
179 case SDLK_HOME:
180 move_view_to(game().map().get_starting_pos(m_player_number));
181 return true;

Subscribers

People subscribed via source and target branches

to status/vote changes: