* commit '19b03e4ef1e7861b938dd7c52356af5396f456b3': EmuGL: fix GL view position in window on OS X
This commit is contained in:
@@ -36,10 +36,18 @@
|
|||||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||||
EGLNativeDisplayType* display_out,
|
EGLNativeDisplayType* display_out,
|
||||||
int x, int y,int width, int height){
|
int x, int y,int width, int height){
|
||||||
NSRect contentRect = NSMakeRect(x, y, width, height);
|
NSWindow *win = (NSWindow *)p_window;
|
||||||
|
if (!win) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (x,y) assume an upper-left origin, but Cocoa uses a lower-left origin */
|
||||||
|
NSRect content_rect = [win contentRectForFrameRect:[win frame]];
|
||||||
|
int cocoa_y = (int)content_rect.size.height - (y + height);
|
||||||
|
NSRect contentRect = NSMakeRect(x, cocoa_y, width, height);
|
||||||
|
|
||||||
NSView *glView = [[EmuGLView alloc] initWithFrame:contentRect];
|
NSView *glView = [[EmuGLView alloc] initWithFrame:contentRect];
|
||||||
if (glView) {
|
if (glView) {
|
||||||
NSWindow *win = (NSWindow *)p_window;
|
|
||||||
[[win contentView] addSubview:glView];
|
[[win contentView] addSubview:glView];
|
||||||
[win makeKeyAndOrderFront:nil];
|
[win makeKeyAndOrderFront:nil];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user