x11-toolkits/swt: update to 4.21

- Sync patches with eclipse 4.21
- Remove patch-org_eclipse_swt_graphics_Device.java (which breaks
  icons in Eclipse) and install missing *.css files
- Add patch-org_eclipse_swt_widgets_Shell.java to fix layout on HiDPI
  scaled to 200%

PR:		264512 (based on)
Submmitted by:	huanghwh@gmail.com
This commit is contained in:
Max Brazhnikov 2022-06-07 15:37:25 +03:00
parent f35fdab00d
commit d551e5b93e
13 changed files with 111 additions and 43 deletions

View file

@ -1,9 +1,9 @@
# Created by: Robert C. Noland III <rnoland@FreeBSD.org>
PORTNAME= swt
DISTVERSION= 4.20
DISTVERSION= 4.21
CATEGORIES= x11-toolkits devel java
MASTER_SITES= http://archive.eclipse.org/eclipse/downloads/drops4/R-${DISTVERSION}-202106111600/
MASTER_SITES= http://archive.eclipse.org/eclipse/downloads/drops4/R-${DISTVERSION}-202109060500/
DISTNAME= ${PORTNAME}-${DISTVERSION}-gtk-linux-x86_64
MAINTAINER= makc@FreeBSD.org
@ -22,7 +22,7 @@ USE_JAVA= yes
USE_XORG= xtst
JAVA_OS= native
SWT_VERSION= 4944r26
SWT_VERSION= 4946r21
MAKEFILE= make_freebsd.mak
MAKE_ENV= SWT_VERSION=${SWT_VERSION}
@ -47,6 +47,7 @@ post-extract:
@(cd ${WRKSRC} && ${UNZIP_CMD} -qo "*.zip")
@${CP} ${FILESDIR}/build.xml ${WRKSRC}/build.xml
@${CP} ${WRKSRC}/make_linux.mak ${WRKSRC}/make_freebsd.mak
@${CP} ${FILESDIR}/*.css ${WRKSRC}/org/eclipse/swt/internal/gtk/
post-patch:
${SED} -e 's|freebsd|dragonfly|g' ${WRKSRC}/make_freebsd.mak \

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1627381059
SHA256 (swt-4.20-gtk-linux-x86_64.zip) = 0d1ab552b95aab6df6c0499c934fd82864100dc638c43b6c1e793e740bb534c2
SIZE (swt-4.20-gtk-linux-x86_64.zip) = 3808712
TIMESTAMP = 1654502811
SHA256 (swt-4.21-gtk-linux-x86_64.zip) = 3e35a4ababf504bcf64df864e4a957aaa2f0dec9696a922d936c7ee224fa4c5f
SIZE (swt-4.21-gtk-linux-x86_64.zip) = 3851041

View file

@ -39,12 +39,11 @@
<exclude name="**/*.java"/>
<exclude name="**/*.o"/>
<exclude name="**/*.so"/>
<!-- exclude CVS archive -->
<exclude name="**/CVS/**"/>
</fileset>
<fileset dir="${basedir}">
<include name="**/version.txt"/>
<include name="**/*.properties"/>
<include name="**/*.css"/>
</fileset>
</jar>
</target>

View file

@ -1,22 +0,0 @@
--- org/eclipse/swt/internal/gtk/OS.java.orig 2021-06-11 17:24:22 UTC
+++ org/eclipse/swt/internal/gtk/OS.java
@@ -61,15 +61,16 @@ import org.eclipse.swt.internal.*;
*/
public class OS extends C {
/** OS Constants */
- public static final boolean IsLinux, IsWin32, BIG_ENDIAN;
+ public static final boolean IsLinux, IsWin32, BIG_ENDIAN, IsFreeBSD;
static {
/* Initialize the OS flags and locale constants */
String osName = System.getProperty ("os.name");
- boolean isLinux = false, isWin32 = false;
+ boolean isLinux = false, isWin32 = false, isFreeBSD = false;
if (osName.equals ("Linux")) isLinux = true;
if (osName.startsWith("Windows")) isWin32 = true;
- IsLinux = isLinux; IsWin32 = isWin32;
+ if (osName.equals ("FreeBSD")) isFreeBSD = true;
+ IsLinux = isLinux; IsWin32 = isWin32; IsFreeBSD = isFreeBSD;
byte[] buffer = new byte[4];
long ptr = C.malloc(4);

View file

@ -0,0 +1,11 @@
--- org/eclipse/swt/browser/WebKit.java.orig 2022-06-06 23:55:44 UTC
+++ org/eclipse/swt/browser/WebKit.java
@@ -121,7 +121,7 @@ class WebKit extends WebBrowser {
* https://www.nczonline.net/blog/2009/01/05/what-determines-that-a-script-is-long-running/
* https://stackoverflow.com/questions/3030024/maximum-execution-time-for-javascript
*/
- static final int ASYNC_EXEC_TIMEOUT_MS = 10000;
+ static final int ASYNC_EXEC_TIMEOUT_MS = 100; // Dirty hack for webkit issues on FreeBSD
/** Workaround for bug 522733 */
static boolean bug522733FirstInstanceCreated = false;

View file

@ -1,11 +0,0 @@
--- org/eclipse/swt/graphics/Device.java.orig 2021-06-11 17:24:22 UTC
+++ org/eclipse/swt/graphics/Device.java
@@ -740,7 +740,7 @@ protected void init () {
}
systemFont = Font.gtk_new (this, defaultFont);
- overrideThemeValues();
+ //overrideThemeValues();
}
/**

View file

@ -0,0 +1,16 @@
--- org/eclipse/swt/internal/Library.java.orig 2021-09-06 01:22:24 UTC
+++ org/eclipse/swt/internal/Library.java
@@ -65,12 +65,12 @@ static {
static String arch() {
String osArch = System.getProperty("os.arch"); //$NON-NLS-1$
- if (osArch.equals ("amd64")) return "x86_64"; //$NON-NLS-1$ $NON-NLS-2$
return osArch;
}
static String os() {
String osName = System.getProperty("os.name"); //$NON-NLS-1$
+ if (osName.equals ("FreeBSD")) return "freebsd"; //$NON-NLS-1$ $NON-NLS-2$
if (osName.equals ("Linux")) return "linux"; //$NON-NLS-1$ $NON-NLS-2$
if (osName.equals ("Mac OS X")) return "macosx"; //$NON-NLS-1$ $NON-NLS-2$
if (osName.startsWith ("Win")) return "win32"; //$NON-NLS-1$ $NON-NLS-2$

View file

@ -0,0 +1,13 @@
--- org/eclipse/swt/internal/gtk/OS.java.orig 2021-09-06 01:22:24 UTC
+++ org/eclipse/swt/internal/gtk/OS.java
@@ -65,8 +65,8 @@ public class OS extends C {
/* Initialize the OS flags and locale constants */
String osName = System.getProperty ("os.name");
- boolean isLinux = false, isWin32 = false;
- if (osName.equals ("Linux")) isLinux = true;
+ boolean isLinux = osName.equals ("Linux") || osName.equals ("FreeBSD");
+ boolean isWin32 = false;
if (osName.startsWith("Windows")) isWin32 = true;
IsLinux = isLinux; IsWin32 = isWin32;

View file

@ -0,0 +1,20 @@
--- org/eclipse/swt/widgets/Shell.java.orig 2021-09-06 01:22:24 UTC
+++ org/eclipse/swt/widgets/Shell.java
@@ -1507,6 +1507,8 @@ long gtk_button_press_event (long widget, long event)
long gtk_configure_event (long widget, long event) {
int [] x = new int [1], y = new int [1];
GTK3.gtk_window_get_position (shellHandle, x, y);
+ int scale = GTK.gtk_widget_get_scale_factor (shellHandle);
+ x[0] /= scale; y[0] /= scale;
if (!isVisible ()) {
return 0; //We shouldn't handle move/resize events if shell is hidden.
@@ -3351,6 +3353,8 @@ Rectangle getBoundsInPixels () {
// TODO: GTK4 GtkWindow no longer has the ability to get position
} else {
GTK3.gtk_window_get_position (shellHandle, x, y);
+ int scale = GTK.gtk_widget_get_scale_factor (shellHandle);
+ x[0] /= scale; y[0] /= scale;
}
} else {
if (GTK.GTK4) {

View file

@ -1,6 +1,6 @@
--- os.c.orig 2021-06-11 17:24:22 UTC
--- os.c.orig 2021-09-06 01:22:24 UTC
+++ os.c
@@ -16083,11 +16083,16 @@ JNIEXPORT jlong JNICALL OS_NATIVE(realpath)
@@ -15180,11 +15180,16 @@ JNIEXPORT jlong JNICALL OS_NATIVE(realpath)
jlong rc = 0;
OS_NATIVE_ENTER(env, that, realpath_FUNC);
if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;

View file

@ -0,0 +1,13 @@
@binding-set SWTTreeViewBinding {
bind "Left" { "expand-collapse-cursor-row" (0,0,0)};
bind "Right" { "expand-collapse-cursor-row" (0,1,0)};
}
treeview {
-gtk-key-bindings: SWTTreeViewBinding;
}
scrolledwindow undershoot.top, scrolledwindow undershoot.right,
scrolledwindow undershoot.bottom, scrolledwindow undershoot.left {
background-image: none;
}

View file

@ -0,0 +1,25 @@
toolbar {
padding-top: 2px;
padding-bottom: 2px;
}
toolbar button {
padding: 2px;
}
toolbar button.popup {
padding: 0px;
}
toolbar toolbutton button {
padding: 0px 0px 0px 0px;
}
entry {
min-height: 26px;
}
tab {
padding-left: 6px;
padding-right: 6px;
}

View file

@ -0,0 +1,3 @@
button {
padding: 4px 8px;
}