|
@@ -89,9 +89,10 @@
|
|
|
|
|
|
static Uint32 s_moveHack;
|
|
static Uint32 s_moveHack;
|
|
|
|
|
|
-static void ConvertNSRect(NSRect *r)
|
|
|
|
|
|
+static void ConvertNSRect(NSScreen *screen, NSRect *r)
|
|
{
|
|
{
|
|
- r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
|
|
|
|
|
|
+ NSRect visibleScreen = [screen visibleFrame];
|
|
|
|
+ r->origin.y = visibleScreen.size.height - r->origin.y - r->size.height;
|
|
}
|
|
}
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -410,7 +411,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
|
SDL_Window *window = _data->window;
|
|
SDL_Window *window = _data->window;
|
|
NSWindow *nswindow = _data->nswindow;
|
|
NSWindow *nswindow = _data->nswindow;
|
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
|
|
|
|
if (s_moveHack) {
|
|
if (s_moveHack) {
|
|
SDL_bool blockMove = ((SDL_GetTicks() - s_moveHack) < 500);
|
|
SDL_bool blockMove = ((SDL_GetTicks() - s_moveHack) < 500);
|
|
@@ -421,7 +422,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
|
/* Cocoa is adjusting the window in response to a mode change */
|
|
/* Cocoa is adjusting the window in response to a mode change */
|
|
rect.origin.x = window->x;
|
|
rect.origin.x = window->x;
|
|
rect.origin.y = window->y;
|
|
rect.origin.y = window->y;
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
[nswindow setFrameOrigin:rect.origin];
|
|
[nswindow setFrameOrigin:rect.origin];
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -446,7 +447,7 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
|
NSWindow *nswindow = _data->nswindow;
|
|
NSWindow *nswindow = _data->nswindow;
|
|
int x, y, w, h;
|
|
int x, y, w, h;
|
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
x = (int)rect.origin.x;
|
|
x = (int)rect.origin.x;
|
|
y = (int)rect.origin.y;
|
|
y = (int)rect.origin.y;
|
|
w = (int)rect.size.width;
|
|
w = (int)rect.size.width;
|
|
@@ -931,7 +932,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
|
|
/* Fill in the SDL window with the window data */
|
|
/* Fill in the SDL window with the window data */
|
|
{
|
|
{
|
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
window->x = (int)rect.origin.x;
|
|
window->x = (int)rect.origin.x;
|
|
window->y = (int)rect.origin.y;
|
|
window->y = (int)rect.origin.y;
|
|
window->w = (int)rect.size.width;
|
|
window->w = (int)rect.size.width;
|
|
@@ -1007,7 +1008,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
|
|
rect.origin.y = window->y;
|
|
rect.origin.y = window->y;
|
|
rect.size.width = window->w;
|
|
rect.size.width = window->w;
|
|
rect.size.height = window->h;
|
|
rect.size.height = window->h;
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([[NSScreen screens] objectAtIndex:0], &rect);
|
|
|
|
|
|
style = GetWindowStyle(window);
|
|
style = GetWindowStyle(window);
|
|
|
|
|
|
@@ -1135,7 +1136,7 @@ Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
|
|
rect.origin.y = window->y;
|
|
rect.origin.y = window->y;
|
|
rect.size.width = window->w;
|
|
rect.size.width = window->w;
|
|
rect.size.height = window->h;
|
|
rect.size.height = window->h;
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
|
|
|
|
moveHack = s_moveHack;
|
|
moveHack = s_moveHack;
|
|
s_moveHack = 0;
|
|
s_moveHack = 0;
|
|
@@ -1335,7 +1336,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
|
rect.origin.y = bounds.y;
|
|
rect.origin.y = bounds.y;
|
|
rect.size.width = bounds.w;
|
|
rect.size.width = bounds.w;
|
|
rect.size.height = bounds.h;
|
|
rect.size.height = bounds.h;
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
|
|
|
|
/* Hack to fix origin on Mac OS X 10.4 */
|
|
/* Hack to fix origin on Mac OS X 10.4 */
|
|
NSRect screenRect = [[nswindow screen] frame];
|
|
NSRect screenRect = [[nswindow screen] frame];
|
|
@@ -1353,7 +1354,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
|
rect.origin.y = window->windowed.y;
|
|
rect.origin.y = window->windowed.y;
|
|
rect.size.width = window->windowed.w;
|
|
rect.size.width = window->windowed.w;
|
|
rect.size.height = window->windowed.h;
|
|
rect.size.height = window->windowed.h;
|
|
- ConvertNSRect(&rect);
|
|
|
|
|
|
+ ConvertNSRect([nswindow screen], &rect);
|
|
|
|
|
|
if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
|
|
if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
|
|
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)];
|
|
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)];
|