2023-11-01 21:11:11 +00:00
|
|
|
// This file Copyright © Transmission authors and contributors.
|
2022-01-20 18:27:56 +00:00
|
|
|
// It may be used under the MIT (SPDX: MIT) license.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-04-24 20:34:30 +00:00
|
|
|
#import "CocoaCompatibility.h"
|
|
|
|
|
2007-09-16 01:02:06 +00:00
|
|
|
#import "PrefsWindow.h"
|
|
|
|
|
|
|
|
@implementation PrefsWindow
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)awakeFromNib
|
|
|
|
{
|
2020-11-18 03:08:08 +00:00
|
|
|
[super awakeFromNib];
|
2021-08-15 09:41:48 +00:00
|
|
|
|
|
|
|
if (@available(macOS 11.0, *))
|
|
|
|
{
|
2020-11-18 03:08:08 +00:00
|
|
|
self.toolbarStyle = NSWindowToolbarStylePreference;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)keyDown:(NSEvent*)event
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2021-08-07 07:27:56 +00:00
|
|
|
if (event.keyCode == 53) //esc key
|
2021-08-15 09:41:48 +00:00
|
|
|
{
|
2007-09-16 01:02:06 +00:00
|
|
|
[self close];
|
2021-08-15 09:41:48 +00:00
|
|
|
}
|
2008-12-26 21:31:00 +00:00
|
|
|
else
|
2021-08-15 09:41:48 +00:00
|
|
|
{
|
|
|
|
[super keyDown:event];
|
|
|
|
}
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)close
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2021-08-15 09:41:48 +00:00
|
|
|
[self makeFirstResponder:nil]; //essentially saves pref changes on window close
|
2007-09-16 01:02:06 +00:00
|
|
|
[super close];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|