]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/cursor.cpp
fixed setting of initial font under wxGTK2
[wxWidgets.git] / src / gtk1 / cursor.cpp
index fe6c31ea390535506ea750e0ba46cbe1086d5993..4360b9748d770c3126796a878bdf2550d3ebeada 100644 (file)
@@ -7,11 +7,13 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "cursor.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/cursor.h"
 #include "wx/utils.h"
 #include "wx/app.h"
@@ -252,16 +254,27 @@ wxCursor::wxCursor( const wxImage & image )
                              (unsigned char)(colNextMostFreq >> 8),
                              (unsigned char)(colNextMostFreq) );
 
+    int fg_intensity = fg.Red() + fg.Green() + fg.Blue();
+    int bg_intensity = bg.Red() + bg.Green() + bg.Blue();
+       
+       if (bg_intensity > fg_intensity)
+       {
+        //swap fg and bg
+        wxColour tmp = fg;
+        fg = bg;
+        bg = tmp;
+       }                                                        
+
     int hotSpotX;
     int hotSpotY;
 
-    if (image.HasOption(wxCUR_HOTSPOT_X))
-        hotSpotX = image.GetOptionInt(wxCUR_HOTSPOT_X);
+    if (image.HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X))
+        hotSpotX = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
     else
         hotSpotX = 0;
 
-    if (image.HasOption(wxCUR_HOTSPOT_Y))
-        hotSpotY = image.GetOptionInt(wxCUR_HOTSPOT_Y);
+    if (image.HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y))
+        hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
     else
         hotSpotY = 0;