summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-20 15:48:07 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-08-20 15:48:07 -0400
commit086d947eeee09f8b2d4fdef0cdf7977e157524fd (patch)
tree69352f912570da4f85c8fe728c96de6621eeaae0
parent2d5e716dffd4dddfb3899a221100868813e35d21 (diff)
downloadeclipse.platform.swt-086d947eeee09f8b2d4fdef0cdf7977e157524fd.tar.gz
eclipse.platform.swt-086d947eeee09f8b2d4fdef0cdf7977e157524fd.tar.xz
eclipse.platform.swt-086d947eeee09f8b2d4fdef0cdf7977e157524fd.zip
Working on drawBand() Sash to omit gdk deprecated methodscairo_sash
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java46
1 files changed, 30 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index c5f7d7e901..91d03a2262 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.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.*;
@@ -144,23 +145,36 @@ void createHandle (int index) {
void drawBand (int x, int y, int width, int height) {
if ((style & SWT.SMOOTH) != 0) return;
- //TODO: Use Cairo
- int /*long*/ window = gtk_widget_get_window (parent.paintHandle());
+ int /*long*/ window = OS.gtk_widget_get_window(parent.paintHandle());
if (window == 0) return;
- byte [] bits = {-86, 85, -86, 85, -86, 85, -86, 85};
- int /*long*/ stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8);
- int /*long*/ gc = OS.gdk_gc_new (window);
- int /*long*/ colormap = OS.gdk_colormap_get_system();
- GdkColor color = new GdkColor ();
- OS.gdk_color_white (colormap, color);
- OS.gdk_gc_set_foreground (gc, color);
- OS.gdk_gc_set_stipple (gc, stipplePixmap);
- OS.gdk_gc_set_subwindow (gc, OS.GDK_INCLUDE_INFERIORS);
- OS.gdk_gc_set_fill (gc, OS.GDK_STIPPLED);
- OS.gdk_gc_set_function (gc, OS.GDK_XOR);
- OS.gdk_draw_rectangle (window, gc, 1, x, y, width, height);
- OS.g_object_unref (stipplePixmap);
- OS.g_object_unref (gc);
+ if (OS.USE_CAIRO) {
+ int /*long*/ cairo_new = OS.gdk_cairo_create(window);
+ int /*long*/ srcSurface = Cairo.cairo_get_target(cairo_new);
+ int /*long*/ cairo = Cairo.cairo_create(srcSurface);
+ if (cairo == 0) error (SWT.ERROR_NO_HANDLES);
+ Cairo.cairo_set_source_rgb(cairo, 1, 1, 1);
+ Cairo.cairo_set_operator(cairo, Cairo.CAIRO_OPERATOR_DIFFERENCE);
+ Cairo.cairo_rectangle(cairo, x, y, width, height);
+ Cairo.cairo_clip (cairo);
+ Cairo.cairo_paint(cairo);
+ Cairo.cairo_destroy(cairo);
+ } else {
+ byte [] bits = {-86, 85, -86, 85, -86, 85, -86, 85};
+ int /*long*/ stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8);
+ int /*long*/ gc = OS.gdk_gc_new (window);
+ int /*long*/ colormap = OS.gdk_colormap_get_system();
+ GdkColor color = new GdkColor ();
+ OS.gdk_color_white (colormap, color);
+ OS.gdk_gc_set_foreground (gc, color);
+ OS.gdk_gc_set_stipple (gc, stipplePixmap);
+ OS.gdk_gc_set_subwindow (gc, OS.GDK_INCLUDE_INFERIORS);
+ OS.gdk_gc_set_fill (gc, OS.GDK_STIPPLED);
+ OS.gdk_gc_set_function (gc, OS.GDK_XOR);
+ OS.gdk_draw_rectangle (window, gc, 1, x, y, width, height);
+ OS.g_object_unref (stipplePixmap);
+ OS.g_object_unref (gc);
+ }
+
}
int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ eventPtr) {