Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2003-10-27 19:19:33 +0000
committerSilenio Quarti2003-10-27 19:19:33 +0000
commitc830ba87659f66da0a8654b6fd6e8eaf78f224a3 (patch)
treec40b566849d43abc1c5bfde329ce4034aefbdcbe /bundles
parentebafd3a38c46dd46b5dcf6dfd34949295c064eb5 (diff)
downloadeclipse.platform.swt-c830ba87659f66da0a8654b6fd6e8eaf78f224a3.tar.gz
eclipse.platform.swt-c830ba87659f66da0a8654b6fd6e8eaf78f224a3.tar.xz
eclipse.platform.swt-c830ba87659f66da0a8654b6fd6e8eaf78f224a3.zip
24178, 21035
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java52
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java65
3 files changed, 92 insertions, 46 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java
index 3558202ff9..e91e973e5f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/photon/org/eclipse/swt/internal/photon/OS.java
@@ -218,6 +218,9 @@ public class OS {
public static final int Pk_F10 = 0xf0c7;
public static final int Pk_F11 = 0xf0c8;
public static final int Pk_F12 = 0xf0c9;
+ public static final int Pk_F13 = 0xf0cA;
+ public static final int Pk_F14 = 0xf0cB;
+ public static final int Pk_F15 = 0xf0cC;
public static final int Pk_F2 = 0xf0bf;
public static final int Pk_F3 = 0xf0c0;
public static final int Pk_F4 = 0xf0c1;
@@ -238,9 +241,27 @@ public class OS {
public static final int Pk_KF_Sym_Valid = 0x40;
public static final int Pk_KM_Alt = 0x4;
public static final int Pk_KM_Ctrl = 0x2;
+ public static final int Pk_KM_Num_Lock = 0x00020000;
public static final int Pk_KM_Shift = 0x1;
public static final int Pk_KP_Enter = 0xF08D;
public static final int Pk_KP_Tab = 0xf089;
+ public static final int Pk_KP_Equal = 0xF0BD;
+ public static final int Pk_KP_Multiply = 0xF0AA;
+ public static final int Pk_KP_Add = 0xF0AB;
+ public static final int Pk_KP_Separator = 0xF0AC;
+ public static final int Pk_KP_Subtract = 0xF0AD;
+ public static final int Pk_KP_Decimal = 0xF0AE;
+ public static final int Pk_KP_Divide = 0xF0AF;
+ public static final int Pk_KP_0 = 0xF0B0;
+ public static final int Pk_KP_1 = 0xF0B1;
+ public static final int Pk_KP_2 = 0xF0B2;
+ public static final int Pk_KP_3 = 0xF0B3;
+ public static final int Pk_KP_4 = 0xF0B4;
+ public static final int Pk_KP_5 = 0xF0B5;
+ public static final int Pk_KP_6 = 0xF0B6;
+ public static final int Pk_KP_7 = 0xF0B7;
+ public static final int Pk_KP_8 = 0xF0B8;
+ public static final int Pk_KP_9 = 0xF0B9;
public static final int Pk_Left = 0xf051;
public static final int Pk_Linefeed = 0xf00a;
public static final int Pk_Menu = 0xf067;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
index dbef9fbfab..39d7ceb6d0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
@@ -139,6 +139,8 @@ public class Display extends Device {
{OS.Pk_Shift_R, SWT.SHIFT},
{OS.Pk_Control_L, SWT.CONTROL},
{OS.Pk_Control_R, SWT.CONTROL},
+// {OS.Pk_????, SWT.COMMAND},
+// {OS.Pk_????, SWT.COMMAND},
// {OS.VK_LBUTTON, SWT.BUTTON1},
// {OS.VK_MBUTTON, SWT.BUTTON3},
@@ -178,27 +180,37 @@ public class Display extends Device {
{OS.Pk_F10, SWT.F10},
{OS.Pk_F11, SWT.F11},
{OS.Pk_F12, SWT.F12},
-
-
+ {OS.Pk_F13, SWT.F13},
+ {OS.Pk_F14, SWT.F14},
+ {OS.Pk_F15, SWT.F15},
+
/* Numeric Keypad Keys */
- /*
- {OS.XK_KP_Add, SWT.KP_PLUS},
- {OS.XK_KP_Subtract, SWT.KP_MINUS},
- {OS.XK_KP_Multiply, SWT.KP_TIMES},
- {OS.XK_KP_Divide, SWT.KP_DIVIDE},
- {OS.XK_KP_Decimal, SWT.KP_PERIOD},
- {OS.XK_KP_Enter, SWT.KP_ENTER},
- {OS.XK_KP_0, SWT.KP_0},
- {OS.XK_KP_1, SWT.KP_1},
- {OS.XK_KP_2, SWT.KP_2},
- {OS.XK_KP_3, SWT.KP_3},
- {OS.XK_KP_4, SWT.KP_4},
- {OS.XK_KP_5, SWT.KP_5},
- {OS.XK_KP_6, SWT.KP_6},
- {OS.XK_KP_7, SWT.KP_7},
- {OS.XK_KP_8, SWT.KP_8},
- {OS.XK_KP_9, SWT.KP_9},
- */
+ {OS.Pk_KP_Multiply, SWT.KEYPAD_TIMES},
+ {OS.Pk_KP_Add, SWT.KEYPAD_PLUS},
+ {OS.Pk_KP_Enter, SWT.KEYPAD_CR},
+ {OS.Pk_KP_Subtract, SWT.KEYPAD_MINUS},
+ {OS.Pk_KP_Decimal, SWT.KEYPAD_DECIMAL},
+ {OS.Pk_KP_Divide, SWT.KEYPAD_DIVIDE},
+ {OS.Pk_KP_0, SWT.KEYPAD_0},
+ {OS.Pk_KP_1, SWT.KEYPAD_1},
+ {OS.Pk_KP_2, SWT.KEYPAD_2},
+ {OS.Pk_KP_3, SWT.KEYPAD_3},
+ {OS.Pk_KP_4, SWT.KEYPAD_4},
+ {OS.Pk_KP_5, SWT.KEYPAD_5},
+ {OS.Pk_KP_6, SWT.KEYPAD_6},
+ {OS.Pk_KP_7, SWT.KEYPAD_7},
+ {OS.Pk_KP_8, SWT.KEYPAD_8},
+ {OS.Pk_KP_9, SWT.KEYPAD_9},
+
+ /* Other keys */
+ {OS.Pk_Caps_Lock, SWT.CAPS_LOCK},
+ {OS.Pk_Num_Lock, SWT.NUM_LOCK},
+ {OS.Pk_Scroll_Lock, SWT.SCROLL_LOCK},
+ {OS.Pk_Pause, SWT.PAUSE},
+ {OS.Pk_Break, SWT.BREAK},
+ {OS.Pk_Print, SWT.PRINT_SCREEN},
+ {OS.Pk_Help, SWT.HELP},
+
};
/* Multiple Displays. */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
index f1510cede2..c76c3df35b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
@@ -1052,17 +1052,27 @@ boolean setInputState (Event event, int type, int key_mods, int button_state) {
}
boolean setKeyState (Event event, int type, PhKeyEvent_t ke) {
- boolean isNull = false;
- /*
- * Fetuare in Photon. The key_sym value is not valid when Ctrl
- * or Alt is pressed. The fix is to detect this case and try to
- * use the key_cap value.
- */
int key = 0;
- if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) {
- event.keyCode = Display.translateKey (key = ke.key_sym);
- } else if ((ke.key_flags & OS.Pk_KF_Cap_Valid) != 0) {
- event.keyCode = Display.translateKey (key = ke.key_cap);
+ boolean isNull = false;
+ if ((ke.key_flags & OS.Pk_KF_Cap_Valid) != 0) {
+ key = ke.key_cap;
+ if ((ke.key_mods & OS.Pk_KM_Num_Lock) == 0) {
+ switch (key) {
+ case OS.Pk_KP_0: key = OS.Pk_Insert; break;
+ case OS.Pk_KP_1: key = OS.Pk_End; break;
+ case OS.Pk_KP_2: key = OS.Pk_Down; break;
+ case OS.Pk_KP_3: key = OS.Pk_Pg_Down; break;
+ case OS.Pk_KP_4: key = OS.Pk_Left; break;
+ case OS.Pk_KP_5: break;
+ case OS.Pk_KP_6: key = OS.Pk_Right; break;
+ case OS.Pk_KP_7: key = OS.Pk_Home; break;
+ case OS.Pk_KP_8: key = OS.Pk_Up; break;
+ case OS.Pk_KP_9: key = OS.Pk_Pg_Up; break;
+ case OS.Pk_KP_Decimal: key = OS.Pk_Delete; break;
+ }
+
+ }
+ event.keyCode = Display.translateKey (key);
}
switch (key) {
case OS.Pk_BackSpace: event.character = '\b'; break;
@@ -1075,23 +1085,24 @@ boolean setKeyState (Event event, int type, PhKeyEvent_t ke) {
case OS.Pk_KP_Tab:
case OS.Pk_Tab: event.character = '\t'; break;
/* These keys have no mapping in SWT yet */
- case OS.Pk_Break:
case OS.Pk_Clear:
- case OS.Pk_Pause:
- case OS.Pk_Print:
case OS.Pk_Menu:
- case OS.Pk_Help:
case OS.Pk_Hyper_L:
case OS.Pk_Hyper_R:
- case OS.Pk_Caps_Lock:
- case OS.Pk_Num_Lock:
- case OS.Pk_Scroll_Lock: break;
+ break;
default: {
if (event.keyCode == 0) {
if ((ke.key_flags & OS.Pk_KF_Cap_Valid) != 0) {
event.keyCode = ke.key_cap;
}
- if ((ke.key_mods & (OS.Pk_KM_Alt | OS.Pk_KM_Ctrl)) != 0) {
+ }
+ /*
+ * Fetuare in Photon. The key_sym value is not valid when Ctrl
+ * or Alt is pressed. The fix is to detect this case and try to
+ * use the key_cap value.
+ */
+ if ((ke.key_mods & (OS.Pk_KM_Alt | OS.Pk_KM_Ctrl)) != 0) {
+ if (0 <= key && key <= 0x7F) {
if ((ke.key_mods & OS.Pk_KM_Ctrl) != 0) {
isNull = key == '@';
if ('a' <= key && key <= 'z') key -= 'a' - 'A';
@@ -1099,16 +1110,18 @@ boolean setKeyState (Event event, int type, PhKeyEvent_t ke) {
event.character = (char) key;
isNull &= key == 0;
} else {
- event.character = (char) key;
- }
- } else {
- byte [] buffer = new byte [6];
- int length = OS.PhKeyToMb (buffer, ke);
- if (length > 0) {
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- if (unicode.length > 0) event.character = unicode [0];
+ if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) {
+ event.character = (char) ke.key_sym;
+ }
}
}
+ } else {
+ byte [] buffer = new byte [6];
+ int length = OS.PhKeyToMb (buffer, ke);
+ if (length > 0) {
+ char [] unicode = Converter.mbcsToWcs (null, buffer);
+ if (unicode.length > 0) event.character = unicode [0];
+ }
}
}
}

Back to the top