/* CENTRY */ void APIENTRY glutFullScreen(void) { assert(!__glutCurrentWindow->parent); IGNORE_IN_GAME_MODE(); #if !defined(_WIN32) if (__glutMotifHints == None) { __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", SGI_XA__MOTIF_WM_HINTS, 0); if (__glutMotifHints == None) { __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); } } #endif __glutCurrentWindow->desiredX = 0; __glutCurrentWindow->desiredY = 0; __glutCurrentWindow->desiredWidth = __glutScreenWidth; __glutCurrentWindow->desiredHeight = __glutScreenHeight; __glutCurrentWindow->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); }
/* There isn't any concept of multiple screens in Win32, therefore, we don't need to keep track of the screen we're on... it's always the same one. */ __glutScreen = 0; } #else /* !_WIN32 */ void __glutOpenXConnection(char *display) { int errorBase, eventBase; __glutDisplay = XOpenDisplay(display); if (!__glutDisplay) __glutFatalError("could not open display: %s", XDisplayName(display)); if (synchronize) XSynchronize(__glutDisplay, True); if (!glXQueryExtension(__glutDisplay, &errorBase, &eventBase)) __glutFatalError( "OpenGL GLX extension not supported by display: %s", XDisplayName(display)); __glutScreen = DefaultScreen(__glutDisplay); __glutRoot = RootWindow(__glutDisplay, __glutScreen); __glutScreenWidth = DisplayWidth(__glutDisplay, __glutScreen); __glutScreenHeight = DisplayHeight(__glutDisplay, __glutScreen); __glutConnectionFD = ConnectionNumber(__glutDisplay); __glutWMDeleteWindow = XSGIFastInternAtom(__glutDisplay, "WM_DELETE_WINDOW", SGI_XA_WM_DELETE_WINDOW, False); }
int GLUTAPIENTRY glutEnterGameMode(void) { GLUTwindow *window; int width, height; Window win; if (__glutMappedMenu) { __glutFatalUsage("entering game mode not allowed while menus in use"); } if (__glutGameModeWindow) { /* Already in game mode, so blow away game mode window so apps can change resolutions. */ window = __glutGameModeWindow; /* Setting the game mode window to NULL tricks the window destroy code into not undoing the screen display change since we plan on immediately doing another mode change. */ __glutGameModeWindow = NULL; __glutDestroyWindow(window, window); } /* Assume default screen size until we find out if we can actually change the display settings. */ width = __glutScreenWidth; height = __glutScreenHeight; if (currentDm) { #ifdef _WIN32 LONG status; static int registered = 0; status = ChangeDisplaySettings(¤tDm->devmode, CDS_FULLSCREEN); if (status == DISP_CHANGE_SUCCESSFUL) { __glutDisplaySettingsChanged = 1; width = currentDm->cap[DM_WIDTH]; height = currentDm->cap[DM_HEIGHT]; if (!registered) { atexit(__glutCloseDownGameMode); registered = 1; } } else { /* Switch back to default resolution. */ ChangeDisplaySettings(NULL, 0); } #endif } window = __glutCreateWindow(NULL, 0, 0, width, height, /* game mode */ 1); win = window->win; #if !defined(_WIN32) if (__glutMotifHints == None) { __glutMotifHints = XSGIFastInternAtom(__glutDisplay, "_MOTIF_WM_HINTS", SGI_XA__MOTIF_WM_HINTS, 0); if (__glutMotifHints == None) { __glutWarning("Could not intern X atom for _MOTIF_WM_HINTS."); } } /* Game mode window is a toplevel window. */ XSetWMProtocols(__glutDisplay, win, &__glutWMDeleteWindow, 1); #endif /* Schedule the fullscreen property to be added and to make sure the window is configured right. Win32 doesn't need this. */ window->desiredX = 0; window->desiredY = 0; window->desiredWidth = width; window->desiredHeight = height; window->desiredConfMask |= CWX | CWY | CWWidth | CWHeight; #ifdef _WIN32 /* Win32 does not want to use GLUT_FULL_SCREEN_WORK for game mode because we need to be maximizing the window in game mode, not just sizing it to take up the full screen. The Win32-ness of game mode happens when you pass 1 in the gameMode parameter to __glutCreateWindow above. A gameMode of creates a WS_POPUP window, not a standard WS_OVERLAPPEDWINDOW window. WS_POPUP ensures the taskbar is hidden. */ __glutPutOnWorkList(window, GLUT_CONFIGURE_WORK); #else __glutPutOnWorkList(window, GLUT_CONFIGURE_WORK | GLUT_FULL_SCREEN_WORK); #endif __glutGameModeWindow = window; return window->num + 1; }