Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding of tab previews for pinned tabs fixed #3513

Merged
merged 2 commits into from
Nov 5, 2024
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
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Logger+Multiple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ extension Logger {
static var tabSnapshots = { Logger(subsystem: "Tab Snapshots", category: "") }()
static var tabLazyLoading = { Logger(subsystem: "Lazy Loading", category: "") }()
static var updates = { Logger(subsystem: "Updates", category: "") }()
static var tabPreview = { Logger(subsystem: "Tab Preview", category: "") }()
}
1 change: 1 addition & 0 deletions DuckDuckGo/MainWindow/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ final class MainViewController: NSViewController {

func windowDidResignKey() {
browserTabViewController.windowDidResignKey()
tabBarViewController.hideTabPreview()
}

func showBookmarkPromptIfNeeded() {
Expand Down
13 changes: 11 additions & 2 deletions DuckDuckGo/TabPreview/TabPreviewWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ final class TabPreviewWindowController: NSWindowController {
}

func show(parentWindow: NSWindow, topLeftPointInWindow: CGPoint) {
Logger.tabPreview.log("Showing tab preview")

func presentPreview(tabPreviewWindow: NSWindow) {
Logger.tabPreview.log("Presenting tab preview")

parentWindow.addChildWindow(tabPreviewWindow, ordered: .above)
self.layout(topLeftPoint: parentWindow.convertPoint(toScreen: topLeftPointInWindow))
}
Expand All @@ -83,7 +87,7 @@ final class TabPreviewWindowController: NSWindowController {

guard let childWindows = parentWindow.childWindows,
let tabPreviewWindow = self.window else {
Logger.general.error("TabPreviewWindowController: Showing tab preview window failed")
Logger.general.error("Showing tab preview window failed")
return
}

Expand All @@ -107,7 +111,11 @@ final class TabPreviewWindowController: NSWindowController {
}

func hide(allowQuickRedisplay: Bool = false, withDelay delay: Bool = false) {
Logger.tabPreview.log("Hiding tab preview allowQuickRedisplay:\(allowQuickRedisplay) delay:\(delay)")

func removePreview(allowQuickRedisplay: Bool) {
Logger.tabPreview.log("Removing tab preview allowQuickRedisplay:\(allowQuickRedisplay)")

guard let window = window else {
lastHideTime = nil
return
Expand All @@ -117,11 +125,12 @@ final class TabPreviewWindowController: NSWindowController {
if !allowQuickRedisplay {
lastHideTime = nil
}
window.orderOut(nil)
return
}

parentWindow.removeChildWindow(window)
(window).orderOut(nil)
window.orderOut(nil)

// Record the hide time
lastHideTime = allowQuickRedisplay ? Date() : nil
Expand Down
Loading