Skip to content

Commit fd2aaa9

Browse files
committed
Revert "[GTK] Don't use deprecated gtk_style_context_invalidate()"
This reverts commit b7dee8a.
1 parent 29baefd commit fd2aaa9

File tree

9 files changed

+26
-1
lines changed

9 files changed

+26
-1
lines changed

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

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2023 IBM Corporation and others.
2+
* Copyright (c) 2000, 2022 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,6 +1736,18 @@ 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+
17391751
#ifndef NO_gtk_1target_1list_1new
17401752
JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1target_1list_1new)
17411753
(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,6 +165,7 @@ 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,
168169
gtk_1target_1list_1new_FUNC,
169170
gtk_1target_1list_1unref_FUNC,
170171
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,6 +916,11 @@ 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);
919924
/**
920925
* @param screen cast=(GdkScreen *)
921926
* @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,6 +5307,7 @@ 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);
53105311
}
53115312
/**
53125313
* 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,6 +3220,7 @@ 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);
32233224

32243225
COLOR_LIST_FOREGROUND_RGBA = styleContextGetColor (shellContext, GTK.GTK_STATE_FLAG_NORMAL);
32253226
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,6 +259,7 @@ 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);
262263
}
263264

264265
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,6 +308,7 @@ 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);
311312
GTK3.gtk_window_set_type_hint (handle, GDK.GDK_WINDOW_TYPE_HINT_TOOLTIP);
312313
}
313314
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,7 @@ 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);
920921
}
921922

922923
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,6 +1851,8 @@ 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);
18541856
}
18551857
}
18561858

0 commit comments

Comments
 (0)