From ddaeb053672b15bacdb9bda5b47f47ed7c51969a Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Aug 2024 19:08:16 +0200 Subject: [PATCH 1/7] Fix compilation when building without bison --- direct/src/dcparser/dcParser.cxx.prebuilt | 2 +- dtool/src/cppparser/cppBison.cxx.prebuilt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/direct/src/dcparser/dcParser.cxx.prebuilt b/direct/src/dcparser/dcParser.cxx.prebuilt index 6f4f167302..aeab2dc34c 100644 --- a/direct/src/dcparser/dcParser.cxx.prebuilt +++ b/direct/src/dcparser/dcParser.cxx.prebuilt @@ -179,7 +179,7 @@ dc_cleanup_parser() { # endif # endif -#include "dcParser.yxx.h" +#include "dcParser.h" /* Symbol kind. */ enum yysymbol_kind_t { diff --git a/dtool/src/cppparser/cppBison.cxx.prebuilt b/dtool/src/cppparser/cppBison.cxx.prebuilt index 2acccd79f3..cf5abc195a 100644 --- a/dtool/src/cppparser/cppBison.cxx.prebuilt +++ b/dtool/src/cppparser/cppBison.cxx.prebuilt @@ -293,7 +293,7 @@ pop_struct() { # endif # endif -#include "cppBison.yxx.h" +#include "cppBison.h" /* Symbol kind. */ enum yysymbol_kind_t { From 78ace53dbe8c1a33c51f78729b97715016556a52 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Aug 2024 19:08:49 +0200 Subject: [PATCH 2/7] dtoolutil: Fix typo in pfstream causing compiler warning --- dtool/src/dtoolutil/pfstreamBuf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtool/src/dtoolutil/pfstreamBuf.cxx b/dtool/src/dtoolutil/pfstreamBuf.cxx index a5585ee3cd..a333eccf84 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.cxx +++ b/dtool/src/dtoolutil/pfstreamBuf.cxx @@ -183,7 +183,7 @@ is_open() const { */ bool PipeStreamBuf:: eof_pipe() const { - return (_pipe == nullptr) && feof(_pipe); + return (_pipe == nullptr) || feof(_pipe); } /** From 8d1524b6758a705d8f43ba1adca650b54c8e573d Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Aug 2024 19:09:08 +0200 Subject: [PATCH 3/7] distort: Fix unprotected debug output --- panda/src/distort/projectionScreen.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/panda/src/distort/projectionScreen.cxx b/panda/src/distort/projectionScreen.cxx index 74314bce06..7103511d17 100644 --- a/panda/src/distort/projectionScreen.cxx +++ b/panda/src/distort/projectionScreen.cxx @@ -451,9 +451,11 @@ recompute_geom_node(const WorkingNodePath &np, LMatrix4 &rel_mat, int num_geoms = node->get_num_geoms(); for (int i = 0; i < num_geoms; i++) { PT(Geom) geom = node->modify_geom(i); - distort_cat.debug() - << " " << *node << " got geom " << geom - << ", cache_ref = " << geom->get_cache_ref_count() << "\n"; + if (distort_cat.is_debug()) { + distort_cat.debug() + << " " << *node << " got geom " << geom + << ", cache_ref = " << geom->get_cache_ref_count() << "\n"; + } geom->test_ref_count_integrity(); recompute_geom(geom, rel_mat); } From 9e87af9dd74995bfcbaf0d820a9466b7df7573b6 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 14 Aug 2024 19:09:20 +0200 Subject: [PATCH 4/7] linmath: Fix compiler warning with gcc 14 --- panda/src/linmath/lorientation_src.I | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/linmath/lorientation_src.I b/panda/src/linmath/lorientation_src.I index 8cc56aa235..684f71118c 100644 --- a/panda/src/linmath/lorientation_src.I +++ b/panda/src/linmath/lorientation_src.I @@ -70,7 +70,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &m) { */ INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation):: operator * (const FLOATNAME(LRotation) &other) const { - return multiply((FLOATNAME(LOrientation) &)other); + return multiply((const FLOATNAME(LOrientation) &)other); } /** @@ -80,5 +80,5 @@ operator * (const FLOATNAME(LRotation) &other) const { INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation):: operator * (const FLOATNAME(LQuaternion) &other) const { nassert_raise("LOrientation * LQuaternion is undefined; use LOrientation * LRotation or LQuaternion * LQuaternion"); - return multiply((FLOATNAME(LOrientation) &)other); + return multiply((const FLOATNAME(LOrientation) &)other); } From 82b9a1266c9f008451edca0e938bfae30734061d Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 16 Sep 2024 13:29:01 +0200 Subject: [PATCH 5/7] cocoa: Fix error when switching to FS while macOS' FS is active --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index f0388a7ada..acf1fec0a9 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -858,7 +858,7 @@ set_properties_now(WindowProperties &properties) { [_window setLevel: NSNormalWindowLevel]; } if ([_window respondsToSelector:@selector(setStyleMask:)]) { - [_window setStyleMask:NSBorderlessWindowMask]; + [_window setStyleMask:([_window styleMask] & NSFullScreenWindowMask)]; } [_window makeFirstResponder:_view]; [_window setLevel:CGShieldingWindowLevel()]; @@ -897,7 +897,7 @@ set_properties_now(WindowProperties &properties) { // For some reason, setting the style mask makes it give up its // first-responder status. if ([_window respondsToSelector:@selector(setStyleMask:)]) { - [_window setStyleMask:NSBorderlessWindowMask]; + [_window setStyleMask:([_window styleMask] & NSFullScreenWindowMask)]; } [_window makeFirstResponder:_view]; [_window setLevel:CGShieldingWindowLevel()]; @@ -963,13 +963,12 @@ set_properties_now(WindowProperties &properties) { // here. if (!properties.has_undecorated() && !_properties.get_undecorated() && [_window respondsToSelector:@selector(setStyleMask:)]) { - if (properties.get_fixed_size()) { - [_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask | - NSMiniaturizableWindowMask ]; - } else { - [_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask | - NSMiniaturizableWindowMask | NSResizableWindowMask ]; + NSUInteger style = ([_window styleMask] & NSFullScreenWindowMask); + style |= NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask; + if (!properties.get_fixed_size()) { + style |= NSResizableWindowMask; } + [_window setStyleMask:style]; [_window makeFirstResponder:_view]; } } @@ -981,16 +980,14 @@ set_properties_now(WindowProperties &properties) { _properties.set_undecorated(properties.get_undecorated()); if (!_properties.get_fullscreen()) { - if (properties.get_undecorated()) { - [_window setStyleMask: NSBorderlessWindowMask]; - } else if (_properties.get_fixed_size()) { - // Fixed size windows should not show the resize button. - [_window setStyleMask: NSTitledWindowMask | NSClosableWindowMask | - NSMiniaturizableWindowMask ]; - } else { - [_window setStyleMask: NSTitledWindowMask | NSClosableWindowMask | - NSMiniaturizableWindowMask | NSResizableWindowMask ]; + NSUInteger style = ([_window styleMask] & NSFullScreenWindowMask); + if (!properties.get_undecorated()) { + style |= NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask; + if (!properties.get_fixed_size()) { + style |= NSResizableWindowMask; + } } + [_window setStyleMask:style]; [_window makeFirstResponder:_view]; } From c7bcec1ff53473d5eab0e6f2371fef5730516a3e Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 16 Sep 2024 13:29:38 +0200 Subject: [PATCH 6/7] cocoa: Exit macOS' fullscreen mode when switching fullscreen Prevents black screen when switching to fullscreen --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index acf1fec0a9..fde609cff8 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1475,6 +1475,11 @@ do_switch_fullscreen(CFDictionaryRef mode) { } if (_window != nil) { + // Exit macOS' own fullscreen mode, since our own fullscreen mode + // doesn't work properly with it. + if ([_window styleMask] & NSFullScreenWindowMask) { + [_window toggleFullScreen:nil]; + } [_window setFrame:frame display:YES]; [_view setFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)]; [_window update]; From e2fb2d12413fa765016c0e373b5016f1bdca04f6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 16 Sep 2024 13:30:06 +0200 Subject: [PATCH 7/7] cocoa: Prevent eating keyUp when switching to FS from macOS' FS --- panda/src/cocoadisplay/cocoaPandaApp.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaPandaApp.mm b/panda/src/cocoadisplay/cocoaPandaApp.mm index 83f0b8ef42..d256102a2c 100644 --- a/panda/src/cocoadisplay/cocoaPandaApp.mm +++ b/panda/src/cocoadisplay/cocoaPandaApp.mm @@ -16,11 +16,11 @@ @implementation CocoaPandaApp - (void) sendEvent: (NSEvent *) event { - // This is a hack that allows us to receive cmd-key-up events correctly. - // Also prevent it from eating the inserthelp key. - if (([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) - ||([event type] == NSKeyDown && [event keyCode] == 0x72)) { - + // This is a hack that allows us to receive cmd-key-up events correctly, as + // well as key-up events during a full-screen transition. + // Also prevent it from eating the insert/help key. + if ([event type] == NSKeyUp || + ([event type] == NSKeyDown && [event keyCode] == 0x72)) { [[self keyWindow] sendEvent: event]; } else { [super sendEvent: event];