mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 04:20:38 +00:00
Remove obsolete backend classes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5101 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ad16a5786c
commit
97eb87a61c
15 changed files with 421 additions and 52 deletions
|
@ -32,8 +32,23 @@
|
|||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSScreen.h>
|
||||
#include <AppKit/NSInterfaceStyle.h>
|
||||
#include <AppKit/NSGraphicsContext.h>
|
||||
#include <AppKit/DPSOperators.h>
|
||||
|
||||
|
||||
static int *
|
||||
_screen_numbers(void)
|
||||
{
|
||||
int count, *list;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
|
||||
DPScountscreenlist(ctxt, 0, &count);
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
list = NSZoneMalloc(NSDefaultMallocZone(), (count+1)*sizeof(int));
|
||||
DPSscreenlist(ctxt, 0, count, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@implementation NSScreen
|
||||
|
||||
|
@ -82,6 +97,10 @@ static NSScreen *mainScreen = nil;
|
|||
//
|
||||
- initWithDeviceDescription: (NSDictionary *)dict
|
||||
{
|
||||
int screen;
|
||||
float x, y, w, h;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
|
||||
[super init];
|
||||
depth = 0;
|
||||
frame = NSZeroRect;
|
||||
|
@ -89,6 +108,33 @@ static NSScreen *mainScreen = nil;
|
|||
device_desc = [dict mutableCopy];
|
||||
else
|
||||
device_desc = [[NSMutableDictionary dictionary] retain];
|
||||
|
||||
if ([ctxt isDrawingToScreen] == NO)
|
||||
{
|
||||
NSLog(@"Internal error: trying to find screen with wrong context\n");
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (!dict || [dict objectForKey: @"NSScreenKeyName"] == nil
|
||||
|| [[dict objectForKey: @"NSScreenKeyName"] isEqual: @"Main"])
|
||||
{
|
||||
/* Assume the main screen is the one we started with */
|
||||
int *windows = _screen_numbers();
|
||||
screen = 0;
|
||||
if (windows)
|
||||
screen = windows[0];
|
||||
NSZoneFree(NSDefaultMallocZone(), windows);
|
||||
}
|
||||
else if ([dict objectForKey: @"NSScreenNumber"])
|
||||
{
|
||||
screen = [[dict objectForKey: @"NSScreenNumber"] intValue];
|
||||
}
|
||||
/* Special hack to get screen frame since window number of root window
|
||||
is same as screen number */
|
||||
DPScurrentwindowbounds(ctxt, screen, &x, &y, &w, &h);
|
||||
frame = NSMakeRect(x, y, w, h);
|
||||
DPScurrentwindowdepth(ctxt, screen, &depth);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue