diff --git a/direct/src/dist/FreezeTool.py b/direct/src/dist/FreezeTool.py index 18ecbf109a..9c318b8438 100644 --- a/direct/src/dist/FreezeTool.py +++ b/direct/src/dist/FreezeTool.py @@ -2372,6 +2372,17 @@ class PandaModuleFinder(modulefinder.ModuleFinder): path = self.path + if fullname == 'distutils' and hasattr(sys, 'real_prefix'): + # The PyPI version of virtualenv inserts a special version of + # distutils that does some bizarre stuff that won't work in our + # deployed application. Force it to find the regular one. + try: + fp, fn, stuff = self.find_module('opcode') + if fn: + path = [os.path.dirname(fn)] + path + except ImportError: + pass + # Look for the module on the search path. for dir_path in path: basename = os.path.join(dir_path, name.split('.')[-1]) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 6c514647af..824d20f3f3 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -3049,6 +3049,10 @@ class ShowBase(DirectObject.DirectObject): init_app_for_gui() + # Disable the Windows message loop, since Tcl wants to handle this all + # on its own. + ConfigVariableBool('disable-message-loop', False).value = True + if ConfigVariableBool('tk-main-loop', True): # Put Tkinter in charge of the main loop. It really # seems to like this better; the GUI otherwise becomes diff --git a/dtool/src/parser-inc/stdtypedefs.h b/dtool/src/parser-inc/stdtypedefs.h index 873ba9425d..bd49086295 100644 --- a/dtool/src/parser-inc/stdtypedefs.h +++ b/dtool/src/parser-inc/stdtypedefs.h @@ -27,16 +27,18 @@ typedef unsigned long ulong; typedef unsigned short ushort; typedef unsigned char uchar; -inline namespace std { #ifdef _WIN64 - typedef unsigned long long size_t; - typedef long long ssize_t; - typedef long long ptrdiff_t; +#define __SIZE_TYPE__ unsigned long long +#define __PTRDIFF_TYPE__ long long #else - typedef unsigned long size_t; - typedef long ssize_t; - typedef long ptrdiff_t; +#define __SIZE_TYPE__ unsigned long +#define __PTRDIFF_TYPE__ long #endif + +inline namespace std { + typedef __SIZE_TYPE__ size_t; + typedef __PTRDIFF_TYPE__ ssize_t; + typedef __PTRDIFF_TYPE__ ptrdiff_t; } struct timeval; diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index a1ac4aca11..49ffcd6962 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -614,8 +614,11 @@ if (COMPILER == "MSVC"): suffix = "-2_2" elif os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf-2_3.lib"): suffix = "-2_3" + elif os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf-2_4.lib"): + suffix = "-2_4" + LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Imath" + suffix + ".lib") if os.path.isfile(GetThirdpartyDir() + "openexr/lib/IlmImf" + suffix + "_s.lib"): - suffix += "_s" + suffix += "_s" # _s suffix observed for OpenEXR 2.3 only so far LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmImf" + suffix + ".lib") LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/IlmThread" + suffix + ".lib") LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Iex" + suffix + ".lib") diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 5e125e6fa0..e56d6aa159 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2479,6 +2479,8 @@ def SdkLocateAndroid(): return # Allow ANDROID_API/ANDROID_ABI to be used in makepanda.py. + if ANDROID_API is None: + SetTarget('android') api = ANDROID_API SDK["ANDROID_API"] = api diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 7b09d3424a..c769135c12 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -551,6 +551,11 @@ open_window() { _parent_window_handle->attach_child(_window_handle); } + // Always disable application HiDPI support, Cocoa will do the eventual upscaling for us. + // Note: setWantsBestResolutionOpenGLSurface method is supported from MacOS 10.7 onwards + if ([_view respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { + [_view setWantsBestResolutionOpenGLSurface:NO]; + } if (_properties.has_icon_filename()) { NSImage *image = load_image(_properties.get_icon_filename()); if (image != nil) { diff --git a/panda/src/device/ioKitInputDevice.cxx b/panda/src/device/ioKitInputDevice.cxx index 5ff35c4ab3..079614a99f 100644 --- a/panda/src/device/ioKitInputDevice.cxx +++ b/panda/src/device/ioKitInputDevice.cxx @@ -116,12 +116,14 @@ IOKitInputDevice(IOHIDDeviceRef device) : } CFArrayRef elements = IOHIDDeviceCopyMatchingElements(device, nullptr, 0); - CFIndex count = CFArrayGetCount(elements); - for (CFIndex i = 0; i < count; ++i) { - IOHIDElementRef element = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i); - parse_element(element); + if (elements) { + CFIndex count = CFArrayGetCount(elements); + for (CFIndex i = 0; i < count; ++i) { + IOHIDElementRef element = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i); + parse_element(element); + } + CFRelease(elements); } - CFRelease(elements); if (_hat_element != nullptr) { _hat_left_button = (int)_buttons.size(); diff --git a/panda/src/windisplay/config_windisplay.cxx b/panda/src/windisplay/config_windisplay.cxx index 62040c553a..ca3dc64f72 100644 --- a/panda/src/windisplay/config_windisplay.cxx +++ b/panda/src/windisplay/config_windisplay.cxx @@ -91,6 +91,13 @@ ConfigVariableBool paste_emit_keystrokes PRC_DESC("Handle paste events (Ctrl-V) as separate keystroke events for each " "pasted character.")); +ConfigVariableBool disable_message_loop +("disable-message-loop", false, + PRC_DESC("If this is false, Panda will process messages from the Windows " + "message loop, which is required for normal operation. You may set " + "this to true if some other UI framework (such as Tcl/Tk) needs " + "exclusive ownership of the message loop.")); + /** * 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/windisplay/config_windisplay.h b/panda/src/windisplay/config_windisplay.h index 7199b8603d..ae6568ec11 100644 --- a/panda/src/windisplay/config_windisplay.h +++ b/panda/src/windisplay/config_windisplay.h @@ -32,6 +32,7 @@ extern ConfigVariableBool request_dxdisplay_information; extern ConfigVariableBool dpi_aware; extern ConfigVariableBool dpi_window_resize; extern ConfigVariableBool paste_emit_keystrokes; +extern ConfigVariableBool disable_message_loop; extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock; diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 2f6ce8881d..a67ff3659c 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -258,10 +258,12 @@ process_events() { MSG msg; - // Handle all the messages on the queue in a row. Some of these might be - // for another window, but they will get dispatched appropriately. - while (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) { - process_1_event(); + if (!disable_message_loop) { + // Handle all the messages on the queue in a row. Some of these might be + // for another window, but they will get dispatched appropriately. + while (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) { + process_1_event(); + } } }