diff src/video/x11/SDL_x11window.c @ 1956:ba0d62354872

Simplified driver window creation code. Implemented several Cocoa window functions
author Sam Lantinga <slouken@libsdl.org>
date Sat, 29 Jul 2006 21:51:00 +0000
parents 420716272158
children e906da4414a3
line wrap: on
line diff
--- a/src/video/x11/SDL_x11window.c	Sat Jul 29 03:57:55 2006 +0000
+++ b/src/video/x11/SDL_x11window.c	Sat Jul 29 21:51:00 2006 +0000
@@ -193,8 +193,7 @@
                             visual, AllocNone);
     }
 
-    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
-        window->x == SDL_WINDOWPOS_CENTERED) {
+    if (window->x == SDL_WINDOWPOS_CENTERED) {
         x = (DisplayWidth(data->display, displaydata->screen) -
              window->w) / 2;
     } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
@@ -202,8 +201,7 @@
     } else {
         x = window->x;
     }
-    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
-        window->y == SDL_WINDOWPOS_CENTERED) {
+    if (window->y == SDL_WINDOWPOS_CENTERED) {
         y = (DisplayHeight(data->display, displaydata->screen) -
              window->h) / 2;
     } else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
@@ -360,14 +358,7 @@
     wmhints = XAllocWMHints();
     if (wmhints) {
         wmhints->input = True;
-        if (window->flags & SDL_WINDOW_MINIMIZED) {
-            wmhints->initial_state = IconicState;
-        } else if (window->flags & SDL_WINDOW_SHOWN) {
-            wmhints->initial_state = NormalState;
-        } else {
-            wmhints->initial_state = WithdrawnState;
-        }
-        wmhints->flags = InputHint | StateHint;
+        wmhints->flags = InputHint;
         XSetWMHints(data->display, w, wmhints);
         XFree(wmhints);
     }
@@ -391,16 +382,6 @@
     /* Allow the window to be deleted by the window manager */
     XSetWMProtocols(data->display, w, &data->WM_DELETE_WINDOW, 1);
 
-    /* Finally, show the window */
-    if (window->flags & SDL_WINDOW_SHOWN) {
-        XEvent event;
-
-        XMapRaised(data->display, w);
-        do {
-            XCheckWindowEvent(data->display, w, StructureNotifyMask, &event);
-        } while (event.type != MapNotify);
-    }
-
     if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
 #ifdef SDL_VIDEO_OPENGL_GLX
         if (window->flags & SDL_WINDOW_OPENGL) {
@@ -410,9 +391,6 @@
         XDestroyWindow(data->display, w);
         return -1;
     }
-
-    X11_SetWindowTitle(_this, window);
-
     return 0;
 }
 
@@ -510,25 +488,8 @@
     SDL_DisplayData *displaydata =
         (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
     Display *display = data->videodata->display;
-    int x, y;
 
-    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
-        window->x == SDL_WINDOWPOS_CENTERED) {
-        x = (DisplayWidth(display, displaydata->screen) - window->w) / 2;
-    } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
-        x = 0;
-    } else {
-        x = window->x;
-    }
-    if ((window->flags & SDL_WINDOW_FULLSCREEN) ||
-        window->y == SDL_WINDOWPOS_CENTERED) {
-        y = (DisplayHeight(display, displaydata->screen) - window->h) / 2;
-    } else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
-        y = 0;
-    } else {
-        y = window->y;
-    }
-    XMoveWindow(display, data->window, x, y);
+    XMoveWindow(display, data->window, window->x, window->y);
 }
 
 void