diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-05-18 16:40:37 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-05-18 16:54:32 -0400 |
commit | 7eb39505fe0ea4da84d8b917779e7cdc43b38cc9 (patch) | |
tree | 6ecbcd411d039779d26c7dde2a8f1ecf9a9d3e05 | |
parent | 6f7e9db4a5109de2cb967f8161a35ca18fee8f28 (diff) | |
download | eclipse.platform.swt-7eb39505fe0ea4da84d8b917779e7cdc43b38cc9.tar.gz eclipse.platform.swt-7eb39505fe0ea4da84d8b917779e7cdc43b38cc9.tar.xz eclipse.platform.swt-7eb39505fe0ea4da84d8b917779e7cdc43b38cc9.zip |
Cairo implementation for tracker widget drawRectangles() method.tracker_cairo
Fixes incompatibility of Tracker with GTK 3.x by omitting use
of gdk_color_white and gdk_set_foreground deprecated methods.
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java index f24b0b0a1f..701085c35a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java @@ -12,6 +12,7 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.*; +import org.eclipse.swt.internal.cairo.Cairo; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; @@ -311,7 +312,25 @@ void drawRectangles (Rectangle [] rects) { window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); } if (window == 0) return; - //TODO: Use Cairo + + if(OS.USE_CAIRO){ + int /*long*/ cairo = OS.gdk_cairo_create(window); + if (cairo == 0) error (SWT.ERROR_NO_HANDLES); + + Cairo.cairo_set_source_rgb(cairo, 1, 1, 1); + Cairo.cairo_set_line_width(cairo, 1); + Cairo.cairo_set_operator(cairo,Cairo.CAIRO_OPERATOR_DIFFERENCE); + Cairo.cairo_set_antialias(cairo, Cairo.CAIRO_ANTIALIAS_NONE); + + for (int i=0; i<rects.length; i++) { + Rectangle rect = rects [i]; + Cairo.cairo_rectangle (cairo, rect.x, rect.y, rect.width, rect.height); + Cairo.cairo_stroke(cairo); + } + Cairo.cairo_destroy(cairo); + return; + } + int /*long*/ gc = OS.gdk_gc_new (window); if (gc == 0) return; int /*long*/ colormap = OS.gdk_colormap_get_system (); |