Remove special code in GLContext subwindow for different border handling

cases.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@27944 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2009-02-21 22:23:38 +00:00
parent 1cbd3fa6ed
commit 19b62c7318
3 changed files with 47 additions and 74 deletions

View file

@ -1,3 +1,9 @@
2009-02-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGGLContext.m (XGXSubWindow -initWithView:visualInfo:)
* Source/win32/w32_GLcontext.m (Win32Subwindow -initWithView:):
Remove special code for different window border handling.
2009-02-11 Riccardo Mottola <rmottola@users.sf.net> 2009-02-11 Riccardo Mottola <rmottola@users.sf.net>
* Source/win32/WIN32Server.m: Handle Alt-Gr (bug #25397) * Source/win32/WIN32Server.m: Handle Alt-Gr (bug #25397)

View file

@ -93,7 +93,7 @@ LRESULT CALLBACK win32SubwindowProc(
NSDebugMLLog(@"WGL", @"MS window class initialized (%u)", atom); NSDebugMLLog(@"WGL", @"MS window class initialized (%u)", atom);
} }
- (id) initWithView: (NSOpenGLView *) view - (id) initWithView: (NSOpenGLView *)view
{ {
NSRect rect; NSRect rect;
WIN32Server *server; WIN32Server *server;
@ -102,69 +102,53 @@ LRESULT CALLBACK win32SubwindowProc(
HINSTANCE hInstance; HINSTANCE hInstance;
WNDCLASS wclss; WNDCLASS wclss;
ATOM atom; ATOM atom;
RECT parent_rect;
self = [super init]; self = [super init];
if(self) if (!self)
{ return nil;
attached = (NSOpenGLView*)view;
win = [view window]; attached = (NSOpenGLView*)view;
NSAssert(win, @"request of a window attachment on a view that is not on a NSWindow");
if ([view isRotatedOrScaledFromBase]) win = [view window];
[NSException raise: NSInvalidArgumentException NSAssert(win, @"request of a window attachment on a view that is not on a NSWindow");
format: @"Cannot attach an window to a view that is rotated or scaled"];
server = (WIN32Server *)GSServerForWindow(win); if ([view isRotatedOrScaledFromBase])
NSAssert(server != nil, NSInternalInconsistencyException); [NSException raise: NSInvalidArgumentException
format: @"Cannot attach an window to a view that is rotated or scaled"];
NSAssert([server isKindOfClass: [WIN32Server class]], server = (WIN32Server *)GSServerForWindow(win);
NSInternalInconsistencyException); NSAssert(server != nil, NSInternalInconsistencyException);
if ([server handlesWindowDecorations] == YES) NSAssert([server isKindOfClass: [WIN32Server class]],
{ NSInternalInconsistencyException);
/* The window manager handles window decorations, so the
* the parent X window is equal to the content view and
* we must therefore use content view coordinates.
*/
rect = [view convertRect: [view bounds]
toView: [[view window] contentView]];
}
else
{
/* The GUI library handles window decorations, so the
* the parent X window is equal to the NSWindow frame
* and we can use window base coordinates.
*/
rect = [view convertRect: [view bounds] toView: nil];
}
hInstance = GetModuleHandle(NULL); hInstance = GetModuleHandle(NULL);
/* Grab the window class we have registered on [+initialize] */ /* Grab the window class we have registered on [+initialize] */
atom = GetClassInfo( hInstance, NSOPENGLSUBWINDOWCLASS, &wclss ); atom = GetClassInfo( hInstance, NSOPENGLSUBWINDOWCLASS, &wclss );
NSAssert(atom, @"MS window class not found !"); NSAssert(atom, @"MS window class not found !");
RECT parent_rect; GetClientRect((HWND)[win windowNumber], &parent_rect);
GetClientRect((HWND)[win windowNumber], &parent_rect);
x = NSMinX(rect); rect = [view convertRect: [view bounds] toView: nil];
y = (parent_rect.bottom - parent_rect.top) - NSMaxY(rect); x = NSMinX(rect);
width = NSWidth(rect); y = (parent_rect.bottom - parent_rect.top) - NSMaxY(rect);
height = NSHeight(rect); width = NSWidth(rect);
height = NSHeight(rect);
NSDebugMLLog(@"WGL", @"MS window creation (%d, %d, %u, %u)", x, y, width, height); NSDebugMLLog(@"WGL", @"MS window creation (%d, %d, %u, %u)", x, y, width, height);
winid = CreateWindow( winid = CreateWindow(
NSOPENGLSUBWINDOWCLASS, NSOPENGLSUBWINDOWNAME, NSOPENGLSUBWINDOWCLASS, NSOPENGLSUBWINDOWNAME,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
x, y, width, height, x, y, width, height,
(HWND)[win windowNumber], (HMENU)NULL, hInstance, (LPVOID)self); (HWND)[win windowNumber], (HMENU)NULL, hInstance, (LPVOID)self);
NSAssert(winid, @"Failed to create a MS window"); NSAssert(winid, @"Failed to create a MS window");
ShowCursor( TRUE );
ShowCursor( TRUE );
}
return self; return self;
} }

View file

@ -58,7 +58,7 @@
@implementation XGXSubWindow @implementation XGXSubWindow
//We assume that the current context is the same and is an XGServer //We assume that the current context is the same and is an XGServer
- initWithView:(NSView *)view visualinfo:(XVisualInfo *)xVisualInfo - initWithView: (NSView *)view visualinfo: (XVisualInfo *)xVisualInfo
{ {
NSRect rect; NSRect rect;
gswindow_device_t *win_info; gswindow_device_t *win_info;
@ -90,24 +90,7 @@
win_info = [XGServer _windowWithTag: [window windowNumber]]; win_info = [XGServer _windowWithTag: [window windowNumber]];
NSAssert(win_info, NSInternalInconsistencyException); NSAssert(win_info, NSInternalInconsistencyException);
if ([server handlesWindowDecorations] == YES) rect = [view convertRect: [view bounds] toView: nil];
{
/* The window manager handles window decorations, so the
* the parent X window is equal to the content view and
* we must therefore use content view coordinates.
*/
rect = [view convertRect: [view bounds]
toView: [[view window] contentView]];
}
else
{
/* The GUI library handles window decorations, so the
* the parent X window is equal to the NSWindow frame
* and we can use window base coordinates.
*/
rect = [view convertRect: [view bounds] toView: nil];
}
x = NSMinX(rect); x = NSMinX(rect);
y = NSHeight(win_info->xframe) - NSMaxY(rect); y = NSHeight(win_info->xframe) - NSMaxY(rect);
width = NSWidth(rect); width = NSWidth(rect);