Code

Applying fix from LP #183646
authorozmikepittman <ozmikepittman@users.sourceforge.net>
Fri, 28 Mar 2008 00:35:36 +0000 (00:35 +0000)
committerozmikepittman <ozmikepittman@users.sourceforge.net>
Fri, 28 Mar 2008 00:35:36 +0000 (00:35 +0000)
src/libgdl/gdl-dock-master.c
src/libgdl/gdl-win32.c [new file with mode: 0644]
src/libgdl/gdl-win32.h [new file with mode: 0644]

index 205900702b05ac097d4d42c90cd40c7de689d121..1c362ed16f2f56986b94eae28f311602d5d4231f 100644 (file)
@@ -33,6 +33,9 @@
 #include "gdl-dock-item.h"
 #include "libgdlmarshal.h"
 #include "libgdltypebuiltins.h"
+#ifdef WIN32
+#include "gdl-win32.h"
+#endif
 
 /* ----- Private prototypes ----- */
 
@@ -645,8 +648,20 @@ gdl_dock_master_xor_rect (GdlDockMaster *master)
             window, &values, GDK_GC_FUNCTION | GDK_GC_SUBWINDOW);
     };
 
+#ifdef WIN32    
+    GdkLineStyle lineStyle = GDK_LINE_ON_OFF_DASH;
+    if (is_os_vista())
+    {
+        // On Vista the dash-line is increadibly slow to draw, it takes several minutes to draw the tracking lines
+        // With GDK_LINE_SOLID it is parts of a second
+        // No performance issue on WinXP
+        lineStyle = GDK_LINE_SOLID;
+    }
+#else
+    GdkLineStyle lineStyle = GDK_LINE_ON_OFF_DASH;
+#endif
     gdk_gc_set_line_attributes (master->_priv->root_xor_gc, 1,
-                                GDK_LINE_ON_OFF_DASH,
+                                lineStyle,
                                 GDK_CAP_NOT_LAST,
                                 GDK_JOIN_BEVEL);
     
diff --git a/src/libgdl/gdl-win32.c b/src/libgdl/gdl-win32.c
new file mode 100644 (file)
index 0000000..044befe
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+ * Windows stuff\r
+ *\r
+ * Author:\r
+ *   Albin Sunnanbo\r
+ *   Based on code by Lauris Kaplinski <lauris@kaplinski.com> (/src/extension/internal/win32.cpp)\r
+ *\r
+ * This code is in public domain\r
+ */\r
+\r
+#ifdef HAVE_CONFIG_H\r
+# include "config.h"\r
+#endif\r
+\r
+#include "gdl-win32.h"\r
+\r
+/* Platform detection */\r
+gboolean\r
+is_os_vista()\r
+{\r
+       static gboolean initialized = FALSE;\r
+       static gboolean is_vista = FALSE;\r
+       static OSVERSIONINFOA osver;\r
+\r
+       if ( !initialized )\r
+       {\r
+               BOOL result;\r
+\r
+               initialized = TRUE;\r
+\r
+               memset (&osver, 0, sizeof(OSVERSIONINFOA));\r
+               osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);\r
+               result = GetVersionExA (&osver);\r
+               if (result)\r
+               {\r
+                       if (osver.dwMajorVersion == WIN32_MAJORVERSION_VISTA)\r
+                               is_vista = TRUE;\r
+               }\r
+       }\r
+\r
+       return is_vista;\r
+}\r
diff --git a/src/libgdl/gdl-win32.h b/src/libgdl/gdl-win32.h
new file mode 100644 (file)
index 0000000..8fa0800
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __INKSCAPE_GDL_WIN32_H__\r
+#define __INKSCAPE_GDL_WIN32_H__\r
+\r
+/*\r
+ * Windows stuff\r
+ *\r
+ * Author:\r
+ *   Albin Sunnanbo\r
+ *\r
+ * This code is in public domain\r
+ */\r
+\r
+\r
+\r
+#define WIN32_MAJORVERSION_VISTA               0x0006\r
+\r
+\r
+\r
+#include <config.h>\r
+#include <windows.h>\r
+#include <gdk/gdk.h>\r
+\r
+#ifndef WIN32\r
+#error "This file is only usable for Windows"\r
+#endif\r
+\r
+/* Platform detection */\r
+gboolean is_os_vista();\r
+\r
+#endif /* __INKSCAPE_GDL_WIN32_H__ */\r