mirror of
https://github.com/TermiT/Flycut.git
synced 2025-02-22 23:13:34 +08:00
25 lines
678 B
Objective-C
25 lines
678 B
Objective-C
//
|
|
// NSWindow+TrueCenter.m
|
|
// Flycut
|
|
//
|
|
// Flycut by Gennadiy Potapov and contributors. Based on Jumpcut by Steve Cook.
|
|
// Copyright 2011 General Arcade. All rights reserved.
|
|
//
|
|
// This code is open-source software subject to the MIT License; see the homepage
|
|
// at <https://github.com/TermiT/Flycut> for details.
|
|
//
|
|
//
|
|
|
|
#import "NSWindow+TrueCenter.h"
|
|
|
|
@implementation NSWindow (TrueCenter)
|
|
|
|
- (void)trueCenter {
|
|
NSRect frame = [self frame];
|
|
NSRect screen = [[self screen] frame];
|
|
frame.origin.x = (screen.size.width - frame.size. width) / 2;
|
|
frame.origin.y = (screen.size.height - frame.size.height) / 2;
|
|
[self setFrameOrigin:frame.origin];
|
|
}
|
|
|
|
@end
|