diff options
| author | Silenio Quarti | 2013-04-03 14:24:39 +0000 |
|---|---|---|
| committer | Carolyn MacLeod | 2013-04-09 14:57:02 +0000 |
| commit | 5593c1df804233a5e3050dd9c6cdbe962b706e18 (patch) | |
| tree | f4f45041886b8fb59e081d9dee5d24437be9a682 | |
| parent | 6b2bf483ac5c1ea880cd86b9b40d232d503c7ad5 (diff) | |
| download | eclipse.platform.swt-5593c1df804233a5e3050dd9c6cdbe962b706e18.tar.gz eclipse.platform.swt-5593c1df804233a5e3050dd9c6cdbe962b706e18.tar.xz eclipse.platform.swt-5593c1df804233a5e3050dd9c6cdbe962b706e18.zip | |
Bug 404163 - [GTK3] setBackgroundImage not working on Fedora 18
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 36 |
1 files changed, 26 insertions, 10 deletions
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 ec36b15bae..658385aeb7 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 @@ -333,9 +333,7 @@ void hookEvents () { int paintMask = OS.GDK_EXPOSURE_MASK | OS.GDK_VISIBILITY_NOTIFY_MASK; OS.gtk_widget_add_events (paintHandle, paintMask); - if (!OS.GTK3) { - OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT_INVERSE], false); - } + OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT_INVERSE], false); /* * As of GTK 2.17.11, obscured controls no longer send expose @@ -2494,6 +2492,9 @@ GdkColor getContextBackground () { long /*int*/ context = OS.gtk_widget_get_style_context (fontHandle); GdkRGBA rgba = new GdkRGBA (); OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + if (rgba.alpha == 0) { + return display.COLOR_WIDGET_BACKGROUND; + } GdkColor color = new GdkColor (); color.red = (short)(rgba.red * 0xFFFF); color.green = (short)(rgba.green * 0xFFFF); @@ -5358,13 +5359,28 @@ long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ us if ((state & OBSCURED) != 0) break; if (OS.USE_CAIRO) { Control control = findBackgroundControl (); - if (control != null && control.backgroundImage != null) { - GdkEventExpose gdkEvent = new GdkEventExpose (); - OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof); - long /*int*/ paintWindow = paintWindow(); - long /*int*/ window = gdkEvent.window; - if (window != paintWindow) break; - drawBackground(control, window, gdkEvent.region, gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height); + boolean draw = control != null && control.backgroundImage != null; + if (OS.GTK3 && !draw && (state & CANVAS) != 0) { + GdkRGBA rgba = new GdkRGBA(); + long /*int*/ context = OS.gtk_widget_get_style_context (handle); + OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + draw = rgba.alpha == 0; + } + if (draw) { + if (OS.GTK3) { + long /*int*/ cairo = arg0; + GdkRectangle rect = new GdkRectangle (); + OS.gdk_cairo_get_clip_rectangle (cairo, rect); + if (control == null) control = this; + drawBackground (control, 0, cairo, 0, rect.x, rect.y, rect.width, rect.height); + } else { + GdkEventExpose gdkEvent = new GdkEventExpose (); + OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof); + long /*int*/ paintWindow = paintWindow(); + long /*int*/ window = gdkEvent.window; + if (window != paintWindow) break; + drawBackground(control, window, gdkEvent.region, gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height); + } } } if (OS.GTK_VERSION < OS.VERSION (2, 8, 0)) { |
