994 const int w = maxint(window->w, _display->current_mode.w); |
994 const int w = maxint(window->w, _display->current_mode.w); |
995 const int h = maxint(window->h, _display->current_mode.h); |
995 const int h = maxint(window->h, _display->current_mode.h); |
996 unsigned long xattrmask = 0; |
996 unsigned long xattrmask = 0; |
997 XSetWindowAttributes xattr; |
997 XSetWindowAttributes xattr; |
998 XEvent ev; |
998 XEvent ev; |
999 int x = 0; |
999 SDL_Rect rect; |
1000 int y = 0; |
|
1001 |
1000 |
1002 if ( data->fswindow ) { |
1001 if ( data->fswindow ) { |
1003 return; /* already fullscreen, I hope. */ |
1002 return; /* already fullscreen, I hope. */ |
1004 } |
1003 } |
|
1004 |
|
1005 X11_GetDisplayBounds(_this, _display, &rect); |
1005 |
1006 |
1006 /* Ungrab the input so that we can move the mouse around */ |
1007 /* Ungrab the input so that we can move the mouse around */ |
1007 XUngrabPointer(display, CurrentTime); |
1008 XUngrabPointer(display, CurrentTime); |
1008 |
1009 |
1009 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
1010 #if SDL_VIDEO_DRIVER_X11_XINERAMA |
1018 xattr.border_pixel = 0; |
1019 xattr.border_pixel = 0; |
1019 xattrmask |= CWBorderPixel; |
1020 xattrmask |= CWBorderPixel; |
1020 xattr.colormap = data->colormap; |
1021 xattr.colormap = data->colormap; |
1021 xattrmask |= CWColormap; |
1022 xattrmask |= CWColormap; |
1022 |
1023 |
1023 data->fswindow = XCreateWindow(display, root, x, y, w, h, 0, |
1024 data->fswindow = XCreateWindow(display, root, |
|
1025 rect.x, rect.y, rect.w, rect.h, 0, |
1024 displaydata->depth, InputOutput, |
1026 displaydata->depth, InputOutput, |
1025 visual, xattrmask, &xattr); |
1027 visual, xattrmask, &xattr); |
1026 |
1028 |
1027 XSelectInput(display, data->fswindow, StructureNotifyMask); |
1029 XSelectInput(display, data->fswindow, StructureNotifyMask); |
1028 |
1030 |
1046 SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE); |
1048 SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE); |
1047 XFlush(display); |
1049 XFlush(display); |
1048 //XIfEvent(display, &ev, &isConfigureNotify, (XPointer)&data->xwindow); |
1050 //XIfEvent(display, &ev, &isConfigureNotify, (XPointer)&data->xwindow); |
1049 |
1051 |
1050 /* Center actual window within our cover-the-screen window. */ |
1052 /* Center actual window within our cover-the-screen window. */ |
1051 x += (w - window->w) / 2; |
1053 rect.x += (rect.w - window->w) / 2; |
1052 y += (h - window->h) / 2; |
1054 rect.y += (rect.h - window->h) / 2; |
1053 XReparentWindow(display, data->xwindow, data->fswindow, x, y); |
1055 XReparentWindow(display, data->xwindow, data->fswindow, rect.x, rect.y); |
1054 XRaiseWindow(display, data->xwindow); |
1056 XRaiseWindow(display, data->xwindow); |
1055 |
1057 |
1056 /* Make sure the fswindow is in view by warping mouse to the corner */ |
1058 /* Make sure the fswindow is in view by warping mouse to the corner */ |
1057 XWarpPointer(display, None, root, 0, 0, 0, 0, 0, 0); |
1059 XWarpPointer(display, None, root, 0, 0, 0, 0, 0, 0); |
1058 XFlush(display); |
1060 XFlush(display); |
1059 |
1061 |
1060 /* Center mouse in the window. */ |
1062 /* Center mouse in the window. */ |
1061 x += (window->w / 2); |
1063 rect.x += (window->w / 2); |
1062 y += (window->h / 2); |
1064 rect.y += (window->h / 2); |
1063 XWarpPointer(display, None, root, 0, 0, 0, 0, x, y); |
1065 XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); |
1064 |
1066 |
1065 /* Wait to be mapped, filter Unmap event out if it arrives. */ |
1067 /* Wait to be mapped, filter Unmap event out if it arrives. */ |
1066 XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow); |
1068 XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow); |
1067 |
1069 |
1068 /* Wait to be visible, or XSetInputFocus() triggers an X error. */ |
1070 /* Wait to be visible, or XSetInputFocus() triggers an X error. */ |