Skip to content

Commit b7dee8a

Browse files
committed
[GTK] Don't use deprecated gtk_style_context_invalidate()
GTK sources say: Deprecated: 3.12: Style contexts are invalidated automatically. https://www.eclipse.org/swt/faq.php#gtkstartup says: Eclipse/SWT 4.16.x: GTK+ 3.20.0 and its dependencies Eclipse/SWT 4.15.x: GTK+ 3.14.0 and its dependencies This means that it's been at least 3 years since SWT requires GTK 3.20. Sounds safe to stop using the deprecated function now. Signed-off-by: Alexandr Miloslavskiy <[email protected]>
1 parent 434d1dd commit b7dee8a

File tree

9 files changed

+1
-26
lines changed

9 files changed

+1
-26
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2022 IBM Corporation and others.
2+
* Copyright (c) 2000, 2023 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -1736,18 +1736,6 @@ JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1style_1context_1get_1parent)
17361736
}
17371737
#endif
17381738

1739-
#ifndef NO_gtk_1style_1context_1invalidate
1740-
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
1741-
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1style_1context_1invalidate)
1742-
(JNIEnv *env, jclass that, jlong arg0)
1743-
{
1744-
GTK3_NATIVE_ENTER(env, that, gtk_1style_1context_1invalidate_FUNC);
1745-
gtk_style_context_invalidate((GtkStyleContext *)arg0);
1746-
GTK3_NATIVE_EXIT(env, that, gtk_1style_1context_1invalidate_FUNC);
1747-
}
1748-
G_GNUC_END_IGNORE_DEPRECATIONS
1749-
#endif
1750-
17511739
#ifndef NO_gtk_1target_1list_1new
17521740
JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1target_1list_1new)
17531741
(JNIEnv *env, jclass that, jlong arg0, jint arg1)

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ typedef enum {
165165
gtk_1style_1context_1get_1font_FUNC,
166166
gtk_1style_1context_1get_1padding_FUNC,
167167
gtk_1style_1context_1get_1parent_FUNC,
168-
gtk_1style_1context_1invalidate_FUNC,
169168
gtk_1target_1list_1new_FUNC,
170169
gtk_1target_1list_1unref_FUNC,
171170
gtk_1text_1view_1get_1window_FUNC,

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java

-5
Original file line numberDiff line numberDiff line change
@@ -916,11 +916,6 @@ public class GTK3 {
916916
public static final native boolean gtk_css_provider_load_from_data(long css_provider, byte[] data, long length, long error[]);
917917

918918
/* GtkStyleContext */
919-
/**
920-
* @method flags=ignore_deprecations
921-
* @param context cast=(GtkStyleContext *)
922-
*/
923-
public static final native void gtk_style_context_invalidate(long context);
924919
/**
925920
* @param screen cast=(GdkScreen *)
926921
* @param provider cast=(GtkStyleProvider *)

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java

-1
Original file line numberDiff line numberDiff line change
@@ -5307,7 +5307,6 @@ void setBackgroundGdkRGBA (long handle, GdkRGBA rgba) {
53075307

53085308
long context = GTK.gtk_widget_get_style_context(handle);
53095309
setBackgroundGdkRGBA(context, handle, rgba);
5310-
if (!GTK.GTK4) GTK3.gtk_style_context_invalidate(context);
53115310
}
53125311
/**
53135312
* Sets the receiver's background image to the image specified

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java

-1
Original file line numberDiff line numberDiff line change
@@ -3220,7 +3220,6 @@ void initializeSystemColorsList(long shellContext) {
32203220
GTK.gtk_style_context_save (shellContext);
32213221
GTK.gtk_style_context_add_class(shellContext, GTK.GTK_STYLE_CLASS_VIEW);
32223222
GTK.gtk_style_context_add_class(shellContext, GTK.GTK_STYLE_CLASS_CELL);
3223-
if (!GTK.GTK4) GTK3.gtk_style_context_invalidate(shellContext);
32243223

32253224
COLOR_LIST_FOREGROUND_RGBA = styleContextGetColor (shellContext, GTK.GTK_STATE_FLAG_NORMAL);
32263225
COLOR_LIST_BACKGROUND_RGBA = styleContextEstimateBackgroundColor(shellContext, GTK.GTK_STATE_FLAG_NORMAL);

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java

-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ void createHandle (int index) {
259259
long context = GTK.gtk_widget_get_style_context(handle);
260260
String background = display.gtk_rgba_to_css_string(display.COLOR_LIST_BACKGROUND_RGBA);
261261
gtk_css_provider_load_from_css(context, "entry {border: solid; background: " + background + ";}");
262-
if (!GTK.GTK4) GTK3.gtk_style_context_invalidate(context);
263262
}
264263

265264
float alignment = 0.0f;

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java

-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ void createHandle (int index) {
308308
GdkRGBA bgRGBA = background.handle;
309309
String css = "window {background-color: " + display.gtk_rgba_to_css_string(bgRGBA) + ";}";
310310
gtk_css_provider_load_from_css (context, css);
311-
GTK3.gtk_style_context_invalidate (context);
312311
GTK3.gtk_window_set_type_hint (handle, GDK.GDK_WINDOW_TYPE_HINT_TOOLTIP);
313312
}
314313
}

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java

-1
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@ private void setTrackerBackground(boolean opaque) {
917917
GTK4.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
918918
} else {
919919
GTK3.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
920-
GTK3.gtk_style_context_invalidate (context);
921920
}
922921

923922
long region = Cairo.cairo_region_create ();

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java

-2
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,6 @@ void setFontDescription(long widget, long fontDescription) {
18511851
// gtk_widget_override_font() copies the fields from 'fontDescription'
18521852
// and does not remember the pointer passed to it.
18531853
GTK3.gtk_widget_override_font(widget, fontDescription);
1854-
long context = GTK.gtk_widget_get_style_context(widget);
1855-
GTK3.gtk_style_context_invalidate(context);
18561854
}
18571855
}
18581856

0 commit comments

Comments
 (0)