]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/displayx11.cpp
Added an extra c header for memcmp and stuff...
[wxWidgets.git] / src / unix / displayx11.cpp
index 4e1bb56b841fb0f208896786ef927b3d2ed62044..93e52b192d86da24d77c352893c51aa2b6357198 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 #include "wx/display.h"
+#include "wx/intl.h"
 #include "wx/log.h"
 
 #ifndef WX_PRECOMP
@@ -38,7 +39,9 @@ extern "C" {
   #include <X11/Xlib.h>
   #include <X11/Xlibint.h>
   #include <X11/extensions/Xinerama.h>
+#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
   #include <X11/extensions/xf86vmode.h>
+#endif
 }
 
 class wxDisplayUnixPriv
@@ -81,9 +84,9 @@ int wxDisplayBase::GetFromPoint(const wxPoint &p)
     for (i = 0; i < numscreens; ++i)
     {
       if (p.x >= screenarr[i].x_org &&
-          p.x <= screenarr[i].x_org + screenarr[i].width &&
+          p.x < screenarr[i].x_org + screenarr[i].width &&
           p.y >= screenarr[i].y_org &&
-          p.y <= screenarr[i].y_org + screenarr[i].height)
+          p.y < screenarr[i].y_org + screenarr[i].height)
       {
         which_screen = i;
       }
@@ -96,9 +99,9 @@ int wxDisplayBase::GetFromPoint(const wxPoint &p)
   {
     wxSize size = wxGetDisplaySize();
     if (p.x >= 0 &&
-        p.x <= size.GetWidth() && 
-        p.y > 0 &&
-        p.y <= size.GetHeight())
+        p.x < size.GetWidth() &&
+        p.y >= 0 &&
+        p.y < size.GetHeight())
     {
         return 0;
     }
@@ -149,6 +152,9 @@ wxString wxDisplay::GetName() const
   return wxEmptyString;
 }
 
+
+#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
+
 //
 //  See (http://www.xfree86.org/4.2.0/XF86VidModeDeleteModeLine.3.html) for more
 //  info about xf86 video mode extensions
@@ -191,7 +197,7 @@ wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& mode) const
     }
     else //OOPS!
     {
-        wxLogSysError("XF86VidModeGetAllModeLines Failed in wxX11Display::GetModes()!");
+        wxLogSysError(_("Failed to enumerate video modes"));
     }
 
     return Modes;
@@ -252,11 +258,44 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
         }
         else //OOPS!
         {
-            wxLogSysError("XF86VidModeGetAllModeLines Failed in wxX11Display::ChangeMode()!");
+            wxLogSysError(_("Failed to change video mode"));
             return false;
         }
     }
 }
 
-#endif /* wxUSE_DISPLAY */
 
+#else // !HAVE_X11_EXTENSIONS_XF86VMODE_H
+
+wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& mode) const
+{
+  Display *disp = (Display*)wxGetDisplay();
+  int count_return;
+  int* depths = XListDepths(disp, 0, &count_return);
+  wxArrayVideoModes modes;
+  if (depths)
+  {
+    int x;
+    for (x = 0; x < count_return; ++x)
+    {
+      modes.Add(wxVideoMode(m_priv->m_rect.GetWidth(), m_priv->m_rect.GetHeight(), depths[x]));
+    }
+  }
+  return modes;
+}
+
+wxVideoMode wxDisplay::GetCurrentMode() const
+{
+    // Not implemented
+    return wxVideoMode();
+}
+
+bool wxDisplay::ChangeMode(const wxVideoMode& mode)
+{
+    // Not implemented
+    return false;
+}
+
+#endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H
+
+#endif /* wxUSE_DISPLAY */