Store key combos that need special handling in a table for fast lookup

This commit is contained in:
Kovid Goyal
2017-09-15 18:06:26 +05:30
parent 0423c55dc1
commit b2c7272af1
5 changed files with 42 additions and 4 deletions

View File

@@ -23,6 +23,12 @@ key_to_bytes(int glfw_key, bool smkx, bool extended, int mods, int action) {
return key_bytes[key];
}
void
set_special_key_combo(int glfw_key, int mods) {
int k = (glfw_key & 0x7f) | ( (mods & 0xF) << 7);
needs_special_handling[k] = true;
}
#define PYWRAP1(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args)
#define PA(fmt, ...) if(!PyArg_ParseTuple(args, fmt, __VA_ARGS__)) return NULL;
#define M(name, arg_type) {#name, (PyCFunction)py##name, arg_type, NULL}