• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

development


コミットメタ情報

リビジョン8768990de5d2b227c821ae5effcb300b87101c46 (tree)
日時2009-11-11 18:04:36
作者Yi Sun <beyounn@gmai...>
コミッターYi Sun

ログメッセージ

Changed ctrl to the real Ctrl keys. I did not add CAP key support for the Term yet.

変更サマリ

差分

--- a/apps/Term/res/xml/preferences.xml
+++ b/apps/Term/res/xml/preferences.xml
@@ -41,20 +41,6 @@
4141 </PreferenceCategory>
4242
4343 <PreferenceCategory
44- android:title="@string/keyboard_preferences">
45-
46- <ListPreference
47- android:key="controlkey"
48- android:defaultValue="@string/default_value_controlkey_preference"
49- android:title="@string/title_controlkey_preference"
50- android:summary="@string/summary_controlkey_preference"
51- android:entries="@array/entries_controlkey_preference"
52- android:entryValues="@array/entryvalues_controlkey_preference"
53- android:dialogTitle="@string/dialog_title_controlkey_preference" />
54-
55- </PreferenceCategory>
56-
57- <PreferenceCategory
5844 android:title="@string/shell_preferences">
5945
6046 <EditTextPreference
--- a/apps/Term/src/com/android/term/Term.java
+++ b/apps/Term/src/com/android/term/Term.java
@@ -121,11 +121,9 @@ public class Term extends Activity {
121121
122122 private int mFontSize = 9;
123123 private int mColorId = 2;
124- private int mControlKeyId = 0;
125124
126125 private static final String FONTSIZE_KEY = "fontsize";
127126 private static final String COLOR_KEY = "color";
128- private static final String CONTROLKEY_KEY = "controlkey";
129127 private static final String SHELL_KEY = "shell";
130128 private static final String INITIALCOMMAND_KEY = "initialcommand";
131129
@@ -136,18 +134,6 @@ public class Term extends Activity {
136134 private static final int[][] COLOR_SCHEMES = {
137135 {BLACK, WHITE}, {WHITE, BLACK}, {WHITE, BLUE}};
138136
139- private static final int[] CONTROL_KEY_SCHEMES = {
140- KeyEvent.KEYCODE_DPAD_CENTER,
141- KeyEvent.KEYCODE_AT,
142- KeyEvent.KEYCODE_ALT_LEFT,
143- KeyEvent.KEYCODE_ALT_RIGHT
144- };
145- private static final String[] CONTROL_KEY_NAME = {
146- "Ball", "@", "Left-Alt", "Right-Alt"
147- };
148-
149- private int mControlKeyCode;
150-
151137 private final static String DEFAULT_SHELL = "/system/bin/sh -";
152138 private String mShell;
153139
@@ -315,8 +301,6 @@ public class Term extends Activity {
315301 private void readPrefs() {
316302 mFontSize = readIntPref(FONTSIZE_KEY, mFontSize, 20);
317303 mColorId = readIntPref(COLOR_KEY, mColorId, COLOR_SCHEMES.length - 1);
318- mControlKeyId = readIntPref(CONTROLKEY_KEY, mControlKeyId,
319- CONTROL_KEY_SCHEMES.length - 1);
320304 {
321305 String newShell = readStringPref(SHELL_KEY, mShell);
322306 if ((newShell == null) || ! newShell.equals(mShell)) {
@@ -344,7 +328,6 @@ public class Term extends Activity {
344328 private void updatePrefs() {
345329 mEmulatorView.setTextSize(mFontSize);
346330 setColors();
347- mControlKeyCode = CONTROL_KEY_SCHEMES[mControlKeyId];
348331 }
349332
350333 private int readIntPref(String key, int defaultValue, int maxValue) {
@@ -369,7 +352,6 @@ public class Term extends Activity {
369352 e.clear();
370353 e.putString(FONTSIZE_KEY, Integer.toString(mFontSize));
371354 e.putString(COLOR_KEY, Integer.toString(mColorId));
372- e.putString(CONTROLKEY_KEY, Integer.toString(mControlKeyId));
373355 e.putString(SHELL_KEY, mShell);
374356 e.putString(INITIALCOMMAND_KEY, mInitialCommand);
375357 e.commit();
@@ -424,7 +406,8 @@ public class Term extends Activity {
424406 }
425407
426408 private boolean handleControlKey(int keyCode, boolean down) {
427- if (keyCode == mControlKeyCode) {
409+ if (keyCode == KeyEvent.KEYCODE_CTRL_RIGHT ||
410+ keyCode == KeyEvent.KEYCODE_CTRL_LEFT) {
428411 mKeyListener.handleControlKey(down);
429412 return true;
430413 }
@@ -531,9 +514,9 @@ public class Term extends Activity {
531514 }
532515
533516 private void doDocumentKeys() {
534- String controlKey = CONTROL_KEY_NAME[mControlKeyId];
517+ String controlKey = "ctrl";
535518 new AlertDialog.Builder(this).
536- setTitle("Press " + controlKey + " and Key").
519+ setTitle("Press "+controlKey+" and Key").
537520 setMessage(controlKey + " Space ==> Control-@ (NUL)\n"
538521 + controlKey + " A..Z ==> Control-A..Z\n"
539522 + controlKey + " 1 ==> Control-[ (ESC)\n"
@@ -3181,6 +3164,7 @@ class TermKeyListener {
31813164 mControlKey.onPress();
31823165 } else {
31833166 mControlKey.onRelease();
3167+ mControlKey.adjustAfterKeypress();
31843168 }
31853169 }
31863170
@@ -3207,8 +3191,6 @@ class TermKeyListener {
32073191
32083192 if (result > -1) {
32093193 mAltKey.adjustAfterKeypress();
3210- mCapKey.adjustAfterKeypress();
3211- mControlKey.adjustAfterKeypress();
32123194 }
32133195 return result;
32143196 }
@@ -3232,7 +3214,6 @@ class TermKeyListener {
32323214 case KeyEvent.KEYCODE_SHIFT_RIGHT:
32333215 mCapKey.onPress();
32343216 break;
3235-
32363217 case KeyEvent.KEYCODE_ENTER:
32373218 // Convert newlines into returns. The vt100 sends a
32383219 // '\r' when the 'Return' key is pressed, but our
@@ -3272,6 +3253,7 @@ class TermKeyListener {
32723253 case KeyEvent.KEYCODE_SHIFT_LEFT:
32733254 case KeyEvent.KEYCODE_SHIFT_RIGHT:
32743255 mCapKey.onRelease();
3256+ mCapKey.adjustAfterKeypress();
32753257 break;
32763258 default:
32773259 // Ignore other keyUps