diff src/zamikongine/platform/linux/symkey_map.nim @ 499:3f1111f3b9f8

did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
author Sam <sam@basx.dev>
date Wed, 18 Jan 2023 09:52:03 +0700
parents 14e5151f68d1
children
line wrap: on
line diff
--- a/src/zamikongine/platform/linux/symkey_map.nim	Mon Jan 16 00:51:03 2023 +0700
+++ b/src/zamikongine/platform/linux/symkey_map.nim	Wed Jan 18 09:52:03 2023 +0700
@@ -1,16 +1,27 @@
 import std/tables
 export tables
 
-import x11/keysym
-# import x11/x
+import x11/x
+
 
 import ../../events
 
+# got values (keycodes) from xev
 const KeyTypeMap* = {
-  XK_A: A, XK_B: B, XK_C: C, XK_D: D, XK_E: E, XK_F: F, XK_G: G, XK_H: H, XK_I: I, XK_J: J, XK_K: K, XK_L: L, XK_M: M, XK_N: N, XK_O: O, XK_P: P, XK_Q: Q, XK_R: R, XK_S: S, XK_T: T, XK_U: U, XK_V: V, XK_W: W, XK_X: X, XK_Y: Y, XK_Z: Z,
-  XK_a: a, XK_b: b, XK_c: c, XK_d: d, XK_e: e, XK_f: f, XK_g: g, XK_h: h, XK_i: i, XK_j: j, XK_k: k, XK_l: l, XK_m: m, XK_n: n, XK_o: o, XK_p: p, XK_q: q, XK_r: r, XK_s: s, XK_t: t, XK_u: u, XK_v: v, XK_w: w, XK_x: Key.x, XK_y: y, XK_z: z,
-  XK_1: `1`, XK_2: `2`, XK_3: `3`, XK_4: `4`, XK_5: `5`, XK_6: `6`, XK_7: `7`, XK_8: `8`, XK_9: `9`, XK_0: `0`,
-  XK_minus: Minus, XK_plus: Plus, XK_underscore: Underscore, XK_equal: Equals, XK_space: Space, XK_Return: Enter, XK_BackSpace: Backspace, XK_Tab: Tab,
-  XK_comma: Comma, XK_period: Period, XK_semicolon: Semicolon, XK_colon: Colon,
-  XK_Escape: Escape, XK_Control_L: CtrlL, XK_Shift_L: ShirtL, XK_Alt_L: AltL, XK_Control_R: CtrlR, XK_Shift_R: ShirtR, XK_Alt_R: AltR
+  9: Escape, 67: F1, 68: F2, 69: F3, 70: F4, 71: F5, 72: F6, 73: F7, 74: F8, 75: F9, 76: F10, 95: F11, 96: F12,
+  49: NumberRowExtra1, 10: `1`, 11: `2`, 12: `3`, 13: `4`, 14: `5`, 15: `6`, 16: `7`, 17: `8`, 18: `9`, 19: `0`, 20: NumberRowExtra2, 21: NumberRowExtra3,
+  24: Q, 25: W, 26: E, 27: R, 28: T, 29: Y, 30: U, 31: I, 32: O, 33: P, 38: A, 39: S, 40: D, 41: Key.F, 42: G, 43: H, 44: J, 45: K, 46: L, 52: Z, 53: X, 54: C, 55: V, 56: B, 57: N, 58: M,
+
+  23: Tab, 66: CapsLock, 50: ShiftL, 62: ShiftR, 37: CtrlL, 105: CtrlR, 133: SuperL, #[ SuperR, ]# 64: AltL, #[ AltR, ]# 65: Space, 36: Enter, 22: Backspace,
+    34: LetterRow1Extra1, 35: LetterRow1Extra2, 51: LetterRow1Extra3,
+    47: LetterRow2Extra1, 48: LetterRow2Extra2,
+    59: LetterRow3Extra1, 60: LetterRow3Extra2, 61: LetterRow3Extra3,
+    111: Up, 116: Down, 113: Left, 114: Right,
+    112: PageUp, 117: PageDown, 110: Home, 115: End, 118: Insert, 119: Delete,
 }.toTable
+
+const MouseButtonTypeMap* = {
+  Button1: MouseButton.Mouse1,
+  Button2: MouseButton.Mouse2,
+  Button3: MouseButton.Mouse3,
+}.toTable