diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 624ae7a339..4b04141d3e 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -639,9 +639,14 @@ if (COMPILER == "MSVC"): if os.path.isfile(GetThirdpartyDir() + "openssl/lib/libpandassl.lib"): LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandassl.lib") LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libpandaeay.lib") - else: + elif os.path.isfile(GetThirdpartyDir() + "openssl/lib/ssleay32.lib"): LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libeay32.lib") LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/ssleay32.lib") + else: + LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libssl.lib") + LibName("OPENSSL", GetThirdpartyDir() + "openssl/lib/libcrypto.lib") + LibName("OPENSSL", "crypt32.lib") + LibName("OPENSSL", "ws2_32.lib") if (PkgSkip("PNG")==0): if os.path.isfile(GetThirdpartyDir() + "png/lib/libpng16_static.lib"): LibName("PNG", GetThirdpartyDir() + "png/lib/libpng16_static.lib") diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 29b0eaef5c..e5c6404c09 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1929,11 +1929,14 @@ handle_wheel_event(double x, double y) { _input->button_up(MouseButton::wheel_down()); } - // TODO: check if this is correct, I don't own a MacBook - if (x > 0.0) { + if (x != 0 && cocoa_invert_wheel_x) { + x = -x; + } + + if (x < 0.0) { _input->button_down(MouseButton::wheel_right()); _input->button_up(MouseButton::wheel_right()); - } else if (x < 0.0) { + } else if (x > 0.0) { _input->button_down(MouseButton::wheel_left()); _input->button_up(MouseButton::wheel_left()); } diff --git a/panda/src/cocoadisplay/config_cocoadisplay.h b/panda/src/cocoadisplay/config_cocoadisplay.h index 43a0e057c3..43051a67c5 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.h +++ b/panda/src/cocoadisplay/config_cocoadisplay.h @@ -20,6 +20,8 @@ NotifyCategoryDecl(cocoadisplay, EXPCL_PANDA_COCOADISPLAY, EXPTP_PANDA_COCOADISPLAY); +extern ConfigVariableBool cocoa_invert_wheel_x; + extern EXPCL_PANDA_COCOADISPLAY void init_libcocoadisplay(); #endif diff --git a/panda/src/cocoadisplay/config_cocoadisplay.mm b/panda/src/cocoadisplay/config_cocoadisplay.mm index 96662d6c9c..a79144769b 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.mm +++ b/panda/src/cocoadisplay/config_cocoadisplay.mm @@ -31,6 +31,11 @@ ConfigureFn(config_cocoadisplay) { init_libcocoadisplay(); } +ConfigVariableBool cocoa_invert_wheel_x +("cocoa-invert-wheel-x", false, + PRC_DESC("Set this to true to swap the wheel_left and wheel_right mouse " + "button events, to restore to the pre-1.10.12 behavior.")); + /** * Initializes the library. This must be called at least once before any of * the functions or classes in this library can be used. Normally it will be diff --git a/panda/src/device/ioKitInputDeviceManager.cxx b/panda/src/device/ioKitInputDeviceManager.cxx index 3f1c807469..aa8d67301c 100644 --- a/panda/src/device/ioKitInputDeviceManager.cxx +++ b/panda/src/device/ioKitInputDeviceManager.cxx @@ -16,6 +16,18 @@ #if defined(__APPLE__) && !defined(CPPPARSER) +static ConfigVariableBool iokit_scan_mouse_devices +("iokit-scan-mouse-devices", false, + PRC_DESC("Set this to true to enable capturing raw mouse data via IOKit on " + "macOS. This is disabled by default because newer macOS versions " + "will prompt the user explicitly for permissions when this is on.")); + +static ConfigVariableBool iokit_scan_keyboard_devices +("iokit-scan-keyboard-devices", false, + PRC_DESC("Set this to true to enable capturing raw keyboard data via IOKit on " + "macOS. This is disabled by default because newer macOS versions " + "will prompt the user explicitly for permissions when this is on.")); + /** * Initializes the input device manager by scanning which devices are currently * connected and setting up any platform-dependent structures necessary for @@ -34,15 +46,22 @@ IOKitInputDeviceManager() { int page = kHIDPage_GenericDesktop; int usages[] = {kHIDUsage_GD_GamePad, kHIDUsage_GD_Joystick, - kHIDUsage_GD_Mouse, - kHIDUsage_GD_Keyboard, - kHIDUsage_GD_MultiAxisController, 0}; - int *usage = usages; + kHIDUsage_GD_MultiAxisController, + 0, 0, 0}; + + int num_usages = 3; + if (iokit_scan_mouse_devices) { + usages[num_usages++] = kHIDUsage_GD_Mouse; + } + if (iokit_scan_keyboard_devices) { + usages[num_usages++] = kHIDUsage_GD_Keyboard; + } // This giant mess is necessary to create an array of match dictionaries // that will match the devices we're interested in. CFMutableArrayRef match = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); nassertv(match); + int *usage = usages; while (*usage) { CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFNumberRef page_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); diff --git a/panda/src/mathutil/plane_src.cxx b/panda/src/mathutil/plane_src.cxx index 7ba18701c6..4463d57756 100644 --- a/panda/src/mathutil/plane_src.cxx +++ b/panda/src/mathutil/plane_src.cxx @@ -158,3 +158,17 @@ void FLOATNAME(LPlane):: write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } + +/** + * Returns a string representation of this LPlane. + */ +std::string FLOATNAME(LPlane):: +__repr__() const { + std::ostringstream out; + out << "LPlane" << FLOATTOKEN << "(" + << MAYBE_ZERO(_v(0)) << ", " + << MAYBE_ZERO(_v(1)) << ", " + << MAYBE_ZERO(_v(2)) << ", " + << MAYBE_ZERO(_v(3)) << ")"; + return out.str(); +} diff --git a/panda/src/mathutil/plane_src.h b/panda/src/mathutil/plane_src.h index c1dffc4d5d..c1d7ef0252 100644 --- a/panda/src/mathutil/plane_src.h +++ b/panda/src/mathutil/plane_src.h @@ -61,6 +61,7 @@ PUBLISHED: void output(std::ostream &out) const; void write(std::ostream &out, int indent_level = 0) const; + std::string __repr__() const; }; INLINE_MATHUTIL std::ostream &