]> git.tdb.fi Git - libs/gui.git/blobdiff - source/gbase/display.cpp
Make xf86vidmode support optional
[libs/gui.git] / source / gbase / display.cpp
index 5d79ca5e9246210caa05472308e092f5b17c297b..cb0cecc59869fbd6aca14c5b8171bd7d63784349 100644 (file)
@@ -8,8 +8,10 @@ Distributed under the LGPL
 #include <iostream>
 #ifndef WIN32
 #include <X11/Xlib.h>
+#ifdef WITH_XF86VIDMODE
 #include <X11/extensions/xf86vmode.h>
 #endif
+#endif
 #include <msp/core/except.h>
 #include <msp/strings/formatter.h>
 #include <msp/strings/lexicalcast.h>
@@ -86,6 +88,7 @@ Display::Display(const string &disp_name):
 
        XSetErrorHandler(x_error_handler);
 
+#ifdef WITH_XF86VIDMODE
        int screen=DefaultScreen(priv->display);
 
        int nmodes;
@@ -110,6 +113,7 @@ Display::Display(const string &disp_name):
        if(modeline.htotal && modeline.vtotal)
                orig_mode.rate=dotclock/(modeline.htotal*modeline.vtotal);
 #endif
+#endif
 }
 
 Display::~Display()
@@ -132,7 +136,7 @@ void Display::remove_window(Window &wnd)
 
 void Display::set_mode(const VideoMode &mode)
 {
-#ifdef WIN32
+#if defined(WIN32)
        DEVMODE info;
        info.dmSize=sizeof(DEVMODE);
        info.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT;
@@ -145,7 +149,7 @@ void Display::set_mode(const VideoMode &mode)
        }
 
        ChangeDisplaySettings(&info, CDS_FULLSCREEN);
-#else
+#elif defined(WITH_XF86VIDMODE)
        int screen=DefaultScreen(priv->display);
 
        int nmodes;
@@ -167,6 +171,9 @@ void Display::set_mode(const VideoMode &mode)
        }
 
        throw InvalidParameterValue("Requested mode not supported");
+#else
+       (void)mode;
+       throw Exception("Video mode switching not supported");
 #endif
 }