GHost: Code cleanup, prepare for strict C++ flags
[blender.git] / intern / ghost / intern / GHOST_System.cpp
index 8c6491bcbfd95d971e028dfea459e03dba069b09..baa1bdff79ad450ae52e0ef23fff69f5eeefa288 100644 (file)
 
 
 GHOST_System::GHOST_System()
-       : m_displayManager(0),
-       m_timerManager(0),
-       m_windowManager(0),
-       m_eventManager(0)
+    : m_nativePixel(false),
+      m_displayManager(NULL),
+      m_timerManager(NULL),
+      m_windowManager(NULL),
+      m_eventManager(NULL)
 #ifdef WITH_INPUT_NDOF
-       , m_ndofManager(0)
+      , m_ndofManager(0)
 #endif
 {
 }
@@ -151,7 +152,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
                        success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
                        if (success == GHOST_kSuccess) {
                                //GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
-                               success = createFullScreenWindow((GHOST_Window **)window, stereoVisual, numOfAASamples);
+                               success = createFullScreenWindow((GHOST_Window **)window, setting, stereoVisual, numOfAASamples);
                                if (success == GHOST_kSuccess) {
                                        m_windowManager->beginFullScreen(*window, stereoVisual);
                                }
@@ -168,7 +169,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
 }
 
 
-GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window)
+GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow ** /*window*/)
 {
        GHOST_TSuccess success = GHOST_kFailure;
        GHOST_ASSERT(m_windowManager, "GHOST_System::updateFullScreen(): invalid window manager");
@@ -323,19 +324,19 @@ GHOST_TSuccess GHOST_System::exit()
        }
        if (m_displayManager) {
                delete m_displayManager;
-               m_displayManager = 0;
+               m_displayManager = NULL;
        }
        if (m_windowManager) {
                delete m_windowManager;
-               m_windowManager = 0;
+               m_windowManager = NULL;
        }
        if (m_timerManager) {
                delete m_timerManager;
-               m_timerManager = 0;
+               m_timerManager = NULL;
        }
        if (m_eventManager) {
                delete m_eventManager;
-               m_eventManager = 0;
+               m_eventManager = NULL;
        }
 #ifdef WITH_INPUT_NDOF
        if (m_ndofManager) {
@@ -346,30 +347,38 @@ GHOST_TSuccess GHOST_System::exit()
        return GHOST_kSuccess;
 }
 
-
-GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
+GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings,
+                                                    const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
 {
-       GHOST_TSuccess success;
-       GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager");
-       GHOST_DisplaySetting settings;
+       GHOST_GLSettings glSettings = {0};
 
-       success = m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, settings);
-       if (success) {
-               //GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
-               *window = (GHOST_Window *)createWindow(
-                   STR_String(""),
-                   0, 0, settings.xPixels, settings.yPixels,
-                   GHOST_kWindowStateFullScreen,
-                   GHOST_kDrawingContextTypeOpenGL,
-                   stereoVisual,
-                   numOfAASamples);
-               success = *window == 0 ? GHOST_kFailure : GHOST_kSuccess;
-       }
-       return success;
+       if (stereoVisual)
+               glSettings.flags |= GHOST_glStereoVisual;
+       glSettings.numOfAASamples = numOfAASamples;
+
+       /* note: don't use getCurrentDisplaySetting() because on X11 we may
+        * be zoomed in and the desktop may be bigger then the viewport. */
+       GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager");
+       //GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
+       *window = (GHOST_Window *)createWindow(
+           STR_String(""),
+           0, 0, settings.xPixels, settings.yPixels,
+           GHOST_kWindowStateNormal,
+           GHOST_kDrawingContextTypeOpenGL,
+           glSettings,
+           true  /* exclusive */);
+       return (*window == NULL) ? GHOST_kFailure : GHOST_kSuccess;
 }
 
 
-int GHOST_System::confirmQuit(GHOST_IWindow *window) const
+int GHOST_System::confirmQuit(GHOST_IWindow * /*window*/) const
+{
+       return 1;
+}
+
+bool GHOST_System::useNativePixel(void)
 {
+       m_nativePixel = true;
        return 1;
 }
+