MCPcopy Create free account
hub / github.com/VCVRack/Rack / getMods

Method getMods

src/window/Window.cpp:681–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679
680
681int Window::getMods() {
682 int mods = 0;
683#if defined ARCH_LIN
684 // On Linux X11, get mods directly from X11 display, to support X11 key remapping
685 Display* display = glfwGetX11Display();
686 XkbStateRec state;
687 XkbGetState(display, XkbUseCoreKbd, &state);
688
689 // Derived from GLFW's translateState() from x11_window.c
690 if (state.mods & ShiftMask)
691 mods |= GLFW_MOD_SHIFT;
692 if (state.mods & ControlMask)
693 mods |= GLFW_MOD_CONTROL;
694 if (state.mods & Mod1Mask)
695 mods |= GLFW_MOD_ALT;
696 if (state.mods & Mod4Mask)
697 mods |= GLFW_MOD_SUPER;
698 if (state.mods & LockMask)
699 mods |= GLFW_MOD_CAPS_LOCK;
700 if (state.mods & Mod2Mask)
701 mods |= GLFW_MOD_NUM_LOCK;
702#else
703 // Use GLFW key codes on other OS's
704 if (glfwGetKey(win, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS || glfwGetKey(win, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS)
705 mods |= GLFW_MOD_SHIFT;
706 if (glfwGetKey(win, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || glfwGetKey(win, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS)
707 mods |= GLFW_MOD_CONTROL;
708 if (glfwGetKey(win, GLFW_KEY_LEFT_ALT) == GLFW_PRESS || glfwGetKey(win, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS)
709 mods |= GLFW_MOD_ALT;
710 if (glfwGetKey(win, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS || glfwGetKey(win, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS)
711 mods |= GLFW_MOD_SUPER;
712#endif
713 return mods;
714}
715
716
717void Window::setFullScreen(bool fullScreen) {

Callers 9

handleHoverMethod · 0.80
onDragStartMethod · 0.80
stepMethod · 0.80
onDragMoveMethod · 0.80
onDragStartMethod · 0.80
getModSpeedFunction · 0.80
onHoverScrollMethod · 0.80
onHoverScrollMethod · 0.80
onDragDropMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected