From 19b62c731848acfa94370d824254844498b0f7b8 Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Sat, 21 Feb 2009 22:23:38 +0000 Subject: [PATCH] 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 --- ChangeLog | 6 +++ Source/win32/w32_GLcontext.m | 94 +++++++++++++++--------------------- Source/x11/XGGLContext.m | 21 +------- 3 files changed, 47 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40e7af8..50ea2e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-21 Fred Kiefer + + * 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 * Source/win32/WIN32Server.m: Handle Alt-Gr (bug #25397) diff --git a/Source/win32/w32_GLcontext.m b/Source/win32/w32_GLcontext.m index c239944..185fc4a 100644 --- a/Source/win32/w32_GLcontext.m +++ b/Source/win32/w32_GLcontext.m @@ -93,7 +93,7 @@ LRESULT CALLBACK win32SubwindowProc( NSDebugMLLog(@"WGL", @"MS window class initialized (%u)", atom); } -- (id) initWithView: (NSOpenGLView *) view +- (id) initWithView: (NSOpenGLView *)view { NSRect rect; WIN32Server *server; @@ -102,69 +102,53 @@ LRESULT CALLBACK win32SubwindowProc( HINSTANCE hInstance; WNDCLASS wclss; ATOM atom; + RECT parent_rect; self = [super init]; - if(self) - { - attached = (NSOpenGLView*)view; + if (!self) + return nil; - win = [view window]; - NSAssert(win, @"request of a window attachment on a view that is not on a NSWindow"); + attached = (NSOpenGLView*)view; - if ([view isRotatedOrScaledFromBase]) - [NSException raise: NSInvalidArgumentException - format: @"Cannot attach an window to a view that is rotated or scaled"]; + win = [view window]; + NSAssert(win, @"request of a window attachment on a view that is not on a NSWindow"); - server = (WIN32Server *)GSServerForWindow(win); - NSAssert(server != nil, NSInternalInconsistencyException); - - NSAssert([server isKindOfClass: [WIN32Server class]], - NSInternalInconsistencyException); - - if ([server handlesWindowDecorations] == YES) - { - /* 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); - - /* Grab the window class we have registered on [+initialize] */ - atom = GetClassInfo( hInstance, NSOPENGLSUBWINDOWCLASS, &wclss ); - NSAssert(atom, @"MS window class not found !"); - - RECT parent_rect; - GetClientRect((HWND)[win windowNumber], &parent_rect); - - x = NSMinX(rect); - y = (parent_rect.bottom - parent_rect.top) - NSMaxY(rect); - width = NSWidth(rect); - height = NSHeight(rect); + if ([view isRotatedOrScaledFromBase]) + [NSException raise: NSInvalidArgumentException + format: @"Cannot attach an window to a view that is rotated or scaled"]; - NSDebugMLLog(@"WGL", @"MS window creation (%d, %d, %u, %u)", x, y, width, height); + server = (WIN32Server *)GSServerForWindow(win); + NSAssert(server != nil, NSInternalInconsistencyException); - winid = CreateWindow( - NSOPENGLSUBWINDOWCLASS, NSOPENGLSUBWINDOWNAME, - WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, - x, y, width, height, - (HWND)[win windowNumber], (HMENU)NULL, hInstance, (LPVOID)self); + NSAssert([server isKindOfClass: [WIN32Server class]], + NSInternalInconsistencyException); - NSAssert(winid, @"Failed to create a MS window"); + hInstance = GetModuleHandle(NULL); + + /* Grab the window class we have registered on [+initialize] */ + atom = GetClassInfo( hInstance, NSOPENGLSUBWINDOWCLASS, &wclss ); + NSAssert(atom, @"MS window class not found !"); + + GetClientRect((HWND)[win windowNumber], &parent_rect); + + rect = [view convertRect: [view bounds] toView: nil]; + x = NSMinX(rect); + y = (parent_rect.bottom - parent_rect.top) - NSMaxY(rect); + width = NSWidth(rect); + height = NSHeight(rect); + + NSDebugMLLog(@"WGL", @"MS window creation (%d, %d, %u, %u)", x, y, width, height); + + winid = CreateWindow( + NSOPENGLSUBWINDOWCLASS, NSOPENGLSUBWINDOWNAME, + WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, + x, y, width, height, + (HWND)[win windowNumber], (HMENU)NULL, hInstance, (LPVOID)self); + + NSAssert(winid, @"Failed to create a MS window"); + + ShowCursor( TRUE ); - ShowCursor( TRUE ); - } return self; } diff --git a/Source/x11/XGGLContext.m b/Source/x11/XGGLContext.m index f562d73..e953c00 100644 --- a/Source/x11/XGGLContext.m +++ b/Source/x11/XGGLContext.m @@ -58,7 +58,7 @@ @implementation XGXSubWindow //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; gswindow_device_t *win_info; @@ -90,24 +90,7 @@ win_info = [XGServer _windowWithTag: [window windowNumber]]; NSAssert(win_info, NSInternalInconsistencyException); - if ([server handlesWindowDecorations] == YES) - { - /* 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]; - } - + rect = [view convertRect: [view bounds] toView: nil]; x = NSMinX(rect); y = NSHeight(win_info->xframe) - NSMaxY(rect); width = NSWidth(rect);