]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/settings.cpp
The mmedia contrib requires sys/soundcard.h on unix, so disable it on unix
[wxWidgets.git] / src / gtk1 / settings.cpp
index b8ace189883fcee87aa847ae5c36c4daa5f980e0..5efb1a3ebc7cca4cea9398b60e5b1a68cda9c825 100644 (file)
@@ -91,7 +91,8 @@ static bool GetColourFromGTKWidget(int& red, int& green, int& blue,
 
         case wxGTK_LIST:
             widget = gtk_list_new();
-       
+            break;
+
         case wxGTK_MENUITEM:
             widget = gtk_menu_item_new();
     }
@@ -307,9 +308,9 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
         case wxSYS_COLOUR_MAX:
         default:
             wxFAIL_MSG( _T("unknown system colour index") );
-  }
+    }
 
-  return *wxWHITE;
+    return *wxWHITE;
 }
 
 wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
@@ -371,6 +372,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
 int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
 {
 #ifdef __WXGTK20__
+    bool success = false;
+            
     guchar *data = NULL;
     GdkWindow *window = NULL;
     if(win && GTK_WIDGET_REALIZED(win->GetHandle()))
@@ -379,6 +382,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
 
     switch (index)
     {
+#ifdef __WXGTK20__
         case wxSYS_BORDER_X:
         case wxSYS_BORDER_Y:
         case wxSYS_EDGE_X:
@@ -418,9 +422,12 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
                     Atom type;
                     gint format;
                     gulong nitems;
-                    gulong bytes_after;
-    
-                    if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
+                    
+#if GTK_CHECK_VERSION(2,2,0)
+                    if (!gtk_check_version(2,2,0))
+                    {
+                        gulong bytes_after;
+                        success = (XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
                                             GDK_WINDOW_XWINDOW(window),
                                             gdk_x11_get_xatom_by_name_for_display (
                                                     gdk_drawable_get_display(window),
@@ -430,7 +437,10 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
                                             false, // do not delete property
                                             XA_CARDINAL, // 32 bit
                                             &type, &format, &nitems, &bytes_after, &data
-                                           ) == Success)
+                                           ) == Success);
+                    }
+#endif
+                    if (success)
                     {
                         int border_return = -1;
 
@@ -460,6 +470,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
             }
 
             return -1; // no window specified
+#endif // gtk2
 
         case wxSYS_CURSOR_X:
         case wxSYS_CURSOR_Y:
@@ -571,9 +582,12 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
             Atom type;
             gint format;
             gulong nitems;
-            gulong bytes_after;
 
-            if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
+#if GTK_CHECK_VERSION(2,2,0)
+            if (!gtk_check_version(2,2,0))
+            {
+                gulong bytes_after;
+                success = (XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
                                     GDK_WINDOW_XWINDOW(window),
                                     gdk_x11_get_xatom_by_name_for_display (
                                             gdk_drawable_get_display(window),
@@ -583,7 +597,10 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
                                     false, // do not delete property
                                     XA_CARDINAL, // 32 bit
                                     &type, &format, &nitems, &bytes_after, &data
-                                   ) == Success)
+                                   ) == Success);
+            }
+#endif
+            if (success)
             {
                 int caption_height = -1;