1 2 module ws.gui.keyboard_old; 3 4 import io = ws.io; 5 6 version(linux){ 7 import x11.keysymdef; 8 } 9 10 class keyboard { 11 12 alias ushort key; 13 14 version(Windows){ 15 enum: key { 16 shift = 16, 17 control = 17, 18 caps = 20, 19 win = 91, 20 escape = 27, 21 enter = 13, 22 backspace = 8, 23 space = 32, 24 del = 46, 25 26 left = 37, 27 up = 38, 28 right = 39, 29 down = 40 30 } 31 } 32 version(linux){ 33 enum: key { 34 35 shift = cast(key)XK_Shift_L, 36 shiftR = cast(key)XK_Shift_R, 37 control = cast(key)XK_Control_L, 38 controlR = cast(key)XK_Control_R, 39 caps = cast(key)XK_Caps_Lock, 40 win = cast(key)XK_Super_L, 41 winR = cast(key)XK_Super_R, 42 43 escape = cast(key)XK_Escape, 44 enter = cast(key)XK_Return, 45 46 backspace = cast(key)XK_BackSpace, 47 space = cast(key)XK_space, 48 del = cast(key)XK_Delete, 49 50 left = cast(key)XK_Left, 51 up = cast(key)XK_Up, 52 right = cast(key)XK_Right, 53 down = cast(key)XK_Down, 54 55 } 56 } 57 58 static bool get(key i){ 59 return chars[i]; 60 } 61 62 static void set(key i, bool p){ 63 chars[i] = p; 64 } 65 66 private static bool[key.max] chars = [false]; 67 68 }