]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/utils.cpp
no message
[wxWidgets.git] / src / motif / utils.cpp
index 4567ad472d75b5bcf604b166b09e478e76dc4d5b..b8d38a52823918896cbe94cb13473c44bb930c3a 100644 (file)
@@ -126,7 +126,7 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
 }
 
 // Reading and writing resources (eg WIN.INI, .Xdefaults)
-#if USE_RESOURCES
+#if wxUSE_RESOURCES
 bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
 {
     // TODO
@@ -198,7 +198,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
   }
   else return FALSE;
 }
-#endif // USE_RESOURCES
+#endif // wxUSE_RESOURCES
 
 static int wxBusyCursorCount = 0;
 
@@ -257,21 +257,28 @@ void wxGetMousePosition( int* x, int* y )
 // Return TRUE if we have a colour display
 bool wxColourDisplay()
 {
-    // TODO
-    return TRUE;
+    Display *dpy = (Display*) wxGetDisplay();
+
+    if (DefaultDepth (dpy, DefaultScreen (dpy)) < 2)
+      return FALSE;
+    else
+      return TRUE;
 }
 
 // Returns depth of screen
 int wxDisplayDepth()
 {
-    // TODO
-    return 0;
+    Display *dpy = (Display*) wxGetDisplay();
+    return DefaultDepth (dpy, DefaultScreen (dpy));
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
-    // TODO
+  Display *dpy = (Display*) wxGetDisplay();
+  
+  *width = DisplayWidth (dpy, DefaultScreen (dpy));
+  *height = DisplayHeight (dpy, DefaultScreen (dpy));
 }
 
 /* Configurable display in Motif */
@@ -283,7 +290,12 @@ WXDisplay *wxGetDisplay()
   if (gs_currentDisplay)
     return gs_currentDisplay;
 
-  return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
+  if (wxTheApp && wxTheApp->GetTopLevelWidget())
+    return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
+  else if (wxTheApp)
+    return wxTheApp->GetInitialDisplay();
+  else
+    return (WXDisplay*) NULL;
 }
 
 bool wxSetDisplay(const wxString& display_name)