mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 20:50:38 +00:00
Allow wrapping of native windows into NSWindow.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22851 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3e3154f2f6
commit
d2dcf19356
4 changed files with 68 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-05-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/Additions/GNUstepGUI/GSDisplayServer.h (-nativeWindow:::::):
|
||||||
|
Added new method.
|
||||||
|
* Source/GSDisplayServer.m (-nativeWindow:::::):
|
||||||
|
Implemented this method as subclassResponsibility.
|
||||||
|
* Source/NSWindow.m (-initWithWindowRef:], -windowRef):
|
||||||
|
Implemented these methods to wrap native window into GNUstep windows.
|
||||||
|
|
||||||
2006-05-01 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-05-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSMatrix..m: ([performKeyEquivalent:]) Check modifier flags
|
* Source/NSMatrix..m: ([performKeyEquivalent:]) Check modifier flags
|
||||||
|
|
|
@ -116,6 +116,8 @@ APPKIT_EXPORT NSString * GSScreenNumber;
|
||||||
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
|
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
|
||||||
: (int)screen;
|
: (int)screen;
|
||||||
- (void) termwindow: (int) win;
|
- (void) termwindow: (int) win;
|
||||||
|
- (int) nativeWindow: (void *)winref : (NSRect*)frame : (NSBackingStoreType*)type
|
||||||
|
: (unsigned int*)style : (int*)screen;
|
||||||
|
|
||||||
/* Only if handlesWindowDecorations returns YES. */
|
/* Only if handlesWindowDecorations returns YES. */
|
||||||
- (void) stylewindow: (unsigned int) style : (int) win;
|
- (void) stylewindow: (unsigned int) style : (int) win;
|
||||||
|
|
|
@ -547,6 +547,15 @@ GSCurrentServer(void)
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create all the backend structures for a reference to a native window and
|
||||||
|
return the extend, backing type, style and screen for that window. */
|
||||||
|
- (int) nativeWindow: (void *)winref : (NSRect*)frame : (NSBackingStoreType*)type
|
||||||
|
: (unsigned int*)style : (int*)screen
|
||||||
|
{
|
||||||
|
[self subclassResponsibility: _cmd];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets the style of the window. See [NSWindow-styleMask] for a
|
/** Sets the style of the window. See [NSWindow-styleMask] for a
|
||||||
description of the available styles */
|
description of the available styles */
|
||||||
- (void) stylewindow: (unsigned int) style : (int) win
|
- (void) stylewindow: (unsigned int) style : (int) win
|
||||||
|
|
|
@ -984,6 +984,51 @@ many times.
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) initWithWindowRef: (void *)windowRef
|
||||||
|
{
|
||||||
|
NSRect contentRect;
|
||||||
|
unsigned int aStyle;
|
||||||
|
NSBackingStoreType bufferingType;
|
||||||
|
NSScreen* aScreen;
|
||||||
|
int screen;
|
||||||
|
int winNum;
|
||||||
|
NSGraphicsContext *context = GSCurrentContext();
|
||||||
|
GSDisplayServer *srv = GSCurrentServer();
|
||||||
|
|
||||||
|
// Get the properties for the underlying window
|
||||||
|
winNum = [srv nativeWindow: windowRef : &contentRect : &bufferingType
|
||||||
|
: &aStyle : &screen];
|
||||||
|
// FIXME: Get the screen for the right screen number.
|
||||||
|
aScreen = nil;
|
||||||
|
|
||||||
|
// Set up a NSWindow with the same properties
|
||||||
|
self = [self initWithContentRect: contentRect
|
||||||
|
styleMask: aStyle
|
||||||
|
backing: bufferingType
|
||||||
|
defer: YES
|
||||||
|
screen: aScreen];
|
||||||
|
|
||||||
|
// Fake the initialisation of the backend
|
||||||
|
_windowNum = winNum;
|
||||||
|
NSMapInsert (windowmaps, (void*)(intptr_t)_windowNum, self);
|
||||||
|
|
||||||
|
// Set window in new _gstate
|
||||||
|
DPSgsave(context);
|
||||||
|
[srv windowdevice: _windowNum];
|
||||||
|
_gstate = GSDefineGState(context);
|
||||||
|
DPSgrestore(context);
|
||||||
|
|
||||||
|
{
|
||||||
|
NSRect frame = _frame;
|
||||||
|
frame.origin = NSZeroPoint;
|
||||||
|
[_wv setFrame: frame];
|
||||||
|
[_wv setNeedsDisplay: YES];
|
||||||
|
[_wv setWindowNumber: _windowNum];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
-(void) colorListChanged:(NSNotification*)notif
|
-(void) colorListChanged:(NSNotification*)notif
|
||||||
{
|
{
|
||||||
if ([[notif object] isEqual: [NSColorList colorListNamed:@"System"]])
|
if ([[notif object] isEqual: [NSColorList colorListNamed:@"System"]])
|
||||||
|
@ -4222,20 +4267,11 @@ resetCursorRectsForView(NSView *theView)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithWindowRef: (void *)windowRef
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
NSLog(@"Method %s is not implemented for class %s",
|
|
||||||
"initWithWindowRef:", "NSWindow");
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void *)windowRef
|
- (void *)windowRef
|
||||||
{
|
{
|
||||||
// TODO
|
GSDisplayServer *srv = GSServerForWindow(self);
|
||||||
NSLog(@"Method %s is not implemented for class %s",
|
|
||||||
"windowRef", "NSWindow");
|
return [srv windowDevice: _windowNum];
|
||||||
return (void *) 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void *) windowHandle
|
- (void *) windowHandle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue