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>
* 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);
}
- (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;
}

View file

@ -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);