Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/CodeCaps/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, NSMe
/// console if (and only while) the console would cover it.
private func elevateConsole() {
guard let consoleWindow else { return }
consoleWindow.level = NSWindow.Level(Int(CGWindowLevelForKey(.popUpMenuWindow)) + 1)
consoleWindow.level = GlanceWindowLevels.consoleAboveGlance
glanceOcclusion.isOccluded = true
// The PiP HUD is documented to stay "visible on top of all windows at
// all times". The controller remembers the elevated console so a HUD
Expand Down
16 changes: 16 additions & 0 deletions Sources/CodeCaps/GlanceWindowLevels.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import AppKit

/// Window levels for Glance and the Settings/Console window (CC-26).
///
/// The Glance popover uses AppKit's pop-up menu level. When Settings or
/// Console opens while Glance is visible, the console is raised one step above
/// so it is not trapped behind the popover.
enum GlanceWindowLevels {
static var glancePopover: NSWindow.Level {
NSWindow.Level(Int(CGWindowLevelForKey(.popUpMenuWindow)))
}

static var consoleAboveGlance: NSWindow.Level {
NSWindow.Level(glancePopover.rawValue + 1)
}
}
4 changes: 3 additions & 1 deletion Sources/CodeCaps/PipWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@ struct PipWidgetView: View {
.padding(.vertical, PipMetrics.bodyVerticalPadding)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.background(Theme.groupBand)
// Match the vertical rows panel: a grey `groupBand` read as the silver
// header strip the owner asked to remove (CC-9).
.background(background.fill)
}

/// The row whose platform detail is open, if the owner clicked one. `nil`
Expand Down
20 changes: 20 additions & 0 deletions Tests/CodeCapsTests/GlanceWindowLevelsTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import AppKit
import XCTest
@testable import CodeCaps

/// CC-26: Settings/Console must layer above the Glance popover when elevated.
@MainActor
final class GlanceWindowLevelsTests: XCTestCase {
func testConsoleElevatedAboveGlancePopover() {
XCTAssertGreaterThan(
GlanceWindowLevels.consoleAboveGlance.rawValue,
GlanceWindowLevels.glancePopover.rawValue,
"Settings/Console opened from Glance must not sit behind the popover"
)
XCTAssertGreaterThan(
GlanceWindowLevels.glancePopover.rawValue,
NSWindow.Level.normal.rawValue,
"Glance popover is expected above ordinary document windows"
)
}
}
Loading