Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2012-10-31 18:47:00 +0000
committerSilenio Quarti2012-10-31 18:47:00 +0000
commit78fbb6844fc73f459133f9bf8c4ddac92e6ea668 (patch)
tree8181d7f99c45b58f632d15c2ea2c83a8fb75c902
parent5bcc927d92fd92a4706eebf73a5e873324a4a777 (diff)
downloadeclipse.platform.swt-78fbb6844fc73f459133f9bf8c4ddac92e6ea668.tar.gz
eclipse.platform.swt-78fbb6844fc73f459133f9bf8c4ddac92e6ea668.tar.xz
eclipse.platform.swt-78fbb6844fc73f459133f9bf8c4ddac92e6ea668.zip
fix tree/table rendering and inherit background
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c44
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java92
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java4
9 files changed, 222 insertions, 66 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index ba7fcf804f..a6b09ad307 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -2265,14 +2265,48 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1atk_1object_1remove_1relationship)
}
#endif
-#ifndef NO__1call
-JNIEXPORT jintLong JNICALL OS_NATIVE(_1call)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6, jintLong arg7)
+#if (!defined(NO__1call__IIIIIII) && !defined(JNI64)) || (!defined(NO__1call__JJJJJJJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1call__IIIIIII)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6)
+#else
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1call__JJJJJJJ)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6)
+#endif
+{
+ jintLong rc = 0;
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, _1call__IIIIIII_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, _1call__JJJJJJJ_FUNC);
+#endif
+ rc = (jintLong)((jintLong (*)())arg0)(arg1, arg2, arg3, arg4, arg5, arg6);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, _1call__IIIIIII_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, _1call__JJJJJJJ_FUNC);
+#endif
+ return rc;
+}
+#endif
+
+#if (!defined(NO__1call__IIIIIIII) && !defined(JNI64)) || (!defined(NO__1call__JJJJJJJJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1call__IIIIIIII)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6, jintLong arg7)
+#else
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1call__JJJJJJJJ)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6, jintLong arg7)
+#endif
{
jintLong rc = 0;
- OS_NATIVE_ENTER(env, that, _1call_FUNC);
+#ifndef JNI64
+ OS_NATIVE_ENTER(env, that, _1call__IIIIIIII_FUNC);
+#else
+ OS_NATIVE_ENTER(env, that, _1call__JJJJJJJJ_FUNC);
+#endif
rc = (jintLong)((jintLong (*)())arg0)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- OS_NATIVE_EXIT(env, that, _1call_FUNC);
+#ifndef JNI64
+ OS_NATIVE_EXIT(env, that, _1call__IIIIIIII_FUNC);
+#else
+ OS_NATIVE_EXIT(env, that, _1call__JJJJJJJJ_FUNC);
+#endif
return rc;
}
#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index b75cba018f..989589987b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -201,7 +201,16 @@ char * OS_nativeFunctionNames[] = {
"_1access",
"_1atk_1object_1add_1relationship",
"_1atk_1object_1remove_1relationship",
- "_1call",
+#ifndef JNI64
+ "_1call__IIIIIII",
+#else
+ "_1call__JJJJJJJ",
+#endif
+#ifndef JNI64
+ "_1call__IIIIIIII",
+#else
+ "_1call__JJJJJJJJ",
+#endif
"_1call_1get_1size",
"_1dlclose",
"_1dlopen",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 0e2b3d6bdf..4104db76e6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -211,7 +211,16 @@ typedef enum {
_1access_FUNC,
_1atk_1object_1add_1relationship_FUNC,
_1atk_1object_1remove_1relationship_FUNC,
- _1call_FUNC,
+#ifndef JNI64
+ _1call__IIIIIII_FUNC,
+#else
+ _1call__JJJJJJJ_FUNC,
+#endif
+#ifndef JNI64
+ _1call__IIIIIIII_FUNC,
+#else
+ _1call__JJJJJJJJ_FUNC,
+#endif
_1call_1get_1size_FUNC,
_1dlclose_FUNC,
_1dlopen_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 4f2bd06da8..d168287531 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -820,6 +820,15 @@ public static final long /*int*/ call (long /*int*/ function, long /*int*/ arg0,
lock.unlock();
}
}
+public static final native long /*int*/ _call (long /*int*/ function, long /*int*/ arg0, long /*int*/ arg1, long /*int*/ arg2, long /*int*/ arg3, long /*int*/ arg4, long /*int*/ arg5);
+public static final long /*int*/ call (long /*int*/ function, long /*int*/ arg0, long /*int*/ arg1, long /*int*/ arg2, long /*int*/ arg3, long /*int*/ arg4, long /*int*/ arg5) {
+ lock.lock();
+ try {
+ return _call(function, arg0, arg1, arg2, arg3, arg4, arg5);
+ } finally {
+ lock.unlock();
+ }
+}
/** @method flags=no_gen */
public static final native void _call_get_size (long /*int*/ function, long /*int*/ arg0, long /*int*/ arg1, long /*int*/ arg2, long /*int*/ arg3, long /*int*/ arg4, long /*int*/ arg5, long /*int*/ arg6);
public static final void call_get_size (long /*int*/ function, long /*int*/ arg0, long /*int*/ arg1, long /*int*/ arg2, long /*int*/ arg3, long /*int*/ arg4, long /*int*/ arg5, long /*int*/ arg6) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index a760b7e443..fc1a21e27c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -109,8 +109,12 @@ void deregister () {
}
void drawBackground (Control control, long /*int*/ window, long /*int*/ region, int x, int y, int width, int height) {
+ drawBackground(control, window, 0, region, x, y, width, height);
+}
+
+void drawBackground (Control control, long /*int*/ window, long /*int*/ cr, long /*int*/ region, int x, int y, int width, int height) {
if (OS.USE_CAIRO) {
- long /*int*/ cairo = OS.gdk_cairo_create(window);
+ long /*int*/ cairo = cr != 0 ? cr : OS.gdk_cairo_create(window);
if (cairo == 0) error (SWT.ERROR_NO_HANDLES);
if (region != 0) {
OS.gdk_cairo_region(cairo, region);
@@ -136,7 +140,7 @@ void drawBackground (Control control, long /*int*/ window, long /*int*/ region,
}
Cairo.cairo_rectangle (cairo, x, y, width, height);
Cairo.cairo_fill (cairo);
- Cairo.cairo_destroy(cairo);
+ if (cairo != cr) Cairo.cairo_destroy(cairo);
return;
}
long /*int*/ gdkGC = OS.gdk_gc_new (window);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 1e9808b9f8..77dff77659 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -965,7 +965,7 @@ void createDisplay (DeviceData data) {
if (rendererClassInitProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
}
if (rendererRenderProc == 0) {
- rendererRenderCallback = new Callback (getClass (), "rendererRenderProc", 7); //$NON-NLS-1$
+ rendererRenderCallback = new Callback (getClass (), "rendererRenderProc", OS.GTK_VERSION >= OS.VERSION(3, 0, 0) ? 6 : 7); //$NON-NLS-1$
rendererRenderProc = rendererRenderCallback.getAddress ();
if (rendererRenderProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
}
@@ -1336,6 +1336,13 @@ static long /*int*/ rendererGetSizeProc (long /*int*/ cell, long /*int*/ handle,
return 0;
}
+static long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ cr, long /*int*/ handle, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ flags) {
+ Display display = getCurrent ();
+ Widget widget = display.getWidget (handle);
+ if (widget != null) return widget.rendererRenderProc (cell, cr, handle, background_area, cell_area, flags);
+ return 0;
+}
+
static long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*int*/ handle, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) {
Display display = getCurrent ();
Widget widget = display.getWidget (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index fe67d523f9..44b41b790a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
@@ -1911,34 +1912,47 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
return super.gtk_event_after (widget, gdkEvent);
}
-long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
- if ((state & OBSCURED) != 0) return 0;
+void drawInheritedBackground (long /*int*/ eventPtr, long /*int*/ cairo) {
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
Control control = findBackgroundControl ();
if (control != null) {
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, eventPtr, GdkEventExpose.sizeof);
long /*int*/ window = OS.gtk_tree_view_get_bin_window (handle);
- if (window == gdkEvent.window) {
- int [] width = new int [1], height = new int [1];
- gdk_window_get_size (window, width, height);
- int bottom = 0;
- if (itemCount != 0) {
- long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
- OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, itemCount - 1);
- long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
- GdkRectangle rect = new GdkRectangle ();
- OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);
- bottom = rect.y + rect.height;
- OS.gtk_tree_path_free (path);
- OS.g_free (iter);
- }
- if (height [0] > bottom) {
- drawBackground (control, window, gdkEvent.region, 0, bottom, width [0], height [0] - bottom);
- }
+ long /*int*/ rgn = 0;
+ if (eventPtr != 0) {
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, eventPtr, GdkEventExpose.sizeof);
+ if (window != gdkEvent.window) return;
+ rgn = gdkEvent.region;
+ }
+ int [] width = new int [1], height = new int [1];
+ gdk_window_get_size (window, width, height);
+ int bottom = 0;
+ if (itemCount != 0) {
+ long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
+ OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, itemCount - 1);
+ long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
+ GdkRectangle rect = new GdkRectangle ();
+ OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);
+ bottom = rect.y + rect.height;
+ OS.gtk_tree_path_free (path);
+ OS.g_free (iter);
+ }
+ if (height [0] > bottom) {
+ drawBackground (control, window, cairo, rgn, 0, bottom, width [0], height [0] - bottom);
}
}
}
+}
+
+long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
+ if ((state & OBSCURED) != 0) return 0;
+ drawInheritedBackground (0, cairo);
+ return super.gtk_draw (widget, cairo);
+}
+
+long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
+ if ((state & OBSCURED) != 0) return 0;
+ drawInheritedBackground (eventPtr, 0);
return super.gtk_expose_event (widget, eventPtr);
}
@@ -2536,7 +2550,17 @@ long /*int*/ rendererGetSizeProc (long /*int*/ cell, long /*int*/ widget, long /
return 0;
}
+long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ cr, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ flags) {
+ rendererRender (cell, cr, 0, widget, background_area, cell_area, 0, flags);
+ return 0;
+}
+
long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) {
+ rendererRender (cell, 0, window, widget, background_area, cell_area, expose_area, flags);
+ return 0;
+}
+
+void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) {
TableItem item = null;
long /*int*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
if (iter != 0) {
@@ -2583,7 +2607,14 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
Control control = findBackgroundControl ();
if (control != null) {
- drawBackground (control, window, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_save (cr);
+ Cairo.cairo_reset_clip (cr);
+ }
+ drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_restore (cr);
+ }
}
}
}
@@ -2598,7 +2629,14 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
if (wasSelected) {
Control control = findBackgroundControl ();
if (control == null) control = this;
- drawBackground (control, window, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_save (cr);
+ Cairo.cairo_reset_clip (cr);
+ }
+ drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_restore (cr);
+ }
}
GC gc = new GC (this);
if ((drawState & SWT.SELECTED) != 0) {
@@ -2642,7 +2680,6 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
}
}
}
- long /*int*/ result = 0;
if ((drawState & SWT.BACKGROUND) != 0 && (drawState & SWT.SELECTED) == 0) {
GC gc = new GC (this);
gc.setBackground (item.getBackground (columnIndex));
@@ -2658,7 +2695,11 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
if (drawForeground != null && OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
OS.g_object_set (cell, OS.foreground_gdk, drawForeground, 0);
}
- result = OS.call (klass.render, cell, window, handle, background_area, cell_area, expose_area, drawFlags);
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ OS.call (klass.render, cell, cr, widget, background_area, cell_area, drawFlags);
+ } else {
+ OS.call (klass.render, cell, window, widget, background_area, cell_area, expose_area, drawFlags);
+ }
}
if (item != null) {
if (OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
@@ -2719,7 +2760,6 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
}
}
}
- return result;
}
void resetCustomDraw () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index a5ad2e6531..9b2296d0e7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -13,6 +13,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
@@ -1914,39 +1915,52 @@ long /*int*/ gtk_expand_collapse_cursor_row (long /*int*/ widget, long /*int*/ l
return 0;
}
-long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
- if ((state & OBSCURED) != 0) return 0;
+void drawInheritedBackground (long /*int*/ eventPtr, long /*int*/ cairo) {
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
Control control = findBackgroundControl ();
if (control != null) {
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, eventPtr, GdkEventExpose.sizeof);
long /*int*/ window = OS.gtk_tree_view_get_bin_window (handle);
- if (window == gdkEvent.window) {
- int [] width = new int [1], height = new int [1];
- gdk_window_get_size (window, width, height);
- long /*int*/ parent = 0;
- int itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, parent);
- GdkRectangle rect = new GdkRectangle ();
- boolean expanded = true;
- while (itemCount != 0 && expanded && height [0] > (rect.y + rect.height)) {
- long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
- OS.gtk_tree_model_iter_nth_child (modelHandle, iter, parent, itemCount - 1);
- itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, iter);
- long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
- OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);
- expanded = OS.gtk_tree_view_row_expanded (handle, path);
- OS.gtk_tree_path_free (path);
- if (parent != 0) OS.g_free (parent);
- parent = iter;
- }
+ long /*int*/ rgn = 0;
+ if (eventPtr != 0) {
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, eventPtr, GdkEventExpose.sizeof);
+ if (window != gdkEvent.window) return;
+ rgn = gdkEvent.region;
+ }
+ int [] width = new int [1], height = new int [1];
+ gdk_window_get_size (window, width, height);
+ long /*int*/ parent = 0;
+ int itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, parent);
+ GdkRectangle rect = new GdkRectangle ();
+ boolean expanded = true;
+ while (itemCount != 0 && expanded && height [0] > (rect.y + rect.height)) {
+ long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
+ OS.gtk_tree_model_iter_nth_child (modelHandle, iter, parent, itemCount - 1);
+ itemCount = OS.gtk_tree_model_iter_n_children (modelHandle, iter);
+ long /*int*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
+ OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);
+ expanded = OS.gtk_tree_view_row_expanded (handle, path);
+ OS.gtk_tree_path_free (path);
if (parent != 0) OS.g_free (parent);
- if (height [0] > (rect.y + rect.height)) {
- drawBackground (control, window, gdkEvent.region, 0, rect.y + rect.height, width [0], height [0] - (rect.y + rect.height));
- }
+ parent = iter;
+ }
+ if (parent != 0) OS.g_free (parent);
+ if (height [0] > (rect.y + rect.height)) {
+ drawBackground (control, window, cairo, rgn, 0, rect.y + rect.height, width [0], height [0] - (rect.y + rect.height));
}
}
}
+}
+
+long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
+ if ((state & OBSCURED) != 0) return 0;
+ drawInheritedBackground (0, cairo);
+ return super.gtk_draw (widget, cairo);
+}
+
+long /*int*/ gtk_expose_event (long /*int*/ widget, long /*int*/ eventPtr) {
+ if ((state & OBSCURED) != 0) return 0;
+ drawInheritedBackground (eventPtr, 0);
return super.gtk_expose_event (widget, eventPtr);
}
@@ -2534,7 +2548,17 @@ long /*int*/ rendererGetSizeProc (long /*int*/ cell, long /*int*/ widget, long /
return 0;
}
+long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ cr, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ flags) {
+ rendererRender (cell, cr, 0, widget, background_area, cell_area, 0, flags);
+ return 0;
+}
+
long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) {
+ rendererRender (cell, 0, window, widget, background_area, cell_area, expose_area, flags);
+ return 0;
+}
+
+void rendererRender (long /*int*/ cell, long /*int*/ cr, long /*int*/ window, long /*int*/ widget, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) {
TreeItem item = null;
long /*int*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
if (iter != 0) item = _getItem (iter);
@@ -2574,7 +2598,14 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
Control control = findBackgroundControl ();
if (control != null) {
- drawBackground (control, window, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_save (cr);
+ Cairo.cairo_reset_clip (cr);
+ }
+ drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_restore (cr);
+ }
}
}
}
@@ -2588,7 +2619,14 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
if (wasSelected) {
Control control = findBackgroundControl ();
if (control == null) control = this;
- drawBackground (control, window, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_save (cr);
+ Cairo.cairo_reset_clip (cr);
+ }
+ drawBackground (control, window, cr, 0, rect.x, rect.y, rect.width, rect.height);
+ if (cr != 0) {
+ Cairo.cairo_restore (cr);
+ }
}
GC gc = new GC (this);
if ((drawState & SWT.SELECTED) != 0) {
@@ -2632,7 +2670,6 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
}
}
}
- long /*int*/ result = 0;
if ((drawState & SWT.BACKGROUND) != 0 && (drawState & SWT.SELECTED) == 0) {
GC gc = new GC (this);
gc.setBackground (item.getBackground (columnIndex));
@@ -2648,7 +2685,11 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
if (drawForeground != null && OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
OS.g_object_set (cell, OS.foreground_gdk, drawForeground, 0);
}
- result = OS.call (klass.render, cell, window, handle, background_area, cell_area, expose_area, drawFlags);
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ OS.call (klass.render, cell, cr, widget, background_area, cell_area, drawFlags);
+ } else {
+ OS.call (klass.render, cell, window, widget, background_area, cell_area, expose_area, drawFlags);
+ }
}
if (item != null) {
if (OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
@@ -2723,7 +2764,6 @@ long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*
}
}
}
- return result;
}
void resetCustomDraw () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 6ac856254f..148aea15f3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1307,6 +1307,10 @@ long /*int*/ rendererGetSizeProc (long /*int*/ cell, long /*int*/ handle, long /
return 0;
}
+long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ cr, long /*int*/ handle, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ flags) {
+ return 0;
+}
+
long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window, long /*int*/ handle, long /*int*/ background_area, long /*int*/ cell_area, long /*int*/ expose_area, long /*int*/ flags) {
return 0;
}

Back to the top