Take the mouse wheel multiplier into account when generating keypresses for mouse wheel events. Fixes #262

This commit is contained in:
Kovid Goyal
2018-01-04 12:34:31 +05:30
parent 0305009766
commit 847ce37160
3 changed files with 7 additions and 5 deletions

View File

@@ -188,12 +188,14 @@ on_key_input(int key, int scancode, int action, int mods) {
}
void
fake_scroll(bool upwards) {
fake_scroll(int amount, bool upwards) {
Window *w = active_window();
if (!w) return;
Screen *screen = w->render_data.screen;
send_key_to_child(w, upwards ? GLFW_KEY_UP : GLFW_KEY_DOWN, 0, GLFW_PRESS);
if (screen->modes.mEXTENDED_KEYBOARD) send_key_to_child(w, upwards ? GLFW_KEY_UP : GLFW_KEY_DOWN, 0, GLFW_RELEASE);
while (amount-- > 0) {
send_key_to_child(w, upwards ? GLFW_KEY_UP : GLFW_KEY_DOWN, 0, GLFW_PRESS);
if (screen->modes.mEXTENDED_KEYBOARD) send_key_to_child(w, upwards ? GLFW_KEY_UP : GLFW_KEY_DOWN, 0, GLFW_RELEASE);
}
}
#define PYWRAP1(name) static PyObject* py##name(PyObject UNUSED *self, PyObject *args)