From: Mikko Rasa Date: Mon, 23 Mar 2009 11:07:37 +0000 (+0000) Subject: Make xf86vidmode support optional X-Git-Tag: 1.1~3 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=683370ff99fb5d645ca4ef434ec4f3be1984364c;p=libs%2Fgui.git Make xf86vidmode support optional Some fixes to Image --- diff --git a/Build b/Build index 7447df7..591c30d 100644 --- a/Build +++ b/Build @@ -14,10 +14,6 @@ package "mspgbase" if "arch!=win32" { require "xlib"; - build_info - { - library "Xxf86vm"; - }; }; if "arch=win32" { @@ -46,6 +42,15 @@ package "mspgbase" require "opengl"; }; + feature "xf86vidmode" "Include support for video mode switching with xf86vidmode (not win32)"; + if "with_xf86vidmode and arch!=win32" + { + build_info + { + library "Xxf86vm"; + }; + }; + headers "gbase" { source "source/gbase"; diff --git a/source/gbase/display.cpp b/source/gbase/display.cpp index 5d79ca5..cb0cecc 100644 --- a/source/gbase/display.cpp +++ b/source/gbase/display.cpp @@ -8,8 +8,10 @@ Distributed under the LGPL #include #ifndef WIN32 #include +#ifdef WITH_XF86VIDMODE #include #endif +#endif #include #include #include @@ -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 } diff --git a/source/gbase/image.cpp b/source/gbase/image.cpp index c4b3a5a..81c1abe 100644 --- a/source/gbase/image.cpp +++ b/source/gbase/image.cpp @@ -175,6 +175,7 @@ void Image::load_file(const string &fn) throw Exception("Not a PNG image and DevIL support not compiled in"); #endif } + (void)fn; } void Image::load_memory(const void *data, unsigned size) @@ -195,9 +196,10 @@ void Image::load_memory(const void *data, unsigned size) throw Exception("Error loading image from memory"); #else throw Exception("Not a PNG image and DevIL support not compiled in"); - //(void)data; (void)size; #endif } + (void)data; + (void)size; } PixelFormat Image::get_format() const @@ -246,7 +248,7 @@ unsigned Image::get_height() const { #ifdef WITH_LIBPNG if(priv->data) - return priv->width; + return priv->height; #endif #ifdef WITH_DEVIL if(priv->id)