fix: smoother behavior when summoned during a space transition

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-09-05 04:01:32 +09:00
1 parent 66820a1e63
commit e6ded6c79b
5 files changed
+11 -9

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ class Screen {
static func preferred() -> NSScreen {
switch Preferences.showOnScreen {
case .includingMouse: return withMouse() ?? NSScreen.main! // .main as fall-back
case .active: return NSScreen.main!
case .active: return NSScreen.main! // macOS bug: this will return screens[0] if the main screen shows a fullscreen app
case .includingMenubar: return NSScreen.screens.first!
}
}
+3 -1
View File
@@ -195,7 +195,7 @@ class App: AppCenterApplication, NSApplicationDelegate {
guard appIsBeingUsed else { return }
thumbnailsPanel.thumbnailsView.updateItemsAndLayout(currentScreen)
guard appIsBeingUsed else { return }
thumbnailsPanel.setFrame(thumbnailsPanel.thumbnailsView.frame, display: false)
thumbnailsPanel.setContentSize(thumbnailsPanel.thumbnailsView.frame.size)
thumbnailsPanel.display()
guard appIsBeingUsed else { return }
Screen.repositionPanel(thumbnailsPanel, currentScreen, .appleCentered)
@@ -250,6 +250,8 @@ class App: AppCenterApplication, NSApplicationDelegate {
guard appIsBeingUsed else { return }
Applications.refreshBadges()
guard appIsBeingUsed else { return }
thumbnailsPanel.makeKeyAndOrderFront(nil) // workaround: without this, switching between 2 monitors make thumbnailPanel invisible
guard appIsBeingUsed else { return }
refreshOpenUi()
guard appIsBeingUsed else { return }
thumbnailsPanel.show()
+2 -3
View File
@@ -9,8 +9,8 @@ class FeedbackWindow: NSWindow {
var canBecomeKey_ = true
override var canBecomeKey: Bool { canBecomeKey_ }
override init(contentRect: NSRect, styleMask style: StyleMask, backing backingStoreType: BackingStoreType, defer flag: Bool) {
super.init(contentRect: .zero, styleMask: style, backing: backingStoreType, defer: flag)
convenience init() {
self.init(contentRect: .zero, styleMask: [.titled, .miniaturizable, .closable], backing: .buffered, defer: false)
setupWindow()
setupView()
}
@@ -19,7 +19,6 @@ class FeedbackWindow: NSWindow {
title = NSLocalizedString("Send feedback", comment: "")
hidesOnDeactivate = false
isReleasedWhenClosed = false
styleMask.insert([.miniaturizable, .closable])
}
private func setupView() {
+3 -1
View File
@@ -5,7 +5,7 @@ class ThumbnailsPanel: NSPanel {
override var canBecomeKey: Bool { true }
convenience init() {
self.init(contentRect: .zero, styleMask: .nonactivatingPanel, backing: .buffered, defer: true)
self.init(contentRect: .zero, styleMask: .nonactivatingPanel, backing: .buffered, defer: false)
isFloatingPanel = true
updateFadeOutAnimation()
hidesOnDeactivate = false
@@ -13,6 +13,8 @@ class ThumbnailsPanel: NSPanel {
titleVisibility = .hidden
backgroundColor = .clear
contentView!.addSubview(thumbnailsView)
preservesContentDuringLiveResize = false
disableSnapshotRestoration()
// 2nd highest level possible; this allows the app to go on top of context menus
// highest level is .screenSaver but makes drag and drop on top the main window impossible
level = .popUpMenu
@@ -5,8 +5,8 @@ class PreferencesWindow: NSWindow, NSToolbarDelegate {
var canBecomeKey_ = true
override var canBecomeKey: Bool { canBecomeKey_ }
override init(contentRect: NSRect, styleMask style: StyleMask, backing backingStoreType: BackingStoreType, defer flag: Bool) {
super.init(contentRect: .zero, styleMask: style, backing: backingStoreType, defer: flag)
convenience init() {
self.init(contentRect: .zero, styleMask: [.titled, .miniaturizable, .closable], backing: .buffered, defer: false)
setupWindow()
setupView()
}
@@ -14,7 +14,6 @@ class PreferencesWindow: NSWindow, NSToolbarDelegate {
private func setupWindow() {
isReleasedWhenClosed = false
hidesOnDeactivate = false
styleMask.insert([.miniaturizable, .closable])
addQuitButton()
}