20 #include "pedigree/native/input/Input.h" 21 #include "modules/subsys/pedigree-c/pedigree-syscalls.h" 24 using namespace Input;
26 static void event_callback(
size_t p1,
size_t p2, uintptr_t *pBuffer,
size_t p4)
30 callback_t cb =
reinterpret_cast<callback_t
>(pBuffer[1]);
36 pedigree_event_return();
39 void Input::installCallback(CallbackType type, callback_t cb)
41 pedigree_input_install_callback(
42 reinterpret_cast<void *>(event_callback), static_cast<uint32_t>(type),
43 reinterpret_cast<uintptr_t>(cb));
46 void Input::removeCallback(callback_t cb)
48 pedigree_input_remove_callback(reinterpret_cast<void *>(cb));
51 void Input::inhibitEvents()
53 pedigree_input_inhibit_events(1);
56 void Input::uninhibitEvents()
58 pedigree_input_inhibit_events(0);
61 void Input::loadKeymapFromFile(
const char *path)
64 FILE *pFile = fopen(path,
"r");
68 stderr,
"Input::loadKeymapFromFile: Error opening file `%s'.\n",
74 fseek(pFile, 0, SEEK_END);
75 size_t nLength = ftell(pFile);
76 fseek(pFile, 0, SEEK_SET);
79 uint32_t *pBuffer =
new uint32_t[(nLength /
sizeof(uint32_t)) + 1];
80 fread(pBuffer, 1, nLength, pFile);
83 if (pedigree_load_keymap(pBuffer, nLength))
84 fprintf(stderr,
"Input::loadKeymapFromFile: Error loading keymap\n");