From 97e592393977d36eeee897843103ed74443f7b07 Mon Sep 17 00:00:00 2001 From: Brad Grantham Date: Wed, 23 Nov 2016 22:18:49 -0800 Subject: [PATCH] fix paste to only work with SUPER key (CMD on Mac), fix #4 --- interface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface.cpp b/interface.cpp index 822ff47..6424e01 100644 --- a/interface.cpp +++ b/interface.cpp @@ -890,16 +890,16 @@ static void key(GLFWwindow *window, int key, int scancode, int action, int mods) static bool super_down = false; if(action == GLFW_PRESS) { - if(key == GLFW_KEY_RIGHT_SUPER) + if(key == GLFW_KEY_RIGHT_SUPER || key == GLFW_KEY_LEFT_SUPER) super_down = true; - else if(key == GLFW_KEY_V) { + else if(super_down && key == GLFW_KEY_V) { const char* text = glfwGetClipboardString(window); if (text) event_queue.push_back({PASTE, 0, strdup(text)}); } else event_queue.push_back({KEYDOWN, key}); } else if(action == GLFW_RELEASE) { - if(key == GLFW_KEY_RIGHT_SUPER) + if(key == GLFW_KEY_RIGHT_SUPER || key == GLFW_KEY_LEFT_SUPER) super_down = false; event_queue.push_back({KEYUP, key}); }