Dont call window_for_id() unnecessarily

This commit is contained in:
Kovid Goyal 2021-02-24 13:36:38 +05:30
parent cca590c20a
commit 9e7031f5d8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -155,13 +155,13 @@ on_key_input(GLFWkeyevent *ev) {
if (action == GLFW_PRESS || action == GLFW_REPEAT) { if (action == GLFW_PRESS || action == GLFW_REPEAT) {
create_key_event(); create_key_event();
w->last_special_key_pressed = 0;
PyObject *ret = PyObject_CallMethod(global_state.boss, "dispatch_possible_special_key", "O", ke); PyObject *ret = PyObject_CallMethod(global_state.boss, "dispatch_possible_special_key", "O", ke);
Py_CLEAR(ke); Py_CLEAR(ke);
bool consumed = false; bool consumed = false;
// the shortcut could have created a new window or closed the window, rendering the pointer // the shortcut could have created a new window or closed the
// no longer valid // window, rendering the pointer no longer valid
w = window_for_id(active_window_id); w = window_for_id(active_window_id);
if (w) w->last_special_key_pressed = 0;
if (ret == NULL) { PyErr_Print(); } if (ret == NULL) { PyErr_Print(); }
else { else {
consumed = ret == Py_True; consumed = ret == Py_True;