mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 17:12:24 +00:00
Fix -center to center on the main screen if window is off screen
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@35655 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2dd7f9fdcb
commit
0daa47b6fc
2 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2012-10-08 Doug Simons <doug.simons@testplant.com>
|
||||||
|
|
||||||
|
* NSWindow.m: Center on the main screen if window is off screen.
|
||||||
|
|
||||||
2012-09-04 Jonathan Gillaspie <jonathan.gillaspie@testplant.com>
|
2012-09-04 Jonathan Gillaspie <jonathan.gillaspie@testplant.com>
|
||||||
|
|
||||||
* Source/NSWorkspace.m: Log if we have a distributed lock error instead of raise fatally.
|
* Source/NSWorkspace.m: Log if we have a distributed lock error instead of raise fatally.
|
||||||
|
|
|
@ -2067,7 +2067,12 @@ many times.
|
||||||
|
|
||||||
- (void) center
|
- (void) center
|
||||||
{
|
{
|
||||||
NSSize screenSize = [[self screen] visibleFrame].size;
|
NSScreen *screen = [self screen];
|
||||||
|
// if not visible on any screen, center on the main screen
|
||||||
|
if (!screen) {
|
||||||
|
screen = [NSScreen mainScreen];
|
||||||
|
}
|
||||||
|
NSSize screenSize = [screen visibleFrame].size;
|
||||||
NSPoint origin = _frame.origin;
|
NSPoint origin = _frame.origin;
|
||||||
|
|
||||||
origin.x = (screenSize.width - _frame.size.width) / 2;
|
origin.x = (screenSize.width - _frame.size.width) / 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue