This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 295a22e4b2 improve UI for latest macOS, fixes #6257 (#6258)
295a22e4b2 is described below
commit 295a22e4b2fffdb97fd06fbd6ee96ec771259f71
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Dec 26 18:30:40 2025 +0100
improve UI for latest macOS, fixes #6257 (#6258)
---
pom.xml | 2 +-
.../main/java/org/apache/hop/ui/core/PropsUi.java | 80 ++++++++++++++--------
2 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/pom.xml b/pom.xml
index c6e7343ec6..7b38167235 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,7 +148,7 @@
<netty.version>4.2.7.Final</netty.version>
<objenesis.version>3.4</objenesis.version>
<opentelemetry.version>1.56.0</opentelemetry.version>
- <org.eclipse.platform.version>3.131.0</org.eclipse.platform.version>
+ <org.eclipse.platform.version>3.132.0</org.eclipse.platform.version>
<project.build.outputTimestamp>1762773326</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
index 03a9869072..1f79a0f156 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
@@ -37,6 +37,7 @@ import org.apache.hop.ui.hopgui.TextSizeUtilFacade;
import org.apache.hop.ui.util.EnvironmentUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@@ -51,6 +52,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Widget;
@@ -653,57 +655,73 @@ public class PropsUi extends Props {
protected static void setLookOnMac(final Widget widget, int style) {
final GuiResource gui = GuiResource.getInstance();
Font font = gui.getFontDefault();
- Color background = gui.getColorWhite();
- Color foreground = gui.getColorBlack();
+ Color background = null;
+
+ Display display = Display.getCurrent();
+ if (display == null) {
+ return;
+ }
+
+ // Use system colors that automatically adapt to light/dark mode
+ // Only set backgrounds where needed - let macOS handle text colors
natively
+ Color systemWidgetBackground =
display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+ Color systemListBackground =
display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color systemListForeground =
display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
+
+ // Handle Shell windows with system background, but let macOS handle text
color
+ if (widget instanceof Shell shell) {
+ shell.setBackground(systemWidgetBackground);
+ shell.setBackgroundMode(SWT.INHERIT_FORCE);
+ // Don't set foreground - let macOS handle it natively
+ return;
+ }
switch (style) {
case WIDGET_STYLE_DEFAULT:
+ // Use system widget background for default composites
+ // Don't set foreground - let macOS handle text colors
+ background = systemWidgetBackground;
break;
case WIDGET_STYLE_OSX_GROUP:
- background = gui.getColorWhite();
- foreground = gui.getColorBlack();
+ background = systemWidgetBackground;
font = gui.getFontDefault();
Group group = ((Group) widget);
+ final Color groupBg = background;
group.addPaintListener(
paintEvent -> {
- paintEvent.gc.setForeground(gui.getColorBlack());
- paintEvent.gc.setBackground(gui.getColorWhite());
+ // Use system colors in paint listener
+
paintEvent.gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
+ paintEvent.gc.setBackground(groupBg);
paintEvent.gc.fillRectangle(
2, 0, group.getBounds().width - 8, group.getBounds().height
- 20);
});
break;
case WIDGET_STYLE_FIXED:
font = gui.getFontFixed();
+ background = systemWidgetBackground;
break;
case WIDGET_STYLE_TABLE:
- background = gui.getColorLightGray();
- foreground = gui.getColorDarkGray();
+ background = systemWidgetBackground;
Table table = (Table) widget;
- table.setHeaderBackground(gui.getColorLightGray());
- table.setHeaderForeground(gui.getColorDarkGray());
+ table.setHeaderBackground(systemWidgetBackground);
+ // Don't set foreground colors - let macOS handle them
break;
case WIDGET_STYLE_TREE:
- // TODO: Adjust for Linux
+ background = systemWidgetBackground;
break;
case WIDGET_STYLE_TOOLBAR:
- if (PropsUi.getInstance().isDarkMode()) {
- background = gui.getColorLightGray();
- } else {
- background = gui.getColorDemoGray();
- }
+ background = systemWidgetBackground;
break;
case WIDGET_STYLE_TAB:
CTabFolder tabFolder = (CTabFolder) widget;
tabFolder.setBorderVisible(true);
- tabFolder.setBackground(gui.getColorGray());
- tabFolder.setForeground(gui.getColorBlack());
+ tabFolder.setBackground(systemWidgetBackground);
+ tabFolder.setSelectionBackground(systemWidgetBackground);
+ // Don't set foreground colors - let macOS handle them
ensureSafeRenderer(tabFolder);
- tabFolder.setSelectionBackground(gui.getColorWhite());
- tabFolder.setSelectionForeground(gui.getColorBlack());
break;
case WIDGET_STYLE_PUSH_BUTTON:
background = null;
- foreground = null;
break;
default:
background = gui.getColorBackground();
@@ -721,14 +739,22 @@ public class PropsUi extends Props {
controlWidget.setBackground(background);
}
- if (foreground != null
- && !foreground.isDisposed()
- && (widget instanceof Control controlWidget)) {
- controlWidget.setForeground(foreground);
+ // Only set backgrounds and foregrounds for text input widgets to ensure
visibility
+ // with the new glass look in modern macOS versions.
+ // Use system list colors for text fields which provide proper contrast
+ if (widget instanceof Combo combo) {
+ combo.setBackground(systemListBackground);
+ combo.setForeground(systemListForeground);
}
- if (widget instanceof Combo combo) {
- combo.setBackground(gui.getColorWhite());
+ if (widget instanceof Text text) {
+ text.setBackground(systemListBackground);
+ text.setForeground(systemListForeground);
+ }
+
+ if (widget instanceof StyledText styledText) {
+ styledText.setBackground(systemListBackground);
+ styledText.setForeground(systemListForeground);
}
}