fix: hide window controls when another window is selected (closes #1557)
This commit is contained in:
1 parent
71543dc615
commit
2e9cc3b581
3 files changed
+12
-7
No files matched your search
@@ -74,6 +74,7 @@ They helped [localize the app](https://poeditor.com/join/project/8AOEZ0eAZE):
|
||||
* Jaeyong Sung
|
||||
* Jakob
|
||||
* Jakub Bartušek
|
||||
* john doe
|
||||
* Jord Nijhuis
|
||||
* Julian Nowaczyk
|
||||
* Kagurazaka Tsuki
|
||||
|
||||
@@ -23,6 +23,7 @@ class ThumbnailView: NSStackView {
|
||||
var shouldShowWindowControls = false
|
||||
var isShowingWindowControls = false
|
||||
var windowlessIcon = FontIcon(.newWindow)
|
||||
var mouseIsHovering = false
|
||||
|
||||
// for VoiceOver cursor
|
||||
override var canBecomeKeyView: Bool { true }
|
||||
@@ -66,11 +67,9 @@ class ThumbnailView: NSStackView {
|
||||
[closeIcon, minimizeIcon, maximizeIcon].forEach { $0.isHidden = true }
|
||||
}
|
||||
|
||||
func showOrHideWindowControls(_ shouldShowWindowControls_: Bool? = nil) {
|
||||
if let shouldShowWindowControls = shouldShowWindowControls_ {
|
||||
self.shouldShowWindowControls = shouldShowWindowControls
|
||||
}
|
||||
let shouldShow = shouldShowWindowControls && !Preferences.hideColoredCircles && !window_!.isWindowlessApp && !Preferences.hideThumbnails
|
||||
func showOrHideWindowControls(_ shouldShowWindowControls: Bool) {
|
||||
self.shouldShowWindowControls = shouldShowWindowControls
|
||||
let shouldShow = shouldShowWindowControls && !Preferences.hideColoredCircles && !(window_?.isWindowlessApp ?? true) && !Preferences.hideThumbnails
|
||||
if isShowingWindowControls != shouldShow {
|
||||
isShowingWindowControls = shouldShow
|
||||
[closeIcon, minimizeIcon, maximizeIcon].forEach { $0.isHidden = !shouldShow }
|
||||
@@ -92,7 +91,7 @@ class ThumbnailView: NSStackView {
|
||||
highlightOrNot()
|
||||
}
|
||||
}
|
||||
showOrHideWindowControls()
|
||||
showOrHideWindowControls(isHighlighted && mouseIsHovering)
|
||||
}
|
||||
|
||||
func highlightOrNot() {
|
||||
|
||||
@@ -220,14 +220,19 @@ class ScrollView: NSScrollView {
|
||||
if let target = target, target is ThumbnailView {
|
||||
if previousTarget != target {
|
||||
previousTarget?.showOrHideWindowControls(false)
|
||||
previousTarget?.mouseIsHovering = false
|
||||
previousTarget = target as? ThumbnailView
|
||||
}
|
||||
(target as! ThumbnailView).mouseMoved()
|
||||
let target = target as! ThumbnailView
|
||||
target.mouseMoved()
|
||||
target.mouseIsHovering = true
|
||||
} else {
|
||||
previousTarget?.showOrHideWindowControls(false)
|
||||
previousTarget?.mouseIsHovering = false
|
||||
}
|
||||
} else {
|
||||
previousTarget?.showOrHideWindowControls(false)
|
||||
previousTarget?.mouseIsHovering = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user