mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Restore window’s .level from last session
This commit is contained in:
parent
79db0c0e6e
commit
27d16d1c17
@ -5,6 +5,10 @@ Change Log
|
||||
4.5.4 (unreleased)
|
||||
--------------------------
|
||||
|
||||
### Improvements
|
||||
|
||||
- Restore the “Keep on Top” state of windows from the last session.
|
||||
|
||||
|
||||
|
||||
4.5.3 (564)
|
||||
|
@ -73,6 +73,7 @@ final class DocumentWindow: NSWindow {
|
||||
super.encodeRestorableState(with: coder, backgroundQueue: queue)
|
||||
|
||||
coder.encode(self.backgroundAlpha, forKey: #keyPath(backgroundAlpha))
|
||||
coder.encode(self.level, forKey: #keyPath(level))
|
||||
}
|
||||
|
||||
|
||||
@ -83,6 +84,9 @@ final class DocumentWindow: NSWindow {
|
||||
if let alpha = coder.decodeObject(of: NSNumber.self, forKey: #keyPath(backgroundAlpha)) as? CGFloat, alpha != 1 {
|
||||
self.backgroundAlpha = alpha
|
||||
}
|
||||
if let level = coder.decodeObject(of: NSNumber.self, forKey: #keyPath(level)) as? NSWindow.Level {
|
||||
self.level = level
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -128,6 +132,7 @@ final class DocumentWindow: NSWindow {
|
||||
@IBAction func toggleKeepOnTop(_ sender: Any?) {
|
||||
|
||||
self.level = (self.level == .floating) ? .normal : .floating
|
||||
self.invalidateRestorableState()
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user