diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c3face..942a0c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ In this document, Ctrl means Command (⌘) on Mac. +### 2.6.4 (2025-04-18) +- Fix dragging knobs on Mac when UI scale is set to non-Auto. +- SDK + - Fix GLEW and libarchive build failure when CMake 4 is installed. + - Update to GLEW 2.2.0. + ### 2.6.3 (2025-03-26) - Fix failure to launch on Windows 7. - Rack Pro @@ -36,7 +42,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Core - Fix DC filter accuracy of Right input when normalled to Left input in VCV Audio 2. - Change default MIDI CC numbers of *VCV MIDI CC to CV* and *VCV CV to MIDI CC* modules to 1-16 instead of 0-15. -- API +- SDK - Add `Widget::KeyBaseEvent::isKeyCommand()` for checking key commands on all keyboard layouts. - Add `settings::language` global variable. - Add `string::UTF32toUTF8()`, `UTF8toUTF32()`, and `UTF8*()` functions. @@ -57,7 +63,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Allow VST3 plugin to receive MIDI CC, pitch bend, and channel aftertouch. - Core - MIDI to CV: When sustain pedal is released in monophonic mode, turn off gate if no notes are held. -- API +- SDK - Don't combine SDK packages for Mac-x64 and Mac-arm64. - Update to libcurl 8.10.0 and OpenSSL 3.3.2. - Add `dsp::MidiParser` class. @@ -68,7 +74,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Allow building multi-arch x64+arm64 "Universal" Mac binary. - Optimize engine's cable stepping algorithm to be as CPU-efficient as non-stackable inputs. - Limit log file size to 10 MB. -- API +- SDK - Define `ARCH_*` macros in `arch.hpp` header (included in `rack.hpp`) instead of in compiler flags. ### 2.5.1 (2024-04-16) @@ -91,7 +97,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Add `"verifyHttpsCerts"` setting to disable verifying HTTPS certificates. - Rack Pro - Fix MIDI note velocity scale in CLAP adapter. -- API +- SDK - Don't zero output port voltages when disconnecting cables. - Fix `ExpanderChangeEvent` not being dispatched when removing an adjacent module. @@ -100,7 +106,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Fix Library menu plugin update items not being re-enabled when downloading is completed. - Rack Pro - Fix discarded MIDI input messages for all plugin adapters. -- API +- SDK - Add `LightButton` to component library. - Use SSE4.1 intrinsics in `simd::trunc`, `floor`, `ceil`, `round`, and `fmod` to improve performance. @@ -117,7 +123,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Fix crash when using Mac VST3 and AU plugins simultaneously in a DAW. - Fix crash when removing one of multiple running plugin instances in Studio One. - Fix CLAP plugin discarding output MIDI messages. -- API +- SDK - Add `ThemedSvgPanel` and `ThemedSvgScrew` classes which automatically switch SVGs when dark panels are toggled. - Add `"minRackVersion"` property to plugin manifest, which prevents Rack from downloading plugin if version is not compatible. - Fix `ContextCreateEvent` and `ContextDestroyEvent` not defining `vg` NanoVG context. @@ -131,7 +137,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Rack Pro - Don't force MIDI output message channel to 1 in VST3 adapter. Offer all 16 channels. - Fix aftertouch and polyphonic pressure on all MIDI channels in VST3 and CLAP adapters. -- API +- SDK - Make `ParamQuantity::set/getValue()` set/get the Param's target value of the Engine's per-sample smoothing algorithm instead of the Param's immediate value. Add `ParamQuantity::set/getImmediateValue()`. Deprecate `ParamQuantity::set/getSmoothValue()`. - Add `dsp::polyDirect()`, `dsp::polyHorner()`, and `dsp::polyEstrin()`. - Rename `dsp::approxExp2_taylor5()` to `dsp::exp2_taylor5()` and improve polynomial coefficients. @@ -151,7 +157,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Store and recall window size of VST3. - Fix MIDI clock input in CLAP adapter. - Make CLAP adapter a Note Effect and Audio Effect as well as an Instrument. -- API +- SDK - Make unarchiver handle zero-byte files as a special case by deleting destination files instead of overwriting them. This allows plugin packages to remove old presets by including a zero-byte file with its filename. - Add `ModuleWidget::getModule()` convenience method. @@ -161,7 +167,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Zero audio output of all channels in `audio::Device::processBuffer()` before writing, to avoid sending uninitialized values to audio device. - Rack Pro - Fix blank plugin window on certain Linux Nvidia graphics drivers. -- API +- SDK - Don't include SIMDE headers on x64, fixing symbol conflicts when plugins include x64 intrinsic headers. - Don't export symbols from libarchive, zstd, rtaudio, and rtmidi to avoid conflicts with hosts that use these libraries. Rack plugins can no longer link to these libraries. - Rename plugin binary to `plugin-arm64.dylib` on Mac ARM64 so multiple plugin architectures can coexist in the same Rack user folder. @@ -185,7 +191,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Rack Pro - Add VST3, Audio Unit, and CLAP plugin adapters. - Add framerate setting to plugins. -- API +- SDK - Add `system::sleep()`. - Make `random::get()`, `uniform()`, etc use global random state instead of thread-local. @@ -203,7 +209,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Fix probabilistic crash when undoing a module paste action. - Rack Pro - Fix VST2 window size not being remembered on Mac. -- API +- SDK - Make `SvgButton` dispatch `ActionEvent` only on left mouse down, instead of left/right mouse down and drag drop. ### 2.1.0 (2022-02-26) @@ -349,7 +355,7 @@ In this document, Ctrl means Command (⌘) on Mac. - Allow disabling smoothing for MIDI-CV (pitch and mod wheel), MIDI-CC, and MIDI-Map. - Add several module presets for many Core modules. -- API +- SDK - Add setters/getters for nearly every instance variable in Rack's API. Use these for higher likelihood of stability. - Compile Rack and plugins with `-march=nehalem`, enabling (and requiring) up to SSE4.2 and POPCNT instruction sets. - Add `Module::configInput()` and `Module::configOutput()` for adding names to ports. diff --git a/Makefile b/Makefile index 2699aee2..c8276b5e 100644 --- a/Makefile +++ b/Makefile @@ -138,10 +138,13 @@ perf: $(STANDALONE_TARGET) hotspot perf.data rm perf.data +VALGRIND_FLAGS += --gen-suppressions=all +VALGRIND_FLAGS += --suppressions=valgrind.supp +VALGRIND_FLAGS += --leak-check=full +VALGRIND_FLAGS += --track-origins=yes +VALGRIND_FLAGS += --exit-on-first-error=yes valgrind: $(STANDALONE_TARGET) - # --gen-suppressions=yes - # --leak-check=full - valgrind --suppressions=valgrind.supp ./$< -d + valgrind $(VALGRIND_FLAGS) ./$< -d clean: rm -rfv build dist $(TARGET) $(STANDALONE_TARGET) *.a @@ -175,7 +178,7 @@ DIST_HTML := $(patsubst %.md, build/%.html, $(DIST_MD)) DIST_RES := res cacert.pem Core.json template.vcv LICENSE-GPLv3.txt $(DIST_HTML) translations DIST_SDK_DIR := Rack-SDK DIST_SDK = Rack-SDK-$(RACK_VERSION)-$(ARCH_NAME).zip -FUNDAMENTAL_VERSION ?= 2.6.1 +FUNDAMENTAL_VERSION ?= 2.6.2 FUNDAMENTAL_FILENAME := Fundamental-$(FUNDAMENTAL_VERSION)-$(ARCH_NAME).vcvplugin diff --git a/adapters/standalone.cpp b/adapters/standalone.cpp index de612958..d0e922f4 100644 --- a/adapters/standalone.cpp +++ b/adapters/standalone.cpp @@ -136,7 +136,6 @@ int main(int argc, char* argv[]) { } logger::init(); random::init(); - string::init(); // Test code // exit(0); @@ -168,6 +167,8 @@ int main(int argc, char* argv[]) { #endif INFO("System time: %s", string::formatTimeISO(system::getUnixTime()).c_str()); + string::init(); + // Load settings settings::init(); try { diff --git a/dep/Makefile b/dep/Makefile index 14b8223a..f519fa8d 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -41,7 +41,7 @@ ifdef ARCH_WIN openssl = lib/libcrypto.a libcurl = lib/libcurl.a zstd = lib/libzstd.a - libarchive = lib/libarchive_static.a + libarchive = lib/libarchive.a libspeexdsp = lib/libspeexdsp.a libsamplerate = lib/libsamplerate.a rtmidi = lib/librtmidi.a @@ -85,17 +85,18 @@ include $(RACK_DIR)/dep.mk # Targets # These targets are all order-only "|" because we usually don't care if a library was built before or after other libraries. -glew-2.1.0: - $(WGET) "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0.tgz" - $(SHA256) glew-2.1.0.tgz 04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95 - $(UNTAR) glew-2.1.0.tgz - rm glew-2.1.0.tgz +glew-2.2.0: + $(WGET) "https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.tgz" + $(SHA256) glew-2.2.0.tgz d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1 + $(UNTAR) glew-2.2.0.tgz + rm glew-2.2.0.tgz -$(glew): | glew-2.1.0 - cd glew-2.1.0 && mkdir -p build - cd glew-2.1.0/build && $(CMAKE) ./cmake - $(MAKE) -C glew-2.1.0/build - $(MAKE) -C glew-2.1.0/build install +$(glew): | glew-2.2.0 + cd glew-2.2.0 && mkdir -p build + # Increase policy version to support building with Cmake 4 + cd glew-2.2.0/build && $(CMAKE) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 cmake + $(MAKE) -C glew-2.2.0/build + $(MAKE) -C glew-2.2.0/build install $(glfw): | glfw cd glfw && mkdir -p build @@ -104,16 +105,16 @@ $(glfw): | glfw $(MAKE) -C glfw/build $(MAKE) -C glfw/build install -jansson-2.14: - $(WGET) "https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.gz" || $(WGET) "http://www.digip.org/jansson/releases/jansson-2.14.tar.gz" - $(SHA256) jansson-2.14.tar.gz 5798d010e41cf8d76b66236cfb2f2543c8d082181d16bc3085ab49538d4b9929 - $(UNTAR) jansson-2.14.tar.gz - rm jansson-2.14.tar.gz +jansson-2.12: + $(WGET) "https://github.com/akheron/jansson/releases/download/v2.12/jansson-2.12.tar.gz" || $(WGET) "http://www.digip.org/jansson/releases/jansson-2.12.tar.gz" + $(SHA256) jansson-2.12.tar.gz 5f8dec765048efac5d919aded51b26a32a05397ea207aa769ff6b53c7027d2c9 + $(UNTAR) jansson-2.12.tar.gz + rm jansson-2.12.tar.gz -$(jansson): | jansson-2.14 - cd jansson-2.14 && $(CONFIGURE) - $(MAKE) -C jansson-2.14 - $(MAKE) -C jansson-2.14 install +$(jansson): | jansson-2.12 + cd jansson-2.12 && $(CONFIGURE) + $(MAKE) -C jansson-2.12 + $(MAKE) -C jansson-2.12 install openssl-3.3.2: $(WGET) "https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz" @@ -144,32 +145,33 @@ $(libcurl): | $(openssl) curl-8.10.0 $(MAKE) -C curl-8.10.0 $(MAKE) -C curl-8.10.0 install -zstd-1.5.7: - $(WGET) "https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-1.5.7.tar.gz" - $(SHA256) zstd-1.5.7.tar.gz eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3 +zstd-1.5.6: + $(WGET) "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz" + $(SHA256) zstd-1.5.6.tar.gz 8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 # HACK This tar archive creates a symlink "untar" to "tar" before tar exists. This is okay on UNIX but not on Windows where symlinks are copies of files. So create a fake "tar" so the unarchiving works. - mkdir -p zstd-1.5.7/tests/cli-tests/bin - touch zstd-1.5.7/tests/cli-tests/bin/zstd - $(UNTAR) zstd-1.5.7.tar.gz - rm zstd-1.5.7.tar.gz - -$(zstd): | zstd-1.5.7 - cd zstd-1.5.7/build/cmake && $(CMAKE) -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_TESTS=OFF -DZSTD_MULTITHREAD_SUPPORT=OFF . - $(MAKE) -C zstd-1.5.7/build/cmake - $(MAKE) -C zstd-1.5.7/build/cmake install - -libarchive-3.7.8: - $(WGET) "https://github.com/libarchive/libarchive/releases/download/v3.7.8/libarchive-3.7.8.tar.gz" || $(WGET) "https://libarchive.org/downloads/libarchive-3.7.8.tar.gz" - $(SHA256) libarchive-3.7.8.tar.gz a123d87b1bd8adb19e8c187da17ae2d957c7f9596e741b929e6b9ceefea5ad0f - $(UNTAR) libarchive-3.7.8.tar.gz - rm libarchive-3.7.8.tar.gz - -$(libarchive): | $(zstd) libarchive-3.7.8 + mkdir -p zstd-1.5.6/tests/cli-tests/bin + touch zstd-1.5.6/tests/cli-tests/bin/zstd + $(UNTAR) zstd-1.5.6.tar.gz + rm zstd-1.5.6.tar.gz + +$(zstd): | zstd-1.5.6 + cd zstd-1.5.6/build/cmake && $(CMAKE) -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_TESTS=OFF -DZSTD_MULTITHREAD_SUPPORT=OFF . + $(MAKE) -C zstd-1.5.6/build/cmake + $(MAKE) -C zstd-1.5.6/build/cmake install + +libarchive-3.7.7: + $(WGET) "https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.tar.gz" || $(WGET) "https://libarchive.org/downloads/libarchive-3.7.7.tar.gz" + $(SHA256) libarchive-3.7.7.tar.gz 4cc540a3e9a1eebdefa1045d2e4184831100667e6d7d5b315bb1cbc951f8ddff + $(UNTAR) libarchive-3.7.7.tar.gz + rm libarchive-3.7.7.tar.gz + +$(libarchive): | $(zstd) libarchive-3.7.7 #cd libarchive-3.7.7 && $(CONFIGURE) --enable-shared=no --enable-static=yes --disable-bsdtar --disable-bsdcat --disable-bsdcpio --disable-posix-regex-lib --disable-xattr --disable-acl --without-zlib --without-bz2lib --without-libb2 --without-iconv --without-lz4 --without-lzma --without-cng --without-openssl --without-xml2 --without-expat - cd libarchive-3.7.8 && mkdir -p build - cd libarchive-3.7.8/build && $(CMAKE) -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_ACL=OFF -DENABLE_BZip2=OFF -DENABLE_CAT=OFF -DENABLE_CNG=OFF -DENABLE_COVERAGE=OFF -DENABLE_CPIO=OFF -DENABLE_EXPAT=OFF -DENABLE_ICONV=OFF -DENABLE_LIBB2=OFF -DENABLE_LIBXML2=OFF -DENABLE_LZ4=OFF -DENABLE_LZMA=OFF -DENABLE_LZO=OFF -DENABLE_MBEDTLS=OFF -DENABLE_NETTLE=OFF -DENABLE_OPENSSL=OFF -DENABLE_TAR=OFF -DENABLE_TEST=OFF -DENABLE_UNZIP=OFF -DENABLE_WERROR=OFF -DENABLE_XATTR=OFF -DENABLE_ZLIB=OFF -DENABLE_ZSTD=ON -DWINDOWS_VERSION="WIN7" -DZSTD_INCLUDE_DIR:PATH=$(DEP_PATH)/include -DZSTD_LIBRARY=$(DEP_PATH)/lib/libzstd.a .. - $(MAKE) -C libarchive-3.7.8/build - $(MAKE) -C libarchive-3.7.8/build install + cd libarchive-3.7.7 && mkdir -p build + # Increase policy version to support building with Cmake 4 + cd libarchive-3.7.7/build && $(CMAKE) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_ACL=OFF -DENABLE_BZip2=OFF -DENABLE_CAT=OFF -DENABLE_CNG=OFF -DENABLE_COVERAGE=OFF -DENABLE_CPIO=OFF -DENABLE_EXPAT=OFF -DENABLE_ICONV=OFF -DENABLE_LIBB2=OFF -DENABLE_LIBXML2=OFF -DENABLE_LZ4=OFF -DENABLE_LZMA=OFF -DENABLE_LZO=OFF -DENABLE_MBEDTLS=OFF -DENABLE_NETTLE=OFF -DENABLE_OPENSSL=OFF -DENABLE_TAR=OFF -DENABLE_TEST=OFF -DENABLE_UNZIP=OFF -DENABLE_WERROR=OFF -DENABLE_XATTR=OFF -DENABLE_ZLIB=OFF -DENABLE_ZSTD=ON -DWINDOWS_VERSION="WIN7" -DZSTD_INCLUDE_DIR:PATH=$(DEP_PATH)/include -DZSTD_LIBRARY=$(DEP_PATH)/lib/libzstd.a .. + $(MAKE) -C libarchive-3.7.7/build + $(MAKE) -C libarchive-3.7.7/build install $(libspeexdsp): | speexdsp cd speexdsp && ./autogen.sh @@ -177,18 +179,16 @@ $(libspeexdsp): | speexdsp $(MAKE) -C speexdsp $(MAKE) -C speexdsp install -libsamplerate-0.2.2: - $(WGET) "https://github.com/libsndfile/libsamplerate/releases/download/0.2.2/libsamplerate-0.2.2.tar.xz" - $(SHA256) libsamplerate-0.2.2.tar.xz 3258da280511d24b49d6b08615bbe824d0cacc9842b0e4caf11c52cf2b043893 - $(UNTAR) libsamplerate-0.2.2.tar.xz - rm libsamplerate-0.2.2.tar.xz +libsamplerate-0.1.9: + $(WGET) "https://github.com/libsndfile/libsamplerate/releases/download/0.1.9/libsamplerate-0.1.9.tar.gz" || $(WGET) "http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz" + $(SHA256) libsamplerate-0.1.9.tar.gz 0a7eb168e2f21353fb6d84da152e4512126f7dc48ccb0be80578c565413444c1 + $(UNTAR) libsamplerate-0.1.9.tar.gz + rm libsamplerate-0.1.9.tar.gz -$(libsamplerate): | libsamplerate-0.2.2 - cd libsamplerate-0.2.2 && mkdir build - cd libsamplerate-0.2.2/build && $(CMAKE) -DCMAKE_BUILD_TYPE=Release .. - cd libsamplerate-0.2.2/build && $(MAKE) install - cd libsamplerate-0.2.2/build && $(CMAKE) -DBUILD_SHARED_LIBS=ON .. - cd libsamplerate-0.2.2/build && $(MAKE) install +$(libsamplerate): | libsamplerate-0.1.9 + cd libsamplerate-0.1.9 && $(CONFIGURE) --disable-fftw --disable-sndfile + $(MAKE) -C libsamplerate-0.1.9 + $(MAKE) -C libsamplerate-0.1.9 install RTMIDI_FLAGS += --enable-shared=no ifdef ARCH_LIN @@ -215,10 +215,14 @@ ifdef ARCH_MAC RTAUDIO_FLAGS += -DRTAUDIO_API_CORE=ON -DRTAUDIO_API_PULSE=OFF -DRTAUDIO_API_JACK=OFF endif ifdef ARCH_WIN -RTAUDIO_FLAGS += -DRTAUDIO_API_DS=OFF -DRTAUDIO_API_WASAPI=ON +RTAUDIO_FLAGS += -DRTAUDIO_API_DS=ON -DRTAUDIO_API_WASAPI=ON # ASIO is proprietary software owned by Steinberg, so distributing it with your own VCV Rack build would violate Rack's GPLv3 license. # However, since VCV owns the copyright of all GPL'd code in the Rack package, we include ASIO in the Windows build for convenience to our users. +ifdef RTAUDIO_ASIO RTAUDIO_FLAGS += -DRTAUDIO_API_ASIO=ON +else +RTAUDIO_FLAGS += -DRTAUDIO_API_ASIO=OFF +endif endif # RtAudio on Windows and Mac uses these macros to enable UTF-8 device names @@ -267,7 +271,7 @@ $(simde): simde/simde # Helpers -src: glew-2.1.0 glfw jansson-2.14 libsamplerate-0.2.2 openssl-3.3.2 curl-8.10.0 zstd-1.5.7 libarchive-3.7.8 rtaudio nanovg nanosvg oui-blendish osdialog +src: glew-2.2.0 glfw jansson-2.12 libsamplerate-0.1.9 openssl-3.3.2 curl-8.10.0 zstd-1.5.6 libarchive-3.7.7 rtaudio nanovg nanosvg oui-blendish osdialog clean: git clean -fdx diff --git a/src/string.cpp b/src/string.cpp index d0c1712f..18a2e4aa 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -577,6 +577,7 @@ static std::map> translations; static void loadTranslations() { + INFO("Loading translations"); translations.clear(); std::string translationsDir = asset::system("translations"); diff --git a/src/window/Window.cpp b/src/window/Window.cpp index d4eeca06..59497645 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -98,7 +98,7 @@ struct Window::Internal { int lastWindowHeight = 0; int frame = 0; - bool ignoreNextMouseDelta = false; + double ignoreMouseDeltaUntil = -INFINITY; double monitorRefreshRate = 0.0; double frameTime = NAN; double lastFrameDuration = NAN; @@ -167,28 +167,15 @@ static void cursorPosCallback(GLFWwindow* win, double xpos, double ypos) { math::Vec mousePos = math::Vec(xpos, ypos).div(APP->window->pixelRatio / APP->window->windowRatio).round(); math::Vec mouseDelta = mousePos.minus(APP->window->internal->lastMousePos); + // if (glfwGetInputMode(win, GLFW_CURSOR) != GLFW_CURSOR_NORMAL && std::fabs(mouseDelta.y) > 20.0) { + // DEBUG("%d (%f, %f) (%f, %f)", APP->window->internal->frame, VEC_ARGS(mousePos), VEC_ARGS(mouseDelta)); + // } + // Workaround for GLFW warping mouse to a different position when the cursor is locked or unlocked. - if (APP->window->internal->ignoreNextMouseDelta) { - APP->window->internal->ignoreNextMouseDelta = false; + if (APP->window->internal->ignoreMouseDeltaUntil > APP->window->internal->frameTime) { mouseDelta = math::Vec(); } - int cursorMode = glfwGetInputMode(win, GLFW_CURSOR); - (void) cursorMode; - -#if defined ARCH_MAC - // Workaround for Mac. We can't use GLFW_CURSOR_DISABLED because it's buggy, so implement it on our own. - // This is not an ideal implementation. For example, if the user drags off the screen, the new mouse position will be clamped. - if (cursorMode == GLFW_CURSOR_HIDDEN) { - // CGSetLocalEventsSuppressionInterval(0.0); - glfwSetCursorPos(win, APP->window->internal->lastMousePos.x, APP->window->internal->lastMousePos.y); - CGAssociateMouseAndMouseCursorPosition(true); - mousePos = APP->window->internal->lastMousePos; - } - // Because sometimes the cursor turns into an arrow when its position is on the boundary of the window - glfwSetCursor(win, NULL); -#endif - APP->window->internal->lastMousePos = mousePos; APP->event->handleHover(mousePos, mouseDelta); @@ -647,12 +634,14 @@ void Window::cursorLock() { if (!settings::allowCursorLock) return; -#if defined ARCH_MAC - glfwSetInputMode(win, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); -#else glfwSetInputMode(win, GLFW_CURSOR, GLFW_CURSOR_DISABLED); + + // Due to a bug in GLFW, setting GLFW_CURSOR_DISABLED causes a spurious mouse position delta after a few frames. + // https://github.com/glfw/glfw/issues/2523 + // Emperically, this seems to be up to 3-6 frames at 60 Hz but in fewer frames at lower framerates. +#if defined ARCH_MAC + internal->ignoreMouseDeltaUntil = internal->frameTime + 0.09; #endif - internal->ignoreNextMouseDelta = true; } @@ -661,7 +650,6 @@ void Window::cursorUnlock() { return; glfwSetInputMode(win, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - internal->ignoreNextMouseDelta = true; } diff --git a/valgrind.supp b/valgrind.supp index 116f1a0b..dfdaf7fe 100644 --- a/valgrind.supp +++ b/valgrind.supp @@ -1,54 +1,55 @@ { - - Memcheck:Addr8 + <> + Memcheck:Cond + ... + fun:pa_mainloop_run +} +{ + <> + Memcheck:Cond ... - obj:/usr/lib/dri/i965_dri.so + obj:/usr/lib/libgallium* ... } { - - Memcheck:Addr4 + <> + Memcheck:Cond ... - obj:/usr/lib/dri/i965_dri.so + obj:/usr/lib/libGLX_mesa* ... } { - - Memcheck:Addr2 + <> + Memcheck:Leak ... - obj:/usr/lib/dri/i965_dri.so + obj:/usr/lib/libgallium* ... } { - - Memcheck:Addr1 + <> + Memcheck:Leak ... - obj:/usr/lib/dri/i965_dri.so + fun:snd_seq_open ... } - - { - + <> Memcheck:Leak - match-leak-kinds: possible ... - obj:/usr/lib/libasound.so.2.0.0 + fun:snd_config_update_r ... } { - + <> Memcheck:Leak - match-leak-kinds: definite ... - obj:/usr/lib/libgtk-x11-2.0.so.0.2400.32 + fun:_snd_config_load_with_include ... } { Memcheck:Leak - match-leak-kinds: possible ... - obj:/usr/lib/libgobject-2.0.so.0.5800.3 + fun:pa_pdispatch_run ... } \ No newline at end of file