Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Yan2018-12-19 10:49:46 -0500
committerXi Yan2018-12-19 11:15:58 -0500
commitfc80edfc2ecb1d9fb5225ca0426992d70aa233ba (patch)
treecb17a229d2b6b18d2b108032c1926bb31d48aa53
parent64718b5f5dd52c89dea4625f08e64ad2c4dd52ff (diff)
downloadeclipse.platform.swt-fc80edfc2ecb1d9fb5225ca0426992d70aa233ba.tar.gz
eclipse.platform.swt-fc80edfc2ecb1d9fb5225ca0426992d70aa233ba.tar.xz
eclipse.platform.swt-fc80edfc2ecb1d9fb5225ca0426992d70aa233ba.zip
Bug 541451 - [GTK3] Replace deprecated
gdk_window_set_background_pattern() Removing gdk_window_set_background_pattern for GTK3.22+ Tested with ControlExample, GraphicsExample, snippet with bug 218935, bug 475784, Snippet154, 174, 281, 48. Change-Id: Id269e8babaf6473e9be25c04f55bca2253df8d55 Signed-off-by: Xi Yan <xixiyan@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java11
2 files changed, 10 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 55d538b20c..89dfb9b4fa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -902,9 +902,8 @@ long /*int*/ gtk_map (long /*int*/ widget) {
long /*int*/ gtk_realize (long /*int*/ widget) {
long /*int*/ result = super.gtk_realize (widget);
if ((style & SWT.NO_BACKGROUND) != 0) {
- if (GTK.GTK4) {
- // TODO: no gdk_surface_set_background_pattern() on GTK4.
- } else {
+ // No gdk_surface_set_background_pattern() on GTK4.
+ if (GTK.GTK_VERSION < OS.VERSION(3, 22, 0)) {
long /*int*/ window = gtk_widget_get_window (paintHandle ());
if (window != 0) {
GDK.gdk_window_set_background_pattern(window, 0);
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 13cb4b0a12..58d2ed9f8a 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
@@ -4801,12 +4801,15 @@ public void setBackgroundImage (Image image) {
void setBackgroundSurface (Image image) {
long /*int*/ window = gtk_widget_get_window (paintHandle ());
+ if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
+ // gdk_window_set_background_pattern() deprecated in GTK3.22+
+ return;
+ }
if (window != 0) {
if (image.surface != 0) {
long /*int*/ pattern = Cairo.cairo_pattern_create_for_surface(image.surface);
if (pattern == 0) SWT.error(SWT.ERROR_NO_HANDLES);
Cairo.cairo_pattern_set_extend(pattern, Cairo.CAIRO_EXTEND_REPEAT);
- // TODO: no gdk_surface_set_background_pattern() on GTK4.
GDK.gdk_window_set_background_pattern(window, pattern);
Cairo.cairo_pattern_destroy(pattern);
}
@@ -5571,8 +5574,10 @@ public void setRedraw (boolean redraw) {
GDK.GDK_BUTTON_MOTION_MASK | GDK.GDK_BUTTON1_MOTION_MASK |
GDK.GDK_BUTTON2_MOTION_MASK | GDK.GDK_BUTTON3_MOTION_MASK;
GDK.gdk_window_set_events (window, GDK.gdk_window_get_events (window) & ~mouseMask);
- // TODO: no gdk_surface_set_background_pattern() on GTK4.
- GDK.gdk_window_set_background_pattern(redrawWindow, 0);
+ // No gdk_surface_set_background_pattern() on GTK4.
+ if (GTK.GTK_VERSION < OS.VERSION(3, 22, 0)) {
+ GDK.gdk_window_set_background_pattern(redrawWindow, 0);
+ }
GDK.gdk_window_show (redrawWindow);
}
}

Back to the top