Procházet zdrojové kódy

CoreServices::getScreenInfo, Linux version fix: remove hard-to-compile gdk dependency; assume Linux is using SDL and jump straight to that solution.

mcc před 14 roky
rodič
revize
e081af097e
1 změnil soubory, kde provedl 2 přidání a 22 odebrání
  1. 2 22
      Core/Contents/Source/PolyCoreServices.cpp

+ 2 - 22
Core/Contents/Source/PolyCoreServices.cpp

@@ -43,9 +43,6 @@
 #elif defined(__APPLE__) && defined(__MACH__)
 #include <ApplicationServices/ApplicationServices.h>
 #elif defined(__linux) || defined(__linux__) || defined(linux)
-#include <X11/extensions/Xrandr.h>
-#include <gdk/gdkx.h>
-#elif defined(SDL_VERSION)
 #include <SDL/SDL.h>
 #endif
 
@@ -251,24 +248,7 @@ void CoreServices::getScreenInfo(int *width, int *height, int *hz) {
 	
 #elif defined(__linux) || defined(__linux__) || defined(linux)
 	
-    // Get the current configuration.
-    XRRScreenConfiguration *config = XRRGetScreenInfo(gdk_x11_get_default_xdisplay(),
-                                                      gdk_x11_get_default_root_xwindow());
-    int size_count;
-    // Obtain the dimensions.
-    XRRScreenSize *sizes = XRRConfigSizes(config, &size_count);
-    Rotation current_rotation;
-    SizeID current_mode = XRRConfigCurrentConfiguration(config, &current_rotation);
-	
-    // Store the results.
-    if (width) *width = sizes[current_mode].width;
-    if (height) *height = sizes[current_mode].height;
-    if (hz) *hz = XRRConfigCurrentRate(config); // Warning: On some drivers (nvidia?) this can lie.
-	
-    XRRFreeScreenConfigInfo(config);
-	
-#elif defined(SDL_VERSION)
-	
+	SDL_Init(SDL_INIT_VIDEO); // Or GetVideoInfo will not work
 	const SDL_VideoInfo *video = SDL_GetVideoInfo();
 	if (width) *width = video->current_w;
 	if (height) *height = video->current_h;
@@ -281,4 +261,4 @@ void CoreServices::getScreenInfo(int *width, int *height, int *hz) {
 	if (hz) *hz = 0;
 	
 #endif
-}
+}