diff --git a/dtool/src/dtoolutil/pfstreamBuf.cxx b/dtool/src/dtoolutil/pfstreamBuf.cxx index f746ca5ac9..a9a2abd12a 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.cxx +++ b/dtool/src/dtoolutil/pfstreamBuf.cxx @@ -185,7 +185,7 @@ is_open() const { */ bool PipeStreamBuf:: eof_pipe() const { - return (_pipe == nullptr) && feof(_pipe); + return (_pipe == nullptr) || feof(_pipe); } /** diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 3aae8aee63..bfa35b41df 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -728,13 +728,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]; // Resize event fired by makeFirstResponder has an invalid backing scale factor // The actual size must be reset afterward @@ -749,16 +748,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]; // Resize event fired by makeFirstResponder has an invalid backing scale factor // The actual size must be reset afterward @@ -1176,10 +1173,16 @@ do_switch_fullscreen(CGDisplayModeRef 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]; + } + // 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()]; 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]; diff --git a/panda/src/distort/projectionScreen.cxx b/panda/src/distort/projectionScreen.cxx index 63120ea290..ff77e4448c 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); } 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); }