module patch.fixkeyboardinput; import patches : isPatchEnabled; import deimos.X11.keysym; import deimos.X11.X : KeySym, ShiftMask, ControlMask, Mod1Mask, Mod4Mask; static if (isPatchEnabled!"FIXKEYBOARDINPUT_PATCH") { static KeySym[] mappedkeys = [ XK_space, XK_m, XK_i, XK_A, XK_B, XK_C, XK_D, XK_E, XK_F, XK_G, XK_H, XK_I, XK_K, XK_J, XK_L, XK_M, XK_N, XK_O, XK_P, XK_Q, XK_R, XK_S, XK_T, XK_U, XK_V, XK_W, XK_X, XK_Y, XK_Z, XK_0, XK_1, XK_2, XK_3, XK_4, XK_5, XK_6, XK_7, XK_8, XK_9, XK_exclam, XK_quotedbl, XK_numbersign, XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, XK_parenleft, XK_parenright, XK_asterisk, XK_plus, XK_comma, XK_minus, XK_period, XK_slash, XK_colon, XK_semicolon, XK_less, XK_equal, XK_greater, XK_question, XK_at, XK_bracketleft, XK_backslash, XK_bracketright, XK_asciicircum, XK_underscore, XK_grave, XK_braceleft, XK_bar, XK_braceright, XK_asciitilde, ]; struct Key { KeySym keysym; uint mask; string strng; int appkey; int appcursor; } // Note: This is a partial implementation. The full key array from fixkeyboardinput.c // would need to be converted completely, but this provides the structure. static Key[] key = [ Key(XK_KP_Home, ShiftMask, "\033[2J", 0, -1), Key(XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1), Key(XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0), Key(XK_KP_End, ControlMask, "\033[J", -1, 0), Key(XK_KP_End, ControlMask, "\033[1;5F", +1, 0), Key(XK_KP_End, ShiftMask, "\033[K", -1, 0), Key(XK_KP_End, ShiftMask, "\033[1;2F", +1, 0), Key(XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0), Key(XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0), Key(XK_KP_Insert, ShiftMask, "\033[4l", -1, 0), Key(XK_KP_Insert, ControlMask, "\033[L", -1, 0), Key(XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0), Key(XK_KP_Delete, ControlMask, "\033[M", -1, 0), Key(XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0), Key(XK_KP_Delete, ShiftMask, "\033[2K", -1, 0), Key(XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0), // TODO: Add the rest of the key mappings from fixkeyboardinput.c ]; }