Commit 059ef6ad authored by Sam Lantinga's avatar Sam Lantinga

There is only one width and height for the window. If those are changed...

There is only one width and height for the window.  If those are changed during the course of a fullscreen mode change, then they'll stay that size when returning to windowed mode.
parent d63ef6e2
......@@ -86,43 +86,19 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
SDL_WINDOWPOS_ISUNDEFINED(data2)) {
return 0;
}
if (window->flags & SDL_WINDOW_FULLSCREEN) {
window->fullscreen.x = data1;
window->fullscreen.y = data1;
} else {
window->windowed.x = data1;
window->windowed.y = data1;
}
if (data1 == window->x && data2 == window->y) {
return 0;
}
window->x = data1;
window->y = data2;
if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* Do we really want to do this? */
return 0;
}
break;
case SDL_WINDOWEVENT_RESIZED:
if (window->flags & SDL_WINDOW_FULLSCREEN) {
window->fullscreen.w = data1;
window->fullscreen.h = data1;
} else {
window->windowed.w = data1;
window->windowed.h = data1;
}
if (data1 == window->w && data2 == window->h) {
return 0;
}
window->w = data1;
window->h = data2;
SDL_OnWindowResized(window);
if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* Do we really want to do this? */
return 0;
}
break;
case SDL_WINDOWEVENT_MINIMIZED:
if (window->flags & SDL_WINDOW_MINIMIZED) {
......
......@@ -72,20 +72,6 @@ struct SDL_Window
const void *magic;
Uint32 id;
char *title;
/* The fullscreen values */
struct {
int x, y;
int w, h;
} fullscreen;
/* The windowed values */
struct {
int x, y;
int w, h;
} windowed;
/* The public values */
int x, y;
int w, h;
Uint32 flags;
......
......@@ -1082,10 +1082,6 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt)
_this->SetWindowFullscreen(_this, window);
}
display->fullscreen_window = NULL;
/* Generate a mode change events here */
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
window->windowed.w, window->windowed.h);
}
SDL_Window *
......
......@@ -333,8 +333,8 @@ static __inline__ void ConvertNSRect(NSRect *r)
SDL_FingerID fingerId = (SDL_FingerID)[touch identity];
float x = [touch normalizedPosition].x;
float y = [touch normalizedPosition].y;
/* Make the origin the upper left instead of the lower left */
y = 1.0f - y;
/* Make the origin the upper left instead of the lower left */
y = 1.0f - y;
switch (type) {
case COCOA_TOUCH_DOWN:
......@@ -450,10 +450,10 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created
[contentView release];
ConvertNSRect(&rect);
window->fullscreen.x = window->windowed.x = window->x = (int)rect.origin.x;
window->fullscreen.y = window->windowed.y = window->y = (int)rect.origin.y;
window->fullscreen.w = window->windowed.w = window->w = (int)rect.size.width;
window->fullscreen.h = window->windowed.h = window->h = (int)rect.size.height;
window->x = (int)rect.origin.x;
window->y = (int)rect.origin.y;
window->w = (int)rect.size.width;
window->h = (int)rect.size.height;
}
if ([nswindow isVisible]) {
window->flags |= SDL_WINDOW_SHOWN;
......@@ -709,11 +709,10 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
NSWindow *nswindow = data->nswindow;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
NSRect rect;
unsigned int style;
if (FULLSCREEN_VISIBLE(window)) {
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_Rect bounds;
Cocoa_GetDisplayBounds(_this, display, &bounds);
......@@ -723,23 +722,16 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window)
rect.size.height = bounds.h;
ConvertNSRect(&rect);
style = NSBorderlessWindowMask;
[nswindow setStyleMask:NSBorderlessWindowMask];
[nswindow setContentSize:rect.size];
[nswindow setFrameOrigin:rect.origin];
} else {
rect.origin.x = window->windowed.x;
rect.origin.y = window->windowed.y;
rect.size.width = window->windowed.w;
rect.size.height = window->windowed.h;
/* FIXME: This calculation is wrong, we're changing the origin */
ConvertNSRect(&rect);
[nswindow setStyleMask:GetStyleMask(window)];
style = GetStyleMask(window);
// This doesn't seem to do anything...
//[nswindow setFrameOrigin:origin];
}
[nswindow setStyleMask:style];
[nswindow setContentSize:rect.size];
rect = [nswindow frameRectForContentRect:rect];
[nswindow setFrameOrigin:rect.origin];
#ifdef FULLSCREEN_TOGGLEABLE
if (FULLSCREEN_VISIBLE(window)) {
/* OpenGL is rendering to the window, so make it visible! */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment