Skip to content

Commit

Permalink
8329471: Remove GTK2
Browse files Browse the repository at this point in the history
  • Loading branch information
azvegint committed Jul 25, 2024
1 parent 81ed028 commit 574358d
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 3,235 deletions.
4 changes: 0 additions & 4 deletions make/modules/java.desktop/lib/AwtLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
DISABLED_WARNINGS_gcc := int-to-pointer-cast, \
DISABLED_WARNINGS_gcc_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_gcc_GLXSurfaceData.c := unused-function, \
DISABLED_WARNINGS_gcc_gtk2_interface.c := parentheses type-limits, \
DISABLED_WARNINGS_gcc_gtk3_interface.c := parentheses type-limits \
unused-function, \
DISABLED_WARNINGS_gcc_OGLBufImgOps.c := format-nonliteral, \
Expand All @@ -252,7 +251,6 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
DISABLED_WARNINGS_gcc_XToolkit.c := unused-result, \
DISABLED_WARNINGS_gcc_XWindow.c := unused-function, \
DISABLED_WARNINGS_clang_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_clang_gtk2_interface.c := parentheses, \
DISABLED_WARNINGS_clang_gtk3_interface.c := parentheses, \
DISABLED_WARNINGS_clang_OGLBufImgOps.c := format-nonliteral, \
DISABLED_WARNINGS_clang_OGLPaints.c := format-nonliteral, \
Expand All @@ -262,8 +260,6 @@ ifeq ($(call isTargetOs, windows macosx)+$(ENABLE_HEADLESS_ONLY), false+false)
DISABLED_WARNINGS_clang_aix_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_clang_aix_OGLPaints.c := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_OGLBufImgOps.c := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_gtk2_interface.c := parentheses \
logical-op-parentheses, \
DISABLED_WARNINGS_clang_aix_gtk3_interface.c := parentheses \
logical-op-parentheses, \
DISABLED_WARNINGS_clang_aix_sun_awt_X11_GtkFileDialogPeer.c := \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GTKEngine {
/** Size of the image cache */
private static final int CACHE_SIZE = 50;

/** This enum mirrors that in gtk2_interface.h */
/** This enum mirrors that in gtk_interface.h */
static enum WidgetType {
BUTTON, CHECK_BOX, CHECK_BOX_MENU_ITEM, COLOR_CHOOSER,
COMBO_BOX, COMBO_BOX_ARROW_BUTTON, COMBO_BOX_TEXT_FIELD,
Expand Down Expand Up @@ -628,7 +628,7 @@ public void themeChanged() {
cache.flush();
}

/* GtkSettings enum mirrors that in gtk2_interface.h */
/* GtkSettings enum mirrors that in gtk_interface.h */
public Object getSetting(Settings property) {
synchronized(sun.awt.UNIXToolkit.GTK_LOCK) {
return native_get_gtk_setting(property.ordinal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ class GTKIconFactory {
private static final String DESCENDING_SORT_ICON = "paintDescendingSortIcon";
private static final String TOOL_BAR_HANDLE_ICON = "paintToolBarHandleIcon";

private static Map<String, DelegatingIcon> iconsPool =
private final static Map<String, DelegatingIcon> iconsPool =
Collections.synchronizedMap(new HashMap<String, DelegatingIcon>());

private static DelegatingIcon getIcon(String methodName) {
DelegatingIcon result = iconsPool.get(methodName);
if (result == null) {
if (methodName == TREE_COLLAPSED_ICON ||
methodName == TREE_EXPANDED_ICON)
if (TREE_COLLAPSED_ICON.equals(methodName) ||
TREE_EXPANDED_ICON.equals(methodName))
{
result = new SynthExpanderIcon(methodName);

} else if (methodName == TOOL_BAR_HANDLE_ICON) {
} else if (TOOL_BAR_HANDLE_ICON.equals(methodName)) {
result = new ToolBarHandleIcon();

} else if (methodName == MENU_ARROW_ICON) {
} else if (MENU_ARROW_ICON.equals(methodName)) {
result = new MenuArrowIcon();

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,17 +1454,7 @@ public void initialize() {
throw new InternalError("Unable to load native GTK libraries");
}

if (UNIXToolkit.getGtkVersion() == UNIXToolkit.GtkVersions.GTK2) {
@SuppressWarnings("removal")
String version = AccessController.doPrivileged(
new GetPropertyAction("jdk.gtk.version"));
if (version != null) {
IS_22 = version.equals("2.2");
} else {
IS_22 = true;
}
} else if (UNIXToolkit.getGtkVersion() ==
UNIXToolkit.GtkVersions.GTK3) {
if (UNIXToolkit.getGtkVersion() == UNIXToolkit.GtkVersions.GTK3) {
IS_3 = true;
}

Expand Down
15 changes: 0 additions & 15 deletions src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,12 @@ public abstract class UNIXToolkit extends SunToolkit
private static final int[] BAND_OFFSETS_ALPHA = { 0, 1, 2, 3 };
private static final int DEFAULT_DATATRANSFER_TIMEOUT = 10000;

private static final String GTK2_DEPRECATION_MESSAGE =
"WARNING: the GTK 2 library is deprecated and " +
"its support will be removed in a future release";
private static volatile boolean gtk2WarningIssued = false;

// Allowed GTK versions
public enum GtkVersions {
ANY(0),
GTK2(Constants.GTK2_MAJOR_NUMBER),
GTK3(Constants.GTK3_MAJOR_NUMBER);

static class Constants {
static final int GTK2_MAJOR_NUMBER = 2;
static final int GTK3_MAJOR_NUMBER = 3;
}

Expand All @@ -94,8 +87,6 @@ static class Constants {

public static GtkVersions getVersion(int number) {
switch (number) {
case Constants.GTK2_MAJOR_NUMBER:
return GTK2;
case Constants.GTK3_MAJOR_NUMBER:
return GTK3;
default:
Expand Down Expand Up @@ -500,12 +491,6 @@ public static GtkVersions getEnabledGtkVersion() {
new GetPropertyAction("jdk.gtk.version"));
if (version == null) {
return GtkVersions.ANY;
} else if (version.startsWith("2")) {
if (!gtk2WarningIssued) {
System.err.println(GTK2_DEPRECATION_MESSAGE);
gtk2WarningIssued = true;
}
return GtkVersions.GTK2;
} else if("3".equals(version) ){
return GtkVersions.GTK3;
}
Expand Down
Loading

0 comments on commit 574358d

Please sign in to comment.