diff --git a/.github/workflows/junit.yml b/.github/workflows/junit.yml
index fc8bec7af41..23344201e71 100644
--- a/.github/workflows/junit.yml
+++ b/.github/workflows/junit.yml
@@ -38,7 +38,7 @@ jobs:
done
- name: Publish Unit Test Results
- uses: EnricoMi/publish-unit-test-result-action@afb2984f4d89672b2f9d9c13ae23d53779671984 # v2.19.0
+ uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0
id: test-results
with:
commit: ${{ github.event.workflow_run.head_sha }}
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 034d6f2f673..0652fd66600 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -62,7 +62,7 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
- maven-version: 3.9.9
+ maven-version: 3.9.10
- name: Build
env:
GTK_XCFLAGS: '-Wno-deprecated-declarations'
@@ -72,7 +72,7 @@ jobs:
--threads 1C
-DforkCount=1
'-Dnative=${{ matrix.config.native }}'
- -Papi-check
+ -Papi-check -Pjavadoc
'-Dtycho.baseline.replace=none'
--fail-at-end
-DskipNativeTests=false
diff --git a/Jenkinsfile b/Jenkinsfile
index 641ee0e813e..6e5b314c8ff 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -44,7 +44,7 @@ def runOnNativeBuildAgent(String platform, Closure body) {
/** Returns the download URL of the JDK against whose C headers (in the 'include/' folder) and native libraries the SWT natives are compiled.*/
def getNativeJdkUrl(String os, String arch) { // To update the used JDK version update the URL template below
- if('win32'.equals(os) && 'aarch64'.equals(arch)) {
+ if ('win32'.equals(os) && 'aarch64'.equals(arch)) {
// Temporary workaround until there are official Temurin GA releases for Windows on ARM that can be consumed through JustJ
dir("${WORKSPACE}/repackage-win32.aarch64-jdk") {
sh """
@@ -71,7 +71,7 @@ def getNativeJdkUrl(String os, String arch) { // To update the used JDK version
}
def getLatestGitTag() {
- return sh(script: 'git describe --abbrev=0 --tags --match v[0-9][0-9][0-9][0-9]*', returnStdout: true).strip()
+ return sh(script: 'git describe --abbrev=0 --tags --match v[0-9][0-9][0-9][0-9]*', returnStdout: true).trim()
}
def getSWTVersions() { // must be called from the repository root
@@ -86,10 +86,10 @@ def Set NATIVES_CHANGED = []
pipeline {
options {
- skipDefaultCheckout() // Specialiced checkout is performed below
+ skipDefaultCheckout() // Specialized checkout is performed below
timestamps()
timeout(time: 180, unit: 'MINUTES')
- buildDiscarder(logRotator(numToKeepStr:'5'))
+ buildDiscarder(logRotator(numToKeepStr: 'master'.equals(env.BRANCH_NAME) ? '20' : '5', artifactNumToKeepStr: 'master'.equals(env.BRANCH_NAME) ? '3' : '1' ))
disableConcurrentBuilds(abortPrevious: true)
}
agent {
@@ -116,32 +116,31 @@ pipeline {
script {
def authorMail = sh(script: 'git log -1 --pretty=format:"%ce" HEAD', returnStdout: true)
echo 'HEAD commit author: ' + authorMail
- if ('eclipse-releng-bot@eclipse.org'.equals(authorMail) && !params.forceNativeBuilds) {
- // Prevent endless build-loops due to self triggering because of a previous automated build of SWT-natives and the associated updates.
+ def buildBotMail = 'platform-bot@eclipse.org'
+ if (buildBotMail.equals(authorMail) && !params.forceNativeBuilds) {
+ // Prevent endless build-loops due to self triggering because of a previous automated build of natives and the associated updates.
currentBuild.result = 'ABORTED'
error('Abort build only triggered by automated SWT-natives update.')
}
- }
- sh '''
+ sh """
+ java -version
git version
git lfs version
+ git config --global user.email '${buildBotMail}'
+ git config --global user.name 'Eclipse Platform Bot'
git config --unset core.hooksPath # Jenkins disables hooks by default as security feature, but we need the hooks for LFS
git lfs update # Install Git LFS hooks in repository, which has been skipped due to the initially nulled hookspath
git lfs pull
git fetch --all --tags --quiet
git remote set-url --push origin git@github.com:eclipse-platform/eclipse.platform.swt.git
- '''
+ """
+ }
}
}
}
stage('Check if SWT-binaries build is needed') {
steps {
dir('eclipse.platform.swt') {
- sh'''
- java -version
- git config --global user.email 'eclipse-releng-bot@eclipse.org'
- git config --global user.name 'Eclipse Releng Bot'
- '''
script {
def allWS = ['cocoa', 'gtk', 'win32']
def libraryFilePattern = [ 'cocoa' : 'libswt-*.jnilib', 'gtk' : 'libswt-*.so', 'win32' : 'swt-*.dll' ]
@@ -157,9 +156,9 @@ pipeline {
'''
def sourceFoldersProps = readProperties(file: 'nativeSourceFolders.properties')
def sources = sourceFoldersProps.collectEntries{ k, src -> [ k, src.split(',').collect{ f -> '\'' + f + '\''}.join(' ') ] }
- for(ws in allWS) {
+ for (ws in allWS) {
def diff = sh(script: "git diff HEAD ${swtTag} ${sources.src_common} ${sources['src_' + ws]}", returnStdout: true)
- if (!diff.strip().isEmpty()) {
+ if (!diff.trim().isEmpty()) {
NATIVES_CHANGED += ws
}
}
@@ -175,7 +174,7 @@ pipeline {
sed -i -e "s/rev=${versions.rev}/rev=${versions.new_rev}/g" \
'bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak'
"""
- for(ws in allWS) {
+ for (ws in allWS) {
if (NATIVES_CHANGED.contains(ws)) {
sh """
# Delete native binaries to be replaced by subsequent binaries build
@@ -239,7 +238,7 @@ pipeline {
script {
def (ws, os, arch) = env.PLATFORM.split('\\.')
dir("jdk-download-${ws}.${arch}") {
- // Fetch the JDK, which provides the C header-files and shared native libraries, against which the natives are build.
+ // Fetch the JDK, which provides the C header files and shared native libraries against which the native code is built.
sh "curl ${getNativeJdkUrl(os, arch)} | tar -xzf - include/ lib/"
stash name:"jdk.resources.${ws}.${arch}", includes: "include/,lib/"
deleteDir()
@@ -350,8 +349,8 @@ pipeline {
dir('eclipse.platform.swt') {
sh '''
mvn clean verify \
- --batch-mode --threads 1C -V -U -e -DforkCount=0 \
- -Papi-check \
+ --batch-mode --threads 1C -V -U -e \
+ -Pbree-libs -Papi-check -Pjavadoc \
-Dcompare-version-with-baselines.skip=false \
-Dorg.eclipse.swt.tests.junit.disable.test_isLocal=true \
-Dmaven.test.failure.ignore=true -Dmaven.test.error.ignore=true
@@ -382,11 +381,11 @@ pipeline {
sshagent(['github-bot-ssh']) {
dir('eclipse.platform.swt') {
sh """
- # Check for the master-branch as late as possible to have as much of the same behaviour as possible
+ # Check for the master-branch as late as possible to have as much of the same behavior as possible
if [[ '${BRANCH_NAME}' == master ]] || [[ '${BRANCH_NAME}' =~ R[0-9]+_[0-9]+(_[0-9]+)?_maintenance ]]; then
if [[ ${params.skipCommit} != true ]]; then
- # Don't rebase and just fail in case another commit has been pushed to the master/maintanance branch in the meantime
+ # Don't rebase and just fail in case another commit has been pushed to the master/maintenance branch in the meantime
git push origin HEAD:refs/heads/${BRANCH_NAME}
git push origin refs/tags/${getLatestGitTag()}
diff --git a/binaries/.settings/org.eclipse.jdt.core.prefs b/binaries/.settings/org.eclipse.jdt.core.prefs
index ee1fd8be6de..8487c861252 100644
--- a/binaries/.settings/org.eclipse.jdt.core.prefs
+++ b/binaries/.settings/org.eclipse.jdt.core.prefs
@@ -46,7 +46,7 @@ org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters
index ad4abeb951b..cdc3ecd69b2 100644
--- a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters
@@ -1,261 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -264,226 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/META-INF/MANIFEST.MF
index f0c077d7b74..d7f858f9fc7 100644
--- a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.cocoa.macosx.aarch64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/forceQualifierUpdate.txt
new file mode 100644
index 00000000000..7a4bf9f709b
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/forceQualifierUpdate.txt
@@ -0,0 +1 @@
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4969r13.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4969r13.jnilib
deleted file mode 100755
index af4f54ff2ab..00000000000
--- a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4969r13.jnilib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:482ef61ea92cd898c9a911b814d313e2e81d30608a74c8fea22e7c3caca5f223
-size 51952
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4970r1.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4970r1.jnilib
new file mode 100755
index 00000000000..66e7ddea0cf
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-awt-cocoa-4970r1.jnilib
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1440db907f2b0bed34ab6a76e11a53bbf5b1922c3a77fa1043e965dd8a02126d
+size 51952
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4969r13.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4969r13.jnilib
deleted file mode 100755
index 6c2e4b1ea4b..00000000000
--- a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4969r13.jnilib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ad10c670a164d2910ebc0320d804ee74573d913feca24eba0d18c54227d30291
-size 576624
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4970r1.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4970r1.jnilib
new file mode 100755
index 00000000000..c15001207e5
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-cocoa-4970r1.jnilib
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2826c771148aaaeab9ef18434115022e5d918274ea441b9f23a66b8070301a72
+size 576624
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4969r13.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4969r13.jnilib
deleted file mode 100755
index e5337f0d8bc..00000000000
--- a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4969r13.jnilib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e47cc5179faccfca9a63e8f5974652f83e4bef28f93b8e72d299fbdcc38f36ca
-size 298864
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4970r1.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4970r1.jnilib
new file mode 100755
index 00000000000..407ee904991
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/libswt-pi-cocoa-4970r1.jnilib
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:17e92837f4fb1bcfb65455001acf79227c8c10188e013bb0bcc9a361d34416a9
+size 298864
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters
index 3e161f4e933..b477fd21080 100644
--- a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters
@@ -1,261 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -264,226 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/META-INF/MANIFEST.MF
index 419888cf1fb..5a17d4680de 100644
--- a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.cocoa.macosx.x86_64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/forceQualifierUpdate.txt
new file mode 100644
index 00000000000..7a4bf9f709b
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/forceQualifierUpdate.txt
@@ -0,0 +1 @@
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4969r13.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4969r13.jnilib
deleted file mode 100755
index e956a303650..00000000000
--- a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4969r13.jnilib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:70e79cac05d14f6728a655a8e5c9539cd3cd39dfb40f044721a05ee471ec2de5
-size 52352
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4970r1.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4970r1.jnilib
new file mode 100755
index 00000000000..32081daa831
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-awt-cocoa-4970r1.jnilib
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:79291ae2e6f9f17c5fd58d1e1a2bfdba0a80859aa63a2b1f71a751372f157160
+size 52352
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4969r13.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4969r13.jnilib
deleted file mode 100755
index 2c5ad32c46f..00000000000
--- a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4969r13.jnilib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d47ddcbde21e7d5fdbc10c94a5c1f377a89e157a85ddd8fab7dfc5729036f277
-size 514256
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4970r1.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4970r1.jnilib
new file mode 100755
index 00000000000..cd915a39c84
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-cocoa-4970r1.jnilib
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2945757a7ef4cf17e0d94a4b3c7c7f865151aa658159211332ad405886544d4d
+size 514256
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4969r13.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4969r13.jnilib
deleted file mode 100755
index dd588fb59d1..00000000000
--- a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4969r13.jnilib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4faeafdf8133c8237be31a2e05c8a769aefa4370ad2395d1522e3d65517271f
-size 284016
diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4970r1.jnilib b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4970r1.jnilib
new file mode 100755
index 00000000000..6c0733b38e7
--- /dev/null
+++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/libswt-pi-cocoa-4970r1.jnilib
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3ab804f8a0195a0200c27439bbfad117ee7fcc0066a6816c469f0e800b57789d
+size 284016
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters
index a13db65355a..c2c1d069e19 100644
--- a/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters
@@ -1,461 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -464,26 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.gtk.linux.aarch64/META-INF/MANIFEST.MF
index 68dc81c489f..777a307ca74 100644
--- a/binaries/org.eclipse.swt.gtk.linux.aarch64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.gtk.linux.aarch64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.gtk.linux.aarch64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.gtk.linux.aarch64/forceQualifierUpdate.txt
index 75709314bdd..f844a1dc494 100644
--- a/binaries/org.eclipse.swt.gtk.linux.aarch64/forceQualifierUpdate.txt
+++ b/binaries/org.eclipse.swt.gtk.linux.aarch64/forceQualifierUpdate.txt
@@ -1 +1,2 @@
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-atk-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-awt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-cairo-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-glx-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4969r13.so
deleted file mode 100755
index 5a362e5eda7..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e124b7659cf5fa307d51521bc19bb5e9886aaadd431478503197818329c7b387
-size 536736
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4970r1.so
new file mode 100755
index 00000000000..4463ecd35b7
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-pi3-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e86510c208b40c4104587f27d16eaf25ce75be00771f10ae0ef0e93566a2138a
+size 536736
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4969r13.so
deleted file mode 100755
index 1751d94593c..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:030678fc1a0dfa5c3a265359cb9c9cf269cc32c648f3c12df44997faa247a781
-size 67856
diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4970r1.so
new file mode 100755
index 00000000000..9aee19bcd61
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.aarch64/libswt-webkit-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7d787117667b78c0c63c46cf860e1c05319fa53e5c0e64fe1419cc9b1869fefa
+size 67856
diff --git a/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters
index 32d58add358..56096635fb7 100644
--- a/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters
@@ -1,461 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -464,26 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.gtk.linux.loongarch64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.gtk.linux.loongarch64/forceQualifierUpdate.txt
new file mode 100644
index 00000000000..7a4bf9f709b
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.loongarch64/forceQualifierUpdate.txt
@@ -0,0 +1 @@
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters
index fe0b7c72db9..03263e7bc41 100644
--- a/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters
@@ -1,461 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -464,26 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.gtk.linux.ppc64le/META-INF/MANIFEST.MF
index 11f0c5be901..b88e2ba4d31 100644
--- a/binaries/org.eclipse.swt.gtk.linux.ppc64le/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.gtk.linux.ppc64le/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.gtk.linux.ppc64le;singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.gtk.linux.ppc64le/forceQualifierUpdate.txt
index 75709314bdd..f844a1dc494 100644
--- a/binaries/org.eclipse.swt.gtk.linux.ppc64le/forceQualifierUpdate.txt
+++ b/binaries/org.eclipse.swt.gtk.linux.ppc64le/forceQualifierUpdate.txt
@@ -1 +1,2 @@
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-atk-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-awt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-cairo-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-glx-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4969r13.so
deleted file mode 100755
index 64415d2af9a..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f4f97bd82533746db4c03ce3014ff0713d72a646ada983c085c22a3a0a8f553a
-size 602328
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4970r1.so
new file mode 100755
index 00000000000..bd210632ab9
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-pi3-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:739772f93c16177d447006035292bb4c0ed8c27e083eb5a541f658700a91c13f
+size 602328
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4969r13.so
deleted file mode 100755
index 7ea28696016..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c8d29552814eda9c2edf533364e639e3a506e30cc54cfba4b2cf76e2e91360cc
-size 133160
diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4970r1.so
new file mode 100755
index 00000000000..f24d2db59ba
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.ppc64le/libswt-webkit-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d60df7d59dd0df65cabea925d7d783dc70062a19e1666f62adb0ca9ace418a99
+size 133160
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters
index ac69e64af61..53953ef2c93 100644
--- a/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters
@@ -1,461 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -464,26 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.gtk.linux.riscv64/META-INF/MANIFEST.MF
index 66ace1ae971..2702b8f7455 100644
--- a/binaries/org.eclipse.swt.gtk.linux.riscv64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.gtk.linux.riscv64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.gtk.linux.riscv64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.gtk.linux.riscv64/forceQualifierUpdate.txt
index 75709314bdd..f844a1dc494 100644
--- a/binaries/org.eclipse.swt.gtk.linux.riscv64/forceQualifierUpdate.txt
+++ b/binaries/org.eclipse.swt.gtk.linux.riscv64/forceQualifierUpdate.txt
@@ -1 +1,2 @@
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-atk-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-atk-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-atk-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-atk-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-awt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-awt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-awt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-awt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-cairo-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-cairo-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-cairo-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-cairo-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-glx-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-glx-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-glx-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-glx-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-pi3-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-pi3-gtk-4969r13.so
deleted file mode 100755
index 6adc83bf75d..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-pi3-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0177626385a0b9071df0892f1daed083c56e87cfd5df4438de79c05dc1ae9566
-size 442072
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-pi3-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-pi3-gtk-4970r1.so
new file mode 100755
index 00000000000..e79557f7c23
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-pi3-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:90bc192015265242865ac7809087bdc562e939fb81a332c81280f1f8ac0f7e10
+size 442072
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-webkit-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-webkit-gtk-4969r13.so
deleted file mode 100755
index 15621ce50fe..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-webkit-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:b267bd5dab4b083377e1e619d1885e63f98fcc23993dab1b772c7398a07e97ab
-size 47016
diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-webkit-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-webkit-gtk-4970r1.so
new file mode 100755
index 00000000000..415f11dbd5a
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.riscv64/libswt-webkit-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d87dfb002f011e4dad364ff6e2f98fa34bcf70cccf9de8b03116b0ea60a95f13
+size 47016
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters
index e218c3dcef1..3a7b1ab39d9 100644
--- a/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters
@@ -8,28 +8,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.gtk.linux.x86_64/META-INF/MANIFEST.MF
index b492e62cfb8..748d9b14608 100644
--- a/binaries/org.eclipse.swt.gtk.linux.x86_64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.gtk.linux.x86_64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.gtk.linux.x86_64/forceQualifierUpdate.txt
index 75709314bdd..f844a1dc494 100644
--- a/binaries/org.eclipse.swt.gtk.linux.x86_64/forceQualifierUpdate.txt
+++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/forceQualifierUpdate.txt
@@ -1 +1,2 @@
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-atk-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-awt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-cairo-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-glx-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4970r1.so
similarity index 100%
rename from binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4969r13.so
rename to binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4970r1.so
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4969r13.so
deleted file mode 100755
index 2a7021af0f5..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:47f688357b7420e626db0dbd4086070ac276f67e61f6e25264025ebaac5bb19b
-size 458520
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4970r1.so
new file mode 100755
index 00000000000..515fed09dfd
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi3-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e526611f2e5ab38d5e65a38784631efaa48f8224a85a598dc7c9c23e7145962d
+size 458520
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi4-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi4-gtk-4969r13.so
deleted file mode 100755
index f57997c4413..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi4-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8c1451967cebf83199dae545cc9bf043b293d387a9236b515be602e620d5ae80
-size 399880
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi4-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi4-gtk-4970r1.so
new file mode 100755
index 00000000000..ba371c262cc
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-pi4-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a5d8e25af7bcef1f64a05746be5a8d3572040ab0bfe686647a1ade0a60dd0836
+size 399880
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4969r13.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4969r13.so
deleted file mode 100755
index 3975fee52ef..00000000000
--- a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4969r13.so
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3c7c742d1a8e563b104da16adbaf6e557e8f12cb366224bd30d792f3c25cc111
-size 55240
diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4970r1.so b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4970r1.so
new file mode 100755
index 00000000000..a37816f6a19
--- /dev/null
+++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-webkit-gtk-4970r1.so
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:31debe2277d64fc1c6c9b99b4bd79983316a13aae7959b50173b21b3a4d9d866
+size 55240
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters b/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters
index f6b4725ec0d..3ebbf228412 100644
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters
@@ -1,253 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -329,20 +81,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -389,214 +127,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -614,12 +144,4 @@
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.win32.win32.aarch64/META-INF/MANIFEST.MF
index 3a0115e28e7..b7689042cf1 100644
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.win32.win32.aarch64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.win32.win32.aarch64/forceQualifierUpdate.txt
index 75709314bdd..f844a1dc494 100644
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/forceQualifierUpdate.txt
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/forceQualifierUpdate.txt
@@ -1 +1,2 @@
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-awt-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-awt-win32-4969r13.dll
deleted file mode 100755
index 9ed6f876c0e..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-awt-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:82cb3b64f667e0fc14d26b48c823120766e275713c1c2d3261c48a6c7ce62c17
-size 111208
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-awt-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-awt-win32-4970r1.dll
new file mode 100755
index 00000000000..8168b678209
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-awt-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7b6adb1ab9d29b7bdb2f50fa6103eb2600647b58c0a56e85b25812afb8d31275
+size 111208
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-gdip-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-gdip-win32-4969r13.dll
deleted file mode 100755
index e64d82214c8..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-gdip-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a7ad22646dc644a2d630154e346d58ee1d21af05ce4eca88a92ff1e072b67ae5
-size 160360
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-gdip-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-gdip-win32-4970r1.dll
new file mode 100755
index 00000000000..e0d56981777
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-gdip-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9c7efe424795f8dc50d7878b934372583d3918c11859143c668e3588aece7588
+size 160360
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-osversion-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-osversion-win32-4970r1.dll
new file mode 100755
index 00000000000..e88a8583808
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-osversion-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:72826849cd9ca0a85c4a0adb7be8de2247f8b2d4c9a01a0b3756053f47d7ec47
+size 111720
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-wgl-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-wgl-win32-4969r13.dll
deleted file mode 100755
index 74377d9ba6c..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-wgl-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8d882aa99e801c1776d12664fcdeecf9c3b83ae9d55c8981b045e222ffadd720
-size 114280
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-wgl-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-wgl-win32-4970r1.dll
new file mode 100755
index 00000000000..f9aa4b6a074
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-wgl-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a90285112882d28d61edd424236761ac0d95631b8ce7751828a7a516eef2f87e
+size 114280
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-win32-4969r13.dll
deleted file mode 100755
index 9792547d6bf..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ecca9f796b35a27d73f88ac68881deef05d38cdd72c12a35d0ee392d1ba1c3bd
-size 708712
diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/swt-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-win32-4970r1.dll
new file mode 100755
index 00000000000..1552cc02972
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.aarch64/swt-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2b108afc5845cafe2cb70dedcdcf1f946170dd7810ca45a8e1a79884e5e1e652
+size 706152
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters b/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters
index 5d0ce47678f..8b82f39681d 100644
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters
@@ -1,253 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -375,228 +127,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -614,12 +144,4 @@
-
-
-
-
-
-
-
-
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/META-INF/MANIFEST.MF b/binaries/org.eclipse.swt.win32.win32.x86_64/META-INF/MANIFEST.MF
index 3cb81ab4763..e9aeafceb95 100644
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/META-INF/MANIFEST.MF
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.win32.win32.x86_64; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: fragment
Export-Package:
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/forceQualifierUpdate.txt b/binaries/org.eclipse.swt.win32.win32.x86_64/forceQualifierUpdate.txt
index 75709314bdd..f844a1dc494 100644
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/forceQualifierUpdate.txt
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/forceQualifierUpdate.txt
@@ -1 +1,2 @@
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4969r13.dll
deleted file mode 100755
index 1b47208c816..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7601b2f4176afa1af582aa71009d6c1ddf09887c388cd8818a2d46ca06be0999
-size 121960
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4970r1.dll
new file mode 100755
index 00000000000..d889c50e0e7
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-awt-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2046f11165d4cc696e698f450f7778e34ebbcc72a7b3d8461df2212149119985
+size 121960
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4969r13.dll
deleted file mode 100755
index 7282ee943bc..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:199d246194fdcac29bc7078c8a0e3711cc0b3b0337a15ba85d3427c7e230821e
-size 170600
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4970r1.dll
new file mode 100755
index 00000000000..d432de14b9e
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-gdip-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:909d70af5b34ea2fd79d4135d5a6198a3dee798dc84bec58e81509ef2e59c8c8
+size 170600
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-osversion-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-osversion-win32-4970r1.dll
new file mode 100755
index 00000000000..2b3d6e0a95b
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-osversion-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:491b76534a27fad2f4ef8a0040a82ece11946e54b5604ea921b008fdd0011417
+size 123496
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4969r13.dll
deleted file mode 100755
index d82a405e8ab..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:387741e36f5d3c1897884fdc2b383a9b443c86d455f601b091633bf5cc71cb5f
-size 125544
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4970r1.dll
new file mode 100755
index 00000000000..0a243ce37e6
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-wgl-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:44543172b473471ce344de9d33386dab29baa1c7f2a1a1943445325694202106
+size 125544
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4969r13.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4969r13.dll
deleted file mode 100755
index b908c7d6d5a..00000000000
--- a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4969r13.dll
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:442a181c7a50691f09f0bf45ec8946ca64ee0adcda383ef07210bb705b9340f5
-size 792680
diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4970r1.dll b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4970r1.dll
new file mode 100755
index 00000000000..6cde9dee1ee
--- /dev/null
+++ b/binaries/org.eclipse.swt.win32.win32.x86_64/swt-win32-4970r1.dll
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6e5b8cb4581d8ea8ccef73b9be2813219d6b5cf1465ccf1070c7cb14f611ec77
+size 790120
diff --git a/binaries/pom.xml b/binaries/pom.xml
index 743ed32629c..42accd0e679 100644
--- a/binaries/pom.xml
+++ b/binaries/pom.xml
@@ -19,7 +19,7 @@
org.eclipse.platform
eclipse.platform.swt
- 4.36.0-SNAPSHOT
+ 4.37.0-SNAPSHOT
eclipse.platform.swt.binaries
@@ -83,6 +83,24 @@
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+ field
+ f
+ Native code field
+
+
+ method
+ m
+ Native code method
+
+
+
+
@@ -171,7 +189,8 @@
package-swt-download-zip
- package
+
+ verify
run
diff --git a/bundles/org.eclipse.swt.svg/META-INF/p2.inf b/bundles/org.eclipse.swt.svg/META-INF/p2.inf
new file mode 100644
index 00000000000..9818f97c079
--- /dev/null
+++ b/bundles/org.eclipse.swt.svg/META-INF/p2.inf
@@ -0,0 +1,32 @@
+# ensure that the applicable implementation fragment gets installed (https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3006)
+requires.1.namespace = org.eclipse.equinox.p2.iu
+requires.1.name = org.eclipse.swt.win32.win32.x86_64
+requires.1.filter = (&(osgi.os=win32)(osgi.ws=win32)(osgi.arch=x86_64))
+
+requires.2.namespace = org.eclipse.equinox.p2.iu
+requires.2.name = org.eclipse.swt.cocoa.macosx.x86_64
+requires.2.filter = (&(osgi.os=macosx)(osgi.ws=cocoa)(osgi.arch=x86_64))
+
+requires.3.namespace = org.eclipse.equinox.p2.iu
+requires.3.name = org.eclipse.swt.gtk.linux.x86_64
+requires.3.filter = (&(osgi.os=linux)(osgi.ws=gtk)(osgi.arch=x86_64))
+
+requires.4.namespace = org.eclipse.equinox.p2.iu
+requires.4.name = org.eclipse.swt.gtk.linux.ppc64le
+requires.4.filter = (&(osgi.os=linux)(osgi.ws=gtk)(osgi.arch=ppc64le))
+
+requires.5.namespace = org.eclipse.equinox.p2.iu
+requires.5.name = org.eclipse.swt.gtk.linux.aarch64
+requires.5.filter = (&(osgi.os=linux)(osgi.ws=gtk)(osgi.arch=aarch64))
+
+requires.6.namespace = org.eclipse.equinox.p2.iu
+requires.6.name = org.eclipse.swt.cocoa.macosx.aarch64
+requires.6.filter = (&(osgi.os=macosx)(osgi.ws=cocoa)(osgi.arch=aarch64))
+
+requires.7.namespace = org.eclipse.equinox.p2.iu
+requires.7.name = org.eclipse.swt.win32.win32.aarch64
+requires.7.filter = (&(osgi.os=win32)(osgi.ws=win32)(osgi.arch=aarch64))
+
+requires.8.namespace = org.eclipse.equinox.p2.iu
+requires.8.name = org.eclipse.swt.gtk.linux.riscv64
+requires.8.filter = (&(osgi.os=linux)(osgi.ws=gtk)(osgi.arch=riscv64))
diff --git a/bundles/org.eclipse.swt.tools.base/build.properties b/bundles/org.eclipse.swt.tools.base/build.properties
index 41e4296f792..629da6a5246 100644
--- a/bundles/org.eclipse.swt.tools.base/build.properties
+++ b/bundles/org.eclipse.swt.tools.base/build.properties
@@ -16,4 +16,4 @@ bin.includes = about.html,\
plugin.properties,\
META-INF/,\
.
-src.includes = about.html
+pom.model.property.tycho.source.skip = true
diff --git a/bundles/org.eclipse.swt.tools.spies/.classpath b/bundles/org.eclipse.swt.tools.spies/.classpath
deleted file mode 100644
index 81fe078c20c..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/bundles/org.eclipse.swt.tools.spies/.project b/bundles/org.eclipse.swt.tools.spies/.project
deleted file mode 100644
index 41790f2b0f0..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- org.eclipse.swt.tools.spies
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 99f26c0203a..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding/=UTF-8
diff --git a/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index e85a06301c4..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,104 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=17
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=17
diff --git a/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 9d423fe972d..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,64 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org;com;
-org.eclipse.jdt.ui.ondemandthreshold=1
-org.eclipse.jdt.ui.staticondemandthreshold=1
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_type_arguments=true
-sp_cleanup.remove_trailing_whitespaces=false
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_lambda=true
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-sp_cleanup.use_type_arguments=false
diff --git a/bundles/org.eclipse.swt.tools.spies/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt.tools.spies/META-INF/MANIFEST.MF
deleted file mode 100644
index 69cfd404281..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.swt.tools.spies;singleton:=true
-Bundle-Version: 3.109.600.qualifier
-Bundle-ManifestVersion: 2
-Export-Package: org.eclipse.swt.tools.internal,
- org.eclipse.swt.tools.views
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-17
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.29.0",
- org.eclipse.swt.tools.base;bundle-version="3.106.0",
- org.eclipse.e4.ui.model.workbench;bundle-version="2.1.400",
- org.eclipse.swt;bundle-version="3.119.0",
- org.eclipse.ui;bundle-version="3.113.0",
- org.eclipse.e4.ui.di;bundle-version="1.2.600"
-Automatic-Module-Name: org.eclipse.swt.tools.spies
-Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)"
diff --git a/bundles/org.eclipse.swt.tools.spies/about.html b/bundles/org.eclipse.swt.tools.spies/about.html
deleted file mode 100644
index 164f781a8fd..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/about.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-About
-
-
- About This Content
-
- November 30, 2017
- License
-
-
- The Eclipse Foundation makes available all content in this plug-in
- ("Content"). Unless otherwise indicated below, the Content
- is provided to you under the terms and conditions of the Eclipse
- Public License Version 2.0 ("EPL"). A copy of the EPL is
- available at http://www.eclipse.org/legal/epl-2.0 .
- For purposes of the EPL, "Program" will mean the Content.
-
-
-
- If you did not receive this Content directly from the Eclipse
- Foundation, the Content is being redistributed by another party
- ("Redistributor") and different terms and conditions may
- apply to your use of any object code in the Content. Check the
- Redistributor's license that was provided with the Content. If no such
- license exists, contact the Redistributor. Unless otherwise indicated
- below, the terms and conditions of the EPL still apply to any source
- code in the Content and such source code may be obtained at http://www.eclipse.org .
-
-
-
-
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt.tools.spies/build.properties b/bundles/org.eclipse.swt.tools.spies/build.properties
deleted file mode 100644
index 1b0ce1e600e..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/build.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2025 IBM Corporation and others.
-#
-# This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License 2.0
-# which accompanies this distribution, and is available at
-# https://www.eclipse.org/legal/epl-2.0/
-#
-# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = about.html,\
- plugin.xml,\
- plugin.properties,\
- META-INF/,\
- icons/,\
- .,\
- fragment.e4xmi
-src.includes = about.html
diff --git a/bundles/org.eclipse.swt.tools.spies/forceQualifierUpdate.txt b/bundles/org.eclipse.swt.tools.spies/forceQualifierUpdate.txt
deleted file mode 100644
index f7670efb7ae..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/forceQualifierUpdate.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Bug 510973 - Missing source bundle for org.eclipse.swt.tools
-Bug 527899 [9] Implement JEP 280: Indify String Concatenation
-https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1659
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt.tools.spies/fragment.e4xmi b/bundles/org.eclipse.swt.tools.spies/fragment.e4xmi
deleted file mode 100644
index ac12910e99c..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/fragment.e4xmi
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
- View
-
-
-
diff --git a/bundles/org.eclipse.swt.tools.spies/icons/sleak.gif b/bundles/org.eclipse.swt.tools.spies/icons/sleak.gif
deleted file mode 100644
index 444bd357121..00000000000
Binary files a/bundles/org.eclipse.swt.tools.spies/icons/sleak.gif and /dev/null differ
diff --git a/bundles/org.eclipse.swt.tools.spies/icons/sleak.png b/bundles/org.eclipse.swt.tools.spies/icons/sleak.png
deleted file mode 100644
index 03eb60c8231..00000000000
Binary files a/bundles/org.eclipse.swt.tools.spies/icons/sleak.png and /dev/null differ
diff --git a/bundles/org.eclipse.swt.tools.spies/icons/sleak@2x.png b/bundles/org.eclipse.swt.tools.spies/icons/sleak@2x.png
deleted file mode 100644
index 003a4b06f0f..00000000000
Binary files a/bundles/org.eclipse.swt.tools.spies/icons/sleak@2x.png and /dev/null differ
diff --git a/bundles/org.eclipse.swt.tools.spies/icons/spy.gif b/bundles/org.eclipse.swt.tools.spies/icons/spy.gif
deleted file mode 100644
index 98d6e2e82f9..00000000000
Binary files a/bundles/org.eclipse.swt.tools.spies/icons/spy.gif and /dev/null differ
diff --git a/bundles/org.eclipse.swt.tools.spies/icons/spy.png b/bundles/org.eclipse.swt.tools.spies/icons/spy.png
deleted file mode 100644
index 1016ca8caa0..00000000000
Binary files a/bundles/org.eclipse.swt.tools.spies/icons/spy.png and /dev/null differ
diff --git a/bundles/org.eclipse.swt.tools.spies/icons/spy@2x.png b/bundles/org.eclipse.swt.tools.spies/icons/spy@2x.png
deleted file mode 100644
index 5f2dcf48e2c..00000000000
Binary files a/bundles/org.eclipse.swt.tools.spies/icons/spy@2x.png and /dev/null differ
diff --git a/bundles/org.eclipse.swt.tools.spies/plugin.properties b/bundles/org.eclipse.swt.tools.spies/plugin.properties
deleted file mode 100644
index fe533e6e5a3..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/plugin.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2015 IBM Corporation and others.
-#
-# This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License 2.0
-# which accompanies this distribution, and is available at
-# https://www.eclipse.org/legal/epl-2.0/
-#
-# SPDX-License-Identifier: EPL-2.0
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = SWT Tools Spy
-providerName = Eclipse.org
-spyViewName = SWT Spy
-sleakViewName = Sleak
diff --git a/bundles/org.eclipse.swt.tools.spies/plugin.xml b/bundles/org.eclipse.swt.tools.spies/plugin.xml
deleted file mode 100644
index 69abd2c8586..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/plugin.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/Sleak.java b/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/Sleak.java
deleted file mode 100644
index b4987ebd186..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/Sleak.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.tools.internal;
-
-import java.io.*;
-import java.util.*;
-import java.util.function.*;
-import java.util.stream.*;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.WidgetSpy.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.List;
-
-/**
- * Instructions on how to use the Sleak tool with a standlaone SWT example:
- *
- * Modify the main method below to launch your application.
- * Run Sleak.
- */
-@SuppressWarnings("restriction")
-public class Sleak {
- List list;
- Canvas canvas;
- Button enableTracking, diff, stackTrace, saveAs, save;
- Combo diffType;
- Text text;
-
- String filterPath = "";
- String fileName = "sleakout";
- String selectedName;
- boolean incrementFileNames = true;
- boolean saveImages = true;
- int fileCount;
-
- java.util.List oldObjects = new ArrayList<> ();
- java.util.List objects = new ArrayList<> ();
-
- NonDisposedWidgetTracker nonDisposedWidgetTracker = new NonDisposedWidgetTracker();
-
-public static void main (String [] args) {
- DeviceData data = new DeviceData();
- data.tracking = true;
- Display display = new Display (data);
- Sleak sleak = new Sleak ();
- Shell shell = new Shell(display);
- shell.setText ("S-Leak");
- Point size = shell.getSize ();
- shell.setSize (size.x / 2, size.y / 2);
- GridLayout layout = new GridLayout(2, false);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- shell.setLayout(layout);
- sleak.create (shell);
- shell.open();
-
- // Launch your application here
- // e.g.
-// Shell shell2 = new Shell(display);
-// Button button1 = new Button(shell2, SWT.PUSH);
-// button1.setBounds(10, 10, 100, 50);
-// button1.setText("Hello World");
-// Image image = new Image(display, 20, 20);
-// Button button2 = new Button(shell2, SWT.PUSH);
-// button2.setBounds(10, 70, 100, 50);
-// button2.setImage(image);
-// button1.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
-// Font oldFont = button1.getFont();
-// int style = oldFont.getFontData()[0].getStyle() ^ SWT.BOLD;
-// button1.setFont(new Font(display, "Arial", 10, style));
-// button1.setForeground(new Color(100,200,100));
-// oldFont.dispose();
-// }));
-// shell2.open();
-
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-
-public void create (Composite parent) {
-
- SashForm sash = new SashForm(parent, SWT.SMOOTH);
- sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- sash.setOrientation(SWT.HORIZONTAL);
- sash.setVisible(true);
-
- Composite left = new Composite(sash, 0);
- left.setLayout(new GridLayout());
- left.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Composite right = new Composite(sash, 0);
- right.setLayout(new GridLayout());
-
- sash.setWeights(new int[] {40,60});
-
- // Right side
- canvas = new Canvas (right, SWT.BORDER);
- canvas.addListener (SWT.Paint, event -> paintCanvas (event));
- canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 10));
- text = new Text (right, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 10));
- setVisible(text, false);
-
- // Left side
- enableTracking = new Button (left, SWT.CHECK);
- enableTracking.setText ("Enable resource tracking");
- enableTracking.setToolTipText("Enable Device resource tracking. Only resources allocated once enabled will be tracked. To track devices created before view is created, turn on tracing options, see https://www.eclipse.org/swt/tools.php");
- enableTracking.addListener (SWT.Selection, e -> toggleEnableTracking ());
- enableTracking.setSelection(enableTracking.getDisplay().isTracking());
- enableTracking.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
-
- Composite buttons = new Composite(left, 0);
- buttons.setLayout(new GridLayout(4, false));
- buttons.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- diff = new Button (buttons, SWT.PUSH);
- diff.setText ("Snap && Diff");
- diff.addListener (SWT.Selection, event -> refreshDifference ());
- GridData diffData = new GridData(SWT.FILL, SWT.NONE, true, false);
- diffData.horizontalSpan = 2;
- diff.setLayoutData(diffData);
-
- save = new Button (buttons, SWT.PUSH);
- save.setText ("Save");
- save.setToolTipText("Saves to the previously selected file.");
- save.addListener (SWT.Selection, event -> saveToFile (false));
- save.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
-
- saveAs = new Button (buttons, SWT.PUSH);
- saveAs.setText ("Save As...");
- saveAs.setToolTipText("Saves the contents of the list to a file, optionally with the stack traces if selected.");
- saveAs.addListener (SWT.Selection, event -> saveToFile (true));
- saveAs.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
-
- Composite checkboxAndCombo = new Composite(left, 0);
- checkboxAndCombo.setLayout(new GridLayout(2, false));
- checkboxAndCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
-
- diffType = new Combo (checkboxAndCombo, SWT.CHECK);
- diffType.add ("Object identity");
- diffType.add ("Creator class and line");
- diffType.add ("Creator class");
- diffType.select(0);
- diffType.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
-
- stackTrace = new Button (checkboxAndCombo, SWT.CHECK);
- stackTrace.setText ("Show Stack");
- stackTrace.addListener (SWT.Selection, e -> toggleStackTrace ());
- stackTrace.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, true, false));
-
- list = new List (left, SWT.BORDER | SWT.V_SCROLL);
- list.addListener (SWT.Selection, event -> refreshObject ());
- list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- stackTrace.setSelection (false);
- filterNonDisposedWidgetTypes();
-}
-
-private void toggleEnableTracking() {
- Display display = enableTracking.getDisplay();
- boolean tracking = display.isTracking();
- display.setTracking(!tracking);
- setWidgetTrackingEnabled(tracking);
-}
-
-void refreshLabel (java.util.List createdObjects, java.util.List deletedObjects) {
- Function super ObjectWithError, ? extends String> classifier = o -> o.object.getClass().getSimpleName();
-
- Map deleted = deletedObjects.stream().collect(
- Collectors.groupingBy(classifier, Collectors.counting()));
-
- Map created = createdObjects.stream().collect(
- Collectors.groupingBy(classifier, Collectors.counting()));
-
- StringBuilder sb = new StringBuilder();
- Stream deletedAndCreated = Stream.concat(deleted.keySet().stream(), created.keySet().stream());
- deletedAndCreated.distinct().sorted().forEach(type -> addCounts(sb, type, deleted.get(type), created.get(type)));
-
- String description = sb.length() > 0 ? sb.toString() : "0 object(s)";
- list.setToolTipText(description);
-}
-
-static void addCounts (StringBuilder string, String type, Long deleted, Long created) {
- if (deleted != null || created != null) {
- if (deleted != null) {
- string.append("-" + deleted);
- if (created != null) {
- string.append(" / ");
- }
- }
- if (created != null) {
- string.append(created);
- }
- string.append(" " + type + "(s)\n");
- }
-}
-
-void refreshDifference () {
- Display display = canvas.getDisplay();
- DeviceData info = getDeviceData(display);
-
- boolean hasOldData = !oldObjects.isEmpty();
-
- java.util.List old = new ArrayList<>(oldObjects);
- java.util.List disposed = new ArrayList<>();
- java.util.List created = new ArrayList<>();
- java.util.List same = collectNewObjects(info, old, disposed, created);
- java.util.List nonDisposedWidgets = getNonDisposedWidgets();
- created.addAll(nonDisposedWidgets);
- resetNonDisposedWidgets();
-
- if (diffType.getSelectionIndex() > 0) {
- old.removeAll(same);
- if (!old.isEmpty()) {
- Iterator createdIter = created.iterator ();
- while (createdIter.hasNext ()) {
- ObjectWithError createdObj = createdIter.next ();
- StackTraceElement stack = createdObj.getCreator ();
- Iterator oldIter = old.iterator ();
- while (oldIter.hasNext ()) {
- ObjectWithError oldObj = oldIter.next();
- if (creatorEquals(stack, oldObj.getCreator ())) {
- createdIter.remove ();
- break;
- }
- }
- }
- }
- }
-
- objects.clear();
- objects.addAll(created);
-
- oldObjects.clear();
- oldObjects.addAll(same);
- oldObjects.addAll(created);
-
-
- list.removeAll ();
- text.setText ("");
- canvas.redraw ();
- if(hasOldData) {
- for (ObjectWithError object : created) {
- list.add (object.object.toString());
- }
- }
- if(hasOldData) {
- refreshLabel (created, disposed);
- } else {
- refreshLabel (Collections.emptyList(), Collections.emptyList());
- }
-}
-
-private static java.util.List collectNewObjects(DeviceData info,
- java.util.List oldObjects,
- java.util.List disposedObjects,
- java.util.List createdObjects
- ) {
- disposedObjects.addAll(oldObjects);
- ArrayList sameObjects = new ArrayList<>();
-
- for (int i=0; i oldObject = oldObjects.iterator ();
- Object infoObject = info.objects [i];
- if (!(infoObject instanceof Color)) {
- // Bug 563018: Colors don't require disposal, so exclude them from the list of allocated objects.
- while (oldObject.hasNext () && !found) {
- ObjectWithError next = oldObject.next ();
- if (infoObject == next.object) {
- sameObjects.add(next);
- found = true;
- }
- }
- if (!found) {
- createdObjects.add(new ObjectWithError (infoObject, info.errors[i]));
- }
- }
- }
- // objects that were not found in new system state are disposed
- disposedObjects.removeAll(sameObjects);
- return sameObjects;
-}
-
-private DeviceData getDeviceData(Display display) {
- DeviceData info = display.getDeviceData ();
- if (!info.tracking) {
- Shell shell = canvas.getShell();
- MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
- dialog.setText (shell.getText ());
- dialog.setMessage ("Warning: Device is not tracking resource allocation\nWould you like to enable tracking now for future created resources?");
- if (SWT.YES == dialog.open ()) {
- enableTracking.setSelection(true);
- toggleEnableTracking();
- }
- }
- return info;
-}
-
-boolean creatorEquals (StackTraceElement first, StackTraceElement second) {
- switch (diffType.getSelectionIndex()) {
- case 1: return first.equals(second);
- case 2: return first.getClassName().equals(second.getClassName());
- default: throw new IllegalArgumentException();
- }
-}
-private void saveToFile(boolean prompt) {
- if (prompt || selectedName == null) {
- FileDialog dialog = new FileDialog(saveAs.getShell(), SWT.SAVE);
- dialog.setFilterPath(filterPath);
- dialog.setFileName(fileName);
- dialog.setOverwrite(true);
- selectedName = dialog.open();
- fileCount = 0;
- if (selectedName == null) {
- return;
- }
- filterPath = dialog.getFilterPath();
- fileName = dialog.getFileName();
-
- MessageBox msg = new MessageBox(saveAs.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
- msg.setText("Append incrementing file counter?");
- msg.setMessage("Append an incrementing file count to the file name on each save, starting at 000?");
- incrementFileNames = msg.open() == SWT.YES;
-
- msg = new MessageBox(saveAs.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
- msg.setText("Save images for each resource?");
- msg.setMessage("Save an image (png) for each resource?");
- saveImages = msg.open() == SWT.YES;
- }
-
- String fileName = selectedName;
- if (incrementFileNames) {
- fileName = String.format("%s_%03d", fileName, fileCount++);
- }
- try (PrintWriter file = new PrintWriter(new FileOutputStream(fileName))) {
-
- int i = 0;
- for (ObjectWithError o : objects) {
- Object object = o.object;
- Error error = o.error;
- file.print(object.toString());
- if (saveImages) {
- String suffix = String.format("%05d.png", i++);
- String pngName = String.format("%s_%s", fileName, suffix);
- Image image = new Image(saveAs.getDisplay(), (gc, width, height) -> draw(gc, object), 100, 100);
- try {
- ImageLoader loader = new ImageLoader();
- loader.data = new ImageData[] { image.getImageData() };
- loader.save(pngName, SWT.IMAGE_PNG);
- } finally {
- image.dispose();
- }
-
- file.print(" -> ");
- file.print(suffix);
- }
- file.println();
- if (stackTrace.getSelection()) {
- error.printStackTrace(file);
- System.out.println();
- }
- }
- } catch (IOException e1) {
- MessageBox msg = new MessageBox(saveAs.getShell(), SWT.ICON_ERROR | SWT.OK);
- msg.setText("Failed to save");
- msg.setMessage("Failed to save S-Leak file.\n" + e1.getMessage());
- msg.open();
- }
-}
-
-void toggleStackTrace () {
- refreshObject ();
- canvas.getParent().layout ();
-}
-
-void paintCanvas (Event event) {
- canvas.setCursor (null);
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- GC gc = event.gc;
- Object object = objects.get(index).object;
- draw(gc, object);
-}
-
-void draw(GC gc, Object object) {
- if (object instanceof Cursor) {
- if (((Cursor)object).isDisposed ()) return;
- canvas.setCursor ((Cursor) object);
- return;
- }
- if (object instanceof Font) {
- if (((Font)object).isDisposed ()) return;
- gc.setFont ((Font) object);
- String string = "";
- String lf = text.getLineDelimiter ();
- for (FontData data : gc.getFont ().getFontData ()) {
- String style = "NORMAL";
- int bits = data.getStyle ();
- if (bits != 0) {
- if ((bits & SWT.BOLD) != 0) style = "BOLD ";
- if ((bits & SWT.ITALIC) != 0) style += "ITALIC";
- }
- string += data.getName () + " " + data.getHeight () + " " + style + lf;
- }
- gc.drawString (string, 0, 0);
- return;
- }
- //NOTHING TO DRAW FOR GC
-// if (object instanceof GC) {
-// return;
-// }
- if (object instanceof Image) {
- if (((Image)object).isDisposed ()) return;
- gc.drawImage ((Image) object, 0, 0);
- return;
- }
- if (object instanceof Path) {
- if (((Path)object).isDisposed ()) return;
- gc.drawPath ((Path) object);
- return;
- }
- if (object instanceof Pattern) {
- if (((Pattern)object).isDisposed ()) return;
- gc.setBackgroundPattern ((Pattern)object);
- gc.fillRectangle (canvas.getClientArea ());
- gc.setBackgroundPattern (null);
- return;
- }
- if (object instanceof Region) {
- if (((Region)object).isDisposed ()) return;
- String string = ((Region)object).getBounds().toString();
- gc.drawString (string, 0, 0);
- return;
- }
- if (object instanceof TextLayout) {
- if (((TextLayout)object).isDisposed ()) return;
- ((TextLayout)object).draw (gc, 0, 0);
- return;
- }
- if (object instanceof Transform) {
- if (((Transform)object).isDisposed ()) return;
- String string = ((Transform)object).toString();
- gc.drawString (string, 0, 0);
- return;
- }
-}
-
-void refreshObject () {
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- if (stackTrace.getSelection ()) {
- text.setText (objects.get(index).getStack());
- setVisible(text, true);
- setVisible(canvas, false);
- text.getParent().layout();
- } else {
- setVisible(canvas, true);
- setVisible(text, false);
- canvas.redraw ();
- }
-}
-
-private void setVisible(Control control, boolean visible) {
- control.setVisible(visible);
- ((GridData)control.getLayoutData()).exclude = !visible;
-}
-
-private void filterNonDisposedWidgetTypes() {
- java.util.List> trackedTypes = Arrays.asList(
-// Composite.class,
-// Menu.class
- );
- nonDisposedWidgetTracker.setTrackedTypes(trackedTypes);
-}
-
-private void setWidgetTrackingEnabled(boolean tracking) {
- nonDisposedWidgetTracker.setTrackingEnabled(tracking);
-}
-
-private java.util.List getNonDisposedWidgets() {
- java.util.List nonDisposedWidgets = new ArrayList<>();
- nonDisposedWidgetTracker.getNonDisposedWidgets().forEach((w, e) -> nonDisposedWidgets.add(new ObjectWithError(w, e)));
- return nonDisposedWidgets;
-}
-
-private void resetNonDisposedWidgets() {
- nonDisposedWidgetTracker.startTracking();
-}
-
-private static final class ObjectWithError {
- final Object object;
- final Error error;
- String stack;
- StackTraceElement creator;
-
- ObjectWithError(Object o, Error e) {
- this.object = o;
- this.error = e;
- }
-
- StackTraceElement getCreator() {
- if (creator == null) {
- String objectType = object.getClass().getName();
- Iterator stack = Arrays.asList(error.getStackTrace()).iterator();
- while (stack.hasNext()) {
- StackTraceElement element = stack.next();
- if (element.getClassName().equals(objectType) && element.getMethodName().equals("")) {
- creator = stack.hasNext() ? stack.next() : null;
- break;
- }
- }
- }
- return creator;
- }
-
- String getStack() {
- if (stack == null) {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- PrintStream s = new PrintStream(stream);
- error.printStackTrace(s);
- stack = stream.toString();
- }
- return stack;
- }
-}
-}
diff --git a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/views/SleakView.java b/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/views/SleakView.java
deleted file mode 100644
index bbf444c9b8f..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/views/SleakView.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2019 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Lars Vogel - Converted to e4 view
- *******************************************************************************/
-package org.eclipse.swt.tools.views;
-
-import org.eclipse.e4.ui.di.*;
-import org.eclipse.swt.tools.internal.*;
-import org.eclipse.swt.widgets.*;
-
-import jakarta.annotation.*;
-
-/**
- * Sleak view to trace native handler allocation
- */
-
-public class SleakView {
-
- private Composite composite;
-
- @PostConstruct
- public void createPartControl(Composite parent) {
- Sleak sleak = new Sleak ();
- sleak.create(parent);
- composite = parent;
- }
-
- @Focus
- public void setFocus() {
- composite.setFocus();
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/views/SpyView.java b/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/views/SpyView.java
deleted file mode 100644
index e1ccca3cfda..00000000000
--- a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/views/SpyView.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.tools.views;
-
-import java.io.*;
-import java.lang.reflect.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.tools.internal.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-
-public class SpyView extends ViewPart {
- private StyledText output;
- private Action spyAction, fullyQualifiedAction;
- private Listener keyFilter;
- private Runnable timer;
- private Control lastControl;
- private Field field;
-
- static final int TIMEOUT = 100;
-
- private static final ImageDescriptor SPY_IMAGE_DESCRIPTOR = ImageDescriptor.createFromURL(
- FileLocator.find(Platform.getBundle(SpiesConstants.PLUGIN_ID), new Path("icons/spy.png"), null));
- /**
- * This is a callback that will allow us
- * to create the viewer and initialize it.
- */
- @Override
- public void createPartControl(Composite parent) {
- output = new StyledText(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
-
- keyFilter = e -> {
- // If this accelerator changes, change the tooltip text
- if (e.keyCode == '.' && e.stateMask == (SWT.ALT | SWT.SHIFT | SWT.CONTROL)) {
- if (spyAction.isChecked()) {
- spyAction.setChecked(false);
- } else {
- spyAction.setChecked(true);
- spyAction.run();
- }
- e.type = SWT.None;
- }
- };
- parent.getDisplay().addFilter(SWT.KeyDown, keyFilter);
-
- timer = new Runnable() {
- @Override
- public void run() {
- if (output == null || output.isDisposed() || !spyAction.isChecked()) return;
- Display display = output.getDisplay();
- Control control = display.getCursorControl();
- if (control != lastControl) {
- StringBuilder text = new StringBuilder();
- if (control != null) {
- text.append(getName(control)+"@"+getOSHandle(control)+"\n");
- text.append("\tStyle: "+getStyle(control)+"\n");
- text.append("\tLayout Data: "+getName(control.getLayoutData())+"\n");
- text.append("\tBounds: "+control.getBounds()+"\n");
- if (control instanceof Composite && ((Composite)control).getLayout() != null) {
- text.append("\tLayout: "+getName(((Composite)control).getLayout())+"\n");
- }
- text.append("\n");
- if (control instanceof Composite) {
- text.append("\nChildren:\n");
- for (Control element : ((Composite)control).getChildren()) {
- text.append("\t"+getName(element)+"\n");
- }
- }
- Composite parent = control.getParent();
- if (parent != null) {
- text.append("\nPeers:\n");
- for (Control peer : parent.getChildren()) {
- text.append("\t");
- if (peer == control) text.append("*");
- text.append(getName(peer)+"@"+getOSHandle(peer));
- text.append(" Layout Data: "+getName(peer.getLayoutData()));
- text.append(" Bounds: "+peer.getBounds());
- text.append("\n");
- }
- text.append("\nParent Tree:\n");
- Composite[] parents = new Composite[0];
- while (parent != null) {
- Composite[] newParents = new Composite[parents.length + 1];
- System.arraycopy(parents, 0, newParents, 0, parents.length);
- newParents[parents.length] = parent;
- parents = newParents;
- parent = parent.getParent();
- }
- for (int i = parents.length - 1; i >= 0; i--) {
- String prefix = "\t";
- for (int j = 0; j < parents.length - i - 1; j++) {
- prefix += "\t";
- }
- text.append(prefix + getName(parents[i])+"@"+getOSHandle(parents[i])+"\n");
- text.append(prefix+"\t Style: "+getStyle(parents[i])+"\n");
- text.append(prefix+"\t Bounds: "+parents[i].getBounds()+"\n");
- text.append(prefix+"\t Layout: "+getName(parents[i].getLayout())+"\n");
- text.append(prefix+"\t LayoutData: "+getName(parents[i].getLayoutData())+"\n");
- }
- }
- Error error = (Error)control.getData("StackTrace");
- if (error != null) {
- text.append("\nCreation Stack Trace:\n");
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- PrintStream s = new PrintStream(stream);
- error.printStackTrace(s);
- text.append(stream.toString());
- }
- }
- output.setText(text.toString());
- }
- lastControl = control;
- display.timerExec(100, this);
- }
- };
-
- makeActions();
- contributeToActionBars();
- }
-
- String getName(Object object) {
- if (object == null) return "null";
- String name = object.toString ();
- if (fullyQualifiedAction.isChecked()) {
- int index = name.indexOf(' ');
- if (index >= 0 && name.length() >= 1) {
- name = object.getClass ().getName () + name.substring(index);
- }
- }
- return name;
- }
-
- /**
- * Passing the focus request to the viewer's control.
- */
- @Override
- public void setFocus() {
- if (output != null & !output.isDisposed()) output.setFocus();
- }
-
- private String getOSHandle(Control control) {
- if (field == null) {
- for (String fieldName : new String[]{"handle", "view"}) {
- try {
- field = control.getClass().getField(fieldName);
- if (field != null) break;
- } catch (Throwable e) {}
- }
- }
- try {
- return field.get(control).toString();
- } catch (Throwable e) {}
- return "";
- }
-
- private void contributeToActionBars() {
- IActionBars bars = getViewSite().getActionBars();
- fillLocalPullDown(bars.getMenuManager());
- fillLocalToolBar(bars.getToolBarManager());
- }
-
- @Override
- public void dispose() {
- if (keyFilter != null) {
- Display.getCurrent().removeFilter(SWT.KeyDown, keyFilter);
- }
- super.dispose();
- }
-
- private void fillLocalPullDown(IMenuManager manager) {
- manager.add(spyAction);
- manager.add(fullyQualifiedAction);
- }
-
- private void fillLocalToolBar(IToolBarManager manager) {
- manager.add(spyAction);
- }
-
- private void makeActions() {
- spyAction = new Action("Spy", IAction.AS_CHECK_BOX) {
- @Override
- public void run() {
- Display.getCurrent().timerExec(TIMEOUT, timer);
- }
- };
- spyAction.setToolTipText("Toggle Spy (CONTROL+ALT+SHIFT+.)");
- spyAction.setImageDescriptor(SPY_IMAGE_DESCRIPTOR);
-
- fullyQualifiedAction = new Action("Fully Qualify Names", IAction.AS_CHECK_BOX) {
- @Override
- public void run() {
- }
- };
- }
-
- private String getStyle(Widget w) {
- //MODELESS = 0;
- //BAR = 1 << 1;
- //SEPARATOR = 1 << 1;
- //TOGGLE = 1 << 1;
- //MULTI = 1 << 1;
- //INDETERMINATE = 1 << 1;
- //DBCS = 1 << 1;
- //ALPHA = 1 << 2;
- //TOOL = 1 << 2;
- //SINGLE = 1 << 2;
- //ARROW = 1 << 2;
- //DROP_DOWN = 1 << 2;
- //SHADOW_IN = 1 << 2;
- //POP_UP = 1 << 3;
- //PUSH = 1 << 3;
- //READ_ONLY = 1 << 3;
- //SHADOW_OUT = 1 << 3;
- //NO_TRIM = 1 << 3;
- //NATIVE = 1 << 3;
- //RESIZE = 1 << 4;
- //SHADOW_ETCHED_IN = 1 << 4;
- //RADIO = 1 << 4;
- //PHONETIC = 1 << 4;
- //ROMAN = 1 << 5;
- //CHECK = 1 << 5;
- //SHADOW_NONE = 1 << 5;
- //TITLE = 1 << 5;
- //DATE = 1 << 5;
- //CLOSE = 1 << 6;
- //MENU = CLOSE;
- //CASCADE = 1 << 6;
- //WRAP = 1 << 6;
- //SIMPLE = 1 << 6;
- //SHADOW_ETCHED_OUT = 1 << 6;
- //MIN = 1 << 7;
- //UP = 1 << 7;
- //TOP = UP;
- //TIME = 1 << 7;
- //HORIZONTAL = 1 << 8;
- //H_SCROLL = 1 << 8;
- //V_SCROLL = 1 << 9;
- //VERTICAL = 1 << 9;
- //MAX = 1 << 10;
- //DOWN = 1 << 10;
- //BOTTOM = DOWN;
- //CALENDAR = 1 << 10;
- //BORDER = 1 << 11;
- //CLIP_CHILDREN = 1 << 12;
- //BALLOON = 1 << 12;
- //CLIP_SIBLINGS = 1 << 13;
- //ON_TOP = 1 << 14;
- //LEAD = 1 << 14;
- //LEFT = LEAD;
- //PRIMARY_MODAL = 1 << 15;
- //HIDE_SELECTION = 1 << 15;
- //SHORT = 1 << 15;
- //MEDIUM = 1 << 16;
- //FULL_SELECTION = 1 << 16;
- //SMOOTH = 1 << 16;
- //APPLICATION_MODAL = 1 << 16;
- //SYSTEM_MODAL = 1 << 17;
- //TRAIL = 1 << 17;
- //RIGHT = TRAIL;
- //NO_BACKGROUND = 1 << 18;
- //NO_FOCUS = 1 << 19;
- //NO_REDRAW_RESIZE = 1 << 20;
- //NO_MERGE_PAINTS = 1 << 21;
- //NO_RADIO_GROUP = 1 << 22;
- //PASSWORD = 1 << 22;
- //FLAT = 1 << 23;
- //EMBEDDED = 1 << 24;
- //CENTER = 1 << 24;
- //LEFT_TO_RIGHT = 1 << 25;
- //RIGHT_TO_LEFT = 1 << 26;
- //MIRRORED = 1 << 27;
- //VIRTUAL = 1 << 28;
- //LONG = 1 << 28;
- //DOUBLE_BUFFERED = 1 << 29;
-
- int style = w.getStyle();
- String result = "";
- if (style == SWT.DEFAULT) {
- return "DEFAULT - bad!";
- }
- if ((style & 1 << 1) != 0) {
- if (w instanceof CTabFolder || w instanceof StyledText || w instanceof List || w instanceof Text || w instanceof Table || w instanceof Tree) {
- result += "MULTI | ";
- } else if (w instanceof Menu) {
- result += "BAR | ";
- } else if (w instanceof Label || w instanceof MenuItem || w instanceof ToolItem) {
- result += "SEPARATOR | ";
- } else if (w instanceof Button) {
- result += "TOGGLE | ";
- } else if (w instanceof ProgressBar) {
- result += "INDETERMINATE | ";
- } else {
- result += "BAR or SEPARATOR or TOGGLE or MULTI or INDETERMINATE or DBCS | ";
- }
- }
- if ((style & 1 << 2) != 0) {
- if (w instanceof Menu || w instanceof ToolItem || w instanceof CoolItem || w instanceof Combo) {
- result += "DROP_DOWN | ";
- } else if (w instanceof Button) {
- result += "ARROW | ";
- } else if (w instanceof CTabFolder || w instanceof StyledText || w instanceof List || w instanceof Text || w instanceof Table || w instanceof Tree) {
- result += "SINGLE | ";
- } else if (w instanceof Label || w instanceof Group) {
- result += "SHADOW_IN | ";
- } else if (w instanceof Decorations) {
- result += "TOOL | ";
- } else {
- result += "ALPHA or TOOL or SINGLE or ARROW or DROP_DOWN or SHADOW_IN | ";
- }
- }
- if ((style & 1 << 3) != 0) {
- if (w instanceof Menu) {
- result += "POP_UP | ";
- } else if (w instanceof Button || w instanceof MenuItem || w instanceof ToolItem) {
- result += "PUSH | ";
- } else if (w instanceof Combo || w instanceof Text || w instanceof StyledText) {
- result += "READ_ONLY | ";
- } else if (w instanceof Label || w instanceof Group || w instanceof ToolBar) {
- result += "SHADOW_OUT | ";
- } else if (w instanceof Decorations) {
- result += "NO_TRIM | ";
- } else {
- result += "POP_UP or PUSH or READ_ONLY or SHADOW_OUT or NO_TRIM or NATIVE | ";
- }
- }
- if ((style & 1 << 4) != 0) {
- if (w instanceof Button || w instanceof MenuItem || w instanceof ToolItem) {
- result += "RADIO | ";
- } else if (w instanceof Group) {
- result += "SHADOW_ETCHED_IN | ";
- } else if (w instanceof Decorations || w instanceof Tracker) {
- result += "RESIZE | ";
- } else {
- result += "RESIZE or SHADOW_ETCHED_IN or RADIO or PHONETIC | ";
- }
- }
- if ((style & 1 << 5) != 0) {
- if (w instanceof Button || w instanceof MenuItem || w instanceof ToolItem || w instanceof Table || w instanceof Tree) {
- result += "CHECK | ";
- } else if (w instanceof Label || w instanceof Group) {
- result += "SHADOW_NONE | ";
- } else if (w instanceof Decorations) {
- result += "TITLE | ";
- } else if (w instanceof DateTime) {
- result += "DATE | ";
- } else {
- result += "ROMAN or CHECK or SHADOW_NONE or TITLE | ";
- }
- }
- if ((style & 1 << 6) != 0) {
- if (w instanceof MenuItem) {
- result += "CASCADE | ";
- } else if (w instanceof StyledText || w instanceof Label || w instanceof Text || w instanceof ToolBar) {
- result += "WRAP | ";
- } else if (w instanceof Combo) {
- result += "SIMPLE | ";
- } else if (w instanceof Group) {
- result += "SHADOW_ETCHED_OUT | ";
- } else if (w instanceof Decorations || w instanceof CTabFolder || w instanceof CTabItem) {
- result += "CLOSE | ";
- } else {
- result += "CLOSE or MENU or CASCADE or WRAP or SIMPLE or SHADOW_ETCHED_OUT | ";
- }
- }
- if ((style & 1 << 7) != 0) {
- if (w instanceof Decorations) {
- result += "MIN | ";
- } else if (w instanceof Button || w instanceof Tracker) {
- result += "UP | ";
- } else if (w instanceof CTabFolder) {
- result += "TOP | ";
- } else if (w instanceof DateTime) {
- result += "TIME | ";
- } else {
- result += "MIN or UP or TOP | ";
- }
- }
- if ((style & 1 << 8) != 0) {
- result += "HORIZONTAL | ";
- }
- if ((style & 1 << 9) != 0) {
- result += "VERTICAL | ";
- }
- if ((style & 1 << 10) != 0) {
- if (w instanceof Decorations) {
- result += "MAX | ";
- } else if (w instanceof Button || w instanceof Tracker) {
- result += "DOWN | ";
- } else if (w instanceof CTabFolder) {
- result += "BOTTOM | ";
- } else if (w instanceof DateTime) {
- result += "CALENDAR | ";
- } else {
- result += "MAX or DOWN or BOTTOM | ";
- }
- }
- if ((style & 1 << 11) != 0) {
- result += "BORDER | ";
- }
- if ((style & 1 << 12) != 0) {
- if (w instanceof ToolTip) {
- result += "BALLOON | ";
- } else {
- result += "CLIP_CHILDREN | ";
- }
- }
- if ((style & 1 << 13) != 0) {
- result += "CLIP_SIBLINGS | ";
- }
- if ((style & 1 << 14) != 0) {
- result += "ON_TOP or LEAD or LEFT | ";
- }
- if ((style & 1 << 15) != 0) {
- if (w instanceof Shell) {
- result += "PRIMARY_MODAL | ";
- } else if (w instanceof Table || w instanceof Tree) {
- result += "HIDE_SELECTION | ";
- } else if (w instanceof DateTime) {
- result += "SHORT | ";
- } else {
- result += "PRIMARY_MODAL or HIDE_SELECTION | ";
- }
- }
- if ((style & 1 << 16) != 0) {
- if (w instanceof StyledText || w instanceof Table || w instanceof Tree) {
- result += "FULL_SELECTION | ";
- } else if (w instanceof Shell) {
- result += "APPLICATION_MODAL | ";
- } else if (w instanceof ProgressBar) {
- result += "SMOOTH | ";
- } else if (w instanceof DateTime) {
- result += "MEDIUM | ";
- } else {
- result += "FULL_SELECTION or SMOOTH or APPLICATION_MODAL | ";
- }
- }
- if ((style & 1 << 17) != 0) {
- if (w instanceof Shell) {
- result += "SYSTEM_MODAL | ";
- } else if (w instanceof Button || w instanceof Label || w instanceof TableColumn || w instanceof Tracker || w instanceof ToolBar) {
- result += "TRAIL | ";
- } else {
- result += "SYSTEM_MODAL or TRAIL or RIGHT | ";
- }
- }
- if ((style & 1 << 18) != 0) {
- result += "NO_BACKGROUND | ";
- }
- if ((style & 1 << 19) != 0) {
- result += "NO_FOCUS | ";
- }
- if ((style & 1 << 20) != 0) {
- result += "NO_REDRAW_RESIZE | ";
- }
- if ((style & 1 << 21) != 0) {
- result += "NO_MERGE_PAINTS | ";
- }
- if ((style & 1 << 22) != 0) {
- if (w instanceof Text) {
- result += "PASSWORD | ";
- } else if (w instanceof Composite) {
- result += "NO_RADIO_GROUP | ";
- } else {
- result += "NO_RADIO_GROUP or PASSWORD | ";
- }
- }
- if ((style & 1 << 23) != 0) {
- result += "FLAT | ";
- }
- if ((style & 1 << 24) != 0) {
- if (w instanceof Button || w instanceof Label || w instanceof TableColumn) {
- result += "CENTER | ";
- } else {
- result += "EMBEDDED or CENTER | ";
- }
- }
- if ((style & 1 << 25) != 0) {
- result += "LEFT_TO_RIGHT | ";
- }
- if ((style & 1 << 26) != 0) {
- result += "RIGHT_TO_LEFT | ";
- }
- if ((style & 1 << 27) != 0) {
- result += "MIRRORED | ";
- }
- if ((style & 1 << 28) != 0) {
- if (w instanceof DateTime) {
- result += "LONG | ";
- } else {
- result += "VIRTUAL | ";
- }
- }
- if ((style & 1 << 29) != 0) {
- result += "DOUBLE_BUFFERED | ";
- }
- int lastOr = result.lastIndexOf("|");
- if (lastOr == result.length() - 2 ) result = result.substring(0, result.length() - 2);
- return result;
- }
-}
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties
index 7b85efdb120..d7982f1b9f9 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.properties
@@ -20,9 +20,6 @@ swt_copyright=/*****************************************************************
* https://www.eclipse.org/legal/epl-2.0/\n \
*\n \
* SPDX-License-Identifier: EPL-2.0\n \
-*\n \
-* Contributors:\n \
-* IBM Corporation - initial API and implementation\n \
*******************************************************************************/\n
swt_properties_copyright=###############################################################################\n\
# Copyright (c) 2000, %END_YEAR IBM Corporation and others.\n\
@@ -33,9 +30,6 @@ swt_properties_copyright=#######################################################
# https://www.eclipse.org/legal/epl-2.0/\n\
#\n\
# SPDX-License-Identifier: EPL-2.0\n\
-#\n\
-# Contributors:\n\
-# IBM Corporation - initial API and implementation\n\
###############################################################################
swt_main_classes=\
org.eclipse.swt.internal.accessibility.gtk.ATK,../org.eclipse.swt/Eclipse SWT PI/gtk/library/,\
@@ -44,6 +38,7 @@ org.eclipse.swt.internal.gtk3.GTK3,../org.eclipse.swt/Eclipse SWT PI/gtk/library
org.eclipse.swt.internal.gtk4.GTK4,../org.eclipse.swt/Eclipse SWT PI/gtk/library/,\
org.eclipse.swt.internal.ole.win32.COM,../org.eclipse.swt/Eclipse SWT PI/win32/library/,\
org.eclipse.swt.internal.win32.OS,../org.eclipse.swt/Eclipse SWT PI/win32/library/,\
+org.eclipse.swt.internal.win32.version.OsVersion,../org.eclipse.swt/Eclipse SWT PI/win32/library/,\
org.eclipse.swt.internal.gdip.Gdip,../org.eclipse.swt/Eclipse SWT PI/win32/library/,\
org.eclipse.swt.internal.cairo.Cairo,../org.eclipse.swt/Eclipse SWT PI/cairo/library/,\
org.eclipse.swt.internal.opengl.glx.GLX,../org.eclipse.swt/Eclipse SWT OpenGL/glx/library/,\
diff --git a/bundles/org.eclipse.swt.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt.tools/META-INF/MANIFEST.MF
index 1a5437e7c6a..6ef829656d3 100644
--- a/bundles/org.eclipse.swt.tools/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.swt.tools/META-INF/MANIFEST.MF
@@ -12,7 +12,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.29.0",
org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.jdt.core;bundle-version="3.4.0",
org.eclipse.ui;bundle-version="3.4.0",
- org.eclipse.jface.text;bundle-version="3.4.0",
- org.eclipse.swt.tools.base;bundle-version="3.106.0";visibility:=reexport,
- org.eclipse.swt.tools.spies;bundle-version="3.106.0";visibility:=reexport
+ org.eclipse.jface.text;bundle-version="3.4.0"
Automatic-Module-Name: org.eclipse.swt.tools
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
index ad34ca74296..8c6ef0ab432 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -231,7 +231,7 @@ public static Frame new_Frame (final Composite parent) {
});
break;
case SWT.Resize:
- final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea());
+ final Rectangle clientArea = parent.getClientArea();
EventQueue.invokeLater(() -> frame[0].setSize (clientArea.width, clientArea.height));
break;
}
@@ -241,7 +241,7 @@ public static Frame new_Frame (final Composite parent) {
parent.getDisplay().asyncExec(() -> {
if (parent.isDisposed()) return;
- final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea());
+ final Rectangle clientArea = parent.getClientArea();
EventQueue.invokeLater(() -> {
frame[0].setSize (clientArea.width, clientArea.height);
frame[0].validate ();
@@ -285,7 +285,7 @@ public void componentResized (ComponentEvent e) {
display.syncExec (() -> {
if (shell.isDisposed()) return;
Dimension dim = parent.getSize ();
- shell.setSize (DPIUtil.autoScaleDown(new Point(dim.width, dim.height)));
+ shell.setSize (new Point(dim.width, dim.height));
});
}
};
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java
index ed12c5fe9d2..076654fdcf6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java
@@ -1351,7 +1351,7 @@ public id internal_accessibilityFocusedUIElement(int childID) {
* You can assume the point has already been determined to lie within the receiver.
* Override this method to do deeper hit testing within a UIElement - e.g. a NSMatrix
* would test its cells. The point is bottom-left relative screen coordinates.
- *
+ *
* IMPORTANT: This field is not part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
@@ -1393,7 +1393,7 @@ public id internal_accessibilityHitTest(NSPoint point, int childID) {
* Return YES if the UIElement doesn't show up to the outside world -
* i.e. its parent should return the UIElement's children as its own -
* cutting the UIElement out. E.g. NSControls are ignored when they are single-celled.
- *
+ *
* IMPORTANT: This field is not part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
@@ -1422,7 +1422,7 @@ public boolean internal_accessibilityIsIgnored(int childID) {
/**
* Return the array of supported attributes that take parameters.
- *
+ *
* IMPORTANT: This field is not part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
@@ -1484,7 +1484,7 @@ public NSArray internal_accessibilityParameterizedAttributeNames(int childID) {
/**
* Performs the specified action.
- *
+ *
* IMPORTANT: This field is not part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
@@ -1530,7 +1530,7 @@ public boolean internal_accessibilityPerformAction(NSString action, int childID)
/**
* Set the value of the specified attribute to the given value.
* Unsupported attributes are ignored.
- *
+ *
* IMPORTANT: This field is not part of the SWT
* public API. It is marked public only so that it can be shared
* within the packages provided by SWT. It is not available on all
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
index 25f7ebe2a5d..de97efcb6c1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
@@ -4534,10 +4534,8 @@ static long toDisplay (long gdkResource, long x, long y) {
} else {
GDK.gdk_window_get_origin (gdkResource, origin_x, origin_y);
}
- int scaledX = DPIUtil.autoScaleDown (origin_x [0]);
- int scaledY = DPIUtil.autoScaleDown (origin_y [0]);
- C.memmove (x, new int[] {scaledX}, 4);
- C.memmove (y, new int[] {scaledY}, 4);
+ C.memmove (x, new int[] {origin_x [0]}, 4);
+ C.memmove (y, new int[] {origin_y [0]}, 4);
return 0;
}
@@ -4651,6 +4649,7 @@ void removeRelation (int type, Accessible target) {
}
void selectionChanged () {
+ if(GTK.GTK4) return; //TODO investigate proper way for GTK 4.x
OS.g_signal_emit_by_name (atkHandle, ATK.selection_changed);
}
@@ -4864,6 +4863,7 @@ void sendEvent(int event, Object eventData, int childID) {
}
void setFocus (int childID) {
+ if(GTK.GTK4) return; //TODO investigate proper way for GTK 4.x
updateChildren ();
AccessibleObject accObject = getChildByID (childID);
if (accObject != null) {
@@ -4873,10 +4873,12 @@ void setFocus (int childID) {
}
void textCaretMoved(int index) {
+ if(GTK.GTK4) return; //TODO investigate proper way for GTK 4.x
OS.g_signal_emit_by_name (atkHandle, ATK.text_caret_moved, index);
}
void textChanged(int type, int startIndex, int length) {
+ if(GTK.GTK4) return; //TODO investigate proper way for GTK 4.x
if (type == ACC.TEXT_DELETE) {
OS.g_signal_emit_by_name (atkHandle, ATK.text_changed_delete, startIndex, length);
} else {
@@ -4885,6 +4887,7 @@ void textChanged(int type, int startIndex, int length) {
}
void textSelectionChanged() {
+ if(GTK.GTK4) return; //TODO investigate proper way for GTK 4.x
OS.g_signal_emit_by_name (atkHandle, ATK.text_selection_changed);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java
index 6d0403b9082..3f4eb80708e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java
@@ -13,7 +13,10 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import java.util.*;
+
import org.eclipse.swt.*;
+import org.eclipse.swt.program.*;
import org.eclipse.swt.widgets.*;
/**
@@ -93,10 +96,7 @@ public Browser (Composite parent, int style) {
}
style = getStyle ();
- webBrowser = new BrowserFactory ().createWebBrowser (style);
- if (webBrowser != null) {
- webBrowser.setBrowser (this);
- webBrowser.create (parent, style);
+ if (createWebBrowser(parent, style)) {
return;
}
dispose ();
@@ -119,6 +119,72 @@ public Browser (Composite parent, int style) {
SWT.error (SWT.ERROR_NO_HANDLES, null, errMsg);
}
+private boolean createWebBrowser(Composite parent, int style) {
+ webBrowser = new BrowserFactory ().createWebBrowser (style);
+ if (webBrowser == null) {
+ return false;
+ }
+ webBrowser.setBrowser (this);
+ try {
+ webBrowser.create (parent, style);
+ return true;
+ } catch (SWTError error) {
+ boolean isEdge = "win32".equals(SWT.getPlatform()) && (style & SWT.IE) == 0;
+ if (isEdge && error.code == SWT.ERROR_NOT_IMPLEMENTED) {
+ WebViewUnavailableDialog.showAsync(getShell());
+ }
+ throw error;
+ }
+}
+
+private class WebViewUnavailableDialog {
+ private record DialogOption(int index, String message) {};
+ private static final DialogOption USE_IE_OPTION = new DialogOption(SWT.YES, "Use IE");
+ private static final DialogOption MORE_INFORMATION_OPTION = new DialogOption(SWT.NO, "Information");
+ private static final DialogOption CANCEL_OPTION = new DialogOption(SWT.CANCEL, "Cancel");
+
+ private static final String DIALOG_TITLE = "Default browser engine not available";
+ private static final String DIALOG_MESSAGE = "Microsoft Edge (WebView2) is not available. Do you want to use the legacy Internet Explorer?\n\nNote: It is necessary to reopen browsers for the change to take effect.";
+ private static final String FAQ_URL = "https://github.com/eclipse-platform/eclipse.platform/tree/master/docs/FAQ/FAQ_How_do_I_use_Edge-IE_as_the_Browser's_underlying_renderer.md";
+
+ private static final int DIALOG_OPTION_FLAGS = USE_IE_OPTION.index | MORE_INFORMATION_OPTION.index | CANCEL_OPTION.index;
+ private static final Map DIALOG_OPTION_LABELS = Map.of( //
+ USE_IE_OPTION.index, USE_IE_OPTION.message, //
+ MORE_INFORMATION_OPTION.index, MORE_INFORMATION_OPTION.message, //
+ CANCEL_OPTION.index, CANCEL_OPTION.message);
+
+ private static boolean shownOnce;
+
+ static void showAsync(Shell parentShell) {
+ if (shownOnce) {
+ return;
+ }
+ shownOnce = true;
+ parentShell.getDisplay().asyncExec(() -> {
+ processDialog(parentShell);
+ });
+ }
+
+ static private void processDialog(Shell parentShell) {
+ MessageBox fallbackInfoBox = new MessageBox(parentShell, SWT.ICON_ERROR | DIALOG_OPTION_FLAGS);
+ fallbackInfoBox.setText(DIALOG_TITLE);
+ fallbackInfoBox.setMessage(DIALOG_MESSAGE);
+ fallbackInfoBox.setButtonLabels(DIALOG_OPTION_LABELS);
+ boolean completed;
+ do {
+ int result = fallbackInfoBox.open();
+ completed = true;
+ if (result == MORE_INFORMATION_OPTION.index) {
+ Program.launch(FAQ_URL);
+ completed = false;
+ } else if (result == USE_IE_OPTION.index) {
+ System.setProperty(PROPERTY_DEFAULTTYPE, "ie");
+ DefaultType = SWT.IE;
+ }
+ } while (!completed);
+ }
+}
+
static Composite checkParent (Composite parent) {
String platform = SWT.getPlatform ();
if (!"gtk".equals (platform)) return parent; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java
index 0ce5bf07263..5edd673d800 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java
@@ -233,15 +233,24 @@ static void error(int code, int hr) {
SWT.error(code, null, String.format(" [0x%08x]", hr));
}
-static IUnknown newCallback(ICoreWebView2SwtCallback handler) {
- long punk = COM.CreateSwtWebView2Callback((arg0, arg1) -> {
+static class HandleCoreWebView2SwtCallback implements ICoreWebView2SwtCallback {
+ private final ICoreWebView2SwtCallback handler;
+ public HandleCoreWebView2SwtCallback(ICoreWebView2SwtCallback handler) {
+ this.handler = handler;
+ }
+ @Override
+ public int Invoke(long arg0, long arg1) {
inCallback++;
try {
return handler.Invoke(arg0, arg1);
} finally {
inCallback--;
}
- });
+ }
+}
+
+static IUnknown newCallback(ICoreWebView2SwtCallback handler) {
+ long punk = COM.CreateSwtWebView2Callback(new HandleCoreWebView2SwtCallback(handler));
if (punk == 0) error(SWT.ERROR_NO_HANDLES, COM.E_OUTOFMEMORY);
return new IUnknown(punk);
}
@@ -789,7 +798,7 @@ void setupBrowser(int hr, long pv) {
handler.Release();
}
- IUnknown hostDisp = newHostObject(this::handleCallJava);
+ IUnknown hostDisp = newHostObject(new HandleCoreWebView2SwtHost(this.functions));
long[] hostObj = { COM.VT_DISPATCH, hostDisp.getAddress(), 0 }; // VARIANT
webView.AddHostObjectToScript("swt\0".toCharArray(), hostObj);
hostDisp.Release();
@@ -916,6 +925,14 @@ public Object evaluate(String script) throws SWTException {
// Feature in WebView2. ExecuteScript works regardless of IsScriptEnabled setting.
// Disallow programmatic execution manually.
if (!jsEnabled) return null;
+ return evaluateInternal(script);
+}
+
+/**
+ * Unconditional script execution, bypassing {@link WebBrowser#jsEnabled} flag /
+ * {@link Browser#setJavascriptEnabled(boolean)}.
+ */
+private Object evaluateInternal(String script) throws SWTException {
if(inCallback > 0) {
// Execute script, but do not wait for async call to complete as otherwise it
// can cause a deadlock if execute inside a WebView callback.
@@ -965,7 +982,7 @@ String getJavaCallDeclaration() {
@Override
public String getText() {
- return (String)evaluate("return document.documentElement.outerHTML;");
+ return (String)evaluateInternal("return document.documentElement.outerHTML;");
}
@Override
@@ -1012,24 +1029,31 @@ int handleDocumentTitleChanged(long pView, long pArgs) {
return COM.S_OK;
}
-long handleCallJava(int index, long bstrToken, long bstrArgsJson) {
- Object result = null;
- String token = bstrToString(bstrToken);
- BrowserFunction function = functions.get(index);
- if (function != null && token.equals (function.token)) {
- inCallback++;
- try {
- String argsJson = bstrToString(bstrArgsJson);
- Object args = JSON.parse(argsJson.toCharArray());
- result = function.function ((Object[]) args);
- } catch (Throwable e) {
- result = WebBrowser.CreateErrorString(e.getLocalizedMessage());
- } finally {
- inCallback--;
+static class HandleCoreWebView2SwtHost implements ICoreWebView2SwtHost {
+ private final Map functions;
+ public HandleCoreWebView2SwtHost(Map functions) {
+ this.functions = functions;
+ }
+ @Override
+ public long CallJava(int index, long bstrToken, long bstrArgsJson) {
+ Object result = null;
+ String token = bstrToString(bstrToken);
+ BrowserFunction function = functions.get(index);
+ if (function != null && token.equals (function.token)) {
+ inCallback++;
+ try {
+ String argsJson = bstrToString(bstrArgsJson);
+ Object args = JSON.parse(argsJson.toCharArray());
+ result = function.function ((Object[]) args);
+ } catch (Throwable e) {
+ result = WebBrowser.CreateErrorString(e.getLocalizedMessage());
+ } finally {
+ inCallback--;
+ }
}
- }
- String json = JSON.stringify(result);
- return COM.SysAllocStringLen(json.toCharArray(), json.length());
+ String json = JSON.stringify(result);
+ return COM.SysAllocStringLen(json.toCharArray(), json.length());
+ }
}
int handleFrameNavigationStarting(long pView, long pArgs) {
@@ -1526,8 +1550,10 @@ public void stop() {
static boolean isLocationForCustomText(String location) {
try {
- return URI_FOR_CUSTOM_TEXT_PAGE.equals(new URI(location));
- } catch (URISyntaxException e) {
+ URI locationUri = new URI(location);
+ return "file".equals(locationUri.getScheme())
+ && Path.of(URI_FOR_CUSTOM_TEXT_PAGE).equals(Path.of(locationUri));
+ } catch (URISyntaxException | IllegalArgumentException e) {
return false;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
index 8830850b1cb..e82fbca3754 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -792,7 +792,7 @@ boolean setEventData(long context, int x, int y, int time, DNDEvent event) {
long window = GTK3.gtk_widget_get_window (control.handle);
GDK.gdk_window_get_origin(window, origin_x, origin_y);
}
- Point coordinates = DPIUtil.autoScaleDown(new Point(origin_x[0] + x, origin_y[0] + y));
+ Point coordinates = new Point(origin_x[0] + x, origin_y[0] + y);
event.widget = this;
event.x = coordinates.x;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java
index 8b14b6f23b3..d224ab6c0d1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -136,7 +136,7 @@ public void dragOver(DropTargetEvent event) {
long handle = table.handle;
int effect = checkEffect(event.feedback);
Point coordinates = new Point(event.x, event.y);
- coordinates = DPIUtil.autoScaleUp(table.toControl(coordinates));
+ coordinates = table.toControl(coordinates);
long [] path = new long [1];
GTK.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);
int index = -1;
@@ -154,7 +154,7 @@ public void dragOver(DropTargetEvent event) {
} else {
if (index != -1 && scrollIndex == index && scrollBeginTime != 0) {
if (System.currentTimeMillis() >= scrollBeginTime) {
- if (coordinates.y < DPIUtil.autoScaleUp(table.getItemHeight())) {
+ if (coordinates.y < table.getItemHeight()) {
GTK.gtk_tree_path_prev(path[0]);
} else {
GTK.gtk_tree_path_next(path[0]);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java
index 0f77fc07745..b252e0c5e5a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -150,7 +150,7 @@ public void dragOver(DropTargetEvent event) {
long handle = tree.handle;
Point coordinates = new Point(event.x, event.y);
- coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates));
+ coordinates = tree.toControl(coordinates);
long [] path = new long [1];
GTK.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null);
int index = -1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
index dee4ef16cb1..9a48e39abc8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
@@ -380,9 +380,15 @@ public DragSource(Control control, int style) {
DragSource.this.drag(event);
}
}
+ if (event.type == SWT.ZoomChanged) {
+ if (!DragSource.this.isDisposed()) {
+ this.nativeZoom = event.detail;
+ }
+ }
};
control.addListener(SWT.Dispose, controlListener);
control.addListener(SWT.DragDetect, controlListener);
+ control.addListener(SWT.ZoomChanged, controlListener);
this.addListener(SWT.Dispose, e -> DragSource.this.onDispose());
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
index 0d3f32e137e..2a804684a87 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
@@ -14,6 +14,7 @@
package org.eclipse.swt.dnd;
import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.ole.win32.*;
import org.eclipse.swt.internal.win32.*;
@@ -281,16 +282,14 @@ int DragEnter_64(long pDataObject, int grfKeyState, long pt, long pdwEffect) {
}
int DragEnter(long pDataObject, int grfKeyState, int pt_x, int pt_y, long pdwEffect) {
- int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom);
- pt_x = DPIUtil.scaleDown(pt_x, zoom);// To Points
- pt_y = DPIUtil.scaleDown(pt_y, zoom);// To Points
+ Point location = convertPixelToPoint(pt_x, pt_y);
selectedDataType = null;
selectedOperation = DND.DROP_NONE;
if (iDataObject != null) iDataObject.Release();
iDataObject = null;
DNDEvent event = new DNDEvent();
- if (!setEventData(event, pDataObject, grfKeyState, pt_x, pt_y, pdwEffect)) {
+ if (!setEventData(event, pDataObject, grfKeyState, location.x, location.y, pdwEffect)) {
OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
return COM.S_FALSE;
}
@@ -349,14 +348,12 @@ int DragOver_64(int grfKeyState, long pt, long pdwEffect) {
}
int DragOver(int grfKeyState, int pt_x, int pt_y, long pdwEffect) {
- int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom);
- pt_x = DPIUtil.scaleDown(pt_x, zoom);// To Points
- pt_y = DPIUtil.scaleDown(pt_y, zoom);// To Points
+ Point location = convertPixelToPoint(pt_x, pt_y);
if (iDataObject == null) return COM.S_FALSE;
int oldKeyOperation = keyOperation;
DNDEvent event = new DNDEvent();
- if (!setEventData(event, iDataObject.getAddress(), grfKeyState, pt_x, pt_y, pdwEffect)) {
+ if (!setEventData(event, iDataObject.getAddress(), grfKeyState, location.x, location.y, pdwEffect)) {
keyOperation = -1;
OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
return COM.S_FALSE;
@@ -403,23 +400,38 @@ int Drop_64(long pDataObject, int grfKeyState, long pt, long pdwEffect) {
return Drop(pDataObject, grfKeyState, point.x, point.y, pdwEffect);
}
+private Point convertPixelToPoint(int xInPixels, int yInPixels) {
+ if (this.control == null) {
+ // If there is no control for context, the behavior remains as before
+ int zoom = DPIUtil.getZoomForAutoscaleProperty(this.nativeZoom);
+ return DPIUtil.scaleDown(new Point(xInPixels, yInPixels), zoom);
+ }
+ int zoom = DPIUtil.getZoomForAutoscaleProperty(this.control.nativeZoom);
+ // There is no API to convert absolute values in pixels to display relative
+ // points. Therefor, the display relative pixel values are converted to control
+ // relative pixel values via Windows API. These values can be scaled down to points
+ POINT pt = new POINT ();
+ pt.x = xInPixels; pt.y = yInPixels;
+ OS.ScreenToClient (this.control.handle, pt);
+ Point p = DPIUtil.scaleDown(new Point (pt.x, pt.y), zoom);
+ return this.control.toDisplay(p);
+}
+
int Drop(long pDataObject, int grfKeyState, int pt_x, int pt_y, long pdwEffect) {
try {
- int zoom = DPIUtil.getZoomForAutoscaleProperty(nativeZoom);
- pt_x = DPIUtil.scaleDown(pt_x, zoom);// To Points
- pt_y = DPIUtil.scaleDown(pt_y, zoom);// To Points
+ Point location = convertPixelToPoint(pt_x, pt_y);
DNDEvent event = new DNDEvent();
event.widget = this;
event.time = OS.GetMessageTime();
if (dropEffect != null) {
- event.item = dropEffect.getItem(pt_x, pt_y);
+ event.item = dropEffect.getItem(location.x, location.y);
}
event.detail = DND.DROP_NONE;
notifyListeners(DND.DragLeave, event);
refresh();
event = new DNDEvent();
- if (!setEventData(event, pDataObject, grfKeyState, pt_x, pt_y, pdwEffect)) {
+ if (!setEventData(event, pDataObject, grfKeyState, location.x, location.y, pdwEffect)) {
keyOperation = -1;
OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
return COM.S_FALSE;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ImageTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ImageTransfer.java
index 4acd5730978..a5ffe176cdb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ImageTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ImageTransfer.java
@@ -15,7 +15,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.ole.win32.*;
import org.eclipse.swt.internal.win32.*;
@@ -184,8 +183,9 @@ public Object nativeToJava(TransferData transferData) {
pSourceBits -= scanline;
}
}
- Image image = Image.win32_new(null, SWT.BITMAP, memDib, DPIUtil.getNativeDeviceZoom());
- ImageData data = image.getImageData (DPIUtil.getDeviceZoom ());
+ final int DEFAULT_IMAGE_STORAGE_ZOOM = 100;
+ Image image = Image.win32_new(null, SWT.BITMAP, memDib, DEFAULT_IMAGE_STORAGE_ZOOM);
+ ImageData data = image.getImageData ();
OS.DeleteObject(memDib);
image.dispose();
return data;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
index d7dd4873eba..4757b387f6c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.internal.opengl.glx.*;
@@ -164,7 +163,7 @@ public GLCanvas (Composite parent, int style, GLData data) {
GLX.glViewport (viewport [0],viewport [1],viewport [2],viewport [3]);
break;
case SWT.Resize:
- Rectangle clientArea = DPIUtil.autoScaleUp(getClientArea());
+ Rectangle clientArea = getClientArea();
GDK.gdk_window_move (glWindow, clientArea.x, clientArea.y);
GDK.gdk_window_resize (glWindow, clientArea.width, clientArea.height);
break;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java
index 06cf11fdb28..dbf7dbc102e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/Platform.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.swt.internal;
-
public class Platform {
public static final String PLATFORM = "cocoa"; //$NON-NLS-1$
@@ -21,4 +20,11 @@ public static boolean isLoadable () {
return Library.isLoadable ();
}
+public static void exitIfNotLoadable() {
+ if (!Library.isLoadable ()) {
+ System.err.println("Libraries for platform " + Platform.PLATFORM + " cannot be loaded because of incompatible environment");
+ System.exit(1);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/C.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/C.java
index 1abd49ca477..df91aef01a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/C.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/C.java
@@ -16,6 +16,7 @@
public class C extends Platform {
static {
+ exitIfNotLoadable();
Library.loadLibrary ("swt"); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
index 5f4472c73c8..20ddc91e1e3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2022 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -35,12 +35,12 @@ public class Library {
/**
* SWT Minor version number (must be in the range 0..999)
*/
- static int MINOR_VERSION = 969;
+ static int MINOR_VERSION = 970;
/**
* SWT revision number (must be >= 0)
*/
- static int REVISION = 13;
+ static int REVISION = 1;
/**
* The JAVA and SWT versions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
index bf5b9cb7af1..35e3cc4aa9a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
@@ -7,9 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -2275,6 +2272,16 @@ JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1widget_1get_1window)
}
#endif
+#ifndef NO_gtk_1widget_1hide
+JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1hide)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ GTK3_NATIVE_ENTER(env, that, gtk_1widget_1hide_FUNC);
+ gtk_widget_hide((GtkWidget *)arg0);
+ GTK3_NATIVE_EXIT(env, that, gtk_1widget_1hide_FUNC);
+}
+#endif
+
#ifndef NO_gtk_1widget_1input_1shape_1combine_1region
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1input_1shape_1combine_1region)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
@@ -2408,6 +2415,16 @@ JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1shape_1combine_1region)
}
#endif
+#ifndef NO_gtk_1widget_1show
+JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1show)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ GTK3_NATIVE_ENTER(env, that, gtk_1widget_1show_FUNC);
+ gtk_widget_show((GtkWidget *)arg0);
+ GTK3_NATIVE_EXIT(env, that, gtk_1widget_1show_FUNC);
+}
+#endif
+
#ifndef NO_gtk_1widget_1size_1allocate
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1widget_1size_1allocate)
(JNIEnv *env, jclass that, jlong arg0, jobject arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h
index 9eed9c0cd17..217b2e2e7a8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h
@@ -7,9 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -209,6 +206,7 @@ typedef enum {
gtk_1widget_1get_1screen_FUNC,
gtk_1widget_1get_1toplevel_FUNC,
gtk_1widget_1get_1window_FUNC,
+ gtk_1widget_1hide_FUNC,
gtk_1widget_1input_1shape_1combine_1region_FUNC,
gtk_1widget_1override_1font_FUNC,
gtk_1widget_1remove_1accelerator_FUNC,
@@ -221,6 +219,7 @@ typedef enum {
gtk_1widget_1set_1parent_1window_FUNC,
gtk_1widget_1set_1redraw_1on_1allocate_FUNC,
gtk_1widget_1shape_1combine_1region_FUNC,
+ gtk_1widget_1show_FUNC,
gtk_1widget_1size_1allocate_FUNC,
gtk_1widget_1style_1get__J_3B_3IJ_FUNC,
gtk_1widget_1style_1get__J_3B_3JJ_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
index f7f7f26124a..b61216f0dee 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
@@ -7,9 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -710,6 +707,18 @@ JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1editable_1get_1delegate)
}
#endif
+#ifndef NO_gtk_1editable_1get_1max_1width_1chars
+JNIEXPORT jint JNICALL GTK4_NATIVE(gtk_1editable_1get_1max_1width_1chars)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jint rc = 0;
+ GTK4_NATIVE_ENTER(env, that, gtk_1editable_1get_1max_1width_1chars_FUNC);
+ rc = (jint)gtk_editable_get_max_width_chars((GtkEditable *)arg0);
+ GTK4_NATIVE_EXIT(env, that, gtk_1editable_1get_1max_1width_1chars_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_gtk_1editable_1get_1text
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1editable_1get_1text)
(JNIEnv *env, jclass that, jlong arg0)
@@ -722,6 +731,16 @@ JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1editable_1get_1text)
}
#endif
+#ifndef NO_gtk_1editable_1set_1max_1width_1chars
+JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1editable_1set_1max_1width_1chars)
+ (JNIEnv *env, jclass that, jlong arg0, jint arg1)
+{
+ GTK4_NATIVE_ENTER(env, that, gtk_1editable_1set_1max_1width_1chars_FUNC);
+ gtk_editable_set_max_width_chars((GtkEditable *)arg0, (int)arg1);
+ GTK4_NATIVE_EXIT(env, that, gtk_1editable_1set_1max_1width_1chars_FUNC);
+}
+#endif
+
#ifndef NO_gtk_1entry_1buffer_1get_1text
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1entry_1buffer_1get_1text)
(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h
index 7db184262b4..2bb889d9b0a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h
@@ -7,9 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
*******************************************************************************/
/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
@@ -75,7 +72,9 @@ typedef enum {
gtk_1drop_1target_1async_1new_FUNC,
gtk_1drop_1target_1async_1set_1formats_FUNC,
gtk_1editable_1get_1delegate_FUNC,
+ gtk_1editable_1get_1max_1width_1chars_FUNC,
gtk_1editable_1get_1text_FUNC,
+ gtk_1editable_1set_1max_1width_1chars_FUNC,
gtk_1entry_1buffer_1get_1text_FUNC,
gtk_1entry_1get_1buffer_FUNC,
gtk_1entry_1get_1text_1length_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 262bfbaf443..bc2e9a63b03 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -9352,16 +9352,6 @@ JNIEXPORT jboolean JNICALL GTK_NATIVE(gtk_1widget_1has_1focus)
}
#endif
-#ifndef NO_gtk_1widget_1hide
-JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1hide)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- GTK_NATIVE_ENTER(env, that, gtk_1widget_1hide_FUNC);
- gtk_widget_hide((GtkWidget *)arg0);
- GTK_NATIVE_EXIT(env, that, gtk_1widget_1hide_FUNC);
-}
-#endif
-
#ifndef NO_gtk_1widget_1insert_1action_1group
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1insert_1action_1group)
(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1, jlong arg2)
@@ -9680,16 +9670,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1set_1visible)
}
#endif
-#ifndef NO_gtk_1widget_1show
-JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1show)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- GTK_NATIVE_ENTER(env, that, gtk_1widget_1show_FUNC);
- gtk_widget_show((GtkWidget *)arg0);
- GTK_NATIVE_EXIT(env, that, gtk_1widget_1show_FUNC);
-}
-#endif
-
#ifndef NO_gtk_1widget_1unparent
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1unparent)
(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index c483797d324..8d57a7eedcb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -748,7 +748,6 @@ typedef enum {
gtk_1widget_1grab_1focus_FUNC,
gtk_1widget_1has_1default_FUNC,
gtk_1widget_1has_1focus_FUNC,
- gtk_1widget_1hide_FUNC,
gtk_1widget_1insert_1action_1group_FUNC,
gtk_1widget_1is_1focus_FUNC,
gtk_1widget_1mnemonic_1activate_FUNC,
@@ -774,7 +773,6 @@ typedef enum {
gtk_1widget_1set_1valign_FUNC,
gtk_1widget_1set_1vexpand_FUNC,
gtk_1widget_1set_1visible_FUNC,
- gtk_1widget_1show_FUNC,
gtk_1widget_1unparent_FUNC,
gtk_1window_1fullscreen_FUNC,
gtk_1window_1get_1default_1size_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/Platform.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/Platform.java
index 3b6c5e72589..af2f17d7b92 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/Platform.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/Platform.java
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.swt.internal;
-
public class Platform {
public static final String PLATFORM = "gtk"; //$NON-NLS-1$
@@ -22,4 +21,11 @@ public static boolean isLoadable () {
return Library.isLoadable ();
}
+public static void exitIfNotLoadable() {
+ if (!Library.isLoadable ()) {
+ System.err.println("Libraries for platform " + Platform.PLATFORM + " cannot be loaded because of incompatible environment");
+ System.exit(1);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index 29f15836b1d..cffb588f19c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -185,7 +185,7 @@ public class GTK extends OS {
public static final byte[] gtk_application_prefer_dark_theme = OS.ascii("gtk-application-prefer-dark-theme");
/** Named icons.
- * See https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html
+ * See https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html
* See http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#names
* Icon preview tool: gtk3-icon-browser
* Snippets often demonstrate usage of these. E.x 309, 258.
@@ -2340,8 +2340,7 @@ public class GTK extends OS {
public static final native void gtk_widget_grab_focus(long widget);
/** @param widget cast=(GtkWidget *) */
public static final native boolean gtk_widget_has_focus(long widget);
- /** @param widget cast=(GtkWidget *) */
- public static final native void gtk_widget_hide(long widget);
+
/** @param widget cast=(GtkWidget *) */
public static final native boolean gtk_widget_is_focus(long widget);
/** @param widget cast=(GtkWidget *) */
@@ -2399,8 +2398,7 @@ public class GTK extends OS {
* @param height cast=(gint)
*/
public static final native void gtk_widget_set_size_request(long widget, int width, int height);
- /** @param widget cast=(GtkWidget *) */
- public static final native void gtk_widget_show(long widget);
+
/** @param widget cast=(GtkWidget *) */
public static final native boolean gtk_widget_activate(long widget);
/** @param widget cast=(GtkWidget *) */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 97cc31ee5d8..37601e1f413 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -741,7 +741,6 @@ public static boolean isX11 () {
public static final native long G_OBJECT_CLASS_CONSTRUCTOR(long object_class);
/**
* @param object_class cast=(GObjectClass *)
- * @paramOFF constructor cast=(GObject* (*) (GType, guint, GObjectConstructParam *))
*/
public static final native void G_OBJECT_CLASS_SET_CONSTRUCTOR(long object_class, long constructor);
/** @param xevent cast=(XEvent *) */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java
index 5e5c9e278aa..91921218c10 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java
@@ -1089,5 +1089,9 @@ public class GTK3 {
public static final native int GdkEventWindowState_sizeof();
public static final native int GdkGeometry_sizeof();
public static final native int GdkWindowAttr_sizeof();
+ /** @param widget cast=(GtkWidget *) */
+ public static final native void gtk_widget_show(long widget);
+ /** @param widget cast=(GtkWidget *) */
+ public static final native void gtk_widget_hide(long widget);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java
index 4b2f1f4efa2..1f7f51514a8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java
@@ -120,6 +120,15 @@ public class GTK4 {
public static final native long gtk_editable_get_text(long editable);
/** @param editable cast=(GtkEditable *) */
public static final native long gtk_editable_get_delegate(long editable);
+ /**
+ * @param editable cast=(GtkEditable *)
+ */
+ public static final native int gtk_editable_get_max_width_chars(long editable);
+ /**
+ * @param editable cast=(GtkEditable *)
+ * @param chars cast=(int)
+ */
+ public static final native void gtk_editable_set_max_width_chars(long editable, int chars);
/* GtkPicture */
public static final native long gtk_picture_new();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
index bc458f60731..0f19029181c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
@@ -31,6 +31,10 @@ SWT_OBJS = swt.obj callback.obj c.obj c_stats.obj \
os.obj os_structs.obj os_custom.obj os_stats.obj \
com_structs.obj com.obj com_stats.obj com_custom.obj
+OSVERSION_PREFIX = swt-osversion
+OSVERSION_LIB = $(OSVERSION_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
+OSVERSION_OBJS = osversion.obj osversion_structs.obj osversion_stats.obj
+
GDIP_PREFIX = swt-gdip
GDIP_LIB = $(GDIP_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
GDIP_LIBS = gdiplus.lib
@@ -57,7 +61,7 @@ dlllflags = -dll /WX
guilibsmt = kernel32.lib ws2_32.lib mswsock.lib advapi32.lib bufferoverflowu.lib user32.lib gdi32.lib comdlg32.lib winspool.lib
olelibsmt = ole32.lib uuid.lib oleaut32.lib $(guilibsmt)
-all: make_swt make_awt make_gdip make_wgl
+all: make_osversion make_swt make_awt make_gdip make_wgl
.c.obj:
cl $(CFLAGS) $*.c
@@ -74,6 +78,14 @@ make_swt: $(SWT_OBJS) swt.res
link @templrf
del templrf
+make_osversion: $(OSVERSION_OBJS) swt_osversion.res
+ echo $(ldebug) $(dlllflags) $(guilibsmt) >templrf
+ echo $(OSVERSION_OBJS) >>templrf
+ echo swt_osversion.res >>templrf
+ echo -out:$(OSVERSION_LIB) >>templrf
+ link @templrf
+ del templrf
+
make_gdip: $(GDIP_OBJS) swt_gdip.res
echo $(ldebug) $(dlllflags) $(guilibsmt) >templrf
echo $(GDIP_LIBS) >>templrf
@@ -104,6 +116,9 @@ make_wgl: $(WGL_OBJS) swt_wgl.res
swt.res:
rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(SWT_LIB)\" -r -fo swt.res swt.rc
+swt_osversion.res:
+ rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(OSVERSION_LIB)\" -r -fo swt_osversion.res swt_osversion.rc
+
swt_gdip.res:
rc $(RCFLAGS) -DSWT_ORG_FILENAME=\"$(GDIP_LIB)\" -r -fo swt_gdip.res swt_gdip.rc
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
index ceb19ea77eb..0d075e66459 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
@@ -108,22 +108,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(AddFontResourceEx)
}
#endif
-#ifndef NO_AdjustWindowRectEx
-JNIEXPORT jboolean JNICALL OS_NATIVE(AdjustWindowRectEx)
- (JNIEnv *env, jclass that, jobject arg0, jint arg1, jboolean arg2, jint arg3)
-{
- RECT _arg0, *lparg0=NULL;
- jboolean rc = 0;
- OS_NATIVE_ENTER(env, that, AdjustWindowRectEx_FUNC);
- if (arg0) if ((lparg0 = getRECTFields(env, arg0, &_arg0)) == NULL) goto fail;
- rc = (jboolean)AdjustWindowRectEx(lparg0, arg1, arg2, arg3);
-fail:
- if (arg0 && lparg0) setRECTFields(env, arg0, lparg0);
- OS_NATIVE_EXIT(env, that, AdjustWindowRectEx_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_AdjustWindowRectExForDpi
JNIEXPORT jboolean JNICALL OS_NATIVE(AdjustWindowRectExForDpi)
(JNIEnv *env, jclass that, jobject arg0, jint arg1, jboolean arg2, jint arg3, jint arg4)
@@ -132,15 +116,7 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(AdjustWindowRectExForDpi)
jboolean rc = 0;
OS_NATIVE_ENTER(env, that, AdjustWindowRectExForDpi_FUNC);
if (arg0) if ((lparg0 = getRECTFields(env, arg0, &_arg0)) == NULL) goto fail;
-/*
rc = (jboolean)AdjustWindowRectExForDpi(lparg0, arg1, arg2, arg3, arg4);
-*/
- {
- OS_LOAD_FUNCTION(fp, AdjustWindowRectExForDpi)
- if (fp) {
- rc = (jboolean)((jboolean (CALLING_CONVENTION*)(RECT *, jint, jboolean, jint, jint))fp)(lparg0, arg1, arg2, arg3, arg4);
- }
- }
fail:
if (arg0 && lparg0) setRECTFields(env, arg0, lparg0);
OS_NATIVE_EXIT(env, that, AdjustWindowRectExForDpi_FUNC);
@@ -3320,15 +3296,7 @@ JNIEXPORT jint JNICALL OS_NATIVE(GetSystemMetricsForDpi)
{
jint rc = 0;
OS_NATIVE_ENTER(env, that, GetSystemMetricsForDpi_FUNC);
-/*
rc = (jint)GetSystemMetricsForDpi(arg0, arg1);
-*/
- {
- OS_LOAD_FUNCTION(fp, GetSystemMetricsForDpi)
- if (fp) {
- rc = (jint)((jint (CALLING_CONVENTION*)(jint, jint))fp)(arg0, arg1);
- }
- }
OS_NATIVE_EXIT(env, that, GetSystemMetricsForDpi_FUNC);
return rc;
}
@@ -6551,18 +6519,6 @@ JNIEXPORT void JNICALL OS_NATIVE(NotifyWinEvent)
}
#endif
-#ifndef NO_OSVERSIONINFOEX_1sizeof
-JNIEXPORT jint JNICALL OS_NATIVE(OSVERSIONINFOEX_1sizeof)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, OSVERSIONINFOEX_1sizeof_FUNC);
- rc = (jint)OSVERSIONINFOEX_sizeof();
- OS_NATIVE_EXIT(env, that, OSVERSIONINFOEX_1sizeof_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_OUTLINETEXTMETRIC_1sizeof
JNIEXPORT jint JNICALL OS_NATIVE(OUTLINETEXTMETRIC_1sizeof)
(JNIEnv *env, jclass that)
@@ -7354,30 +7310,6 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(RoundRect)
}
#endif
-#ifndef NO_RtlGetVersion
-JNIEXPORT jint JNICALL OS_NATIVE(RtlGetVersion)
- (JNIEnv *env, jclass that, jobject arg0)
-{
- OSVERSIONINFOEX _arg0, *lparg0=NULL;
- jint rc = 0;
- OS_NATIVE_ENTER(env, that, RtlGetVersion_FUNC);
- if (arg0) if ((lparg0 = getOSVERSIONINFOEXFields(env, arg0, &_arg0)) == NULL) goto fail;
-/*
- rc = (jint)RtlGetVersion(lparg0);
-*/
- {
- OS_LOAD_FUNCTION(fp, RtlGetVersion)
- if (fp) {
- rc = (jint)((jint (CALLING_CONVENTION*)(OSVERSIONINFOEX *))fp)(lparg0);
- }
- }
-fail:
- if (arg0 && lparg0) setOSVERSIONINFOEXFields(env, arg0, lparg0);
- OS_NATIVE_EXIT(env, that, RtlGetVersion_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_SAFEARRAYBOUND_1sizeof
JNIEXPORT jint JNICALL OS_NATIVE(SAFEARRAYBOUND_1sizeof)
(JNIEnv *env, jclass that)
@@ -9329,15 +9261,7 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(SystemParametersInfoForDpi)
jboolean rc = 0;
OS_NATIVE_ENTER(env, that, SystemParametersInfoForDpi_FUNC);
if (arg2) if ((lparg2 = getNONCLIENTMETRICSFields(env, arg2, &_arg2)) == NULL) goto fail;
-/*
rc = (jboolean)SystemParametersInfoForDpi(arg0, arg1, lparg2, arg3, arg4);
-*/
- {
- OS_LOAD_FUNCTION(fp, SystemParametersInfoForDpi)
- if (fp) {
- rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jint, jint, NONCLIENTMETRICS *, jint, jint))fp)(arg0, arg1, lparg2, arg3, arg4);
- }
- }
fail:
if (arg2 && lparg2) setNONCLIENTMETRICSFields(env, arg2, lparg2);
OS_NATIVE_EXIT(env, that, SystemParametersInfoForDpi_FUNC);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h
index f26e394844f..594aa2c27cb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h
@@ -22,8 +22,5 @@
#define GetDpiForWindow_LIB "user32.dll"
#define RtlGetVersion_LIB "ntdll.dll"
#define OpenThemeDataForDpi_LIB "uxtheme.dll"
-#define GetSystemMetricsForDpi_LIB "user32.dll"
#define GetThreadDpiAwarenessContext_LIB "user32.dll"
#define SetThreadDpiAwarenessContext_LIB "user32.dll"
-#define SystemParametersInfoForDpi_LIB "user32.dll"
-#define AdjustWindowRectExForDpi_LIB "user32.dll"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
index 4175ca4a320..bc809ece5f4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
@@ -29,7 +29,6 @@ typedef enum {
ActivateActCtx_FUNC,
ActivateKeyboardLayout_FUNC,
AddFontResourceEx_FUNC,
- AdjustWindowRectEx_FUNC,
AdjustWindowRectExForDpi_FUNC,
AllowDarkModeForWindow_FUNC,
AllowSetForegroundWindow_FUNC,
@@ -500,7 +499,6 @@ typedef enum {
NONCLIENTMETRICS_1sizeof_FUNC,
NOTIFYICONDATA_1V2_1SIZE_FUNC,
NotifyWinEvent_FUNC,
- OSVERSIONINFOEX_1sizeof_FUNC,
OUTLINETEXTMETRIC_1sizeof_FUNC,
OffsetRect_FUNC,
OffsetRgn_FUNC,
@@ -555,7 +553,6 @@ typedef enum {
ReplyMessage_FUNC,
RestoreDC_FUNC,
RoundRect_FUNC,
- RtlGetVersion_FUNC,
SAFEARRAYBOUND_1sizeof_FUNC,
SAFEARRAY_1sizeof_FUNC,
SCRIPT_1ANALYSIS_1sizeof_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c
index da11d5aa500..6de84ef4593 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c
@@ -4213,73 +4213,6 @@ void setNOTIFYICONDATAFields(JNIEnv *env, jobject lpObject, NOTIFYICONDATA *lpSt
}
#endif
-#ifndef NO_OSVERSIONINFOEX
-typedef struct OSVERSIONINFOEX_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID dwOSVersionInfoSize, dwMajorVersion, dwMinorVersion, dwBuildNumber, dwPlatformId, szCSDVersion, wServicePackMajor, wServicePackMinor, wSuiteMask, wProductType, wReserved;
-} OSVERSIONINFOEX_FID_CACHE;
-
-OSVERSIONINFOEX_FID_CACHE OSVERSIONINFOEXFc;
-
-void cacheOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject)
-{
- if (OSVERSIONINFOEXFc.cached) return;
- OSVERSIONINFOEXFc.clazz = (*env)->GetObjectClass(env, lpObject);
- OSVERSIONINFOEXFc.dwOSVersionInfoSize = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwOSVersionInfoSize", "I");
- OSVERSIONINFOEXFc.dwMajorVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwMajorVersion", "I");
- OSVERSIONINFOEXFc.dwMinorVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwMinorVersion", "I");
- OSVERSIONINFOEXFc.dwBuildNumber = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwBuildNumber", "I");
- OSVERSIONINFOEXFc.dwPlatformId = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwPlatformId", "I");
- OSVERSIONINFOEXFc.szCSDVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "szCSDVersion", "[C");
- OSVERSIONINFOEXFc.wServicePackMajor = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wServicePackMajor", "I");
- OSVERSIONINFOEXFc.wServicePackMinor = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wServicePackMinor", "I");
- OSVERSIONINFOEXFc.wSuiteMask = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wSuiteMask", "I");
- OSVERSIONINFOEXFc.wProductType = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wProductType", "I");
- OSVERSIONINFOEXFc.wReserved = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wReserved", "I");
- OSVERSIONINFOEXFc.cached = 1;
-}
-
-OSVERSIONINFOEX *getOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct)
-{
- if (!OSVERSIONINFOEXFc.cached) cacheOSVERSIONINFOEXFields(env, lpObject);
- lpStruct->dwOSVersionInfoSize = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwOSVersionInfoSize);
- lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMajorVersion);
- lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMinorVersion);
- lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwBuildNumber);
- lpStruct->dwPlatformId = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwPlatformId);
- {
- jcharArray lpObject1 = (jcharArray)(*env)->GetObjectField(env, lpObject, OSVERSIONINFOEXFc.szCSDVersion);
- (*env)->GetCharArrayRegion(env, lpObject1, 0, sizeof(lpStruct->szCSDVersion) / sizeof(jchar), (jchar *)lpStruct->szCSDVersion);
- }
- lpStruct->wServicePackMajor = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMajor);
- lpStruct->wServicePackMinor = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMinor);
- lpStruct->wSuiteMask = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wSuiteMask);
- lpStruct->wProductType = (BYTE)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wProductType);
- lpStruct->wReserved = (BYTE)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wReserved);
- return lpStruct;
-}
-
-void setOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct)
-{
- if (!OSVERSIONINFOEXFc.cached) cacheOSVERSIONINFOEXFields(env, lpObject);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwOSVersionInfoSize, (jint)lpStruct->dwOSVersionInfoSize);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMajorVersion, (jint)lpStruct->dwMajorVersion);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMinorVersion, (jint)lpStruct->dwMinorVersion);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwBuildNumber, (jint)lpStruct->dwBuildNumber);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwPlatformId, (jint)lpStruct->dwPlatformId);
- {
- jcharArray lpObject1 = (jcharArray)(*env)->GetObjectField(env, lpObject, OSVERSIONINFOEXFc.szCSDVersion);
- (*env)->SetCharArrayRegion(env, lpObject1, 0, sizeof(lpStruct->szCSDVersion) / sizeof(jchar), (jchar *)lpStruct->szCSDVersion);
- }
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMajor, (jint)lpStruct->wServicePackMajor);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMinor, (jint)lpStruct->wServicePackMinor);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wSuiteMask, (jint)lpStruct->wSuiteMask);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wProductType, (jint)lpStruct->wProductType);
- (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wReserved, (jint)lpStruct->wReserved);
-}
-#endif
-
#ifndef NO_OUTLINETEXTMETRIC
typedef struct OUTLINETEXTMETRIC_FID_CACHE {
int cached;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h
index c195326032f..1acb67b74d7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h
@@ -965,18 +965,6 @@ void setNOTIFYICONDATAFields(JNIEnv *env, jobject lpObject, NOTIFYICONDATA *lpSt
#define NOTIFYICONDATA_sizeof() 0
#endif
-#ifndef NO_OSVERSIONINFOEX
-void cacheOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject);
-OSVERSIONINFOEX *getOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct);
-void setOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct);
-#define OSVERSIONINFOEX_sizeof() sizeof(OSVERSIONINFOEX)
-#else
-#define cacheOSVERSIONINFOEXFields(a,b)
-#define getOSVERSIONINFOEXFields(a,b,c) NULL
-#define setOSVERSIONINFOEXFields(a,b,c)
-#define OSVERSIONINFOEX_sizeof() 0
-#endif
-
#ifndef NO_OUTLINETEXTMETRIC
void cacheOUTLINETEXTMETRICFields(JNIEnv *env, jobject lpObject);
OUTLINETEXTMETRIC *getOUTLINETEXTMETRICFields(JNIEnv *env, jobject lpObject, OUTLINETEXTMETRIC *lpStruct);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion.c
new file mode 100644
index 00000000000..babc08e1135
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion.c
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
+/* DO NOT EDIT - your changes will be lost. */
+
+#include "swt.h"
+#include "osversion_structs.h"
+#include "osversion_stats.h"
+
+#ifndef OsVersion_NATIVE
+#define OsVersion_NATIVE(func) Java_org_eclipse_swt_internal_win32_version_OsVersion_##func
+#endif
+
+#ifdef _WIN32
+ /* Many methods don't use their 'env' and 'that' arguments */
+ #pragma warning (disable: 4100)
+#endif
+
+#ifndef NO_OSVERSIONINFOEX_1sizeof
+JNIEXPORT jint JNICALL OsVersion_NATIVE(OSVERSIONINFOEX_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ OsVersion_NATIVE_ENTER(env, that, OSVERSIONINFOEX_1sizeof_FUNC);
+ rc = (jint)OSVERSIONINFOEX_sizeof();
+ OsVersion_NATIVE_EXIT(env, that, OSVERSIONINFOEX_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_RtlGetVersion
+JNIEXPORT jint JNICALL OsVersion_NATIVE(RtlGetVersion)
+ (JNIEnv *env, jclass that, jobject arg0)
+{
+ OSVERSIONINFOEX _arg0, *lparg0=NULL;
+ jint rc = 0;
+ OsVersion_NATIVE_ENTER(env, that, RtlGetVersion_FUNC);
+ if (arg0) if ((lparg0 = getOSVERSIONINFOEXFields(env, arg0, &_arg0)) == NULL) goto fail;
+/*
+ rc = (jint)RtlGetVersion(lparg0);
+*/
+ {
+ OsVersion_LOAD_FUNCTION(fp, RtlGetVersion)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)(OSVERSIONINFOEX *))fp)(lparg0);
+ }
+ }
+fail:
+ if (arg0 && lparg0) setOSVERSIONINFOEXFields(env, arg0, lparg0);
+ OsVersion_NATIVE_EXIT(env, that, RtlGetVersion_FUNC);
+ return rc;
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion.h
new file mode 100644
index 00000000000..135e715071b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion.h
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2025 Vector Informatik GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+#ifndef INC_osversion_H
+#define INC_osversion_H
+
+/*
+ * Windows headers will sometimes have warnings above level 2, just
+ * ignore all of them, we can't do anything about it anyway.
+ */
+#pragma warning(push, 2)
+
+#include
+
+/* Restore warnings */
+#pragma warning(pop)
+
+/* Optional custom definitions to exclude some types */
+#include "defines.h"
+
+#define OsVersion_LOAD_FUNCTION LOAD_FUNCTION
+
+/* Libraries for dynamic loaded functions */
+#define RtlGetVersion_LIB "ntdll.dll"
+
+#endif /* INC_osversion_H */
diff --git a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/SpiesConstants.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_stats.c
similarity index 57%
rename from bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/SpiesConstants.java
rename to bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_stats.c
index 3f8698604b1..8fa86d83225 100644
--- a/bundles/org.eclipse.swt.tools.spies/src/org/eclipse/swt/tools/internal/SpiesConstants.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Ericsson and others.
+ * Copyright (c) 2000, 2025 Vector Informatik GmbH and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -9,16 +9,9 @@
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-package org.eclipse.swt.tools.internal;
+/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
+/* DO NOT EDIT - your changes will be lost. */
-/**
- * Interface containing constants for the Spies plug-in.
- */
+#include "swt.h"
+#include "osversion_stats.h"
-public interface SpiesConstants {
- /**
- * Identifies the spies plug-in.
- */
- public static final String PLUGIN_ID = "org.eclipse.swt.tools.spies"; //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_stats.h
new file mode 100644
index 00000000000..79fae4e1061
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_stats.h
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
+/* DO NOT EDIT - your changes will be lost. */
+
+#ifndef OsVersion_NATIVE_ENTER
+#define OsVersion_NATIVE_ENTER(env, that, func)
+#endif
+#ifndef OsVersion_NATIVE_EXIT
+#define OsVersion_NATIVE_EXIT(env, that, func)
+#endif
+
+typedef enum {
+ OSVERSIONINFOEX_1sizeof_FUNC,
+ RtlGetVersion_FUNC,
+} OsVersion_FUNCS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_structs.c
new file mode 100644
index 00000000000..40fa0586643
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_structs.c
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
+/* DO NOT EDIT - your changes will be lost. */
+
+#include "swt.h"
+#include "osversion_structs.h"
+
+#ifndef NO_OSVERSIONINFOEX
+typedef struct OSVERSIONINFOEX_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID dwOSVersionInfoSize, dwMajorVersion, dwMinorVersion, dwBuildNumber, dwPlatformId, szCSDVersion, wServicePackMajor, wServicePackMinor, wSuiteMask, wProductType, wReserved;
+} OSVERSIONINFOEX_FID_CACHE;
+
+OSVERSIONINFOEX_FID_CACHE OSVERSIONINFOEXFc;
+
+void cacheOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject)
+{
+ if (OSVERSIONINFOEXFc.cached) return;
+ OSVERSIONINFOEXFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ OSVERSIONINFOEXFc.dwOSVersionInfoSize = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwOSVersionInfoSize", "I");
+ OSVERSIONINFOEXFc.dwMajorVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwMajorVersion", "I");
+ OSVERSIONINFOEXFc.dwMinorVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwMinorVersion", "I");
+ OSVERSIONINFOEXFc.dwBuildNumber = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwBuildNumber", "I");
+ OSVERSIONINFOEXFc.dwPlatformId = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "dwPlatformId", "I");
+ OSVERSIONINFOEXFc.szCSDVersion = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "szCSDVersion", "[C");
+ OSVERSIONINFOEXFc.wServicePackMajor = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wServicePackMajor", "I");
+ OSVERSIONINFOEXFc.wServicePackMinor = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wServicePackMinor", "I");
+ OSVERSIONINFOEXFc.wSuiteMask = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wSuiteMask", "I");
+ OSVERSIONINFOEXFc.wProductType = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wProductType", "I");
+ OSVERSIONINFOEXFc.wReserved = (*env)->GetFieldID(env, OSVERSIONINFOEXFc.clazz, "wReserved", "I");
+ OSVERSIONINFOEXFc.cached = 1;
+}
+
+OSVERSIONINFOEX *getOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct)
+{
+ if (!OSVERSIONINFOEXFc.cached) cacheOSVERSIONINFOEXFields(env, lpObject);
+ lpStruct->dwOSVersionInfoSize = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwOSVersionInfoSize);
+ lpStruct->dwMajorVersion = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMajorVersion);
+ lpStruct->dwMinorVersion = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMinorVersion);
+ lpStruct->dwBuildNumber = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwBuildNumber);
+ lpStruct->dwPlatformId = (*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.dwPlatformId);
+ {
+ jcharArray lpObject1 = (jcharArray)(*env)->GetObjectField(env, lpObject, OSVERSIONINFOEXFc.szCSDVersion);
+ (*env)->GetCharArrayRegion(env, lpObject1, 0, sizeof(lpStruct->szCSDVersion) / sizeof(jchar), (jchar *)lpStruct->szCSDVersion);
+ }
+ lpStruct->wServicePackMajor = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMajor);
+ lpStruct->wServicePackMinor = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMinor);
+ lpStruct->wSuiteMask = (WORD)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wSuiteMask);
+ lpStruct->wProductType = (BYTE)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wProductType);
+ lpStruct->wReserved = (BYTE)(*env)->GetIntField(env, lpObject, OSVERSIONINFOEXFc.wReserved);
+ return lpStruct;
+}
+
+void setOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct)
+{
+ if (!OSVERSIONINFOEXFc.cached) cacheOSVERSIONINFOEXFields(env, lpObject);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwOSVersionInfoSize, (jint)lpStruct->dwOSVersionInfoSize);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMajorVersion, (jint)lpStruct->dwMajorVersion);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwMinorVersion, (jint)lpStruct->dwMinorVersion);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwBuildNumber, (jint)lpStruct->dwBuildNumber);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.dwPlatformId, (jint)lpStruct->dwPlatformId);
+ {
+ jcharArray lpObject1 = (jcharArray)(*env)->GetObjectField(env, lpObject, OSVERSIONINFOEXFc.szCSDVersion);
+ (*env)->SetCharArrayRegion(env, lpObject1, 0, sizeof(lpStruct->szCSDVersion) / sizeof(jchar), (jchar *)lpStruct->szCSDVersion);
+ }
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMajor, (jint)lpStruct->wServicePackMajor);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wServicePackMinor, (jint)lpStruct->wServicePackMinor);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wSuiteMask, (jint)lpStruct->wSuiteMask);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wProductType, (jint)lpStruct->wProductType);
+ (*env)->SetIntField(env, lpObject, OSVERSIONINFOEXFc.wReserved, (jint)lpStruct->wReserved);
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_structs.h
new file mode 100644
index 00000000000..0ec38f360cb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/osversion_structs.h
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
+/* DO NOT EDIT - your changes will be lost. */
+
+#include "osversion.h"
+
+#ifndef NO_OSVERSIONINFOEX
+void cacheOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject);
+OSVERSIONINFOEX *getOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct);
+void setOSVERSIONINFOEXFields(JNIEnv *env, jobject lpObject, OSVERSIONINFOEX *lpStruct);
+#define OSVERSIONINFOEX_sizeof() sizeof(OSVERSIONINFOEX)
+#else
+#define cacheOSVERSIONINFOEXFields(a,b)
+#define getOSVERSIONINFOEXFields(a,b,c) NULL
+#define setOSVERSIONINFOEXFields(a,b,c)
+#define OSVERSIONINFOEX_sizeof() 0
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt_osversion.rc b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt_osversion.rc
new file mode 100644
index 00000000000..aff3e580931
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt_osversion.rc
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "windows.h"
+
+VS_VERSION_INFO VERSIONINFO
+ PRODUCTVERSION 0,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40000L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Eclipse Foundation\0"
+ VALUE "FileDescription", "SWT for Windows native library\0"
+ VALUE "InternalName", "SWT\0"
+ VALUE "LegalCopyright", "Copyright (c) 2000, 2025 IBM Corp. All Rights Reserved.\0"
+ VALUE "OriginalFilename", SWT_ORG_FILENAME
+ VALUE "ProductName", "Standard Widget Toolkit\0"
+ VALUE "ProductVersion", "0,0,0,0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java
index 7ae0c40f7aa..0d2b3d46dd6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/Platform.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.swt.internal;
+import org.eclipse.swt.internal.win32.version.*;
public class Platform {
public static final String PLATFORM = "win32"; //$NON-NLS-1$
@@ -21,4 +22,11 @@ public static boolean isLoadable () {
return Library.isLoadable ();
}
+public static void exitIfNotLoadable() {
+ if (!Library.isLoadable ()) {
+ System.err.println("Libraries for platform " + Platform.PLATFORM + " cannot be loaded because of incompatible environment");
+ System.exit(1);
+ }
+ OsVersion.checkCompatibleWindowsVersion();
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index 267573ed8a2..73b75f8d3d9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -19,6 +19,7 @@
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.win32.version.*;
import org.eclipse.swt.widgets.*;
public class OS extends C {
@@ -30,20 +31,6 @@ public class OS extends C {
* SWT Windows flags
*/
public static final boolean IsDBLocale;
- /**
- * Always reports the correct build number, regardless of manifest and
- * compatibility GUIDs. Note that build number alone is sufficient to
- * identify Windows version.
- */
- public static final int WIN32_BUILD;
- /**
- * Values taken from https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
- */
- public static final int WIN32_BUILD_WIN8_1 = 9600; // "Windows 8.1"
- public static final int WIN32_BUILD_WIN10_1607 = 14393; // "Windows 10 August 2016 Update"
- public static final int WIN32_BUILD_WIN10_1809 = 17763; // "Windows 10 October 2018 Update"
- public static final int WIN32_BUILD_WIN10_2004 = 19041; // "Windows 10 May 2020 Update"
- public static final int WIN32_BUILD_WIN11_21H2 = 22000; // Initial Windows 11 release
public static final String NO_MANIFEST = "org.eclipse.swt.internal.win32.OS.NO_MANIFEST";
@@ -55,20 +42,6 @@ public class OS extends C {
public static final int SM_IMMENABLED = 0x52;
static {
- /*
- * Starting with Windows 10, GetVersionEx() lies about version unless
- * application manifest has a proper entry. RtlGetVersion() always
- * reports true version.
- */
- OSVERSIONINFOEX osVersionInfoEx = new OSVERSIONINFOEX ();
- osVersionInfoEx.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof;
- if (0 == OS.RtlGetVersion (osVersionInfoEx)) {
- WIN32_BUILD = osVersionInfoEx.dwBuildNumber;
- } else {
- System.err.println ("SWT: OS: Failed to detect Windows build number");
- WIN32_BUILD = 0;
- }
-
/* Load the manifest to force the XP Theme */
if (System.getProperty (NO_MANIFEST) == null) {
ACTCTX pActCtx = new ACTCTX ();
@@ -1976,7 +1949,6 @@ public static int VERSION (int major, int minor) {
/** @method flags=const */
public static final native int NOTIFYICONDATA_V2_SIZE ();
public static final native int OUTLINETEXTMETRIC_sizeof ();
-public static final native int OSVERSIONINFOEX_sizeof ();
public static final native int PAINTSTRUCT_sizeof ();
public static final native int POINT_sizeof ();
public static final native int PRINTDLG_sizeof ();
@@ -2353,8 +2325,6 @@ public static int HRESULT_FROM_WIN32(int x) {
* @param pdv cast=(PVOID)
*/
public static final native int AddFontResourceEx(char[] lpszFilename, int fl, long pdv);
-public static final native boolean AdjustWindowRectEx (RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle);
-/** @method flags=dynamic */
public static final native boolean AdjustWindowRectExForDpi (RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle, int dpi);
/** @method flags=no_gen */
public static final native boolean AllowDarkModeForWindow(long hWnd, boolean allow);
@@ -3006,7 +2976,6 @@ public static int HRESULT_FROM_WIN32(int x) {
/** @param hWnd cast=(HWND) */
public static final native long GetSystemMenu (long hWnd, boolean bRevert);
public static final native int GetSystemMetrics (int nIndex);
-/** @method flags=dynamic */
public static final native int GetSystemMetricsForDpi (int nIndex, int dpi);
/** @param hDC cast=(HDC) */
public static final native int GetTextColor (long hDC);
@@ -3969,8 +3938,6 @@ public static int HRESULT_FROM_WIN32(int x) {
public static final native boolean RestoreDC (long hdc, int nSavedDC);
/** @param hdc cast=(HDC) */
public static final native boolean RoundRect (long hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nWidth, int nHeight);
-/** @method flags=dynamic */
-public static final native int RtlGetVersion (OSVERSIONINFOEX lpVersionInformation);
/** @param hdc cast=(HDC) */
public static final native int SaveDC (long hdc);
/** @param hWnd cast=(HWND) */
@@ -4496,7 +4463,6 @@ public static int HRESULT_FROM_WIN32(int x) {
public static final native boolean SystemParametersInfo (int uiAction, int uiParam, RECT pvParam, int fWinIni);
public static final native boolean SystemParametersInfo (int uiAction, int uiParam, NONCLIENTMETRICS pvParam, int fWinIni);
public static final native boolean SystemParametersInfo (int uiAction, int uiParam, int [] pvParam, int fWinIni);
-/** @method flags=dynamic */
public static final native boolean SystemParametersInfoForDpi (int uiAction, int uiParam, NONCLIENTMETRICS pvParam, int fWinIni, int dpi);
/**
* @param lpKeyState cast=(PBYTE)
@@ -4622,7 +4588,7 @@ public static final native boolean DuplicateHandle(long hSourceProcessHandle, lo
public static long OpenThemeData(long hwnd, char[] themeName, int dpi) {
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
+ if (OsVersion.IS_WIN10_1809) {
return OS.OpenThemeDataForDpi(hwnd, themeName, dpi);
} else {
return OS.OpenThemeData(hwnd, themeName);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFOEX.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OSVERSIONINFOEX.java
similarity index 89%
rename from bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFOEX.java
rename to bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OSVERSIONINFOEX.java
index df6da82d39c..7156e8d4a46 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OSVERSIONINFOEX.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OSVERSIONINFOEX.java
@@ -11,7 +11,7 @@
* Contributors:
* Syntevo - initial API and implementation
*******************************************************************************/
-package org.eclipse.swt.internal.win32;
+package org.eclipse.swt.internal.win32.version;
public class OSVERSIONINFOEX {
public int dwOSVersionInfoSize;
@@ -31,5 +31,5 @@ public class OSVERSIONINFOEX {
/** @field cast=(BYTE) */
public int wReserved;
- public static final int sizeof = OS.OSVERSIONINFOEX_sizeof ();
+ public static final int sizeof = OsVersion.OSVERSIONINFOEX_sizeof ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OsVersion.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OsVersion.java
new file mode 100644
index 00000000000..094e78da9ee
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/version/OsVersion.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2025 Vector Informatik GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.swt.internal.win32.version;
+
+import org.eclipse.swt.internal.*;
+
+/**
+ * A separate library only for checking the Windows build version. Required as the general
+ * OS library may not be loadable with linkage errors when executed on an unsupported Windows
+ * build, such that a version check cannot be performed successfully, but a a linkage error
+ * will occur instead. This library only adapts a single OS method that can always be loaded,
+ * thus ensuring that the version check can always be executed.
+ *
+ * @jniclass flags=c
+ * */
+public class OsVersion extends Platform {
+ static {
+ Library.loadLibrary ("swt-osversion"); //$NON-NLS-1$
+ }
+
+ /**
+ * Always reports the correct build number, regardless of manifest and
+ * compatibility GUIDs. Note that build number alone is sufficient to
+ * identify Windows version.
+ */
+ private static final int WIN32_BUILD = getCurrentOsVersion();
+
+ /**
+ * Values taken from https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
+ */
+ private static final int WIN10_1607 = 14393;
+ public static final boolean IS_WIN10_1607 = WIN32_BUILD >= WIN10_1607; // "Windows 10 August 2016 Update"
+ public static final boolean IS_WIN10_1809 = WIN32_BUILD >= 17763; // "Windows 10 October 2018 Update"
+ public static final boolean IS_WIN10_2004 = WIN32_BUILD >= 19041; // "Windows 10 May 2020 Update"
+ public static final boolean IS_WIN11_21H2 = WIN32_BUILD >= 22000; // Initial Windows 11 release
+
+ /**
+ * The minimum supported Windows build version for using this SWT version
+ */
+ private static final int MINIMUM_COMPATIBLE_BUILD = WIN10_1607;
+
+ private static final String DISABLE_WINDOWS_VERSION_CHECK_PROPERTY = "swt.disableWindowsVersionCheck";
+
+ private static int getCurrentOsVersion() {
+ /*
+ * Starting with Windows 10, GetVersionEx() lies about version unless
+ * application manifest has a proper entry. RtlGetVersion() always
+ * reports true version.
+ */
+ OSVERSIONINFOEX osVersionInfoEx = new OSVERSIONINFOEX ();
+ osVersionInfoEx.dwOSVersionInfoSize = OSVERSIONINFOEX.sizeof;
+ if (0 == OsVersion.RtlGetVersion (osVersionInfoEx)) {
+ return osVersionInfoEx.dwBuildNumber;
+ } else {
+ System.err.println ("SWT: OS: Failed to detect Windows build number");
+ return 0;
+ }
+ }
+
+ public static void checkCompatibleWindowsVersion() {
+ String disableVersionCheckPropertyValue = System.getProperty(DISABLE_WINDOWS_VERSION_CHECK_PROPERTY, Boolean.FALSE.toString());
+ boolean versionCheckDisabled = "".equals(disableVersionCheckPropertyValue) || Boolean.TRUE.toString().equalsIgnoreCase(disableVersionCheckPropertyValue);
+ if (!versionCheckDisabled && WIN32_BUILD < MINIMUM_COMPATIBLE_BUILD) {
+ System.err.println(String.format("Incompatible OS: Minimum Windows build version is %s but current is %s",
+ MINIMUM_COMPATIBLE_BUILD, WIN32_BUILD));
+ System.exit(1);
+ }
+ }
+
+ public static final native int OSVERSIONINFOEX_sizeof ();
+
+ /** @method flags=dynamic */
+ public static final native int RtlGetVersion (OSVERSIONINFOEX lpVersionInformation);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/browser/EdgeTests.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/browser/EdgeTests.java
index c27bc19ca3e..6686a9bc481 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/browser/EdgeTests.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/browser/EdgeTests.java
@@ -1,34 +1,81 @@
package org.eclipse.swt.browser;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.*;
+import java.util.*;
import org.eclipse.swt.internal.*;
-import org.junit.jupiter.api.*;
+import org.junit.*;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.*;
@ExtendWith(PlatformSpecificExecutionExtension.class)
class EdgeTests {
+ private String originalTempDir;
+
+ @Before
+ public void setup() throws Exception {
+ originalTempDir = System.getProperty("java.io.tmpdir");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ setTempDirAndInitializeEdgeLocationForCustomTextPage(originalTempDir);
+ }
+
+ private static void setTempDirAndInitializeEdgeLocationForCustomTextPage(String dir) {
+ System.setProperty("java.io.tmpdir", dir);
+ Edge.setupLocationForCustomTextPage();
+ }
+
/**
* https://github.com/eclipse-platform/eclipse.platform.swt/issues/1912
*/
@Test
public void handlingOfTempDirWithSpacesAndUnicodeCharacters() throws Exception {
- String originalTempDir = System.getProperty("java.io.tmpdir");
- String temporaryTempDirWithSpacesAndUnicode = Files.createTempDirectory("spaces and únîcòde").toString();
- System.setProperty("java.io.tmpdir", temporaryTempDirWithSpacesAndUnicode);
- try {
- Edge.setupLocationForCustomTextPage();
-
- // URI_FOR_CUSTOM_TEXT_PAGE must already be encoded internally
- assertTrue(Edge.URI_FOR_CUSTOM_TEXT_PAGE.toString().contains("spaces%20and%20%C3%BAn%C3%AEc%C3%B2de"));
- assertTrue(Edge.isLocationForCustomText(Edge.URI_FOR_CUSTOM_TEXT_PAGE.toASCIIString()));
-
- } finally {
- System.setProperty("java.io.tmpdir", originalTempDir);
- Edge.setupLocationForCustomTextPage(); // restore the original value
- }
+ setTempDirAndInitializeEdgeLocationForCustomTextPage(
+ Files.createTempDirectory("spaces and únîcòde").toString());
+
+ // URI_FOR_CUSTOM_TEXT_PAGE must already be encoded internally
+ // for correct handling of spaces and unicode characters
+ assertTrue(Edge.URI_FOR_CUSTOM_TEXT_PAGE.toString().contains("spaces%20and%20%C3%BAn%C3%AEc%C3%B2de"));
+ assertTrue(Edge.isLocationForCustomText(Edge.URI_FOR_CUSTOM_TEXT_PAGE.toASCIIString()));
+ }
+
+ /**
+ * https://github.com/eclipse-platform/eclipse.platform.swt/issues/2061
+ */
+ @Test
+ public void handlingOfUpperLowerCase() throws Exception {
+ setTempDirAndInitializeEdgeLocationForCustomTextPage(Files.createTempDirectory("FoObAr").toString());
+
+ String lowerCaseUri = Edge.URI_FOR_CUSTOM_TEXT_PAGE.toASCIIString().toLowerCase(Locale.ROOT);
+ String upperCaseUri = "file"
+ + Edge.URI_FOR_CUSTOM_TEXT_PAGE.toASCIIString().toUpperCase(Locale.ROOT).substring(4);
+
+ assertTrue(Edge.isLocationForCustomText(lowerCaseUri));
+ assertTrue(Edge.isLocationForCustomText(upperCaseUri));
+ }
+
+ @Test
+ public void handlingOfNonFileURIs() throws Exception {
+ setTempDirAndInitializeEdgeLocationForCustomTextPage(Files.createTempDirectory("any").toString());
+
+ String httpsUri = "https://eclipse.org";
+
+ assertFalse(Edge.isLocationForCustomText(httpsUri));
}
+
+ @Test
+ public void handlingOfInvalidFileURIs() throws Exception {
+ setTempDirAndInitializeEdgeLocationForCustomTextPage(Files.createTempDirectory("any").toString());
+
+ String brokenFileUri = "file://--";
+
+ assertFalse(Edge.isLocationForCustomText(brokenFileUri));
+ }
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/CoordinateSystemMapperTests.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/CoordinateSystemMapperTests.java
index 5fc56ba05d1..d2c8068877a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/CoordinateSystemMapperTests.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/CoordinateSystemMapperTests.java
@@ -26,7 +26,7 @@
import org.junit.jupiter.params.provider.*;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class CoordinateSystemMapperTests {
+class CoordinateSystemMapperTests {
Supplier getMonitorConsumer;
Monitor[] monitors;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/DisplayWin32Test.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/DisplayWin32Test.java
index a4a9605fb5b..043ddd3c748 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/DisplayWin32Test.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/widgets/DisplayWin32Test.java
@@ -9,7 +9,7 @@
@ExtendWith(PlatformSpecificExecutionExtension.class)
@ExtendWith(ResetMonitorSpecificScalingExtension.class)
-public class DisplayWin32Test {
+class DisplayWin32Test {
@Test
public void monitorSpecificScaling_activate() {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
index f65dacb992f..63ed1f28124 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
@@ -1163,6 +1163,26 @@ JNIEXPORT jlong JNICALL WebKitGTK_NATIVE(webkit_1navigation_1policy_1decision_1g
}
#endif
+#ifndef NO_webkit_1network_1session_1get_1default
+JNIEXPORT jlong JNICALL WebKitGTK_NATIVE(webkit_1network_1session_1get_1default)
+ (JNIEnv *env, jclass that)
+{
+ jlong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, webkit_1network_1session_1get_1default_FUNC);
+/*
+ rc = (jlong)webkit_network_session_get_default();
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_network_session_get_default)
+ if (fp) {
+ rc = (jlong)((jlong (CALLING_CONVENTION*)())fp)();
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, webkit_1network_1session_1get_1default_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_webkit_1policy_1decision_1download
JNIEXPORT void JNICALL WebKitGTK_NATIVE(webkit_1policy_1decision_1download)
(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
index 8cfe18f3967..5199504355e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
@@ -79,6 +79,7 @@ typedef enum {
webkit_1javascript_1result_1get_1value_FUNC,
webkit_1javascript_1result_1unref_FUNC,
webkit_1navigation_1policy_1decision_1get_1request_FUNC,
+ webkit_1network_1session_1get_1default_FUNC,
webkit_1policy_1decision_1download_FUNC,
webkit_1policy_1decision_1ignore_FUNC,
webkit_1response_1policy_1decision_1get_1request_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 58913479f60..5b03fc50f40 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -703,10 +703,19 @@ public void create (Composite parent, int style) {
// (!) Note this one's a 'webContext' signal, not webview. See:
// https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebContext.html#WebKitWebContext-download-started
- OS.g_signal_connect (WebKitGTK.webkit_web_context_get_default(), WebKitGTK.download_started, Proc3.getAddress (), DOWNLOAD_STARTED);
+ if (GTK.GTK4) {
+ OS.g_signal_connect (WebKitGTK.webkit_network_session_get_default(), WebKitGTK.download_started, Proc3.getAddress (), DOWNLOAD_STARTED);
+ } else {
+ OS.g_signal_connect (WebKitGTK.webkit_web_context_get_default(), WebKitGTK.download_started, Proc3.getAddress (), DOWNLOAD_STARTED);
+ }
- GTK.gtk_widget_show (webView);
- GTK.gtk_widget_show (browser.handle);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_set_visible(webView, true);
+ GTK.gtk_widget_set_visible(browser.handle, true);
+ } else {
+ GTK3.gtk_widget_show(webView);
+ GTK3.gtk_widget_show(browser.handle);
+ }
// Webview 'title' property
OS.g_signal_connect (webView, WebKitGTK.notify_title, Proc3.getAddress (), NOTIFY_TITLE);
@@ -1835,7 +1844,7 @@ void onDispose (Event e) {
}
void onResize (Event e) {
- Rectangle rect = DPIUtil.autoScaleUp(browser.getClientArea ());
+ Rectangle rect = browser.getClientArea ();
if (webView == 0)
return;
GTK.gtk_widget_set_size_request (webView, rect.width, rect.height);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
index 78b50b51feb..da116e4a1d2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2025 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -359,6 +359,9 @@ public class WebKitGTK extends C {
/** @method flags=dynamic */
public static final native long webkit_web_context_get_default();
+/** @method flags=dynamic */
+public static final native long webkit_network_session_get_default();
+
/** @method flags=dynamic */
public static final native long webkit_web_context_get_cookie_manager(long context);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
index d7ca68d5136..a1d0d5e66e9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,7 +14,6 @@
package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
/**
@@ -219,14 +218,6 @@ public Path (Device device, PathData data) {
public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (width == 0 || height == 0 || arcAngle == 0) return;
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- width = DPIUtil.autoScaleUp(width);
- height = DPIUtil.autoScaleUp(height);
- addArcInPixels(x, y, width, height, startAngle, arcAngle);
-}
-
-void addArcInPixels(float x, float y, float width, float height, float startAngle, float arcAngle) {
moved = true;
if (width == height) {
float angle = -startAngle * (float)Math.PI / 180;
@@ -292,14 +283,6 @@ public void addPath(Path path) {
*/
public void addRectangle(float x, float y, float width, float height) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- width = DPIUtil.autoScaleUp(width);
- height = DPIUtil.autoScaleUp(height);
- addRectangleInPixels(x, y, width, height);
-}
-
-void addRectangleInPixels(float x, float y, float width, float height) {
moved = false;
Cairo.cairo_rectangle(handle, x, y, width, height);
closed = true;
@@ -326,19 +309,13 @@ public void addString(String string, float x, float y, Font font) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
// Scale up the font
FontData fd = font.getFontData()[0];
- fd.setHeight(DPIUtil.autoScaleUp(fd.getHeight()));
Font scaledFont = new Font(font.getDevice(), fd);
- addStringInPixels(string, x, y, scaledFont);
- scaledFont.dispose(); // Dispose the scaled up font
-}
-void addStringInPixels(String string, float x, float y, Font font) {
moved = false;
- GC.addCairoString(handle, string, x, y, font);
+ GC.addCairoString(handle, string, x, y, scaledFont);
closed = true;
+ scaledFont.dispose(); // Dispose the scaled up font
}
/**
@@ -384,11 +361,6 @@ public boolean contains(float x, float y, GC gc, boolean outline) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- return containsInPixels(x, y, gc, outline);
-}
-boolean containsInPixels(float x, float y, GC gc, boolean outline) {
//TODO - see Windows
gc.initCairo();
gc.checkGC(GC.LINE_CAP | GC.LINE_JOIN | GC.LINE_STYLE | GC.LINE_WIDTH);
@@ -423,15 +395,6 @@ boolean containsInPixels(float x, float y, GC gc, boolean outline) {
*/
public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- cx1 = DPIUtil.autoScaleUp(cx1);
- cy1 = DPIUtil.autoScaleUp(cy1);
- cx2 = DPIUtil.autoScaleUp(cx2);
- cy2 = DPIUtil.autoScaleUp(cy2);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- cubicToInPixels(cx1, cy1, cx2, cy2, x, y);
-}
-void cubicToInPixels(float cx1, float cy1, float cx2, float cy2, float x, float y) {
if (!moved) {
double[] currentX = new double[1], currentY = new double[1];
Cairo.cairo_get_current_point(handle, currentX, currentY);
@@ -461,12 +424,6 @@ public void getBounds(float[] bounds) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (bounds.length < 4) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- getBoundsInPixels(bounds);
- for (int i = 0; i < bounds.length; i++) {
- bounds [i] = DPIUtil.autoScaleDown(bounds[i]);
- }
-}
-void getBoundsInPixels(float[] bounds) {
long copy = Cairo.cairo_copy_path(handle);
if (copy == 0) SWT.error(SWT.ERROR_NO_HANDLES);
cairo_path_t path = new cairo_path_t();
@@ -539,13 +496,6 @@ void getBoundsInPixels(float[] bounds) {
*/
public void getCurrentPoint(float[] point) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- getCurrentPointInPixels(point);
- for (int i = 0; i < point.length; i++) {
- point [i] = DPIUtil.autoScaleDown(point[i]);
- }
-}
-
-void getCurrentPointInPixels(float[] point) {
if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (point.length < 2) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
double[] x = new double[1], y = new double[1];
@@ -567,12 +517,6 @@ void getCurrentPointInPixels(float[] point) {
*/
public PathData getPathData() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- PathData result = getPathDataInPixels();
- result.points = DPIUtil.autoScaleDown(result.points);
- return result;
-}
-
-PathData getPathDataInPixels() {
long copy = Cairo.cairo_copy_path(handle);
if (copy == 0) SWT.error(SWT.ERROR_NO_HANDLES);
cairo_path_t path = new cairo_path_t();
@@ -647,11 +591,6 @@ PathData getPathDataInPixels() {
*/
public void lineTo(float x, float y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- lineToInPixels(x, y);
-}
-void lineToInPixels(float x, float y) {
if (!moved) {
double[] currentX = new double[1], currentY = new double[1];
Cairo.cairo_get_current_point(handle, currentX, currentY);
@@ -676,11 +615,6 @@ void lineToInPixels(float x, float y) {
*/
public void moveTo(float x, float y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- moveToInPixels(x, y);
-}
-void moveToInPixels(float x, float y) {
/*
* Bug in Cairo. If cairo_move_to() is not called at the
* begining of a subpath, the first cairo_line_to() or
@@ -707,13 +641,6 @@ void moveToInPixels(float x, float y) {
*/
public void quadTo(float cx, float cy, float x, float y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- x = DPIUtil.autoScaleUp(x);
- y = DPIUtil.autoScaleUp(y);
- cx = DPIUtil.autoScaleUp(cx);
- cy = DPIUtil.autoScaleUp(cy);
- quadToInPixels(cx, cy, x, y);
-}
-void quadToInPixels(float cx, float cy, float x, float y) {
double[] currentX = new double[1], currentY = new double[1];
Cairo.cairo_get_current_point(handle, currentX, currentY);
if (!moved) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java
index 91a15888442..165b48cbc33 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,7 +14,6 @@
package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
/**
@@ -173,10 +172,6 @@ public Pattern(Device device, float x1, float y1, float x2, float y2, Color colo
*/
public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) {
super(device);
- x1 = DPIUtil.autoScaleUp(x1);
- y1 = DPIUtil.autoScaleUp(y1);
- x2 = DPIUtil.autoScaleUp(x2);
- y2 = DPIUtil.autoScaleUp(y2);
if (color1 == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (color1.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
if (color2 == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java
index f9484fdba88..db1dd188f26 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,7 +14,6 @@
package org.eclipse.swt.graphics;
import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
/**
@@ -147,7 +146,7 @@ public Transform (Device device, float m11, float m12, float m21, float m22, flo
super(device);
handle = new double[6];
if (handle == null) SWT.error(SWT.ERROR_NO_HANDLES);
- Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy));
+ Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, dx, dy);
init();
}
@@ -184,8 +183,8 @@ public void getElements(float[] elements) {
elements[1] = (float)handle[1];
elements[2] = (float)handle[2];
elements[3] = (float)handle[3];
- elements[4] = DPIUtil.autoScaleDown((float)handle[4]);
- elements[5] = DPIUtil.autoScaleDown((float)handle[5]);
+ elements[4] = (float)handle[4];
+ elements[5] = (float)handle[5];
}
/**
@@ -320,7 +319,7 @@ public void scale(float scaleX, float scaleY) {
*/
public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy));
+ Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, dx, dy);
}
/**
@@ -362,11 +361,11 @@ public void transform(float[] pointArray) {
double[] dx = new double[1], dy = new double[1];
int length = pointArray.length / 2;
for (int i = 0, j = 0; i < length; i++, j += 2) {
- dx[0] = DPIUtil.autoScaleUp(pointArray[j]);
- dy[0] = DPIUtil.autoScaleUp(pointArray[j + 1]);
+ dx[0] = pointArray[j];
+ dy[0] = pointArray[j + 1];
Cairo.cairo_matrix_transform_point(handle, dx, dy);
- pointArray[j] = DPIUtil.autoScaleDown((float)dx[0]);
- pointArray[j + 1] = DPIUtil.autoScaleDown((float)dy[0]);
+ pointArray[j] = (float)dx[0];
+ pointArray[j + 1] = (float)dy[0];
}
}
@@ -383,7 +382,7 @@ public void transform(float[] pointArray) {
*/
public void translate(float offsetX, float offsetY) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Cairo.cairo_matrix_translate(handle, DPIUtil.autoScaleUp(offsetX), DPIUtil.autoScaleUp(offsetY));
+ Cairo.cairo_matrix_translate(handle, offsetX, offsetY);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Color.java
index 3902461306d..6333bfeb234 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Color.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Color.java
@@ -48,10 +48,6 @@ public final class Color extends Resource {
*/
public double [] handle;
-Color() {
- super();
-}
-
Color(Device device) {
super(device);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Font.java
index a303eb38407..e9729d4055a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Font.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Font.java
@@ -188,12 +188,6 @@ public Font(Device device, String name, int height, int style) {
}
}
-/*public*/ Font(Device device, String name, float height, int style) {
- super(device);
- init(name, height, style, null);
- init();
-}
-
void addTraits(NSMutableAttributedString attrStr, NSRange range) {
if ((extraTraits & OS.NSBoldFontMask) != 0) {
attrStr.addAttribute(OS.NSStrokeWidthAttributeName, NSNumber.numberWithDouble(SYNTHETIC_BOLD), range);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
index 4ecc29fbcb6..8ef4c8ff4bb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
@@ -527,7 +527,10 @@ private void createRepFromSourceAndApplyFlag(NSBitmapImageRep srcRep, int srcWid
*
*
* @see #dispose()
+ *
+ * @deprecated use {@link Image#Image(Device, int, int)} instead
*/
+@Deprecated(since = "2025-06", forRemoval = true)
public Image(Device device, Rectangle bounds) {
super(device);
if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
@@ -903,8 +906,17 @@ public Image(Device device, ImageGcDrawer imageGcDrawer, int width, int height)
}
private ImageData drawWithImageGcDrawer(ImageGcDrawer imageGcDrawer, int width, int height, int zoom) {
- Image image = new Image(device, width, height);
- GC gc = new GC(image);
+ int gcStyle = imageGcDrawer.getGcStyle();
+ Image image;
+ if ((gcStyle & SWT.TRANSPARENT) != 0) {
+ /* Create a 24 bit image data with alpha channel */
+ final ImageData resultData = new ImageData (width, height, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000));
+ resultData.alphaData = new byte [width * height];
+ image = new Image(device, resultData);
+ } else {
+ image = new Image(device, width, height);
+ }
+ GC gc = new GC(image, gcStyle);
try {
imageGcDrawer.drawOn(gc, width, height);
ImageData imageData = image.getImageData(zoom);
@@ -1801,5 +1813,28 @@ public String toString () {
return "Image {" + handle + "}";
}
+/**
+ * IMPORTANT: This method is not part of the public
+ * API for Image. It is marked public only so that it
+ * can be shared within the packages provided by SWT.
+ *
+ * Draws a scaled image using the GC by another image.
+ *
+ * @param gc the GC to draw on the resulting image
+ * @param original the image which is supposed to be scaled and drawn on the resulting image
+ * @param width the width of the original image
+ * @param height the height of the original image
+ * @param scaleFactor the factor with which the image is supposed to be scaled
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+public static void drawScaled(GC gc, Image original, int width, int height, float scaleFactor) {
+ gc.drawImage (original, 0, 0, DPIUtil.autoScaleDown (width), DPIUtil.autoScaleDown (height),
+ /* E.g. destWidth here is effectively DPIUtil.autoScaleDown (scaledWidth), but avoiding rounding errors.
+ * Nevertheless, we still have some rounding errors due to the point-based API GC#drawImage(..).
+ */
+ 0, 0, Math.round (DPIUtil.autoScaleDown (width * scaleFactor)), Math.round (DPIUtil.autoScaleDown (height * scaleFactor)));
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java
index 27c9da5bbd9..d85bc585a64 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/List.java
@@ -25,7 +25,7 @@
* when a string is selected. A list may be single or multi select.
*
* Styles:
- * SINGLE, MULTI
+ * SINGLE, MULTI, NO_SEARCH
* Events:
* Selection, DefaultSelection
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
index 8bd17b965ee..d61ab46ff39 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
@@ -53,7 +53,7 @@
*
*
* Styles:
- * SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL, NO_SCROLL
+ * SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL, NO_SCROLL, NO_SEARCH
* Events:
* Selection, DefaultSelection, SetData, MeasureItem, EraseItem, PaintItem
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
index becc951af50..5138181ffb9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
@@ -60,7 +60,7 @@
*
*
* Styles:
- * SINGLE, MULTI, CHECK, FULL_SELECTION, VIRTUAL, NO_SCROLL
+ * SINGLE, MULTI, CHECK, FULL_SELECTION, VIRTUAL, NO_SCROLL, NO_SEARCH
* Events:
* Selection, DefaultSelection, Collapse, Expand, SetData, MeasureItem, EraseItem, PaintItem, EmptinessChanged
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
index 9733aef6ace..14ab85865ee 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (c) 2000, 2022 IBM Corporation and others.
+# Copyright (c) 2000, 2025 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -13,5 +13,5 @@
#*******************************************************************************
maj_ver=4
-min_ver=969
-rev=13
+min_ver=970
+rev=1
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java
index 5f1dd60f7af..a15f4683ae3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java
@@ -15,6 +15,7 @@
*******************************************************************************/
package org.eclipse.swt.internal;
+import java.util.*;
import java.util.function.*;
import org.eclipse.swt.*;
@@ -42,9 +43,20 @@ public class DPIUtil {
private static int deviceZoom = 100;
private static int nativeDeviceZoom = 100;
- private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH }
- private static AutoScaleMethod autoScaleMethodSetting = AutoScaleMethod.AUTO;
- private static AutoScaleMethod autoScaleMethod = AutoScaleMethod.NEAREST;
+ private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH;
+
+ public static Optional forString(String s) {
+ for (AutoScaleMethod v : values()) {
+ if (v.name().equalsIgnoreCase(s)) {
+ return Optional.of(v);
+ }
+ }
+ return Optional.empty();
+ }
+
+ }
+ private static final AutoScaleMethod AUTO_SCALE_METHOD_SETTING;
+ private static AutoScaleMethod autoScaleMethod;
private static String autoScaleValue;
private static final boolean USE_CAIRO_AUTOSCALE = SWT.getPlatform().equals("gtk");
@@ -100,13 +112,8 @@ private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH }
autoScaleValue = System.getProperty (SWT_AUTOSCALE);
String value = System.getProperty (SWT_AUTOSCALE_METHOD);
- if (value != null) {
- if (AutoScaleMethod.NEAREST.name().equalsIgnoreCase(value)) {
- autoScaleMethod = autoScaleMethodSetting = AutoScaleMethod.NEAREST;
- } else if (AutoScaleMethod.SMOOTH.name().equalsIgnoreCase(value)) {
- autoScaleMethod = autoScaleMethodSetting = AutoScaleMethod.SMOOTH;
- }
- }
+ AUTO_SCALE_METHOD_SETTING = AutoScaleMethod.forString(value).orElse(AutoScaleMethod.AUTO);
+ autoScaleMethod = AUTO_SCALE_METHOD_SETTING != AutoScaleMethod.AUTO ? AUTO_SCALE_METHOD_SETTING : AutoScaleMethod.NEAREST;
}
/**
@@ -295,20 +302,21 @@ private static ImageData autoScaleImageData (Device device, final ImageData imag
boolean useSmoothScaling = isSmoothScalingEnabled() && imageData.getTransparencyType() != SWT.TRANSPARENCY_MASK;
if (useSmoothScaling) {
Image original = new Image (device, (ImageDataProvider) zoom -> imageData);
- /* Create a 24 bit image data with alpha channel */
- final ImageData resultData = new ImageData (scaledWidth, scaledHeight, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000));
- resultData.alphaData = new byte [scaledWidth * scaledHeight];
- Image resultImage = new Image (device, (ImageDataProvider) zoom -> resultData);
- GC gc = new GC (resultImage);
- gc.setAntialias (SWT.ON);
- gc.drawImage (original, 0, 0, autoScaleDown (width), autoScaleDown (height),
- /* E.g. destWidth here is effectively DPIUtil.autoScaleDown (scaledWidth), but avoiding rounding errors.
- * Nevertheless, we still have some rounding errors due to the point-based API GC#drawImage(..).
- */
- 0, 0, Math.round (autoScaleDown (width * scaleFactor)), Math.round (autoScaleDown (height * scaleFactor)));
- gc.dispose ();
+ ImageGcDrawer drawer = new ImageGcDrawer() {
+ @Override
+ public void drawOn(GC gc, int imageWidth, int imageHeight) {
+ gc.setAntialias (SWT.ON);
+ Image.drawScaled(gc, original, width, height, scaleFactor);
+ };
+
+ @Override
+ public int getGcStyle() {
+ return SWT.TRANSPARENT;
+ }
+ };
+ Image resultImage = new Image (device, drawer, scaledWidth, scaledHeight);
+ ImageData result = resultImage.getImageData (100);
original.dispose ();
- ImageData result = resultImage.getImageData (getDeviceZoom ());
resultImage.dispose ();
return result;
} else {
@@ -614,7 +622,7 @@ public static void setDeviceZoom (int nativeDeviceZoom) {
// in GTK, preserve the current method when switching to a 100% monitor
boolean preserveScalingMethod = SWT.getPlatform().equals("gtk") && deviceZoom == 100;
- if (!preserveScalingMethod && autoScaleMethodSetting == AutoScaleMethod.AUTO) {
+ if (!preserveScalingMethod && AUTO_SCALE_METHOD_SETTING == AutoScaleMethod.AUTO) {
if (sholdUseSmoothScaling()) {
autoScaleMethod = AutoScaleMethod.SMOOTH;
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/ImageColorTransformer.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/ImageColorTransformer.java
index 73f8b26de57..a3e0ddef4bd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/ImageColorTransformer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/ImageColorTransformer.java
@@ -23,17 +23,17 @@ public interface ImageColorTransformer {
public static final ImageColorTransformer DEFAULT_DISABLED_IMAGE_TRANSFORMER = switch (IMAGE_DISABLEMENT_ALGORITHM) {
case IMAGE_DISABLEMENT_ALGORITHM_GTK -> ImageColorTransformer.forRGB(0.5f, 0.5f, 0.5f, 0.5f);
- case IMAGE_DISABLEMENT_ALGORITHM_DESATURATED -> ImageColorTransformer.forHSB(1.0f, 0.2f, 0.9f, 0.5f);
+ case IMAGE_DISABLEMENT_ALGORITHM_DESATURATED -> ImageColorTransformer.forSaturationBrightness(0.2f, 0.9f, 0.5f);
default -> ImageColorTransformer.forGrayscaledContrastBrightness(0.2f, 2.9f);
};
RGBA adaptPixelValue(int red, int green, int blue, int alpha);
- public static ImageColorTransformer forHSB(float hueFactor, float saturationFactor, float brightnessFactor,
+ public static ImageColorTransformer forSaturationBrightness(float saturationFactor, float brightnessFactor,
float alphaFactor) {
return (red, green, blue, alpha) -> {
float[] hsba = new RGBA(red, green, blue, alpha).getHSBA();
- float hue = Math.min(hueFactor * hsba[0], 1.0f);
+ float hue = hsba[0];
float saturation = Math.min(saturationFactor * hsba[1], 1.0f);
float brightness = Math.min(brightnessFactor * hsba[2], 1.0f);
float alphaResult = Math.min(alphaFactor * hsba[3], 255.0f);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/SVGFileFormat.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/SVGFileFormat.java
index 001b9b6828d..78d8abebcb6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/SVGFileFormat.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/SVGFileFormat.java
@@ -31,7 +31,8 @@
public class SVGFileFormat extends FileFormat {
/** The instance of the registered {@link SVGRasterizer}. */
- private static final SVGRasterizer RASTERIZER = ServiceLoader.load(SVGRasterizer.class).findFirst().orElse(null);
+ private static final SVGRasterizer RASTERIZER = ServiceLoader
+ .load(SVGRasterizer.class, SVGFileFormat.class.getClassLoader()).findFirst().orElse(null);
@Override
boolean isFileFormat(LEDataInputStream stream) throws IOException {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
index 162f21de8d3..78e8a92e1f3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
@@ -1 +1 @@
-version 4.969
\ No newline at end of file
+version 4.970
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
index f6260f94275..c9cbd1de6d9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
@@ -50,10 +50,6 @@ public final class Color extends Resource {
public GdkRGBA handle;
int alpha = 0;
-Color() {
- super();
-}
-
Color(Device device) {
super(device);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index a397b63a3be..d2a9a4e30eb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -367,10 +367,6 @@ protected void destroy () {
*/
public Rectangle getBounds () {
checkDevice ();
- return DPIUtil.autoScaleDown (getBoundsInPixels ());
-}
-
-private Rectangle getBoundsInPixels () {
return new Rectangle(0, 0, 0, 0);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
index 30b80fa9300..a394f1090ae 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
@@ -147,12 +147,6 @@ public Font(Device device, String name, int height, int style) {
init();
}
-/*public*/ Font(Device device, String name, float height, int style) {
- super(device);
- init(name, height, style, null);
- init();
-}
-
@Override
void destroy() {
OS.pango_font_description_free(handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
index dd8581c1348..74158802a5e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
@@ -403,7 +403,10 @@ public Image(Device device, Image srcImage, int flag) {
*
*
* @see #dispose()
+ *
+ * @deprecated use {@link Image#Image(Device, int, int)} instead
*/
+@Deprecated(since = "2025-06", forRemoval = true)
public Image(Device device, Rectangle bounds) {
super(device);
if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
@@ -437,11 +440,14 @@ public Image(Device device, Rectangle bounds) {
* @see #dispose()
*/
public Image(Device device, ImageData data) {
+ this(device, DPIUtil.autoScaleUp(device, data), DPIUtil.getDeviceZoom());
+}
+
+private Image(Device device, ImageData data, int zoom) {
super(device);
if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- currentDeviceZoom = DPIUtil.getDeviceZoom();
- data = DPIUtil.autoScaleUp (device, data);
- init(data);
+ currentDeviceZoom = zoom;
+ init(data, zoom);
init();
}
@@ -695,9 +701,9 @@ public Image(Device device, ImageGcDrawer imageGcDrawer, int width, int height)
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
this.imageGcDrawer = imageGcDrawer;
- currentDeviceZoom = DPIUtil.getDeviceZoom();
+ currentDeviceZoom = 100;
ImageData imageData = drawWithImageGcDrawer(width, height, currentDeviceZoom);
- init (imageData);
+ init (imageData, currentDeviceZoom);
init ();
}
@@ -1162,8 +1168,17 @@ public ImageData getImageData (int zoom) {
}
private ImageData drawWithImageGcDrawer(int width, int height, int zoom) {
- Image image = new Image(device, width, height);
- GC gc = new GC(image);
+ int gcStyle = imageGcDrawer.getGcStyle();
+ Image image;
+ if ((gcStyle & SWT.TRANSPARENT) != 0) {
+ /* Create a 24 bit image data with alpha channel */
+ final ImageData resultData = new ImageData(width, height, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000));
+ resultData.alphaData = new byte [width * height];
+ image = new Image(device, resultData, zoom);
+ } else {
+ image = new Image(device, width, height);
+ }
+ GC gc = new GC(image, gcStyle);
try {
imageGcDrawer.drawOn(gc, width, height);
ImageData imageData = image.getImageData(zoom);
@@ -1274,6 +1289,10 @@ void init(int width, int height) {
}
void init(ImageData image) {
+ init(image, DPIUtil.getDeviceZoom());
+}
+
+private void init(ImageData image, int zoom) {
if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
PaletteData palette = image.palette;
@@ -1286,7 +1305,7 @@ void init(ImageData image) {
int imageDataHeight = image.height;
// Scale dimensions of Image object to 100% scale factor
- double scaleFactor = DPIUtil.getDeviceZoom() / 100f;
+ double scaleFactor = zoom / 100f;
this.width = (int) Math.round(imageDataWidth / scaleFactor);
this.height = (int) Math.round(imageDataHeight / scaleFactor);
@@ -1551,4 +1570,27 @@ public String toString () {
return "Image {" + surface + "}";
}
+/**
+ * IMPORTANT: This method is not part of the public
+ * API for Image. It is marked public only so that it
+ * can be shared within the packages provided by SWT.
+ *
+ * Draws a scaled image using the GC by another image.
+ *
+ * @param gc the GC to draw on the resulting image
+ * @param original the image which is supposed to be scaled and drawn on the resulting image
+ * @param width the width of the original image
+ * @param height the height of the original image
+ * @param scaleFactor the factor with which the image is supposed to be scaled
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+public static void drawScaled(GC gc, Image original, int width, int height, float scaleFactor) {
+ gc.drawImage (original, 0, 0, DPIUtil.autoScaleDown (width), DPIUtil.autoScaleDown (height),
+ /* E.g. destWidth here is effectively DPIUtil.autoScaleDown (scaledWidth), but avoiding rounding errors.
+ * Nevertheless, we still have some rounding errors due to the point-based API GC#drawImage(..).
+ */
+ 0, 0, Math.round (DPIUtil.autoScaleDown (width * scaleFactor)), Math.round (DPIUtil.autoScaleDown (height * scaleFactor)));
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
index f33de0b3a9c..fd89ccc5dea 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,6 @@
import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
@@ -156,9 +155,6 @@ static void cairo_region_get_rectangles(long region, long [] rectangles, int[] n
public void add (int[] pointArray) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addInPixels(DPIUtil.autoScaleUp(pointArray));
-}
-void addInPixels (int[] pointArray) {
/*
* Bug in GTK. If gdk_region_polygon() is called with one point,
* it segment faults. The fix is to make sure that it is called
@@ -187,10 +183,7 @@ void addInPixels (int[] pointArray) {
public void add(Rectangle rect) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- addInPixels(DPIUtil.autoScaleUp(rect));
-}
-void addInPixels(Rectangle rect) {
- addInPixels (rect.x, rect.y, rect.width, rect.height);
+ add (rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -214,9 +207,6 @@ void addInPixels(Rectangle rect) {
public void add(int x, int y, int width, int height) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- add(new Rectangle(x, y, width, height));
-}
-void addInPixels(int x, int y, int width, int height) {
cairo_rectangle_int_t rect = new cairo_rectangle_int_t();
rect.x = x;
rect.y = y;
@@ -262,9 +252,6 @@ public void add(Region region) {
*/
public boolean contains(int x, int y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return contains(new Point(x, y));
-}
-boolean containsInPixels(int x, int y) {
return Cairo.cairo_region_contains_point(handle, x, y);
}
@@ -285,11 +272,8 @@ boolean containsInPixels(int x, int y) {
*/
public boolean contains(Point pt) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return containsInPixels(DPIUtil.autoScaleUp(pt));
-}
-boolean containsInPixels(Point pt) {
if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return containsInPixels(pt.x, pt.y);
+ return contains(pt.x, pt.y);
}
@Override
@@ -328,9 +312,6 @@ public boolean equals(Object object) {
*/
public Rectangle getBounds() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return DPIUtil.autoScaleDown(getBoundsInPixels());
-}
-Rectangle getBoundsInPixels() {
cairo_rectangle_int_t rect = new cairo_rectangle_int_t();
Cairo.cairo_region_get_extents(handle, rect);
return new Rectangle(rect.x, rect.y, rect.width, rect.height);
@@ -390,11 +371,7 @@ public int hashCode() {
public void intersect(Rectangle rect) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- intersectInPixels(DPIUtil.autoScaleUp(rect));
-}
-
-void intersectInPixels(Rectangle rect) {
- intersectInPixels (rect.x, rect.y, rect.width, rect.height);
+ intersect (rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -418,10 +395,6 @@ void intersectInPixels(Rectangle rect) {
public void intersect(int x, int y, int width, int height) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- intersect(new Rectangle(x, y, width, height));
-}
-
-void intersectInPixels(int x, int y, int width, int height) {
cairo_rectangle_int_t rect = new cairo_rectangle_int_t();
rect.x = x;
rect.y = y;
@@ -506,7 +479,7 @@ boolean intersectsInPixels (int x, int y, int width, int height) {
public boolean intersects(Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return intersectsInPixels(DPIUtil.autoScaleUp(rect));
+ return intersectsInPixels(rect);
}
boolean intersectsInPixels(Rectangle rect) {
@@ -562,10 +535,6 @@ public boolean isEmpty() {
public void subtract (int[] pointArray) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- subtractInPixels(DPIUtil.autoScaleUp(pointArray));
-}
-
-void subtractInPixels (int[] pointArray) {
/*
* Bug in GTK. If gdk_region_polygon() is called with one point,
* it segment faults. The fix is to make sure that it is called
@@ -595,11 +564,7 @@ void subtractInPixels (int[] pointArray) {
public void subtract(Rectangle rect) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- subtractInPixels(DPIUtil.autoScaleUp(rect));
-}
-
-void subtractInPixels(Rectangle rect) {
- subtractInPixels (rect.x, rect.y, rect.width, rect.height);
+ subtract (rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -623,10 +588,6 @@ void subtractInPixels(Rectangle rect) {
public void subtract(int x, int y, int width, int height) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- subtract(new Rectangle(x, y, width, height));
-}
-
-void subtractInPixels(int x, int y, int width, int height) {
cairo_rectangle_int_t rect = new cairo_rectangle_int_t ();
rect.x = x;
rect.y = y;
@@ -676,10 +637,6 @@ public void subtract(Region region) {
*/
public void translate (int x, int y) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- translate(new Point(x, y));
-}
-
-void translateInPixels (int x, int y) {
Cairo.cairo_region_translate (handle, x, y);
}
@@ -701,8 +658,7 @@ void translateInPixels (int x, int y) {
public void translate (Point pt) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- pt = DPIUtil.autoScaleUp(pt);
- translateInPixels(pt.x, pt.y);
+ translate(pt.x, pt.y);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
index f6903657204..dc819bff0c5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
@@ -31,7 +31,7 @@
*
* This class is tested via: org.eclipse.swt.tests.gtk.Test_GtkTextEncoding
*
- * About JNI & string conversion:
+ * About JNI & string conversion:
* #############################
* - Regular JNI String conversion usually uses a modified UTF-8, see: https://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8
* - And in JNI, normally (env*)->GetStringUTFChars(..) is used to convert a javaString into a C string.
@@ -50,12 +50,12 @@
* Java uses UTF-16 Wide characters internally to represent a string.
* C uses UTF-8 Multibyte characters (null terminated) to represent a string.
*
- * About encoding on Linux/Gtk & it's relevance to SWT:
+ * About encoding on Linux/Gtk & it's relevance to SWT:
* ####################################################
*
* UTF-* = variable length encoding.
*
- * UTF-8 = minimum is 8 bits, max is 6 bytes, but rarely goes beyond 4 bytes. Gtk & most of web uses this.
+ * UTF-8 = minimum is 8 bits, max is 6 bytes, but rarely goes beyond 4 bytes. Gtk & most of web uses this.
* UTF-16 = minimum is 16 bits. Java's string are stored this way.
* UTF-16 can be
* Big Endian : 65 = 00000000 01000001 # Human friendly, reads left to right.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java
index 648c9ac8dcd..7cc17b2d6e1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java
@@ -58,7 +58,7 @@ public static class GDBusMethod {
* @param inputArgs 2D array pair of Strings in the format of: (DBUS_TYPE_*, argument_name).
* Where argument_name is only so that it's seen by command line by user.
* @param outputArgs Same as inputArgs, but for returning values.
- * @param userFunction A Function, that you would like to run when the user calls the method over gdbus.
+ * @param userFunction A Function<Object[],Object[]>, that you would like to run when the user calls the method over gdbus.
* Note, input argument(s) are provided as an Object[] array. You need to cast items manually.
* Output must always be an Object[] array or null. (E.g Object[] with only 1 element in it).
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SessionManagerDBus.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SessionManagerDBus.java
index 57e4c036d1b..c7e9f044a82 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SessionManagerDBus.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SessionManagerDBus.java
@@ -111,7 +111,8 @@ public void remove() {
public SessionManagerDBus() {
// Allow to disable session manager, for example in case it conflicts with
// session manager connection implemented in application itself.
- boolean isDisabled = System.getProperty("org.eclipse.swt.internal.SessionManagerDBus.disable") != null;
+ boolean isDisabled = System.getProperty("org.eclipse.swt.internal.SessionManagerDBus.disable") != null
+ || System.getenv("org.eclipse.swt.internal.SessionManagerDBus.disable") != null;
if (isDisabled) return;
start();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SyncDialogUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SyncDialogUtil.java
index bb69ea849e5..19911691033 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SyncDialogUtil.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/SyncDialogUtil.java
@@ -17,6 +17,7 @@
import java.util.function.*;
import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.widgets.*;
/**
@@ -76,7 +77,11 @@ static public int run(Display display, long handle, boolean isNativeDialog) {
if (isNativeDialog) {
GTK.gtk_native_dialog_show(handle);
} else {
- GTK.gtk_widget_show(handle);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_set_visible(handle, true);
+ } else {
+ GTK3.gtk_widget_show(handle);
+ }
}
while (!display.isDisposed()) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 983ea961e0a..bfe1d77024c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -1295,28 +1295,28 @@ public void setText (String string) {
private void updateWidgetsVisibility() {
if (text.length() == 0 && image == null) {
- GTK.gtk_widget_hide (boxHandle);
- GTK.gtk_widget_hide (labelHandle);
- GTK.gtk_widget_hide (imageHandle);
+ gtk_widget_hide (boxHandle);
+ gtk_widget_hide (labelHandle);
+ gtk_widget_hide (imageHandle);
} else {
- GTK.gtk_widget_show (boxHandle);
+ gtk_widget_show (boxHandle);
if (text.length() == 0)
- GTK.gtk_widget_hide (labelHandle);
+ gtk_widget_hide (labelHandle);
else
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (labelHandle);
if (image == null)
- GTK.gtk_widget_hide (imageHandle);
+ gtk_widget_hide (imageHandle);
else
- GTK.gtk_widget_show (imageHandle);
+ gtk_widget_show (imageHandle);
}
}
@Override
void showWidget () {
super.showWidget ();
- if (boxHandle != 0 && ((text != null && text.length() != 0) || image != null)) GTK.gtk_widget_show (boxHandle);
- if (labelHandle != 0 && text != null && text.length() != 0) GTK.gtk_widget_show (labelHandle);
- if (arrowHandle != 0) GTK.gtk_widget_show (arrowHandle);
+ if (boxHandle != 0 && ((text != null && text.length() != 0) || image != null)) gtk_widget_show (boxHandle);
+ if (labelHandle != 0 && text != null && text.length() != 0) gtk_widget_show (labelHandle);
+ if (arrowHandle != 0) gtk_widget_show (arrowHandle);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
index 3ee01839d18..5142e0ccb67 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
@@ -318,12 +317,6 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
* as to why it's unneeded is left as a TODO. See bug 546274.
*/
if (GTK.GTK4) return;
- Point destination = DPIUtil.autoScaleUp (new Point (destX, destY));
- Rectangle srcRect = DPIUtil.autoScaleUp (new Rectangle (x, y, width, height));
- scrollInPixels(destination.x, destination.y, srcRect.x, srcRect.y, srcRect.width, srcRect.height, all);
-}
-
-void scrollInPixels (int destX, int destY, int x, int y, int width, int height, boolean all) {
if ((style & SWT.MIRRORED) != 0) {
int clientWidth = getClientWidth ();
x = clientWidth - width - x;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
index 73b1c713a33..208ed7f0432 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
import org.eclipse.swt.internal.gtk.*;
@@ -142,11 +141,6 @@ private void drawInCellEditor(long window) {
*
*/
public Rectangle getBounds () {
- checkWidget();
- return DPIUtil.autoScaleDown(getBoundsInPixels());
-}
-
-Rectangle getBoundsInPixels () {
checkWidget();
if (image != null) {
Rectangle rect = image.getBoundsInPixels ();
@@ -202,11 +196,6 @@ public Image getImage () {
*
*/
public Point getLocation () {
- checkWidget();
- return DPIUtil.autoScaleDown(getLocationInPixels());
-}
-
-Point getLocationInPixels () {
checkWidget();
return new Point (x, y);
}
@@ -237,11 +226,6 @@ public Canvas getParent () {
*
*/
public Point getSize () {
- checkWidget();
- return DPIUtil.autoScaleDown(getSizeInPixels());
-}
-
-Point getSizeInPixels () {
checkWidget();
if (image != null) {
Rectangle rect = image.getBoundsInPixels ();
@@ -349,11 +333,6 @@ void releaseWidget () {
*
*/
public void setBounds (int x, int y, int width, int height) {
- checkWidget();
- setBounds (new Rectangle (x, y, width, height));
-}
-
-void setBoundsInPixels (int x, int y, int width, int height) {
checkWidget();
if (this.x == x && this.y == y && this.width == width && this.height == height) return;
boolean isFocus = isFocusCaret ();
@@ -378,15 +357,9 @@ void setBoundsInPixels (int x, int y, int width, int height) {
*
*/
public void setBounds (Rectangle rect) {
- checkWidget();
- rect = DPIUtil.autoScaleUp(rect);
- setBoundsInPixels(rect);
-}
-
-void setBoundsInPixels (Rectangle rect) {
checkWidget();
if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBoundsInPixels (rect.x, rect.y, rect.width, rect.height);
+ setBounds (rect.x, rect.y, rect.width, rect.height);
}
void setFocus () {
@@ -459,12 +432,7 @@ public void setImage (Image image) {
*/
public void setLocation (int x, int y) {
checkWidget();
- setLocation (new Point (x, y));
-}
-
-void setLocationInPixels (int x, int y) {
- checkWidget();
- setBoundsInPixels (x, y, width, height);
+ setBounds (x, y, width, height);
}
/**
@@ -480,14 +448,9 @@ void setLocationInPixels (int x, int y) {
*
*/
public void setLocation (Point location) {
- checkWidget();
- setLocationInPixels (DPIUtil.autoScaleUp (location));
-}
-
-void setLocationInPixels (Point location) {
checkWidget();
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocationInPixels (location.x, location.y);
+ setLocation (location.x, location.y);
}
/**
@@ -503,12 +466,7 @@ void setLocationInPixels (Point location) {
*/
public void setSize (int width, int height) {
checkWidget();
- setSize (new Point (width,height));
-}
-
-void setSizeInPixels (int width, int height) {
- checkWidget();
- setBoundsInPixels (x, y, width, height);
+ setBounds (x, y, width, height);
}
/**
@@ -525,14 +483,9 @@ void setSizeInPixels (int width, int height) {
*
*/
public void setSize (Point size) {
- checkWidget();
- setSizeInPixels(DPIUtil.autoScaleUp (size));
-}
-
-void setSizeInPixels (Point size) {
checkWidget();
if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setSizeInPixels (size.x, size.y);
+ setSize (size.x, size.y);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index 8742c6fa51b..f82d16d6f84 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -1080,12 +1080,6 @@ long eventSurface () {
* @since 3.8
*/
public Point getCaretLocation () {
- checkWidget ();
- return DPIUtil.autoScaleDown(getCaretLocationInPixels());
-}
-
-
-Point getCaretLocationInPixels () {
checkWidget ();
if ((style & SWT.READ_ONLY) != 0) {
return new Point (0, 0);
@@ -1308,7 +1302,7 @@ public Point getSelection () {
int [] end = new int [1];
if (entryHandle != 0) {
GTK.gtk_editable_get_selection_bounds (entryHandle, start, end);
- long ptr = GTK3.gtk_entry_get_text (entryHandle);
+ long ptr = GTK.GTK4 ? GTK4.gtk_entry_buffer_get_text(GTK4.gtk_entry_get_buffer(entryHandle)): GTK3.gtk_entry_get_text (entryHandle);
start[0] = (int)OS.g_utf8_offset_to_utf16_offset (ptr, start[0]);
end[0] = (int)OS.g_utf8_offset_to_utf16_offset (ptr, end[0]);
}
@@ -1389,12 +1383,6 @@ String getText (int start, int stop) {
*
*/
public int getTextHeight () {
- checkWidget();
- return DPIUtil.autoScaleDown(getTextHeightInPixels());
-}
-
-
-int getTextHeightInPixels () {
checkWidget();
GtkRequisition requisition = new GtkRequisition ();
gtk_widget_get_preferred_size (handle, requisition);
@@ -1977,7 +1965,14 @@ long paintSurface () {
*/
public void paste () {
checkWidget ();
- if (entryHandle != 0) GTK3.gtk_editable_paste_clipboard (entryHandle);
+ if (entryHandle != 0) {
+ if (GTK.GTK4) {
+ long textHandle = GTK4.gtk_widget_get_first_child(entryHandle);
+ GTK4.gtk_widget_activate_action(textHandle, OS.action_paste_clipboard, null);
+ } else {
+ GTK3.gtk_editable_paste_clipboard (entryHandle);
+ }
+ }
}
@Override
@@ -2275,7 +2270,7 @@ void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
@Override
int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
int newHeight = height;
- if (resize) newHeight = Math.max (getTextHeightInPixels (), height);
+ if (resize) newHeight = Math.max (getTextHeight (), height);
return super.setBounds (x, y, width, newHeight, move, resize);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 4beb8488ff0..6a64f0b58e0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -266,7 +266,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
if (layout != null) {
if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
changed |= (state & LAYOUT_CHANGED) != 0;
- size = DPIUtil.autoScaleUp(layout.computeSize (this, DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), changed));
+ size = layout.computeSize (this, wHint, hHint, changed);
state &= ~LAYOUT_CHANGED;
} else {
size = new Point (wHint, hHint);
@@ -278,7 +278,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
}
if (wHint != SWT.DEFAULT) size.x = wHint;
if (hHint != SWT.DEFAULT) size.y = hHint;
- Rectangle trim = DPIUtil.autoScaleUp (computeTrim (0, 0, DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y)));
+ Rectangle trim = computeTrim (0, 0, size.x, size.y);
return new Point (trim.width, trim.height);
}
@@ -550,14 +550,6 @@ void deregister () {
*/
public void drawBackground (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) {
checkWidget();
- Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height));
- offsetX = DPIUtil.autoScaleUp(offsetX);
- offsetY = DPIUtil.autoScaleUp(offsetY);
- drawBackgroundInPixels(gc, rect.x, rect.y, rect.width, rect.height, offsetX, offsetY);
-}
-
-void drawBackgroundInPixels (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) {
- checkWidget ();
if (gc == null) error (SWT.ERROR_NULL_ARGUMENT);
if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
Control control = findBackgroundControl ();
@@ -591,7 +583,7 @@ void drawBackgroundInPixels (GC gc, int x, int y, int width, int height, int off
Cairo.cairo_fill (cairo);
Cairo.cairo_restore (cairo);
} else {
- gc.fillRectangle(DPIUtil.autoScaleDown(new Rectangle(x, y, width, height)));
+ gc.fillRectangle(new Rectangle(x, y, width, height));
}
}
@@ -1427,10 +1419,10 @@ Point minimumSize (int wHint, int hHint, boolean changed) {
* Since getClientArea can be overridden by subclasses, we cannot
* call getClientAreaInPixels directly.
*/
- Rectangle clientArea = DPIUtil.autoScaleUp(getClientArea ());
+ Rectangle clientArea = getClientArea ();
int width = 0, height = 0;
for (int i=0; i=0; --i) {
@@ -1668,7 +1660,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
if (fixedHandle != 0 && handle != 0
&& getVisible() && !GTK.gtk_widget_get_visible(topHandle) //if SWT State is not HIDDEN, but widget is hidden on GTK side.
&& topHandle == fixedHandle && width > 0 && height > 0 && resize) {
- GTK.gtk_widget_show(topHandle);
+ gtk_widget_show(topHandle);
}
int result = super.setBounds (x, y, width, height, move, resize);
@@ -1831,7 +1823,7 @@ public void setTabList (Control [] tabList) {
void showWidget () {
super.showWidget ();
if (socketHandle != 0) {
- GTK.gtk_widget_show (socketHandle);
+ gtk_widget_show (socketHandle);
embeddedHandle = GTK.gtk_socket_get_id (socketHandle);
}
if (scrolledHandle == 0) fixStyle (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 7d17ca0120e..c7e87f7eeac 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -832,9 +832,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
- wHint = DPIUtil.autoScaleUp(wHint);
- hHint = DPIUtil.autoScaleUp(hHint);
- return DPIUtil.autoScaleDown (computeSizeInPixels (wHint, hHint, changed));
+ return computeSizeInPixels (wHint, hHint, changed);
}
Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
@@ -933,7 +931,7 @@ Accessible _getAccessible () {
*/
public Rectangle getBounds () {
checkWidget();
- return DPIUtil.autoScaleDown(getBoundsInPixels());
+ return getBoundsInPixels();
}
Rectangle getBoundsInPixels () {
@@ -975,7 +973,6 @@ Rectangle getBoundsInPixels () {
public void setBounds (Rectangle rect) {
checkWidget ();
if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- rect = DPIUtil.autoScaleUp(rect);
setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true);
}
@@ -1015,7 +1012,7 @@ void setBoundsInPixels (Rectangle rect) {
*/
public void setBounds (int x, int y, int width, int height) {
checkWidget();
- Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height));
+ Rectangle rect = new Rectangle (x, y, width, height);
setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true);
}
@@ -1148,10 +1145,10 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
*/
if (!GTK.gtk_widget_get_visible(topHandle)) {
Control focusControl = display.getFocusControl();
- GTK.gtk_widget_show(topHandle);
+ gtk_widget_show(topHandle);
gtk_widget_get_preferred_size (topHandle, requisition);
gtk_widget_size_allocate(topHandle, allocation, -1);
- GTK.gtk_widget_hide(topHandle);
+ gtk_widget_hide(topHandle);
/* Bug 540002: Showing and hiding widget causes original focused control to loose focus,
* Reset focus to original focused control after dealing with allocation.
*/
@@ -1183,7 +1180,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
}
}
- GTK.gtk_widget_hide(topHandle);
+ gtk_widget_hide(topHandle);
} else {
if ((state & HIDDEN) == 0) {
if (!GTK.GTK4) {
@@ -1192,7 +1189,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
}
}
- GTK.gtk_widget_show(topHandle);
+ gtk_widget_show(topHandle);
}
}
@@ -1234,7 +1231,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
*/
public Point getLocation () {
checkWidget();
- return DPIUtil.autoScaleDown(getLocationInPixels());
+ return getLocationInPixels();
}
Point getLocationInPixels () {
@@ -1271,7 +1268,6 @@ Point getLocationInPixels () {
public void setLocation (Point location) {
checkWidget ();
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- location = DPIUtil.autoScaleUp(location);
setBounds (location.x, location.y, 0, 0, true, false);
}
@@ -1301,7 +1297,7 @@ void setLocationInPixels (Point location) {
*/
public void setLocation(int x, int y) {
checkWidget();
- Point loc = DPIUtil.autoScaleUp(new Point (x, y));
+ Point loc = new Point (x, y);
setBounds (loc.x, loc.y, 0, 0, true, false);
}
@@ -1325,7 +1321,7 @@ void setLocationInPixels(int x, int y) {
*/
public Point getSize () {
checkWidget();
- return DPIUtil.autoScaleDown(getSizeInPixels());
+ return getSizeInPixels();
}
Point getSizeInPixels () {
@@ -1364,7 +1360,6 @@ Point getSizeInPixels () {
public void setSize (Point size) {
checkWidget ();
if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- size = DPIUtil.autoScaleUp(size);
setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true);
}
@@ -1483,7 +1478,7 @@ void setRelations () {
*/
public void setSize (int width, int height) {
checkWidget();
- Point size = DPIUtil.autoScaleUp(new Point (width, height));
+ Point size = new Point (width, height);
setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true);
}
@@ -1667,9 +1662,9 @@ public Point toControl(int x, int y) {
GDK.gdk_window_get_origin(window, origin_x, origin_y);
}
- x -= DPIUtil.autoScaleDown(origin_x[0]);
- y -= DPIUtil.autoScaleDown(origin_y[0]);
- if ((style & SWT.MIRRORED) != 0) x = DPIUtil.autoScaleDown(getClientWidth()) - x;
+ x -= origin_x[0];
+ y -= origin_y[0];
+ if ((style & SWT.MIRRORED) != 0) x = getClientWidth() - x;
return new Point(x, y);
}
@@ -1732,9 +1727,9 @@ public Point toDisplay(int x, int y) {
GDK.gdk_window_get_origin(window, origin_x, origin_y);
}
- if ((style & SWT.MIRRORED) != 0) x = DPIUtil.autoScaleDown(getClientWidth()) - x;
- x += DPIUtil.autoScaleDown(origin_x[0]);
- y += DPIUtil.autoScaleDown(origin_y[0]);
+ if ((style & SWT.MIRRORED) != 0) x = getClientWidth() - x;
+ x += origin_x[0];
+ y += origin_y[0];
return new Point(x, y);
}
@@ -1785,12 +1780,6 @@ public Point toDisplay (Point point) {
return toDisplay (point.x, point.y);
}
-Point toDisplayInPixels (Point point) {
- checkWidget();
- if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- return toDisplayInPixels (point.x, point.y);
-}
-
/**
* GTK4 only function to replace gdk_surface_get_origin
* @return the origin of the Control's SWTFixed container relative to the Shell
@@ -2698,7 +2687,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean
//Note, input params x/y are relative, the two points below are absolute coords.
Point startPos = null;
Point currPos = null;
- startPos = display.getCursorLocationInPixels();
+ startPos = display.getCursorLocation();
while (!quit) {
long eventPtr = 0;
@@ -2714,7 +2703,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean
if (eventPtr != 0) {
break;
} else {
- currPos = display.getCursorLocationInPixels();
+ currPos = display.getCursorLocation();
dragging = GTK3.gtk_drag_check_threshold (handle,
startPos.x, startPos.y, currPos.x, currPos.y);
if (dragging) break;
@@ -3018,7 +3007,7 @@ GdkRGBA getBaseGdkRGBA () {
*
*/
public int getBorderWidth () {
- return DPIUtil.autoScaleDown(getBorderWidthInPixels());
+ return getBorderWidthInPixels();
}
int getBorderWidthInPixels () {
@@ -3557,8 +3546,7 @@ long gtk_button_press_event (long widget, long event, boolean sendMouseDown) {
// See comment in #dragDetect()
if (OS.isX11()) {
if (dragging) {
- Point scaledEvent = DPIUtil.autoScaleDown(new Point((int)eventX[0], (int) eventY[0]));
- sendDragEvent (eventButton[0], eventState[0], scaledEvent.x, scaledEvent.y, false);
+ sendDragEvent (eventButton[0], eventState[0], (int)eventX[0], (int)eventY[0], false);
if (isDisposed ()) return 1;
}
}
@@ -3885,8 +3873,8 @@ long gtk_draw (long widget, long cairo) {
if (!hooksPaint ()) return 0;
Event event = new Event ();
event.count = 1;
- Rectangle eventBounds = DPIUtil.autoScaleDown (new Rectangle (rect.x, rect.y, rect.width, rect.height));
- if ((style & SWT.MIRRORED) != 0) eventBounds.x = DPIUtil.autoScaleDown (getClientWidth ()) - eventBounds.width - eventBounds.x;
+ Rectangle eventBounds = new Rectangle (rect.x, rect.y, rect.width, rect.height);
+ if ((style & SWT.MIRRORED) != 0) eventBounds.x = getClientWidth () - eventBounds.width - eventBounds.x;
event.setBounds (eventBounds);
GCData data = new GCData ();
/*
@@ -4175,7 +4163,7 @@ long gtk_motion_notify_event (long widget, long event) {
int eventType = GDK.gdk_event_get_event_type(event);
if (eventType == GDK.GDK_3BUTTON_PRESS) return 0;
- Point scaledEvent = DPIUtil.autoScaleDown(new Point((int)eventX[0], (int) eventY[0]));
+ Point scaledEvent = new Point((int)eventX[0], (int) eventY[0]);
int [] eventButton = new int [1];
int [] eventState = new int [1];
@@ -4707,12 +4695,6 @@ void redraw (boolean all) {
* @see SWT#DOUBLE_BUFFERED
*/
public void redraw (int x, int y, int width, int height, boolean all) {
- checkWidget();
- Rectangle rect = DPIUtil.autoScaleUp(new Rectangle(x, y, width, height));
- redrawInPixels(rect.x, rect.y, rect.width, rect.height, all);
-}
-
-void redrawInPixels (int x, int y, int width, int height, boolean all) {
checkWidget();
if (!GTK.gtk_widget_get_visible (topHandle ())) return;
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x;
@@ -4894,7 +4876,7 @@ boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateM
event.button = button;
Rectangle eventRect = new Rectangle (x, y, 0, 0);
event.setBounds (eventRect);
- if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(getClientWidth ()) - event.x;
+ if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.x;
if (isStateMask) {
event.stateMask = stateMask;
} else {
@@ -5062,7 +5044,7 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen
if (is_hint) {
// coordinates are already window-relative, see #gtk_motion_notify_event(..) and bug 94502
Rectangle eventRect = new Rectangle ((int)x, (int)y, 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
} else {
int [] origin_x = new int [1], origin_y = new int [1];
Rectangle eventRect;
@@ -5071,15 +5053,15 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen
// GDK.gdk_surface_get_origin (surface, origin_x, origin_y);
// eventRect = new Rectangle ((int)x - origin_x [0], (int)y - origin_y [0], 0, 0);
eventRect = new Rectangle ((int)x, (int)y, 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
} else {
long window = eventWindow ();
GDK.gdk_window_get_origin (window, origin_x, origin_y);
eventRect = new Rectangle ((int)x - origin_x [0], (int)y - origin_y [0], 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
}
}
- if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.x;
+ if ((style & SWT.MIRRORED) != 0) event.x = getClientWidth () - event.x;
setInputState (event, state);
/**
@@ -6144,7 +6126,7 @@ public void setVisible (boolean visible) {
if (!GTK.GTK4) {
if (enableWindow != 0) GDK.gdk_window_show_unraised(enableWindow);
}
- GTK.gtk_widget_show (topHandle);
+ gtk_widget_show (topHandle);
}
} else {
/*
@@ -6169,7 +6151,7 @@ public void setVisible (boolean visible) {
if (isDisposed ()) return;
GTK.gtk_widget_set_can_focus (topHandle, true);
}
- GTK.gtk_widget_hide (topHandle);
+ gtk_widget_hide (topHandle);
if (isDisposed ()) return;
if (!GTK.GTK4) {
if (enableWindow != 0) GDK.gdk_window_hide(enableWindow);
@@ -6309,7 +6291,7 @@ boolean showMenu (int x, int y) {
boolean showMenu (int x, int y, int detail) {
Event event = new Event ();
Rectangle eventRect = new Rectangle (x, y, 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
event.detail = detail;
sendEvent (SWT.MenuDetect, event);
//widget could be disposed at this point
@@ -6327,14 +6309,14 @@ boolean showMenu (int x, int y, int detail) {
if (temp != 0) OS.g_object_unref(temp);
- menu.setLocationInPixels(x, y);
+ menu.setLocation(x, y);
menu.setVisible(true);
return true;
} else {
- Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
+ Rectangle rect = event.getBounds ();
if (rect.x != x || rect.y != y) {
- menu.setLocationInPixels (rect.x, rect.y);
+ menu.setLocation (rect.x, rect.y);
}
menu.setVisible (true);
return true;
@@ -6356,9 +6338,9 @@ void showWidget () {
} else {
GTK3.gtk_container_add(parentHandle, topHandle);
}
- if (handle != 0 && handle != topHandle) GTK.gtk_widget_show (handle);
+ if (handle != 0 && handle != topHandle) gtk_widget_show (handle);
if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
- if (fixedHandle != 0) GTK.gtk_widget_show (fixedHandle);
+ if (fixedHandle != 0) gtk_widget_show (fixedHandle);
}
if (fixedHandle != 0) fixStyle (fixedHandle);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index 7db3b1084bc..cb9289111e0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -434,7 +434,7 @@ private void createHandleForCalendar() {
flags |= GTK.GTK_CALENDAR_SHOW_WEEK_NUMBERS;
}
GTK3.gtk_calendar_set_display_options(handle, flags);
- GTK.gtk_widget_show(handle);
+ gtk_widget_show(handle);
}
}
@@ -457,8 +457,8 @@ private void createHandleForDateWithDropDown () {
GTK3.gtk_container_add(fixedHandle, handle);
GTK3.gtk_container_add(handle, textEntryHandle);
- GTK.gtk_widget_show(containerHandle);
- GTK.gtk_widget_show(textEntryHandle);
+ gtk_widget_show(containerHandle);
+ gtk_widget_show(textEntryHandle);
// In GTK 3 font description is inherited from parent widget which is not how SWT has always worked,
@@ -627,7 +627,7 @@ void dropDownCalendar (boolean drop) {
//To display popup calendar, we need to know where the parent is relative to the whole screen.
Rectangle coordsRelativeToScreen = display.mapInPixels (getParent (), null, getBoundsInPixels ());
- Rectangle displayRect = DPIUtil.autoScaleUp(getMonitor ().getClientArea ());
+ Rectangle displayRect = getMonitor ().getClientArea ();
showPopupShell (containerBounds, calendarSize, coordsRelativeToScreen, displayRect);
@@ -2326,7 +2326,7 @@ void selectAll () {
void hideDateTime () {
if (isDate () || isTime ()){
- GTK.gtk_widget_hide (fixedHandle);
+ gtk_widget_hide (fixedHandle);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
index 5d135c46e8b..5bbf30ec8d8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -275,7 +275,7 @@ public long await(long result) {
}
}
}
-
+
Optional result = Optional.empty();
if (response == GTK.GTK_RESPONSE_ACCEPT) {
result = Optional.ofNullable(selectedPath);
@@ -306,7 +306,7 @@ void GTK3setNativeDialogMessage(long handle, String message) {
if (label == 0) error(SWT.ERROR_NO_HANDLES);
GTK3.gtk_container_add(box, label);
- GTK.gtk_widget_show(label);
+ GTK3.gtk_widget_show(label);
GTK3.gtk_label_set_line_wrap(label, true);
GTK.gtk_box_set_homogeneous(box, false);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 41aea9b1e16..dfc3d563a75 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1774,7 +1774,7 @@ public Shell getActiveShell () {
@Override
public Rectangle getBounds () {
checkDevice ();
- return DPIUtil.autoScaleDown (getBoundsInPixels ());
+ return getBoundsInPixels ();
}
/**
@@ -1985,10 +1985,6 @@ boolean filters (int eventType) {
*
*/
public Point getCursorLocation() {
- return DPIUtil.autoScaleDown(getCursorLocationInPixels());
-}
-
-Point getCursorLocationInPixels() {
checkDevice();
int[] x = new int[1], y = new int[1];
@@ -2649,7 +2645,7 @@ Rectangle getWorkArea() {
public Monitor[] getMonitors() {
checkDevice();
Monitor[] monitors = null;
- Rectangle workArea = DPIUtil.autoScaleDown(getWorkArea ());
+ Rectangle workArea = getWorkArea ();
long display = GDK.gdk_display_get_default();
if (display != 0) {
int monitorCount;
@@ -2670,10 +2666,10 @@ public Monitor[] getMonitors() {
Monitor monitor = new Monitor();
monitor.handle = gdkMonitor;
- monitor.x = DPIUtil.autoScaleDown(geometry.x);
- monitor.y = DPIUtil.autoScaleDown(geometry.y);
- monitor.width = DPIUtil.autoScaleDown(geometry.width);
- monitor.height = DPIUtil.autoScaleDown(geometry.height);
+ monitor.x = geometry.x;
+ monitor.y = geometry.y;
+ monitor.width = geometry.width;
+ monitor.height = geometry.height;
if (!OS.isX11()) {
int scaleFactor = (int) GDK.gdk_monitor_get_scale_factor(gdkMonitor);
monitor.zoom = scaleFactor * 100;
@@ -2685,10 +2681,10 @@ public Monitor[] getMonitors() {
* since it takes into account per-monitor trim. Not available in GTK4.
*/
if (!GTK.GTK4) GDK.gdk_monitor_get_workarea(gdkMonitor, geometry);
- monitor.clientX = DPIUtil.autoScaleDown(geometry.x);
- monitor.clientY = DPIUtil.autoScaleDown(geometry.y);
- monitor.clientWidth = DPIUtil.autoScaleDown(geometry.width);
- monitor.clientHeight = DPIUtil.autoScaleDown(geometry.height);
+ monitor.clientX = geometry.x;
+ monitor.clientY = geometry.y;
+ monitor.clientWidth = geometry.width;
+ monitor.clientHeight = geometry.height;
monitors[i] = monitor;
}
@@ -4016,16 +4012,16 @@ public Point map (Control from, Control to, int x, int y) {
Point point = new Point (x, y);
if (from == to) return point;
if (from != null) {
- Point origin = DPIUtil.autoScaleDown (GTK.GTK4 ? from.getSurfaceOrigin() : from.getWindowOrigin ());
- if ((from.style & SWT.MIRRORED) != 0) point.x = DPIUtil.autoScaleDown (from.getClientWidth ()) - point.x;
+ Point origin = GTK.GTK4 ? from.getSurfaceOrigin() : from.getWindowOrigin ();
+ if ((from.style & SWT.MIRRORED) != 0) point.x = from.getClientWidth () - point.x;
point.x += origin.x;
point.y += origin.y;
}
if (to != null) {
- Point origin = DPIUtil.autoScaleDown (GTK.GTK4 ? to.getSurfaceOrigin() : to.getWindowOrigin ());
+ Point origin = GTK.GTK4 ? to.getSurfaceOrigin() : to.getWindowOrigin ();
point.x -= origin.x;
point.y -= origin.y;
- if ((to.style & SWT.MIRRORED) != 0) point.x = DPIUtil.autoScaleDown (to.getClientWidth ()) - point.x;
+ if ((to.style & SWT.MIRRORED) != 0) point.x = to.getClientWidth () - point.x;
}
return point;
}
@@ -4145,16 +4141,16 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei
if (from == to) return rect;
boolean fromRTL = false, toRTL = false;
if (from != null) {
- Point origin = DPIUtil.autoScaleDown (GTK.GTK4 ? from.getSurfaceOrigin () : from.getWindowOrigin ());
- if (fromRTL = (from.style & SWT.MIRRORED) != 0) rect.x = DPIUtil.autoScaleDown (from.getClientWidth ()) - rect.x;
+ Point origin = GTK.GTK4 ? from.getSurfaceOrigin () : from.getWindowOrigin ();
+ if (fromRTL = (from.style & SWT.MIRRORED) != 0) rect.x = from.getClientWidth () - rect.x;
rect.x += origin.x;
rect.y += origin.y;
}
if (to != null) {
- Point origin = DPIUtil.autoScaleDown (GTK.GTK4 ? to.getSurfaceOrigin() : to.getWindowOrigin ());
+ Point origin = GTK.GTK4 ? to.getSurfaceOrigin() : to.getWindowOrigin ();
rect.x -= origin.x;
rect.y -= origin.y;
- if (toRTL = (to.style & SWT.MIRRORED) != 0) rect.x = DPIUtil.autoScaleDown (to.getClientWidth ()) - rect.x;
+ if (toRTL = (to.style & SWT.MIRRORED) != 0) rect.x = to.getClientWidth () - rect.x;
}
if (fromRTL != toRTL) rect.x -= rect.width;
@@ -4297,8 +4293,8 @@ public boolean post (Event event) {
int type = event.type;
if (type == SWT.MouseMove) {
- Rectangle loc = DPIUtil.autoScaleUp(event.getBounds());
- setCursorLocationInPixels(new Point(loc.x, loc.y));
+ Rectangle loc = event.getBounds();
+ setCursorLocation(new Point(loc.x, loc.y));
return true;
}
@@ -4840,6 +4836,11 @@ void releaseDisplay () {
OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoFontFaceClass, pangoFontFaceNewProc);
OS.g_type_class_unref (pangoFontFaceClass);
pangoFontFaceNewProc = 0;
+ long printerOptionWidgetType = GTK.gtk_printer_option_widget_get_type();
+ long printerOptionWidgetClass = OS.g_type_class_ref (printerOptionWidgetType);
+ OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (printerOptionWidgetClass, printerOptionWidgetNewProc);
+ OS.g_type_class_unref (printerOptionWidgetClass);
+ printerOptionWidgetNewProc = 0;
}
/* Release the sleep resources */
@@ -5253,17 +5254,6 @@ public void setCursorLocation (int x, int y) {
setCursorLocation(new Point (x, y));
}
-void setCursorLocationInPixels (Point location) {
- long gdkDisplay = GDK.gdk_display_get_default();
- long gdkPointer = GDK.gdk_get_pointer(gdkDisplay);
- if (GTK.GTK4) {
- //TODO: GTK4 no gdk_device_warp
- } else {
- long gdkScreen = GDK.gdk_screen_get_default();
- GDK.gdk_device_warp(gdkPointer, gdkScreen, location.x, location.y);
- }
-}
-
/**
* Sets the location of the on-screen pointer relative to the top left corner
* of the screen. Note: It is typically considered bad practice for a
@@ -5282,8 +5272,14 @@ void setCursorLocationInPixels (Point location) {
public void setCursorLocation (Point point) {
checkDevice ();
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
- point = DPIUtil.autoScaleUp(point);
- setCursorLocationInPixels(point);
+ long gdkDisplay = GDK.gdk_display_get_default();
+ long gdkPointer = GDK.gdk_get_pointer(gdkDisplay);
+ if (GTK.GTK4) {
+ //TODO: GTK4 no gdk_device_warp
+ } else {
+ long gdkScreen = GDK.gdk_screen_get_default();
+ GDK.gdk_device_warp(gdkPointer, gdkScreen, point.x, point.y);
+ }
}
/**
@@ -5560,7 +5556,7 @@ void showIMWindow (Control control) {
GTK4.gtk_window_set_child(preeditWindow, preeditLabel);
} else {
GTK3.gtk_container_add (preeditWindow, preeditLabel);
- GTK.gtk_widget_show (preeditLabel);
+ GTK3.gtk_widget_show (preeditLabel);
}
}
long [] preeditString = new long [1];
@@ -5577,14 +5573,14 @@ void showIMWindow (Control control) {
OS.pango_font_description_free (fontDesc);
if (pangoAttrs [0] != 0) GTK.gtk_label_set_attributes (preeditLabel, pangoAttrs[0]);
GTK.gtk_label_set_text (preeditLabel, preeditString [0]);
- Point point = control.toDisplayInPixels (control.getIMCaretPos ());
+ Point point = control.toDisplay (control.getIMCaretPos ());
GTK3.gtk_window_move (preeditWindow, point.x, point.y);
GtkRequisition requisition = new GtkRequisition ();
GTK.gtk_widget_get_preferred_size (preeditLabel, requisition, null);
GTK3.gtk_window_resize (preeditWindow, requisition.width, requisition.height);
- GTK.gtk_widget_show (preeditWindow);
+ GTK3.gtk_widget_show (preeditWindow);
} else {
- GTK.gtk_widget_hide (preeditWindow);
+ GTK3.gtk_widget_hide (preeditWindow);
}
if (preeditString [0] != 0) OS.g_free (preeditString [0]);
if (pangoAttrs [0] != 0) OS.pango_attr_list_unref (pangoAttrs [0]);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
index 8fc0e1a92e5..cf7146bc71b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.internal.gtk4.*;
@@ -309,7 +308,7 @@ public int getItemCount () {
*/
public int getSpacing () {
checkWidget ();
- return DPIUtil.autoScaleDown(spacing);
+ return spacing;
}
@Override
@@ -484,11 +483,6 @@ void setOrientation (boolean create) {
*
*/
public void setSpacing (int spacing) {
- checkWidget ();
- setSpacingInPixels(DPIUtil.autoScaleUp(spacing));
-}
-
-void setSpacingInPixels (int spacing) {
checkWidget ();
if (spacing < 0) return;
if (spacing == this.spacing) return;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index 08e611ebee6..6bca156549b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -232,11 +232,6 @@ public boolean getExpanded() {
*/
public int getHeaderHeight () {
checkWidget ();
- return DPIUtil.autoScaleDown (getHeaderHeightInPixels ());
-}
-
-int getHeaderHeightInPixels() {
- checkWidget();
GtkAllocation allocation = new GtkAllocation();
GTK.gtk_widget_get_allocation(GTK.gtk_expander_get_label_widget(handle), allocation);
@@ -256,7 +251,7 @@ int getHeaderHeightInPixels() {
*/
public int getHeight() {
checkWidget();
- return DPIUtil.autoScaleDown(height);
+ return height;
}
/**
@@ -414,7 +409,7 @@ void resizeControl () {
* to be zero, and the widget is never shown during a layout operation, similar to
* Bug 487757. The fix is to show the control before setting any bounds.
*/
- if (visible) GTK.gtk_widget_show(control.topHandle ());
+ if (visible) gtk_widget_show(control.topHandle ());
control.setBounds (x, y, width, Math.max (0, height), true, true);
control.setVisible (visible);
@@ -506,11 +501,6 @@ void setForegroundRGBA (GdkRGBA rgba) {
*
*/
public void setHeight (int height) {
- checkWidget ();
- setHeightInPixels(DPIUtil.autoScaleUp(height));
-}
-
-void setHeightInPixels (int height) {
checkWidget ();
if (height < 0) return;
this.height = height;
@@ -532,16 +522,16 @@ public void setImage (Image image) {
} else {
GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
}
- if (text.length () == 0) GTK.gtk_widget_hide (labelHandle);
- GTK.gtk_widget_show(imageHandle);
+ if (text.length () == 0) gtk_widget_hide (labelHandle);
+ gtk_widget_show(imageHandle);
} else {
if (GTK.GTK4) {
GTK4.gtk_picture_set_paintable(imageHandle, 0);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, 0);
}
- GTK.gtk_widget_show(labelHandle);
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_show(labelHandle);
+ gtk_widget_hide(imageHandle);
}
}
@@ -567,12 +557,12 @@ void showWidget (int index) {
GTK4.gtk_box_append(parent.handle, handle);
gtk_box_set_child_packing (parent.handle, handle, false, false, 0, GTK.GTK_PACK_START);
} else {
- GTK.gtk_widget_show (handle);
- GTK.gtk_widget_show (clientHandle);
+ gtk_widget_show (handle);
+ gtk_widget_show (clientHandle);
if (labelHandle != 0)
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (labelHandle);
if (boxHandle != 0)
- GTK.gtk_widget_show (boxHandle);
+ gtk_widget_show (boxHandle);
GTK3.gtk_container_add (parent.handle, handle);
gtk_box_set_child_packing (parent.handle, handle, false, false, 0, GTK.GTK_PACK_START);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 7e20a4986a0..f963ffc1f63 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -401,8 +401,8 @@ public void setText (String string) {
@Override
void showWidget () {
super.showWidget ();
- if (clientHandle != 0) GTK.gtk_widget_show (clientHandle);
- if (labelHandle != 0) GTK.gtk_widget_show (labelHandle);
+ if (clientHandle != 0) gtk_widget_show (clientHandle);
+ if (labelHandle != 0) gtk_widget_show (labelHandle);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index ed2eb59080f..8a8d414436b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -654,16 +654,16 @@ public void setImage (Image image) {
} else {
GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
}
- GTK.gtk_widget_hide (labelHandle);
- GTK.gtk_widget_show (imageHandle);
+ gtk_widget_hide (labelHandle);
+ gtk_widget_show (imageHandle);
} else {
if (GTK.GTK4) {
GTK4.gtk_picture_set_paintable(imageHandle, 0);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, 0);
}
- GTK.gtk_widget_show (labelHandle);
- GTK.gtk_widget_hide (imageHandle);
+ gtk_widget_show (labelHandle);
+ gtk_widget_hide (imageHandle);
}
}
@@ -706,8 +706,8 @@ public void setText (String string) {
char [] chars = fixMnemonic (string);
byte [] buffer = Converter.wcsToMbcs (chars, true);
GTK.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
- GTK.gtk_widget_hide (imageHandle);
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_hide (imageHandle);
+ gtk_widget_show (labelHandle);
}
@Override
@@ -719,9 +719,9 @@ void setWidgetBackground () {
@Override
void showWidget () {
super.showWidget ();
- if (frameHandle != 0) GTK.gtk_widget_show (frameHandle);
- if (labelHandle != 0) GTK.gtk_widget_show (labelHandle);
- if (boxHandle != 0) GTK.gtk_widget_show (boxHandle);
+ if (frameHandle != 0) gtk_widget_show (frameHandle);
+ if (labelHandle != 0) gtk_widget_show (labelHandle);
+ if (boxHandle != 0) gtk_widget_show (boxHandle);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index 099764719a6..6968718bd6b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,7 +18,6 @@
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.internal.gtk4.*;
@@ -130,12 +129,12 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
//TEMPORARY CODE
if (wHint == 0) {
layout.setWidth (1);
- Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ());
+ Rectangle rect = layout.getBounds ();
width = 0;
height = rect.height;
} else {
- layout.setWidth (DPIUtil.autoScaleDown(wHint));
- Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ());
+ layout.setWidth (wHint);
+ Rectangle rect = layout.getBounds ();
width = rect.width;
height = rect.height;
}
@@ -192,8 +191,7 @@ void drawWidget(GC gc) {
layout.draw (gc, 0, 0, selStart, selEnd, null, null);
if (hasFocus () && focusIndex != -1) {
Rectangle [] rects = getRectanglesInPixels (focusIndex);
- for (int i = 0; i < rects.length; i++) {
- Rectangle rect = DPIUtil.autoScaleDown(rects [i]);
+ for (Rectangle rect : rects) {
gc.drawFocus (rect.x, rect.y, rect.width, rect.height);
}
}
@@ -303,13 +301,13 @@ String getNameText () {
while (point.y > lineOffsets [lineEnd]) lineEnd++;
int index = 0;
if (lineStart == lineEnd) {
- rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (point.x, point.y));
+ rects [index++] = layout.getBounds (point.x, point.y);
} else {
- rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (point.x, lineOffsets [lineStart]-1));
- rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (lineOffsets [lineEnd-1], point.y));
+ rects [index++] = layout.getBounds (point.x, lineOffsets [lineStart]-1);
+ rects [index++] = layout.getBounds (lineOffsets [lineEnd-1], point.y);
if (lineEnd - lineStart > 1) {
for (int i = lineStart; i < lineEnd - 1; i++) {
- rects [index++] = DPIUtil.autoScaleUp (layout.getLineBounds (i));
+ rects [index++] = layout.getLineBounds (i);
}
}
}
@@ -365,7 +363,7 @@ long gtk_button_press_event (long widget, long event) {
int x = (int) eventX[0];
int y = (int) eventY[0];
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x;
- int offset = DPIUtil.autoScaleUp(layout.getOffset (x, y, null));
+ int offset = layout.getOffset (x, y, null);
int oldSelectionX = selection.x;
int oldSelectionY = selection.y;
selection.x = offset;
@@ -376,8 +374,8 @@ long gtk_button_press_event (long widget, long event) {
oldSelectionX = oldSelectionY;
oldSelectionY = temp;
}
- Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds (oldSelectionX, oldSelectionY));
- redrawInPixels (rect.x, rect.y, rect.width, rect.height, false);
+ Rectangle rect = layout.getBounds (oldSelectionX, oldSelectionY);
+ redraw (rect.x, rect.y, rect.width, rect.height, false);
}
for (int j = 0; j < offsets.length; j++) {
Rectangle [] rects = getRectanglesInPixels (j);
@@ -544,7 +542,7 @@ long gtk_motion_notify_event (long widget, long event) {
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x;
if ((state[0] & GDK.GDK_BUTTON1_MASK) != 0) {
int oldSelection = selection.y;
- selection.y = DPIUtil.autoScaleUp(layout.getOffset (x, y, null));
+ selection.y = layout.getOffset (x, y, null);
if (selection.y != oldSelection) {
int newSelection = selection.y;
if (oldSelection > newSelection) {
@@ -553,7 +551,7 @@ long gtk_motion_notify_event (long widget, long event) {
newSelection = temp;
}
Rectangle rect = layout.getBounds (oldSelection, newSelection);
- redrawInPixels (rect.x, rect.y, rect.width, rect.height, false);
+ redraw (rect.x, rect.y, rect.width, rect.height, false);
}
} else {
for (int j = 0; j < offsets.length; j++) {
@@ -810,7 +808,7 @@ int parseMnemonics (char[] buffer, int start, int end, StringBuilder result) {
int setBounds(int x, int y, int width, int height, boolean move, boolean resize) {
int result = super.setBounds (x, y, width,height, move, resize);
if ((result & RESIZED) != 0) {
- layout.setWidth (DPIUtil.autoScaleDown((width > 0 ? width : -1)));
+ layout.setWidth ((width > 0 ? width : -1));
redraw ();
}
return result;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 9b352763ace..9cfc95aa86a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -275,7 +275,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
* based on the number of items in the table
*/
if (size.y == 0 && hHint == SWT.DEFAULT) {
- size.y = getItemCount() * getItemHeightInPixels();
+ size.y = getItemCount() * getItemHeight();
}
/*
@@ -536,11 +536,6 @@ public int getItemCount () {
*/
public int getItemHeight () {
checkWidget();
- return DPIUtil.autoScaleDown(getItemHeightInPixels());
-}
-
-int getItemHeightInPixels() {
- checkWidget();
final int BASE_ITEM_PADDING = 1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
index 22bb51cdb4c..4e053f85015 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1198,11 +1198,6 @@ public void setEnabled(boolean enabled) {
*/
public void setLocation (int x, int y) {
checkWidget ();
- setLocation (new Point (x, y));
-}
-
-void setLocationInPixels (int x, int y) {
- checkWidget();
if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
this.x = x;
this.y = y;
@@ -1235,13 +1230,8 @@ void setLocationInPixels (int x, int y) {
*/
public void setLocation (Point location) {
checkWidget ();
- setLocationInPixels (DPIUtil.autoScaleUp (location));
-}
-
-void setLocationInPixels (Point location) {
- checkWidget();
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocationInPixels (location.x, location.y);
+ setLocation (location.x, location.y);
}
/**
@@ -1347,7 +1337,7 @@ void verifyMenuPosition (int itemCount) {
* We need to "show" the menu before fetching the preferred height.
* Note, this does not actually pop-up the menu.
*/
- GTK.gtk_widget_show(handle);
+ gtk_widget_show(handle);
/*
* Menus are height-for-width only: use gtk_widget_get_preferred_height()
* instead of gtk_widget_get_preferred_size().
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
index 1ab9134fff4..85b73d3d362 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -433,19 +433,19 @@ void createHandle(int index) {
}
GTK3.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_widget_show (imageHandle);
+ gtk_widget_show (imageHandle);
}
if (labelHandle != 0) {
GTK.gtk_label_set_xalign (labelHandle, 0);
GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL);
gtk_box_pack_end (boxHandle, labelHandle, true, true, 0);
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (labelHandle);
}
if (boxHandle != 0) {
GTK3.gtk_container_add (handle, boxHandle);
- GTK.gtk_widget_show (boxHandle);
+ gtk_widget_show (boxHandle);
}
if ((style & SWT.SEPARATOR) == 0) {
@@ -460,7 +460,7 @@ void createHandle(int index) {
if (!enabled) GTK.gtk_widget_set_sensitive (parentHandle, true);
GTK3.gtk_menu_shell_insert (parentHandle, handle, index);
if (!enabled) GTK.gtk_widget_set_sensitive (parentHandle, false);
- GTK.gtk_widget_show (handle);
+ gtk_widget_show (handle);
}
}
@@ -1067,7 +1067,7 @@ private void _setImage (Image image) {
GTK3.gtk_image_set_from_surface(imageHandle, surface);
}
}
- GTK.gtk_widget_show(imageHandle);
+ gtk_widget_show(imageHandle);
} else {
if (imageHandle != 0) {
if (OS.SWT_PADDED_MENU_ITEMS) {
@@ -1076,7 +1076,7 @@ private void _setImage (Image image) {
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
GTK.gtk_image_set_pixel_size (imageHandle, 16);
GTK3.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_widget_show (imageHandle);
+ gtk_widget_show (imageHandle);
} else {
GTK3.gtk_container_remove(boxHandle, imageHandle);
imageHandle = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index a8455f21b4c..914ef8f1635 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -17,7 +17,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.internal.gtk4.*;
@@ -191,11 +190,11 @@ int gtk_gesture_press_event(long gesture, int n_press, double x, double y, long
Event jEvent = new Event();
jEvent.time = GDK.gdk_event_get_time(event);
Rectangle eventRect = new Rectangle(lastX, lastY, width, height);
- jEvent.setBounds(DPIUtil.autoScaleDown(eventRect));
+ jEvent.setBounds(eventRect);
if ((style & SWT.SMOOTH) == 0) {
jEvent.detail = SWT.DRAG;
}
- if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x;
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x;
sendSelectionEvent(SWT.Selection, jEvent, true);
if (isDisposed()) return result;
@@ -245,15 +244,15 @@ void gtk4_motion_event(long controller, double x, double y, long event) {
Event jEvent = new Event();
jEvent.time = GDK.gdk_event_get_time(event);
Rectangle eventRect = new Rectangle(newX, newY, width, height);
- jEvent.setBounds(DPIUtil.autoScaleDown(eventRect));
+ jEvent.setBounds(eventRect);
if ((style & SWT.SMOOTH) == 0) {
jEvent.detail = SWT.DRAG;
}
- if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x;
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x;
sendSelectionEvent(SWT.Selection, jEvent, true);
if (isDisposed()) return;
- Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds());
+ Rectangle rect = jEvent.getBounds();
if (jEvent.doit) {
lastX = rect.x;
lastY = rect.y;
@@ -311,13 +310,13 @@ boolean gtk4_key_press_event(long controller, int keyval, int keycode, int state
Event jEvent = new Event();
jEvent.time = GDK.gdk_event_get_time(event);
Rectangle eventRect = new Rectangle(newX, newY, width, height);
- jEvent.setBounds(DPIUtil.autoScaleDown(eventRect));
- if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x;
+ jEvent.setBounds(eventRect);
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x;
sendSelectionEvent(SWT.Selection, jEvent, true);
if (isDisposed()) break;
if (jEvent.doit) {
- Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds());
+ Rectangle rect = jEvent.getBounds();
lastX = rect.x;
lastY = rect.y;
if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth() - width - lastX;
@@ -364,16 +363,16 @@ long gtk_button_press_event(long widget, long event) {
Event jEvent = new Event();
jEvent.time = GDK.gdk_event_get_time(event);
Rectangle eventRect = new Rectangle(lastX, lastY, width, height);
- jEvent.setBounds(DPIUtil.autoScaleDown(eventRect));
+ jEvent.setBounds(eventRect);
if ((style & SWT.SMOOTH) == 0) {
jEvent.detail = SWT.DRAG;
}
- if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x;
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x;
sendSelectionEvent(SWT.Selection, jEvent, true);
if (isDisposed()) return 0;
if (jEvent.doit) {
dragging = true;
- Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds());
+ Rectangle rect = jEvent.getBounds();
lastX = rect.x;
lastY = rect.y;
if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth() - width - lastX;
@@ -406,13 +405,13 @@ long gtk_button_release_event(long widget, long event) {
Event jEvent = new Event();
jEvent.time = GDK.gdk_event_get_time(event);
Rectangle eventRect = new Rectangle(lastX, lastY, width, height);
- jEvent.setBounds(DPIUtil.autoScaleDown(eventRect));
- if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x;
+ jEvent.setBounds(eventRect);
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x;
sendSelectionEvent(SWT.Selection, jEvent, true);
if (isDisposed()) return result;
if (jEvent.doit) {
if ((style & SWT.SMOOTH) != 0) {
- Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds());
+ Rectangle rect = jEvent.getBounds();
setBoundsInPixels(rect.x, rect.y, width, height);
// widget could be disposed at this point
}
@@ -501,14 +500,14 @@ long gtk_key_press_event(long widget, long eventPtr) {
Event event = new Event();
event.time = GDK.gdk_event_get_time(eventPtr);
Rectangle eventRect = new Rectangle(newX, newY, width, height);
- event.setBounds(DPIUtil.autoScaleDown(eventRect));
- if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - event.x;
+ event.setBounds(eventRect);
+ if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth() - width - event.x;
sendSelectionEvent(SWT.Selection, event, true);
if (ptrGrabResult == GDK.GDK_GRAB_SUCCESS) gdk_pointer_ungrab(gdkResource, GDK.GDK_CURRENT_TIME);
if (isDisposed()) break;
if (event.doit) {
- Rectangle rect = DPIUtil.autoScaleUp(event.getBounds());
+ Rectangle rect = event.getBounds();
lastX = rect.x;
lastY = rect.y;
if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth() - width - lastX;
@@ -590,15 +589,15 @@ long gtk_motion_notify_event(long widget, long eventPtr) {
Event event = new Event();
event.time = GDK.gdk_event_get_time(eventPtr);
Rectangle eventRect = new Rectangle(newX, newY, width, height);
- event.setBounds(DPIUtil.autoScaleDown(eventRect));
+ event.setBounds(eventRect);
if ((style & SWT.SMOOTH) == 0) {
event.detail = SWT.DRAG;
}
- if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - event.x;
+ if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth() - width - event.x;
sendSelectionEvent(SWT.Selection, event, true);
if (isDisposed()) return 0;
- Rectangle rect = DPIUtil.autoScaleUp(event.getBounds());
+ Rectangle rect = event.getBounds();
if (event.doit) {
lastX = rect.x;
lastY = rect.y;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
index 1b6747bf801..de543a2b1f4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -17,7 +17,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.internal.gtk4.*;
@@ -289,11 +288,6 @@ public int getSelection () {
*
*/
public Point getSize () {
- checkWidget ();
- return DPIUtil.autoScaleDown (getSizeInPixels ());
-}
-
-Point getSizeInPixels () {
checkWidget ();
if (handle == 0) return new Point (0,0);
GtkRequisition requisition = new GtkRequisition ();
@@ -333,11 +327,6 @@ public int getThumb () {
*/
public Rectangle getThumbBounds() {
checkWidget();
- return DPIUtil.autoScaleDown(getThumbBoundsInPixels());
-}
-
-Rectangle getThumbBoundsInPixels() {
- checkWidget();
int[] slider_start = new int[1], slider_end = new int[1];
long rangeHandle = GTK.GTK4 ? GTK4.gtk_widget_get_first_child(handle) : handle;
@@ -402,11 +391,6 @@ Rectangle getThumbBoundsInPixels() {
*/
public Rectangle getThumbTrackBounds () {
checkWidget ();
- return DPIUtil.autoScaleDown(getThumbTrackBoundsInPixels());
-}
-
-Rectangle getThumbTrackBoundsInPixels () {
- checkWidget();
int x = 0, y = 0, width, height;
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 71bc811137c..de4d87922b0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,6 @@
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.internal.gtk3.*;
import org.eclipse.swt.internal.gtk4.*;
@@ -116,8 +115,7 @@ long clientHandle () {
*/
public Rectangle computeTrim (int x, int y, int width, int height) {
checkWidget();
- Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height));
- return DPIUtil.autoScaleDown(computeTrimInPixels(rect.x, rect.y, rect.width, rect.height));
+ return computeTrimInPixels(x, y, width, height);
}
Rectangle computeTrimInPixels (int x, int y, int width, int height) {
@@ -246,7 +244,7 @@ int getBorderWidthInPixels () {
*/
public Rectangle getClientArea () {
checkWidget ();
- return DPIUtil.autoScaleDown(getClientAreaInPixels());
+ return getClientAreaInPixels();
}
Rectangle getClientAreaInPixels () {
@@ -594,7 +592,7 @@ void resizeHandle (int width, int height) {
@Override
void showWidget () {
super.showWidget ();
- if (scrolledHandle != 0) GTK.gtk_widget_show (scrolledHandle);
+ if (scrolledHandle != 0) gtk_widget_show (scrolledHandle);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 3ddb8bc2fa9..562df39c90e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -609,7 +609,12 @@ void bringToTop (boolean force) {
}
if ((xFocus || (style & SWT.ON_TOP) != 0)) {
if (OS.isX11()) {
- long gdkDisplay = GDK.gdk_window_get_display(gdkResource);
+ long gdkDisplay;
+ if (GTK.GTK4) {
+ gdkDisplay = GDK.gdk_surface_get_display(gdkResource);
+ } else {
+ gdkDisplay = GDK.gdk_window_get_display(gdkResource);
+ }
long xDisplay = GDK.gdk_x11_display_get_xdisplay(gdkDisplay);
long xWindow;
if (GTK.GTK4) {
@@ -663,7 +668,7 @@ void center () {
Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
- Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
+ Rectangle monitorRect = parent.getMonitor ().getClientArea();
if (x + rect.width > monitorRect.x + monitorRect.width) {
x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
} else {
@@ -1295,11 +1300,6 @@ public boolean getMaximized () {
* @since 3.1
*/
public Point getMinimumSize () {
- checkWidget ();
- return DPIUtil.autoScaleDown (getMinimumSizeInPixels ());
-}
-
-Point getMinimumSizeInPixels () {
checkWidget ();
int width = Math.max (1, geometry.getMinWidth() + trimWidth ());
int height = Math.max (1, geometry.getMinHeight() + trimHeight ());
@@ -1323,12 +1323,6 @@ Point getMinimumSizeInPixels () {
*/
public Point getMaximumSize () {
checkWidget ();
- return DPIUtil.autoScaleDown (getMaximumSizeInPixels ());
-}
-
-Point getMaximumSizeInPixels () {
- checkWidget ();
-
int width = Math.min (Integer.MAX_VALUE, geometry.getMaxWidth() + trimWidth ());
int height = Math.min (Integer.MAX_VALUE, geometry.getMaxHeight() + trimHeight ());
return new Point (width, height);
@@ -2597,7 +2591,7 @@ public void setMenuBar (Menu menu) {
if (menuBar != null) {
long menuHandle = menuBar.handle;
- GTK.gtk_widget_hide (menuHandle);
+ gtk_widget_hide (menuHandle);
if (!GTK.GTK4) {
destroyAccelGroup();
@@ -2606,7 +2600,7 @@ public void setMenuBar (Menu menu) {
menuBar = menu;
if (menuBar != null) {
long menuHandle = menu.handle;
- GTK.gtk_widget_show (menuHandle);
+ gtk_widget_show (menuHandle);
if (!GTK.GTK4) {
createAccelGroup();
@@ -2627,7 +2621,7 @@ public void setMinimized (boolean minimized) {
if (this.minimized == minimized) return;
super.setMinimized (minimized);
if(!GTK.gtk_widget_get_visible(shellHandle)) {
- GTK.gtk_widget_show(shellHandle);
+ gtk_widget_show(shellHandle);
}
if (minimized) {
if (GTK.GTK4) {
@@ -2661,11 +2655,6 @@ public void setMinimized (boolean minimized) {
* @since 3.1
*/
public void setMinimumSize (int width, int height) {
- checkWidget ();
- setMinimumSize (new Point (width, height));
-}
-
-void setMinimumSizeInPixels (int width, int height) {
checkWidget ();
geometry.setMinWidth(Math.max (width, trimWidth ()) - trimWidth ());
geometry.setMinHeight(Math.max (height, trimHeight ()) - trimHeight ());
@@ -2700,14 +2689,9 @@ void setMinimumSizeInPixels (int width, int height) {
* @since 3.1
*/
public void setMinimumSize (Point size) {
- checkWidget ();
- setMinimumSizeInPixels (DPIUtil.autoScaleUp (size));
-}
-
-void setMinimumSizeInPixels (Point size) {
checkWidget ();
if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setMinimumSizeInPixels (size.x, size.y);
+ setMinimumSize (size.x, size.y);
}
/**
@@ -2732,7 +2716,13 @@ void setMinimumSizeInPixels (Point size) {
*/
public void setMaximumSize (int width, int height) {
checkWidget ();
- setMaximumSize (new Point (width, height));
+ geometry.setMaxWidth(Math.max (width, trimWidth ()) - trimWidth ());
+ geometry.setMaxHeight(Math.max (height, trimHeight ()) - trimHeight ());
+ int hint = GDK.GDK_HINT_MAX_SIZE;
+ if (geometry.getMinWidth() > 0 || geometry.getMinHeight() > 0) {
+ hint = hint | GDK.GDK_HINT_MIN_SIZE;
+ }
+ GTK3.gtk_window_set_geometry_hints (shellHandle, 0, (GdkGeometry) geometry, hint);
}
/**
@@ -2758,25 +2748,9 @@ public void setMaximumSize (int width, int height) {
* @since 3.116
*/
public void setMaximumSize (Point size) {
- checkWidget ();
- setMaximumSizeInPixels (DPIUtil.autoScaleUp (size));
-}
-
-void setMaximumSizeInPixels (Point size) {
checkWidget ();
if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
- setMaximumSizeInPixels (size.x, size.y);
-}
-
-void setMaximumSizeInPixels (int width, int height) {
- checkWidget ();
- geometry.setMaxWidth(Math.max (width, trimWidth ()) - trimWidth ());
- geometry.setMaxHeight(Math.max (height, trimHeight ()) - trimHeight ());
- int hint = GDK.GDK_HINT_MAX_SIZE;
- if (geometry.getMinWidth() > 0 || geometry.getMinHeight() > 0) {
- hint = hint | GDK.GDK_HINT_MIN_SIZE;
- }
- GTK3.gtk_window_set_geometry_hints (shellHandle, 0, (GdkGeometry) geometry, hint);
+ setMaximumSize (size.x, size.y);
}
/**
@@ -2860,7 +2834,7 @@ static Region mirrorRegion (Region region) {
int [] nRects = new int [1];
long [] rects = new long [1];
gdk_region_get_rectangles (rgn, rects, nRects);
- Rectangle bounds = DPIUtil.autoScaleUp(region.getBounds ());
+ Rectangle bounds = region.getBounds ();
cairo_rectangle_int_t rect = new cairo_rectangle_int_t();
for (int i = 0; i < nRects [0]; i++) {
Cairo.memmove (rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof);
@@ -2960,13 +2934,13 @@ public void setVisible (boolean visible) {
int [] init_width = new int[1], init_height = new int[1];
GTK3.gtk_window_get_size(shellHandle, init_width, init_height);
GTK3.gtk_window_resize(shellHandle, 1, 1);
- GTK.gtk_widget_show (shellHandle);
+ gtk_widget_show (shellHandle);
GTK3.gtk_window_resize(shellHandle, init_width[0], init_height[0]);
resizeBounds (init_width[0], init_height[0], false);
oldWidth = init_width[0];
oldHeight = init_height[0];
} else {
- GTK.gtk_widget_show (shellHandle);
+ gtk_widget_show (shellHandle);
}
/**
* Feature in GTK: This handles grabbing the keyboard focus from a SWT.ON_TOP window
@@ -3036,7 +3010,7 @@ public void setVisible (boolean visible) {
} else {
fixActiveShell ();
checkAndUngrabFocus();
- GTK.gtk_widget_hide (shellHandle);
+ gtk_widget_hide (shellHandle);
sendEvent (SWT.Hide);
}
}
@@ -3095,9 +3069,9 @@ void showWidget () {
GTK3.gtk_container_add (shellHandle, vboxHandle);
}
- if (scrolledHandle != 0) GTK.gtk_widget_show (scrolledHandle);
- if (handle != 0) GTK.gtk_widget_show (handle);
- if (vboxHandle != 0) GTK.gtk_widget_show (vboxHandle);
+ if (scrolledHandle != 0) gtk_widget_show (scrolledHandle);
+ if (handle != 0) gtk_widget_show (handle);
+ if (vboxHandle != 0) gtk_widget_show (vboxHandle);
}
@Override
@@ -3135,7 +3109,7 @@ long sizeAllocateProc (long handle, long arg0, long user_data) {
@Override
long sizeRequestProc (long handle, long arg0, long user_data) {
- GTK.gtk_widget_hide (handle);
+ gtk_widget_hide (handle);
return 0;
}
@@ -3263,12 +3237,12 @@ void updateMinimized (boolean minimized) {
if (minimized) {
if (shells[i].isVisible ()) {
shells[i].showWithParent = true;
- GTK.gtk_widget_hide(shells[i].shellHandle);
+ gtk_widget_hide(shells[i].shellHandle);
}
} else {
if (shells[i].showWithParent) {
shells[i].showWithParent = false;
- GTK.gtk_widget_show(shells[i].shellHandle);
+ gtk_widget_show(shells[i].shellHandle);
}
}
}
@@ -3350,7 +3324,7 @@ public void dispose () {
if (popupChild != null && popupChild.shellHandle != 0 && !popupChild.isDisposed()) {
popupChild.dispose();
}
- GTK.gtk_widget_hide (shellHandle);
+ gtk_widget_hide (shellHandle);
super.dispose ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index 0bea1a4c29f..37b7eac1ca4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -330,7 +330,7 @@ void createHandle (int index) {
GTK3.gtk_widget_set_has_window(fixedHandle, true);
GTK3.gtk_container_add (fixedHandle, handle);
}
- GTK.gtk_editable_set_editable (GTK.GTK4 ? entryHandle : handle, (style & SWT.READ_ONLY) == 0);
+ GTK.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
GTK.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0);
imContext = OS.imContextLast();
// In GTK 3 font description is inherited from parent widget which is not how SWT has always worked,
@@ -586,7 +586,12 @@ public String getText() {
*/
public int getTextLimit () {
checkWidget ();
- int limit = GTK.gtk_entry_get_max_length (GTK.GTK4 ? entryHandle : handle);
+ int limit;
+ if (GTK.GTK4) {
+ limit = GTK4.gtk_editable_get_max_width_chars(handle);
+ } else {
+ limit = GTK.gtk_entry_get_max_length (handle);
+ }
return limit == 0 ? LIMIT : limit;
}
@@ -1160,7 +1165,11 @@ public void setSelection (int value) {
public void setTextLimit (int limit) {
checkWidget ();
if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
- GTK.gtk_entry_set_max_length (GTK.GTK4 ? entryHandle : handle, limit);
+ if(GTK.GTK4) {
+ GTK4.gtk_editable_set_max_width_chars (handle, limit);
+ } else {
+ GTK.gtk_entry_set_max_length (handle, limit);
+ }
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index e3f7631a40c..fd95057d491 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -304,11 +304,11 @@ void createItem (TabItem item, int index) {
OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, SWITCH_PAGE);
if (GTK.GTK4) {
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_hide(imageHandle);
} else {
- GTK.gtk_widget_show(boxHandle);
- GTK.gtk_widget_show(labelHandle);
- GTK.gtk_widget_show(pageHandle);
+ gtk_widget_show(boxHandle);
+ gtk_widget_show(labelHandle);
+ gtk_widget_show(pageHandle);
}
item.state |= HANDLE;
@@ -666,7 +666,7 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) {
index++;
}
if (index == count) {
- Rectangle rect = DPIUtil.autoScaleUp(child.getBounds ());
+ Rectangle rect = child.getBounds ();
width = Math.max (width, rect.x + rect.width);
height = Math.max (height, rect.y + rect.height);
} else {
@@ -674,7 +674,7 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) {
* Since computeSize can be overridden by subclasses, we cannot
* call computeSizeInPixels directly.
*/
- Point size = DPIUtil.autoScaleUp(child.computeSize (DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), flushCache));
+ Point size = child.computeSize (wHint, hHint, flushCache);
width = Math.max (width, size.x);
height = Math.max (height, size.y);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
index 64479c09e02..c93fe2b476e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -160,11 +160,6 @@ void destroyWidget () {
*/
public Rectangle getBounds () {
checkWidget ();
- return DPIUtil.autoScaleDown (getBoundsInPixels ());
-}
-
-Rectangle getBoundsInPixels () {
- checkWidget();
GtkAllocation allocation = new GtkAllocation ();
GTK.gtk_widget_get_allocation (handle, allocation);
int x = allocation.x;
@@ -418,14 +413,14 @@ public void setImage (Image image) {
} else {
GTK3.gtk_image_set_from_surface(imageHandle, image.surface);
}
- GTK.gtk_widget_show(imageHandle);
+ gtk_widget_show(imageHandle);
} else {
if (GTK.GTK4) {
GTK4.gtk_image_clear(imageHandle);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, 0);
}
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_hide(imageHandle);
}
}
@@ -473,9 +468,9 @@ public void setText (String string) {
byte [] buffer = Converter.wcsToMbcs (chars, true);
GTK.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
if (string.length () != 0) {
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (labelHandle);
} else {
- GTK.gtk_widget_hide (labelHandle);
+ gtk_widget_hide (labelHandle);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 8f1deb5694d..2e358c828a0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2022 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -737,13 +737,13 @@ void createItem (TableColumn column, int index) {
GTK4.gtk_box_append(boxHandle, imageHandle);
GTK4.gtk_box_append(boxHandle, labelHandle);
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_hide(imageHandle);
} else {
GTK3.gtk_container_add (boxHandle, imageHandle);
GTK3.gtk_container_add (boxHandle, labelHandle);
- GTK.gtk_widget_show (boxHandle);
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (boxHandle);
+ gtk_widget_show (labelHandle);
}
column.labelHandle = labelHandle;
@@ -1157,7 +1157,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean
long [] path = new long [1];
if (GTK.gtk_gesture_drag_get_start_point(dragGesture, startX, startY)) {
if (getHeaderVisible()) {
- startY[0]-= getHeaderHeightInPixels();
+ startY[0]-= getHeaderHeight();
}
if (GTK.gtk_tree_view_get_path_at_pos (handle, (int) startX[0], (int) startY[0], path, null, null, null)) {
if (path [0] != 0) {
@@ -1434,11 +1434,6 @@ TableItem getFocusItem () {
*/
public int getGridLineWidth () {
checkWidget ();
- return DPIUtil.autoScaleDown (getGridLineWidthInPixels ());
-}
-
-int getGridLineWidthInPixels () {
- checkWidget();
return 0;
}
@@ -1488,11 +1483,6 @@ public Color getHeaderForeground () {
*/
public int getHeaderHeight () {
checkWidget ();
- return DPIUtil.autoScaleDown (getHeaderHeightInPixels ());
-}
-
-int getHeaderHeightInPixels () {
- checkWidget();
if (!GTK.gtk_tree_view_get_headers_visible(handle)) return 0;
int height = 0;
@@ -1502,9 +1492,9 @@ int getHeaderHeightInPixels () {
long buttonHandle = columns[i].buttonHandle;
if (buttonHandle != 0) {
if (!GTK.gtk_widget_get_visible(buttonHandle)) {
- GTK.gtk_widget_show(buttonHandle);
+ gtk_widget_show(buttonHandle);
gtk_widget_get_preferred_size(buttonHandle, requisition);
- GTK.gtk_widget_hide(buttonHandle);
+ gtk_widget_hide(buttonHandle);
} else {
gtk_widget_get_preferred_size(buttonHandle, requisition);
}
@@ -1598,11 +1588,6 @@ public TableItem getItem (int index) {
*
*/
public TableItem getItem (Point point) {
- checkWidget();
- return getItemInPixels(DPIUtil.autoScaleUp(point));
-}
-
-TableItem getItemInPixels (Point point) {
checkWidget();
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
long [] path = new long [1];
@@ -1657,11 +1642,6 @@ public int getItemCount () {
*/
public int getItemHeight () {
checkWidget ();
- return DPIUtil.autoScaleDown (getItemHeightInPixels ());
-}
-
-int getItemHeightInPixels () {
- checkWidget();
int height = 0;
if (itemCount == 0) {
@@ -2890,11 +2870,11 @@ void sendMeasureEvent (long cell, long width, long height) {
event.index = columnIndex;
event.gc = gc;
Rectangle eventRect = new Rectangle (0, 0, contentWidth [0], contentHeight [0]);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
if (isSelected) event.detail = SWT.SELECTED;
sendEvent (SWT.MeasureItem, event);
gc.dispose ();
- Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
+ Rectangle rect = event.getBounds ();
contentWidth [0] = rect.width - imageWidth;
if (contentHeight [0] < rect.height) contentHeight [0] = rect.height;
if (width != 0) C.memmove (width, contentWidth, 4);
@@ -3044,13 +3024,9 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
if (cr != 0) {
GdkRectangle r = new GdkRectangle();
GDK.gdk_cairo_get_clip_rectangle(cr, r);
- Rectangle rect2 = DPIUtil.autoScaleDown(rect);
- // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075
- gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height);
+ gc.setClipping(rect.x, rect.y, rect.width, rect.height);
} else {
- Rectangle rect2 = DPIUtil.autoScaleDown(rect);
- // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075
- gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height);
+ gc.setClipping(rect.x, rect.y, rect.width, rect.height);
}
@@ -3068,7 +3044,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
event.index = columnIndex;
event.gc = gc;
event.detail = drawState;
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
sendEvent (SWT.EraseItem, event);
} finally {
Cairo.cairo_translate (cr, 0, y_offset);
@@ -3102,7 +3078,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
if ((drawState & SWT.BACKGROUND) != 0 && (drawState & SWT.SELECTED) == 0) {
GC gc = getGC(cr);
gc.setBackground (item.getBackground (columnIndex));
- gc.fillRectangle (DPIUtil.autoScaleDown (rendererRect.toRectangle ()));
+ gc.fillRectangle (rendererRect.toRectangle ());
gc.dispose ();
}
if ((drawState & SWT.FOREGROUND) != 0 || GTK.GTK_IS_CELL_RENDERER_TOGGLE (cell)) {
@@ -3166,9 +3142,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
gc.setFont (item.getFont (columnIndex));
if ((style & SWT.MIRRORED) != 0) rect.x = getClientWidth () - rect.width - rect.x;
- Rectangle rect2 = DPIUtil.autoScaleDown(rect);
- // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075
- gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height);
+ gc.setClipping(rect.x, rect.y, rect.width, rect.height);
// SWT.PaintItem/SWT.EraseItem often expect that event.y matches
// what 'event.item.getBounds()' returns. The workaround is to
@@ -3184,7 +3158,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
event.index = columnIndex;
event.gc = gc;
event.detail = drawState;
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
sendEvent (SWT.PaintItem, event);
} finally {
Cairo.cairo_translate (cr, 0, y_offset);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
index d44c0037a3b..444e94c5aae 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -319,11 +319,6 @@ public String getToolTipText () {
*/
public int getWidth () {
checkWidget ();
- return DPIUtil.autoScaleDown(getWidthInPixels());
-}
-
-int getWidthInPixels () {
- checkWidget();
if (!GTK.gtk_tree_view_column_get_visible (handle)) {
return 0;
}
@@ -468,10 +463,10 @@ public void pack () {
if (buttonHandle != 0) {
boolean hideHeader = !GTK.gtk_widget_get_visible(buttonHandle);
GtkRequisition requisition = new GtkRequisition ();
- GTK.gtk_widget_show(buttonHandle);
+ gtk_widget_show(buttonHandle);
gtk_widget_get_preferred_size (buttonHandle, requisition);
if (hideHeader) {
- GTK.gtk_widget_hide(buttonHandle);
+ gtk_widget_hide(buttonHandle);
}
width = requisition.width;
}
@@ -507,7 +502,7 @@ public void pack () {
}
OS.g_free (iter);
}
- setWidthInPixels(width);
+ setWidth(width);
}
@Override
@@ -632,14 +627,14 @@ public void setImage (Image image) {
} else {
GTK3.gtk_image_set_from_surface(imageHandle, headerImageList.getSurface(imageIndex));
}
- GTK.gtk_widget_show(imageHandle);
+ gtk_widget_show(imageHandle);
} else {
if (GTK.GTK4) {
GTK4.gtk_image_clear(imageHandle);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, 0);
}
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_hide(imageHandle);
}
}
@@ -708,9 +703,9 @@ public void setText (String string) {
byte [] buffer = Converter.wcsToMbcs (chars, true);
GTK.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
if (string.length () != 0) {
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (labelHandle);
} else {
- GTK.gtk_widget_hide (labelHandle);
+ gtk_widget_hide (labelHandle);
}
}
@@ -760,11 +755,6 @@ public void setToolTipText(String string) {
*/
public void setWidth (int width) {
checkWidget ();
- setWidthInPixels (DPIUtil.autoScaleUp (width));
-}
-
-void setWidthInPixels (int width) {
- checkWidget();
if (width < 0) return;
if (width == lastWidth) return;
if (width > 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
index b38fbe7e05a..cc2c8d8ca8c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -288,7 +288,7 @@ public Color getBackground () {
* @since 3.2
*/
public Rectangle getBounds () {
- return DPIUtil.autoScaleDown (getBoundsinPixels ());
+ return getBoundsinPixels ();
}
/**
@@ -394,11 +394,6 @@ public Color getBackground (int index) {
*/
public Rectangle getBounds (int index) {
checkWidget ();
- return DPIUtil.autoScaleDown (getBoundsInPixels (index));
-}
-
-Rectangle getBoundsInPixels (int index) {
- checkWidget();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
long parentHandle = parent.handle;
long column = 0;
@@ -601,11 +596,6 @@ public Image getImage (int index) {
*
*/
public Rectangle getImageBounds (int index) {
- checkWidget ();
- return DPIUtil.autoScaleDown (getImageBoundsInPixels (index));
-}
-
-Rectangle getImageBoundsInPixels (int index) {
checkWidget ();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
long parentHandle = parent.handle;
@@ -742,11 +732,6 @@ public String getText (int index) {
* @since 3.3
*/
public Rectangle getTextBounds (int index) {
- checkWidget ();
- return DPIUtil.autoScaleDown (getTextBoundsInPixels (index));
-}
-
-Rectangle getTextBoundsInPixels (int index) {
checkWidget ();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
int count = Math.max (1, parent.getColumnCount ());
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index a5470f9e08d..25c1636b8b1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -948,11 +948,6 @@ public int getCaretLineNumber () {
*
*/
public Point getCaretLocation () {
- checkWidget ();
- return DPIUtil.autoScaleDown(getCaretLocationInPixels());
-}
-
-Point getCaretLocationInPixels () {
checkWidget ();
if ((style & SWT.SINGLE) != 0) {
int index = GTK.gtk_editable_get_position (handle);
@@ -1532,11 +1527,6 @@ public int getTopIndex () {
*
*/
public int getTopPixel () {
- checkWidget ();
- return DPIUtil.autoScaleDown(getTopPixelInPixels());
-}
-
-int getTopPixelInPixels () {
checkWidget ();
if ((style & SWT.SINGLE) != 0) return 0;
byte [] position = new byte [ITER_SIZEOF];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index be019ea0d78..c83fba3694e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -302,15 +302,10 @@ public ToolItem getItem (int index) {
*/
public ToolItem getItem (Point point) {
checkWidget();
- return getItemInPixels(DPIUtil.autoScaleUp(point));
-}
-
-
-ToolItem getItemInPixels (Point point) {
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
ToolItem[] items = getItems();
for (int i=0; i
*/
public void setLocation (int x, int y) {
- checkWidget ();
- setLocation (new Point (x, y));
-}
-
-void setLocationInPixels (int x, int y) {
checkWidget ();
this.x = x;
this.y = y;
@@ -745,14 +740,9 @@ void setLocationInPixels (int x, int y) {
*
*/
public void setLocation (Point location) {
- checkWidget ();
- setLocationInPixels(DPIUtil.autoScaleUp(location));
-}
-
-void setLocationInPixels (Point location) {
checkWidget ();
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
- setLocationInPixels (location.x, location.y);
+ setLocation (location.x, location.y);
}
/**
@@ -846,7 +836,7 @@ public void setVisible (boolean visible) {
if (visible) {
if ((style & SWT.BALLOON) != 0) {
configure ();
- GTK.gtk_widget_show (handle);
+ gtk_widget_show (handle);
} else {
long vboxHandle = parent.vboxHandle;
StringBuilder string = new StringBuilder (text);
@@ -864,7 +854,7 @@ public void setVisible (boolean visible) {
}
} else {
if ((style & SWT.BALLOON) != 0) {
- GTK.gtk_widget_hide (handle);
+ gtk_widget_hide (handle);
} else {
long vboxHandle = parent.vboxHandle;
byte[] buffer = Converter.wcsToMbcs("", true);
@@ -876,7 +866,7 @@ public void setVisible (boolean visible) {
@Override
long timerProc (long widget) {
if ((style & SWT.BALLOON) != 0) {
- GTK.gtk_widget_hide (handle);
+ gtk_widget_hide (handle);
}
return 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
index 42723c9f4c7..038041ca256 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -436,16 +436,6 @@ void drawRectangles (Rectangle [] rects) {
*
*/
public Rectangle [] getRectangles () {
- checkWidget();
- Rectangle [] result = new Rectangle [rectangles.length];
- for (int i = 0; i < rectangles.length; i++) {
- Rectangle current = rectangles [i];
- result [i] = DPIUtil.autoScaleDown (new Rectangle (current.x, current.y, current.width, current.height));
- }
- return result;
-}
-
-Rectangle [] getRectanglesInPixels () {
checkWidget();
Rectangle [] result = new Rectangle [rectangles.length];
for (int i = 0; i < rectangles.length; i++) {
@@ -529,9 +519,9 @@ long gtk_key_press_event (long widget, long eventPtr) {
}
Event event = new Event ();
Rectangle eventRect = new Rectangle (oldX + xChange, oldY + yChange, 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
if (parent != null && (parent.style & SWT.MIRRORED) != 0) {
- event.x = DPIUtil.autoScaleDown (parent.getClientWidth ()) - event.width - event.x;
+ event.x = parent.getClientWidth () - event.width - event.x;
}
if ((style & SWT.RESIZE) != 0) {
resizeRectangles (xChange, yChange);
@@ -659,11 +649,11 @@ long gtk_mouse (int eventType, long widget, long eventPtr) {
Event event = new Event ();
if (parent == null) {
Rectangle eventRect = new Rectangle (newX [0], newY [0], 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
} else {
Point screenCoord = display.mapInPixels (parent, null, newX [0], newY [0]);
Rectangle eventRect = new Rectangle (screenCoord.x, screenCoord.y, 0, 0);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
}
if ((style & SWT.RESIZE) != 0) {
resizeRectangles (newX [0] - oldX, newY [0] - oldY);
@@ -849,7 +839,7 @@ public boolean open () {
Rectangle bounds = display.getBoundsInPixels();
GTK3.gtk_window_move (overlay, bounds.x, bounds.y);
GTK3.gtk_window_resize (overlay, bounds.width, bounds.height);
- GTK.gtk_widget_show (overlay);
+ gtk_widget_show (overlay);
/* Tracker behaves like a Dialog with its own OS event loop. */
Display display = this.display;
@@ -1154,16 +1144,6 @@ public void setCursor (Cursor newCursor) {
*
*/
public void setRectangles (Rectangle [] rectangles) {
- checkWidget();
- if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT);
- int length = rectangles.length;
- for (int i = 0; i < length; i++) {
- rectangles [i] = DPIUtil.autoScaleUp (rectangles [i]);
- }
- setRectanglesInPixels (rectangles);
-}
-
-void setRectanglesInPixels (Rectangle [] rectangles) {
checkWidget();
if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT);
int length = rectangles.length;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 7c66e9fd382..073f3882754 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2022 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -645,7 +645,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
* the number of items at the root of the tree.
*/
if (hHint == SWT.DEFAULT && size.y == getHeaderHeight()) {
- int itemHeight = getItemHeightInPixels();
+ int itemHeight = getItemHeight();
// Initialize to height of root items & header
size.y = getItemCount() * itemHeight + getHeaderHeight();
@@ -926,13 +926,13 @@ void createItem (TreeColumn column, int index) {
GTK4.gtk_box_append(boxHandle, imageHandle);
GTK4.gtk_box_append(boxHandle, labelHandle);
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_hide(imageHandle);
} else {
GTK3.gtk_container_add (boxHandle, imageHandle);
GTK3.gtk_container_add (boxHandle, labelHandle);
- GTK.gtk_widget_show (boxHandle);
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (boxHandle);
+ gtk_widget_show (labelHandle);
}
column.labelHandle = labelHandle;
@@ -1320,7 +1320,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean
long [] path = new long [1];
if (GTK.gtk_gesture_drag_get_start_point(dragGesture, startX, startY)) {
if (getHeaderVisible()) {
- startY[0]-= getHeaderHeightInPixels();
+ startY[0]-= getHeaderHeight();
}
if (GTK.gtk_tree_view_get_path_at_pos (handle, (int) startX[0], (int) startY[0], path, null, null, null)) {
if (path [0] != 0) {
@@ -1602,11 +1602,6 @@ TreeItem getFocusItem () {
*/
public int getGridLineWidth () {
checkWidget ();
- return DPIUtil.autoScaleDown (getGridLineWidthInPixels ());
-}
-
-int getGridLineWidthInPixels () {
- checkWidget();
return 0;
}
@@ -1656,11 +1651,6 @@ public Color getHeaderForeground () {
*/
public int getHeaderHeight () {
checkWidget ();
- return DPIUtil.autoScaleDown (getHeaderHeightInPixels ());
-}
-
-int getHeaderHeightInPixels () {
- checkWidget();
if (!GTK.gtk_tree_view_get_headers_visible(handle)) return 0;
int height = 0;
@@ -1771,11 +1761,6 @@ public TreeItem getItem (int index) {
*/
public TreeItem getItem (Point point) {
checkWidget();
- return getItemInPixels(DPIUtil.autoScaleUp(point));
-}
-
-TreeItem getItemInPixels (Point point) {
- checkWidget ();
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
long [] path = new long [1];
GTK.gtk_widget_realize (handle);
@@ -1846,11 +1831,6 @@ public int getItemCount () {
*/
public int getItemHeight () {
checkWidget ();
- return DPIUtil.autoScaleDown (getItemHeightInPixels ());
-}
-
-int getItemHeightInPixels () {
- checkWidget();
int height = 0;
int itemCount = GTK.gtk_tree_model_iter_n_children(modelHandle, 0);
@@ -3089,7 +3069,7 @@ void sendMeasureEvent (long cell, long width, long height) {
event.index = columnIndex;
event.gc = gc;
Rectangle eventRect = new Rectangle (0, 0, contentWidth [0], contentHeight [0]);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
long path = GTK.gtk_tree_model_get_path (modelHandle, iter);
long selection = GTK.gtk_tree_view_get_selection (handle);
if (GTK.gtk_tree_selection_path_is_selected (selection, path)) {
@@ -3098,7 +3078,7 @@ void sendMeasureEvent (long cell, long width, long height) {
GTK.gtk_tree_path_free (path);
sendEvent (SWT.MeasureItem, event);
gc.dispose ();
- Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
+ Rectangle rect = event.getBounds ();
contentWidth [0] = rect.width - imageWidth;
if (contentHeight [0] < rect.height) contentHeight [0] = rect.height;
if (width != 0) C.memmove (width, contentWidth, 4);
@@ -3248,12 +3228,9 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
if (cr != 0) {
// Use the original rectangle, not the Cairo clipping for the y, width, and height values.
// See bug 535124.
- Rectangle rect2 = DPIUtil.autoScaleDown(rect);
- gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height);
+ gc.setClipping(rect.x, rect.y, rect.width, rect.height);
} else {
- Rectangle rect2 = DPIUtil.autoScaleDown(rect);
- // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075
- gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height);
+ gc.setClipping(rect.x, rect.y, rect.width, rect.height);
}
// SWT.PaintItem/SWT.EraseItem often expect that event.y matches
@@ -3270,7 +3247,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
event.index = columnIndex;
event.gc = gc;
event.detail = drawState;
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
sendEvent (SWT.EraseItem, event);
} finally {
Cairo.cairo_translate (cr, 0, y_offset);
@@ -3295,7 +3272,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
if ((drawState & SWT.BACKGROUND) != 0 && (drawState & SWT.SELECTED) == 0) {
GC gc = getGC(cr);
gc.setBackground (item.getBackground (columnIndex));
- gc.fillRectangle (DPIUtil.autoScaleDown (rendererRect.toRectangle ()));
+ gc.fillRectangle (rendererRect.toRectangle ());
gc.dispose ();
}
if ((drawState & SWT.FOREGROUND) != 0 || GTK.GTK_IS_CELL_RENDERER_TOGGLE (cell)) {
@@ -3368,9 +3345,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
rect.x = getClientWidth () - rect.width - rect.x;
}
- Rectangle rect2 = DPIUtil.autoScaleDown(rect);
- // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075
- gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height);
+ gc.setClipping(rect.x, rect.y, rect.width, rect.height);
// SWT.PaintItem/SWT.EraseItem often expect that event.y matches
// what 'event.item.getBounds()' returns. The workaround is to
@@ -3386,7 +3361,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
event.index = columnIndex;
event.gc = gc;
event.detail = drawState;
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ event.setBounds (eventRect);
sendEvent (SWT.PaintItem, event);
} finally {
Cairo.cairo_translate (cr, 0, y_offset);
@@ -3467,7 +3442,7 @@ public void setInsertMark (TreeItem item, boolean before) {
}
if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
if (item.parent != this) return;
- Rectangle rect = item.getBoundsInPixels();
+ Rectangle rect = item.getBounds();
long [] path = new long [1];
GTK.gtk_widget_realize (handle);
if (!GTK.gtk_tree_view_get_path_at_pos(handle, rect.x, rect.y, path, null, null, null)) return;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
index 7cb6c749d8c..ec2d754fa9a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -321,11 +321,6 @@ public String getToolTipText () {
*/
public int getWidth () {
checkWidget ();
- return DPIUtil.autoScaleDown (getWidthInPixels ());
-}
-
-int getWidthInPixels () {
- checkWidget();
if (!GTK.gtk_tree_view_column_get_visible (handle)) {
return 0;
}
@@ -487,7 +482,7 @@ public void pack () {
}
OS.g_free (iter);
}
- setWidthInPixels(width);
+ setWidth(width);
}
@Override
@@ -612,14 +607,14 @@ public void setImage (Image image) {
} else {
GTK3.gtk_image_set_from_surface(imageHandle, headerImageList.getSurface(imageIndex));
}
- GTK.gtk_widget_show(imageHandle);
+ gtk_widget_show(imageHandle);
} else {
if (GTK.GTK4) {
GTK4.gtk_image_clear(imageHandle);
} else {
GTK3.gtk_image_set_from_surface(imageHandle, 0);
}
- GTK.gtk_widget_hide(imageHandle);
+ gtk_widget_hide(imageHandle);
}
}
@@ -686,9 +681,9 @@ public void setText (String string) {
byte [] buffer = Converter.wcsToMbcs (chars, true);
GTK.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
if (string.length () != 0) {
- GTK.gtk_widget_show (labelHandle);
+ gtk_widget_show (labelHandle);
} else {
- GTK.gtk_widget_hide (labelHandle);
+ gtk_widget_hide (labelHandle);
}
}
@@ -736,11 +731,6 @@ public void setToolTipText(String string) {
*
*/
public void setWidth(int width) {
- checkWidget();
- setWidthInPixels(DPIUtil.autoScaleUp(width));
-}
-
-void setWidthInPixels(int width) {
checkWidget();
if (width < 0) return;
if (width == lastWidth) return;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
index d143e9699a2..80bea87334e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -407,12 +407,7 @@ public Color getBackground (int index) {
*/
public Rectangle getBounds (int index) {
checkWidget ();
- return DPIUtil.autoScaleDown (getBoundsInPixels (index));
-}
-
-Rectangle getBoundsInPixels (int index) {
// TODO fully test on early and later versions of GTK
- checkWidget();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
long parentHandle = parent.handle;
long column = 0;
@@ -454,13 +449,8 @@ Rectangle getBoundsInPixels (int index) {
*/
public Rectangle getBounds () {
checkWidget ();
- return DPIUtil.autoScaleDown (getBoundsInPixels ());
-}
-
-Rectangle getBoundsInPixels () {
// TODO fully test on early and later versions of GTK
// shifted a bit too far right on later versions of GTK - however, old Tree also had this problem
- checkWidget ();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
long parentHandle = parent.handle;
long column = GTK.gtk_tree_view_get_column (parentHandle, 0);
@@ -694,12 +684,7 @@ public Image getImage (int index) {
*/
public Rectangle getImageBounds (int index) {
checkWidget ();
- return DPIUtil.autoScaleDown(getImageBoundsInPixels(index));
-}
-
-Rectangle getImageBoundsInPixels (int index) {
// TODO fully test on early and later versions of GTK
- checkWidget ();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
long parentHandle = parent.handle;
long column = 0;
@@ -927,11 +912,6 @@ public String getText (int index) {
* @since 3.3
*/
public Rectangle getTextBounds (int index) {
- checkWidget ();
- return DPIUtil.autoScaleDown(getTextBoundsInPixels(index));
-}
-
-Rectangle getTextBoundsInPixels (int index) {
checkWidget ();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
int count = Math.max (1, parent.getColumnCount ());
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 13d5a7efaf9..92c3f16aafb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -2759,4 +2759,14 @@ void notifyDisposalTracker() {
}
}
+void gtk_widget_hide(long widget) {
+ if (GTK.GTK4) GTK.gtk_widget_set_visible(widget, false);
+ else GTK3.gtk_widget_hide(widget);
+}
+
+void gtk_widget_show(long widget) {
+ if (GTK.GTK4) GTK.gtk_widget_set_visible(widget, true);
+ else GTK3.gtk_widget_show(widget);
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
index f9547d512ba..319fef5ed2d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java
@@ -50,13 +50,6 @@ public final class Color extends Resource {
public int handle;
int alpha = 255;
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Color() {
- super();
-}
-
/**
* Prevents uninitialized instances from being created outside the package.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
index 719a4020a21..f1002ba50be 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
@@ -356,7 +356,6 @@ public Cursor(Device device, ImageData source, int hotspotX, int hotspotY) {
*
* @param cursor the cursor
* @param zoom zoom level (in %) of the monitor the cursor is currently in.
- *
* @return The handle of the cursor.
*
* @noreference This method is not intended to be referenced by clients.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java
index fc7014ec99c..b1f3249ab26 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java
@@ -46,9 +46,8 @@ public final class Font extends Resource {
* platforms and should never be accessed from application code.
*
*
- * @noreference This field is not intended to be referenced by clients.
*/
- public long handle;
+ private long handle;
/**
* The zoom in % of the standard resolution used for conversion of point height to pixel height
@@ -56,23 +55,25 @@ public final class Font extends Resource {
*/
int zoom;
+ /**
+ * this field is used to mark destroyed fonts
+ */
+ private boolean isDestroyed;
+
+ /**
+ * this field is used to store fontData provided during initialization
+ */
+ private final FontData fontData;
+
/**
* Font height in points. As the conversion to pixel height involves rounding the fontHeight must
* be cached.
*/
private final float fontHeight;
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Font(Device device) {
- super(device);
- this.zoom = DPIUtil.getNativeDeviceZoom();
- this.fontHeight = 0;
-}
-
private Font(Device device, long handle, int zoom) {
super(device);
+ this.fontData = null;
this.handle = handle;
this.zoom = zoom;
this.fontHeight = device.computePoints(fetchLogFontData(), handle, zoom);
@@ -100,16 +101,18 @@ private Font(Device device, long handle, int zoom) {
*/
public Font(Device device, FontData fd) {
super(device);
+ if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
this.zoom = DPIUtil.getNativeDeviceZoom();
- init(fd);
+ this.fontData = new FontData(fd.toString());
this.fontHeight = fd.height;
init();
}
private Font(Device device, FontData fd, int zoom) {
super(device);
+ if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
this.zoom = zoom;
- init(fd);
+ this.fontData = new FontData(fd.toString());
this.fontHeight = fd.height;
init();
}
@@ -148,7 +151,7 @@ public Font(Device device, FontData[] fds) {
}
this.zoom = DPIUtil.getNativeDeviceZoom();
FontData fd = fds[0];
- init(fds[0]);
+ this.fontData = new FontData(fd.toString());
this.fontHeight = fd.height;
init();
}
@@ -181,23 +184,16 @@ public Font(Device device, String name, int height, int style) {
super(device);
if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
this.zoom = DPIUtil.getNativeDeviceZoom();
- init(new FontData (name, height, style));
+ this.fontData = new FontData (name, height, style);
this.fontHeight = height;
init();
}
-/*public*/ Font(Device device, String name, float height, int style) {
- super(device);
- if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.zoom = DPIUtil.getNativeDeviceZoom();
- init(new FontData (name, height, style));
- this.fontHeight = height;
- init();
-}
@Override
void destroy() {
OS.DeleteObject(handle);
handle = 0;
+ isDestroyed = true;
}
/**
@@ -215,7 +211,7 @@ public boolean equals(Object object) {
if (object == this) return true;
if (!(object instanceof Font)) return false;
Font font = (Font) object;
- return device == font.device && handle == font.handle;
+ return device == font.device && win32_getHandle(this) == win32_getHandle(font);
}
/**
@@ -238,7 +234,7 @@ public FontData[] getFontData() {
private LOGFONT fetchLogFontData() {
LOGFONT logFont = new LOGFONT ();
- OS.GetObject(handle, LOGFONT.sizeof, logFont);
+ OS.GetObject(win32_getHandle(this), LOGFONT.sizeof, logFont);
return logFont;
}
@@ -254,7 +250,7 @@ private LOGFONT fetchLogFontData() {
*/
@Override
public int hashCode () {
- return (int)handle;
+ return (int) win32_getHandle(this);
}
void init (FontData fd) {
@@ -279,7 +275,7 @@ void init (FontData fd) {
*/
@Override
public boolean isDisposed() {
- return handle == 0;
+ return isDestroyed;
}
/**
@@ -294,6 +290,26 @@ public String toString () {
return "Font {" + handle + "}";
}
+/**
+ * Creates or returns a handle for the requested font.
+ *
+ * IMPORTANT: This method is not part of the public API for
+ * Font. It is marked public only so that it can be shared within
+ * the packages provided by SWT. It is not available on all platforms, and
+ * should never be called from application code.
+ *
+ * @param font the font to get the handle of
+ * @return handle of the font
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+public static long win32_getHandle(Font font) {
+ if (font.handle == 0 && font.fontData != null && !font.isDestroyed) {
+ font.init(font.fontData);
+ }
+ return font.handle;
+}
+
/**
* Invokes platform specific functionality to allocate a new font.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
index 54b81968559..9edadddfacf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
@@ -14,10 +14,14 @@
package org.eclipse.swt.graphics;
+import java.util.*;
+import java.util.stream.*;
+
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gdip.*;
import org.eclipse.swt.internal.win32.*;
+import org.eclipse.swt.widgets.*;
/**
* Class GC is where all of the drawing capabilities that are
@@ -333,10 +337,10 @@ void checkGC(int mask) {
}
}
if ((state & FONT) != 0) {
- Font font = data.font;
- OS.SelectObject(handle, font.handle);
+ long fontHandle = SWTFontProvider.getFontHandle(data.font, data.nativeZoom);
+ OS.SelectObject(handle, fontHandle);
long[] hFont = new long[1];
- long gdipFont = createGdipFont(handle, font.handle, gdipGraphics, device.fontCollection, null, hFont);
+ long gdipFont = createGdipFont(handle, fontHandle, gdipGraphics, device.fontCollection, null, hFont);
if (hFont[0] != 0) OS.SelectObject(handle, hFont[0]);
if (data.hGDIFont != 0) OS.DeleteObject(data.hGDIFont);
data.hGDIFont = hFont[0];
@@ -454,8 +458,8 @@ void checkGC(int mask) {
OS.SetTextColor(handle, data.foreground);
}
if ((state & FONT) != 0) {
- Font font = data.font;
- OS.SelectObject(handle, font.handle);
+ long fontHandle = SWTFontProvider.getFontHandle(data.font, data.nativeZoom);
+ OS.SelectObject(handle, fontHandle);
}
}
@@ -985,36 +989,77 @@ public void drawImage (Image image, int srcX, int srcY, int srcWidth, int srcHei
if (image == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- int deviceZoom = getZoom();
- Rectangle src = DPIUtil.scaleUp(drawable, new Rectangle(srcX, srcY, srcWidth, srcHeight), deviceZoom);
- Rectangle dest = DPIUtil.scaleUp(drawable, new Rectangle(destX, destY, destWidth, destHeight), deviceZoom);
- if (deviceZoom != 100) {
+ int gcZoom = getZoom();
+ int srcImageZoom = calculateZoomForImage(gcZoom, srcWidth, srcHeight, destWidth, destHeight);
+ drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, gcZoom, srcImageZoom);
+}
+
+private Collection getAllCurrentMonitorZooms() {
+ if (device instanceof Display display) {
+ return Arrays.stream(display.getMonitors())
+ .map(Monitor::getZoom)
+ .collect(Collectors.toSet());
+ }
+ return Collections.emptySet();
+}
+
+private int calculateZoomForImage(int gcZoom, int srcWidth, int srcHeight, int destWidth, int destHeight) {
+ if (srcWidth == 1 && srcHeight == 1) {
+ // One pixel images can use the GC zoom
+ return gcZoom;
+ }
+ if (destWidth == srcWidth && destHeight == srcHeight) {
+ // unscaled images can use the GC zoom
+ return gcZoom;
+ }
+
+ float imageScaleFactor = 1f * destWidth / srcWidth;
+ int imageZoom = Math.round(gcZoom * imageScaleFactor);
+ if (getAllCurrentMonitorZooms().contains(imageZoom)) {
+ return imageZoom;
+ }
+ if (imageZoom > 150) {
+ return 200;
+ }
+ return 100;
+}
+
+private void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY,
+ int destWidth, int destHeight, int imageZoom, int scaledImageZoom) {
+ Rectangle src = DPIUtil.scaleUp(drawable, new Rectangle(srcX, srcY, srcWidth, srcHeight), scaledImageZoom);
+ Rectangle dest = DPIUtil.scaleUp(drawable, new Rectangle(destX, destY, destWidth, destHeight), imageZoom);
+ if (scaledImageZoom != 100) {
/*
* This is a HACK! Due to rounding errors at fractional scale factors,
* the coordinates may be slightly off. The workaround is to restrict
* coordinates to the allowed bounds.
*/
- Rectangle b = image.getBounds(deviceZoom);
+ Rectangle b = image.getBounds(scaledImageZoom);
int errX = src.x + src.width - b.width;
int errY = src.y + src.height - b.height;
if (errX != 0 || errY != 0) {
- if (errX <= deviceZoom / 100 && errY <= deviceZoom / 100) {
+ if (errX <= scaledImageZoom / 100 && errY <= scaledImageZoom / 100) {
src.intersect(b);
} else {
SWT.error (SWT.ERROR_INVALID_ARGUMENT);
}
}
}
- drawImage(image, src.x, src.y, src.width, src.height, dest.x, dest.y, dest.width, dest.height, false);
+ drawImage(image, src.x, src.y, src.width, src.height, dest.x, dest.y, dest.width, dest.height, false, scaledImageZoom);
}
void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
+ drawImage(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, getZoom());
+}
+
+void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imageZoom) {
if (data.gdipGraphics != 0) {
//TODO - cache bitmap
- long [] gdipImage = srcImage.createGdipImage(getZoom());
+ long [] gdipImage = srcImage.createGdipImage(imageZoom);
long img = gdipImage[0];
int imgWidth = Gdip.Image_GetWidth(img);
int imgHeight = Gdip.Image_GetHeight(img);
+
if (simple) {
srcWidth = destWidth = imgWidth;
srcHeight = destHeight = imgHeight;
@@ -1065,17 +1110,18 @@ void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight,
}
return;
}
+ long imageHandle = Image.win32_getHandle(srcImage, imageZoom);
switch (srcImage.type) {
case SWT.BITMAP:
- drawBitmap(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
+ drawBitmap(srcImage, imageHandle, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
break;
case SWT.ICON:
- drawIcon(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
+ drawIcon(imageHandle, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
break;
}
}
-void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
+void drawIcon(long imageHandle, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
int technology = OS.GetDeviceCaps(handle, OS.TECHNOLOGY);
boolean drawIcon = true;
@@ -1099,14 +1145,14 @@ void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, i
/* Simple case: no stretching, entire icon */
if (simple && technology != OS.DT_RASPRINTER && drawIcon) {
if (offsetX != 0 || offsetY != 0) OS.SetWindowOrgEx(handle, 0, 0, null);
- OS.DrawIconEx(handle, destX - offsetX, destY - offsetY, Image.win32_getHandle(srcImage, getZoom()), 0, 0, 0, 0, flags);
+ OS.DrawIconEx(handle, destX - offsetX, destY - offsetY, imageHandle, 0, 0, 0, 0, flags);
if (offsetX != 0 || offsetY != 0) OS.SetWindowOrgEx(handle, offsetX, offsetY, null);
return;
}
/* Get the icon info */
ICONINFO srcIconInfo = new ICONINFO();
- OS.GetIconInfo(Image.win32_getHandle(srcImage, getZoom()), srcIconInfo);
+ OS.GetIconInfo(imageHandle, srcIconInfo);
/* Get the icon width and height */
long hBitmap = srcIconInfo.hbmColor;
@@ -1128,11 +1174,11 @@ void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, i
srcWidth == destWidth && srcHeight == destHeight &&
srcWidth == iconWidth && srcHeight == iconHeight;
if (!drawIcon) {
- drawBitmapMask(srcImage, srcIconInfo.hbmColor, srcIconInfo.hbmMask, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, iconWidth, iconHeight, false);
+ drawBitmapMask(srcIconInfo.hbmColor, srcIconInfo.hbmMask, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, iconWidth, iconHeight, false);
} else if (simple && technology != OS.DT_RASPRINTER) {
/* Simple case: no stretching, entire icon */
if (offsetX != 0 || offsetY != 0) OS.SetWindowOrgEx(handle, 0, 0, null);
- OS.DrawIconEx(handle, destX - offsetX, destY - offsetY, Image.win32_getHandle(srcImage, getZoom()), 0, 0, 0, 0, flags);
+ OS.DrawIconEx(handle, destX - offsetX, destY - offsetY, imageHandle, 0, 0, 0, 0, flags);
if (offsetX != 0 || offsetY != 0) OS.SetWindowOrgEx(handle, offsetX, offsetY, null);
} else {
/* Create the icon info and HDC's */
@@ -1205,9 +1251,9 @@ void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, i
if (failed) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
-void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
+void drawBitmap(Image srcImage, long imageHandle, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
BITMAP bm = new BITMAP();
- OS.GetObject(Image.win32_getHandle(srcImage, getZoom()), BITMAP.sizeof, bm);
+ OS.GetObject(imageHandle, BITMAP.sizeof, bm);
int imgWidth = bm.bmWidth;
int imgHeight = bm.bmHeight;
if (simple) {
@@ -1235,19 +1281,19 @@ void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight,
boolean isDib = bm.bmBits != 0;
int depth = bm.bmPlanes * bm.bmBitsPixel;
if (isDib && depth == 32) {
- drawBitmapAlpha(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
+ drawBitmapAlpha(imageHandle, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
} else if (srcImage.transparentPixel != -1) {
- drawBitmapTransparent(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, bm, imgWidth, imgHeight);
+ drawBitmapTransparent(srcImage, imageHandle, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple, bm, imgWidth, imgHeight);
} else {
- drawBitmapColor(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
+ drawBitmapColor(imageHandle, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
}
if (mustRestore) {
- long hOldBitmap = OS.SelectObject(memGC.handle, Image.win32_getHandle(srcImage, getZoom()));
+ long hOldBitmap = OS.SelectObject(memGC.handle, imageHandle);
memGC.data.hNullBitmap = hOldBitmap;
}
}
-void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
+void drawBitmapAlpha(long imageHandle, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
boolean alphaBlendSupport = true;
boolean isPrinter = OS.GetDeviceCaps(handle, OS.TECHNOLOGY) == OS.DT_RASPRINTER;
int sourceAlpha = -1;
@@ -1255,7 +1301,7 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
int caps = OS.GetDeviceCaps(handle, OS.SHADEBLENDCAPS);
if (caps != 0) {
long srcHdc = OS.CreateCompatibleDC(handle);
- long oldSrcBitmap = OS.SelectObject(srcHdc, Image.win32_getHandle(srcImage, getZoom()));
+ long oldSrcBitmap = OS.SelectObject(srcHdc, imageHandle);
long memDib = Image.createDIB(srcWidth, srcHeight, 32);
if (memDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
long memHdc = OS.CreateCompatibleDC(handle);
@@ -1282,7 +1328,7 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
if (sourceAlpha != -1) {
if (sourceAlpha == 0) return;
if (sourceAlpha == 255) {
- drawBitmapColor(srcImage, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
+ drawBitmapColor(imageHandle, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, simple);
return;
}
alphaBlendSupport = (caps & OS.SB_CONST_ALPHA) != 0;
@@ -1296,7 +1342,7 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
BLENDFUNCTION blend = new BLENDFUNCTION();
blend.BlendOp = OS.AC_SRC_OVER;
long srcHdc = OS.CreateCompatibleDC(handle);
- long oldSrcBitmap = OS.SelectObject(srcHdc, Image.win32_getHandle(srcImage, getZoom()));
+ long oldSrcBitmap = OS.SelectObject(srcHdc, imageHandle);
blend.SourceConstantAlpha = (byte)sourceAlpha;
blend.AlphaFormat = OS.AC_SRC_ALPHA;
OS.AlphaBlend(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, blend);
@@ -1329,7 +1375,7 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
/* Create resources */
long srcHdc = OS.CreateCompatibleDC(handle);
- long oldSrcBitmap = OS.SelectObject(srcHdc, Image.win32_getHandle(srcImage, getZoom()));
+ long oldSrcBitmap = OS.SelectObject(srcHdc, imageHandle);
long memHdc = OS.CreateCompatibleDC(handle);
long memDib = Image.createDIB(Math.max(srcWidth, destWidth), Math.max(srcHeight, destHeight), 32);
if (memDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
@@ -1445,7 +1491,7 @@ void drawBitmapTransparentByClipping(long srcHdc, long maskHdc, int srcX, int sr
OS.DeleteObject(rgn);
}
-void drawBitmapMask(Image srcImage, long srcColor, long srcMask, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight, boolean offscreen) {
+void drawBitmapMask(long srcColor, long srcMask, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, int imgWidth, int imgHeight, boolean offscreen) {
int srcColorY = srcY;
if (srcColor == 0) {
srcColor = srcMask;
@@ -1497,11 +1543,11 @@ void drawBitmapMask(Image srcImage, long srcColor, long srcMask, int srcX, int s
OS.DeleteDC(srcHdc);
}
-void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, BITMAP bm, int imgWidth, int imgHeight) {
+void drawBitmapTransparent(Image srcImage, long imageHandle, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, BITMAP bm, int imgWidth, int imgHeight) {
/* Find the RGB values for the transparent pixel. */
boolean isDib = bm.bmBits != 0;
- long hBitmap = Image.win32_getHandle(srcImage, getZoom());
+ long hBitmap = imageHandle;
long srcHdc = OS.CreateCompatibleDC(handle);
long oldSrcBitmap = OS.SelectObject(srcHdc, hBitmap);
byte[] originalColors = null;
@@ -1546,7 +1592,7 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
bmiHeader.biBitCount = bm.bmBitsPixel;
byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + numColors * 4];
OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
- OS.GetDIBits(srcHdc, Image.win32_getHandle(srcImage, getZoom()), 0, 0, null, bmi, OS.DIB_RGB_COLORS);
+ OS.GetDIBits(srcHdc, imageHandle, 0, 0, null, bmi, OS.DIB_RGB_COLORS);
int offset = BITMAPINFOHEADER.sizeof + 4 * srcImage.transparentPixel;
transRed = bmi[offset + 2] & 0xFF;
transGreen = bmi[offset + 1] & 0xFF;
@@ -1619,13 +1665,13 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
OS.DeleteObject(maskBitmap);
}
OS.SelectObject(srcHdc, oldSrcBitmap);
- if (hBitmap != Image.win32_getHandle(srcImage, getZoom())) OS.DeleteObject(hBitmap);
+ if (hBitmap != imageHandle) OS.DeleteObject(hBitmap);
OS.DeleteDC(srcHdc);
}
-void drawBitmapColor(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
+void drawBitmapColor(long imageHandle, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) {
long srcHdc = OS.CreateCompatibleDC(handle);
- long oldSrcBitmap = OS.SelectObject(srcHdc, Image.win32_getHandle(srcImage, getZoom()));
+ long oldSrcBitmap = OS.SelectObject(srcHdc, imageHandle);
int dwRop = OS.GetROP2(handle) == OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
int mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
@@ -2388,7 +2434,7 @@ void drawText(long gdipGraphics, String string, int x, int y, int flags, Point s
char[] chars = string.toCharArray();
long hdc = Gdip.Graphics_GetHDC(gdipGraphics);
long hFont = data.hGDIFont;
- if (hFont == 0 && data.font != null) hFont = data.font.handle;
+ if (hFont == 0 && data.font != null) hFont = SWTFontProvider.getFontHandle(data.font, data.nativeZoom);
long oldFont = 0;
if (hFont != 0) oldFont = OS.SelectObject(hdc, hFont);
TEXTMETRIC lptm = new TEXTMETRIC();
@@ -2478,7 +2524,7 @@ RectF drawText(long gdipGraphics, char[] buffer, int start, int length, int x, i
}
long hdc = Gdip.Graphics_GetHDC(gdipGraphics);
long hFont = data.hGDIFont;
- if (hFont == 0 && data.font != null) hFont = data.font.handle;
+ if (hFont == 0 && data.font != null) hFont = SWTFontProvider.getFontHandle(data.font, data.nativeZoom);
long oldFont = 0;
if (hFont != 0) oldFont = OS.SelectObject(hdc, hFont);
if (start != 0) {
@@ -3898,18 +3944,18 @@ void init(Drawable drawable, GCData data, long hDC) {
data.background = OS.GetBkColor(hDC);
}
data.state &= ~(NULL_BRUSH | NULL_PEN);
+ if (data.nativeZoom == 0) {
+ data.nativeZoom = extractZoom(hDC);
+ }
Font font = data.font;
if (font != null) {
data.state &= ~FONT;
} else {
- data.font = Font.win32_new(device, OS.GetCurrentObject(hDC, OS.OBJ_FONT));
- }
- if (data.nativeZoom == 0) {
- data.nativeZoom = extractZoom(hDC);
+ data.font = SWTFontProvider.getFont(device, OS.GetCurrentObject(hDC, OS.OBJ_FONT), data.nativeZoom);
}
Image image = data.image;
if (image != null) {
- data.hNullBitmap = OS.SelectObject(hDC, Image.win32_getHandle(image, DPIUtil.getZoomForAutoscaleProperty(data.nativeZoom)));
+ data.hNullBitmap = OS.SelectObject(hDC, Image.win32_getHandle(image, data.nativeZoom));
image.memGC = this;
}
int layout = data.layout;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
index 8e83e08b36c..a78bb198666 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
@@ -18,6 +18,7 @@
import java.io.*;
import java.util.*;
+import java.util.Map.*;
import java.util.function.*;
import org.eclipse.swt.*;
@@ -98,6 +99,11 @@ public final class Image extends Resource implements Drawable {
*/
private boolean isInitialized;
+ /**
+ * this field is used to mark destroyed images
+ */
+ private boolean isDestroyed;
+
/**
* specifies the transparent pixel
*/
@@ -111,7 +117,7 @@ public final class Image extends Resource implements Drawable {
/**
* AbstractImageProvider to avail right ImageProvider (ImageDataProvider or ImageFileNameProvider)
*/
- private AbstractImageProviderWrapper imageProvider;
+ private final AbstractImageProviderWrapper imageProvider;
/**
* Style flag used to differentiate normal, gray-scale and disabled images based
@@ -126,11 +132,6 @@ public final class Image extends Resource implements Drawable {
*/
private RGB backgroundColor;
- /**
- * Attribute to cache current native zoom level
- */
- private int initialNativeZoom = 100;
-
/**
* specifies the default scanline padding
*/
@@ -138,16 +139,12 @@ public final class Image extends Resource implements Drawable {
private Map zoomLevelToImageHandle = new HashMap<>();
-/**
- * Prevents uninitialized instances from being created outside the package.
- */
-Image (Device device) {
- this(device, DPIUtil.getNativeDeviceZoom());
-}
-
-private Image (Device device, int nativeZoom) {
+private Image (Device device, int type, long handle, int nativeZoom) {
super(device);
- initialNativeZoom = nativeZoom;
+ this.type = type;
+ this.imageProvider = new ExistingImageHandleProviderWrapper(handle, nativeZoom);
+ this.isInitialized = true;
+ this.device.registerResourceWithZoomSupport(this);
}
/**
@@ -186,13 +183,7 @@ private Image (Device device, int nativeZoom) {
* @see #dispose()
*/
public Image(Device device, int width, int height) {
- this(device, width, height, DPIUtil.getNativeDeviceZoom());
-}
-
-
-private Image(Device device, int width, int height, int nativeZoom) {
super(device);
- this.initialNativeZoom = nativeZoom;
this.imageProvider = new PlainImageProviderWrapper(width, height);
init();
this.device.registerResourceWithZoomSupport(this);
@@ -240,44 +231,45 @@ public Image(Device device, Image srcImage, int flag) {
ImageHandle imageMetadata;
if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- initialNativeZoom = srcImage.initialNativeZoom;
- Rectangle rect = srcImage.getBounds(getZoom());
this.type = srcImage.type;
- if(srcImage.imageProvider != null) {
- this.imageProvider = srcImage.imageProvider.createCopy(this);
- }
this.styleFlag = srcImage.styleFlag | flag;
- long srcImageHandle = win32_getHandle(srcImage, getZoom());
+ this.imageProvider = srcImage.imageProvider.createCopy(this);
switch (flag) {
case SWT.IMAGE_COPY: {
switch (type) {
case SWT.BITMAP:
- /* Get the HDC for the device */
- long hDC = device.internal_new_GC(null);
-
- /* Copy the bitmap */
- long hdcSource = OS.CreateCompatibleDC(hDC);
- long hdcDest = OS.CreateCompatibleDC(hDC);
- long hOldSrc = OS.SelectObject(hdcSource, srcImageHandle);
- BITMAP bm = new BITMAP();
- OS.GetObject(srcImageHandle, BITMAP.sizeof, bm);
- imageMetadata = new ImageHandle(OS.CreateCompatibleBitmap(hdcSource, rect.width, bm.bmBits != 0 ? -rect.height : rect.height), getZoom());
- if (imageMetadata.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- long hOldDest = OS.SelectObject(hdcDest, imageMetadata.handle);
- OS.BitBlt(hdcDest, 0, 0, rect.width, rect.height, hdcSource, 0, 0, OS.SRCCOPY);
- OS.SelectObject(hdcSource, hOldSrc);
- OS.SelectObject(hdcDest, hOldDest);
- OS.DeleteDC(hdcSource);
- OS.DeleteDC(hdcDest);
-
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
-
+ for (ImageHandle imageHandle : srcImage.zoomLevelToImageHandle.values()) {
+ Rectangle rect = imageHandle.getBounds();
+ long srcImageHandle = imageHandle.handle;
+ /* Get the HDC for the device */
+ long hDC = device.internal_new_GC(null);
+
+ /* Copy the bitmap */
+ long hdcSource = OS.CreateCompatibleDC(hDC);
+ long hdcDest = OS.CreateCompatibleDC(hDC);
+ long hOldSrc = OS.SelectObject(hdcSource, srcImageHandle);
+ BITMAP bm = new BITMAP();
+ OS.GetObject(srcImageHandle, BITMAP.sizeof, bm);
+ imageMetadata = new ImageHandle(OS.CreateCompatibleBitmap(hdcSource, rect.width, bm.bmBits != 0 ? -rect.height : rect.height), imageHandle.zoom);
+ if (imageMetadata.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ long hOldDest = OS.SelectObject(hdcDest, imageMetadata.handle);
+ OS.BitBlt(hdcDest, 0, 0, rect.width, rect.height, hdcSource, 0, 0, OS.SRCCOPY);
+ OS.SelectObject(hdcSource, hOldSrc);
+ OS.SelectObject(hdcDest, hOldDest);
+ OS.DeleteDC(hdcSource);
+ OS.DeleteDC(hdcDest);
+
+ /* Release the HDC for the device */
+ device.internal_dispose_GC(hDC, null);
+ }
transparentPixel = srcImage.transparentPixel;
break;
case SWT.ICON:
- imageMetadata = new ImageHandle(OS.CopyImage(srcImageHandle, OS.IMAGE_ICON, rect.width, rect.height, 0), getZoom());
- if (imageMetadata.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ for (ImageHandle imageHandle : srcImage.zoomLevelToImageHandle.values()) {
+ Rectangle rect = imageHandle.getBounds();
+ imageMetadata = new ImageHandle(OS.CopyImage(imageHandle.handle, OS.IMAGE_ICON, rect.width, rect.height, 0), imageHandle.zoom);
+ if (imageMetadata.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ }
break;
default:
SWT.error(SWT.ERROR_INVALID_IMAGE);
@@ -285,15 +277,21 @@ public Image(Device device, Image srcImage, int flag) {
break;
}
case SWT.IMAGE_DISABLE: {
- ImageData data = srcImage.getImageData(srcImage.getZoom());
- ImageData newData = applyDisableImageData(data, rect.height, rect.width);
- init (newData, getZoom());
+ for (ImageHandle imageHandle : srcImage.zoomLevelToImageHandle.values()) {
+ Rectangle rect = imageHandle.getBounds();
+ ImageData data = srcImage.getImageData(imageHandle.zoom);
+ ImageData newData = applyDisableImageData(data, rect.height, rect.width);
+ init (newData, imageHandle.zoom);
+ }
break;
}
case SWT.IMAGE_GRAY: {
- ImageData data = srcImage.getImageData(srcImage.getZoom());
- ImageData newData = applyGrayImageData(data, rect.height, rect.width);
- init (newData, getZoom());
+ for (ImageHandle imageHandle : srcImage.zoomLevelToImageHandle.values()) {
+ Rectangle rect = imageHandle.getBounds();
+ ImageData data = srcImage.getImageData(imageHandle.zoom);
+ ImageData newData = applyGrayImageData(data, rect.height, rect.width);
+ init (newData, imageHandle.zoom);
+ }
break;
}
default:
@@ -337,11 +335,13 @@ public Image(Device device, Image srcImage, int flag) {
*
*
* @see #dispose()
+ *
+ * @deprecated use {@link Image#Image(Device, int, int)} instead
*/
+@Deprecated(since = "2025-06", forRemoval = true)
public Image(Device device, Rectangle bounds) {
super(device);
if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
this.imageProvider = new PlainImageProviderWrapper(bounds.width, bounds.height);
init();
this.device.registerResourceWithZoomSupport(this);
@@ -373,12 +373,19 @@ public Image(Device device, Rectangle bounds) {
public Image(Device device, ImageData data) {
super(device);
if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
this.imageProvider = new PlainImageDataProviderWrapper(data);
init();
this.device.registerResourceWithZoomSupport(this);
}
+private Image(Device device, ImageData data, int zoom) {
+ super(device);
+ if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.imageProvider = new PlainImageDataProviderWrapper(data, zoom);
+ init();
+ this.device.registerResourceWithZoomSupport(this);
+}
+
/**
* Constructs an instance of this class, whose type is
* SWT.ICON, from the two given ImageData
@@ -416,7 +423,6 @@ public Image(Device device, ImageData source, ImageData mask) {
if (source.width != mask.width || source.height != mask.height) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
this.imageProvider = new MaskedImageDataProviderWrapper(source, mask);
init();
this.device.registerResourceWithZoomSupport(this);
@@ -478,7 +484,6 @@ public Image(Device device, ImageData source, ImageData mask) {
public Image (Device device, InputStream stream) {
super(device);
if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
this.imageProvider = new ImageDataLoaderStreamProviderWrapper(stream);
init();
this.device.registerResourceWithZoomSupport(this);
@@ -519,17 +524,12 @@ public Image (Device device, InputStream stream) {
public Image (Device device, String filename) {
super(device);
if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
this.imageProvider = new ImageFileNameProviderWrapper(zoom -> {
if (zoom == 100) {
return filename;
}
return null;
});
- if (imageProvider.getImageData(100) == null) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT, null,
- ": [" + filename + "] returns null ImageData at 100% zoom.");
- }
init();
this.device.registerResourceWithZoomSupport(this);
}
@@ -566,10 +566,9 @@ public Image (Device device, String filename) {
public Image(Device device, ImageFileNameProvider imageFileNameProvider) {
super(device);
this.imageProvider = new ImageFileNameProviderWrapper(imageFileNameProvider);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
- if (imageProvider.getImageData(100) == null) {
+ if (imageFileNameProvider.getImagePath(100) == null) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT, null,
- ": ImageFileNameProvider [" + imageFileNameProvider + "] returns null ImageData at 100% zoom.");
+ ": ImageFileNameProvider [" + imageFileNameProvider + "] returns null fileName at 100% zoom.");
}
init();
this.device.registerResourceWithZoomSupport(this);
@@ -607,7 +606,6 @@ public Image(Device device, ImageFileNameProvider imageFileNameProvider) {
public Image(Device device, ImageDataProvider imageDataProvider) {
super(device);
this.imageProvider = new ImageDataProviderWrapper(imageDataProvider);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
if (imageDataProvider.getImageData(100) == null) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT, null,
": ImageDataProvider [" + imageDataProvider + "] returns null ImageData at 100% zoom.");
@@ -637,7 +635,6 @@ public Image(Device device, ImageDataProvider imageDataProvider) {
public Image(Device device, ImageGcDrawer imageGcDrawer, int width, int height) {
super(device);
this.imageProvider = new ImageGcDrawerWrapper(imageGcDrawer, width, height);
- initialNativeZoom = DPIUtil.getNativeDeviceZoom();
init();
}
@@ -785,23 +782,7 @@ private ImageHandle getImageMetadata(int zoom) {
if (zoomLevelToImageHandle.get(zoom) != null) {
return zoomLevelToImageHandle.get(zoom);
}
- if (imageProvider != null) {
- return imageProvider.getImageMetadata(zoom);
- } else {
- ImageData resizedData = getImageData(zoom);
- ImageData newData = adaptImageDataIfDisabledOrGray(resizedData);
- if (type == SWT.ICON && newData.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
- // If the original type was an icon with transparency mask and re-scaling leads
- // to image data without transparency mask, this will create invalid images
- // so this fallback will "repair" the image data by explicitly passing
- // the transparency mask created from the scaled image data
- initIconHandle(this.device, newData, newData.getTransparencyMask(), zoom);
- } else {
- init(newData, zoom);
- }
- init();
- }
- return zoomLevelToImageHandle.get(zoom);
+ return imageProvider.newImageHandle(zoom);
}
@@ -828,8 +809,24 @@ public static long win32_getHandle (Image image, int zoom) {
return image.getImageMetadata(zoom).handle;
}
-long [] createGdipImage() {
- return createGdipImage(this.getZoom());
+/**
+ * IMPORTANT: This method is not part of the public
+ * API for Image. It is marked public only so that it
+ * can be shared within the packages provided by SWT.
+ *
+ * Draws a scaled image using the GC by another image.
+ *
+ * @param gc the GC to draw on the resulting image
+ * @param original the image which is supposed to be scaled and drawn on the resulting image
+ * @param width the width of the original image
+ * @param height the height of the original image
+ * @param scaleFactor the factor with which the image is supposed to be scaled
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+public static void drawScaled(GC gc, Image original, int width, int height, float scaleFactor) {
+ gc.drawImage (original, 0, 0, width, height,
+ 0, 0, Math.round (width * scaleFactor), Math.round (height * scaleFactor), false);
}
long [] createGdipImage(Integer zoom) {
@@ -1004,43 +1001,29 @@ public static long win32_getHandle (Image image, int zoom) {
void destroy () {
device.deregisterResourceWithZoomSupport(this);
if (memGC != null) memGC.dispose();
- if (this.imageProvider != null) {
- this.imageProvider.destroy();
- }
- destroyHandle();
+ this.isDestroyed = true;
+ destroyHandles();
memGC = null;
}
-private void destroyHandle () {
- for (ImageHandle imageMetadata : zoomLevelToImageHandle.values()) {
- destroyHandle(imageMetadata.handle);
- }
- zoomLevelToImageHandle.clear();
+private void destroyHandles() {
+ destroyHandles(__ -> true);
}
@Override
void destroyHandlesExcept(Set zoomLevels) {
- zoomLevelToImageHandle.entrySet().removeIf(entry -> {
- final Integer zoom = entry.getKey();
- if (!zoomLevels.contains(zoom) && zoom != DPIUtil.getZoomForAutoscaleProperty(initialNativeZoom)) {
- destroyHandle(entry.getValue().handle);
- return true;
- }
- return false;
- });
-}
-private void destroyHandleForZoom(int zoom) {
- ImageHandle imageHandle = zoomLevelToImageHandle.remove(zoom);
- if (imageHandle != null) {
- destroyHandle(imageHandle.handle);
- }
+ destroyHandles(zoom -> !zoomLevels.contains(zoom) && !this.imageProvider.getPreservedZoomLevels().contains(zoom));
}
-private void destroyHandle(long handle) {
- if (type == SWT.ICON) {
- OS.DestroyIcon (handle);
- } else {
- OS.DeleteObject (handle);
+private void destroyHandles(Predicate filter) {
+ Iterator> it = zoomLevelToImageHandle.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry zoomToHandle = it.next();
+ if (filter.test(zoomToHandle.getKey())) {
+ ImageHandle imageHandle = zoomToHandle.getValue();
+ it.remove();
+ imageHandle.destroy();
+ }
}
}
@@ -1059,12 +1042,8 @@ public boolean equals (Object object) {
if (object == this) return true;
if (!(object instanceof Image)) return false;
Image image = (Image) object;
- if (device != image.device || transparentPixel != image.transparentPixel || getZoom() != image.getZoom()) return false;
- if (imageProvider != null && image.imageProvider != null) {
- return (styleFlag == image.styleFlag) && imageProvider.equals(image.imageProvider);
- } else {
- return win32_getHandle(this, getZoom()) == win32_getHandle(image, getZoom());
- }
+ if (device != image.device || transparentPixel != image.transparentPixel) return false;
+ return (styleFlag == image.styleFlag) && imageProvider.equals(image.imageProvider);
}
/**
@@ -1095,47 +1074,49 @@ public Color getBackground() {
/* Get the HDC for the device */
long hDC = device.internal_new_GC(null);
- long handle = win32_getHandle(this, getZoom());
-
- /* Compute the background color */
- BITMAP bm = new BITMAP();
- OS.GetObject(handle, BITMAP.sizeof, bm);
- long hdcMem = OS.CreateCompatibleDC(hDC);
- long hOldObject = OS.SelectObject(hdcMem, handle);
- int red = 0, green = 0, blue = 0;
- if (bm.bmBitsPixel <= 8) {
- byte[] color = new byte[4];
- OS.GetDIBColorTable(hdcMem, transparentPixel, 1, color);
- blue = color[0] & 0xFF;
- green = color[1] & 0xFF;
- red = color[2] & 0xFF;
- } else {
- switch (bm.bmBitsPixel) {
- case 16:
- blue = (transparentPixel & 0x1F) << 3;
- green = (transparentPixel & 0x3E0) >> 2;
- red = (transparentPixel & 0x7C00) >> 7;
- break;
- case 24:
- blue = (transparentPixel & 0xFF0000) >> 16;
- green = (transparentPixel & 0xFF00) >> 8;
- red = transparentPixel & 0xFF;
- break;
- case 32:
- blue = (transparentPixel & 0xFF000000) >>> 24;
- green = (transparentPixel & 0xFF0000) >> 16;
- red = (transparentPixel & 0xFF00) >> 8;
- break;
- default:
- return null;
+ return applyUsingAnyHandle(imageHandle -> {
+ long handle = imageHandle.handle;
+ /* Compute the background color */
+ BITMAP bm = new BITMAP();
+ OS.GetObject(handle, BITMAP.sizeof, bm);
+ long hdcMem = OS.CreateCompatibleDC(hDC);
+ long hOldObject = OS.SelectObject(hdcMem, handle);
+ int red = 0, green = 0, blue = 0;
+ if (bm.bmBitsPixel <= 8) {
+ byte[] color = new byte[4];
+ OS.GetDIBColorTable(hdcMem, transparentPixel, 1, color);
+ blue = color[0] & 0xFF;
+ green = color[1] & 0xFF;
+ red = color[2] & 0xFF;
+ } else {
+ switch (bm.bmBitsPixel) {
+ case 16:
+ blue = (transparentPixel & 0x1F) << 3;
+ green = (transparentPixel & 0x3E0) >> 2;
+ red = (transparentPixel & 0x7C00) >> 7;
+ break;
+ case 24:
+ blue = (transparentPixel & 0xFF0000) >> 16;
+ green = (transparentPixel & 0xFF00) >> 8;
+ red = transparentPixel & 0xFF;
+ break;
+ case 32:
+ blue = (transparentPixel & 0xFF000000) >>> 24;
+ green = (transparentPixel & 0xFF0000) >> 16;
+ red = (transparentPixel & 0xFF00) >> 8;
+ break;
+ default:
+ return null;
+ }
}
- }
- OS.SelectObject(hdcMem, hOldObject);
- OS.DeleteDC(hdcMem);
+ OS.SelectObject(hdcMem, hOldObject);
+ OS.DeleteDC(hdcMem);
- /* Release the HDC for the device */
- device.internal_dispose_GC(hDC, null);
- return Color.win32_new(device, (blue << 16) | (green << 8) | red);
+
+ /* Release the HDC for the device */
+ device.internal_dispose_GC(hDC, null);
+ return Color.win32_new(device, (blue << 16) | (green << 8) | red);
+ });
}
/**
@@ -1161,13 +1142,8 @@ Rectangle getBounds(int zoom) {
ImageHandle imageMetadata = zoomLevelToImageHandle.get(zoom);
Rectangle rectangle = new Rectangle(0, 0, imageMetadata.width, imageMetadata.height);
return DPIUtil.scaleBounds(rectangle, zoom, imageMetadata.zoom);
- } else if (this.imageProvider != null) {
- return this.imageProvider.getBounds(zoom);
- } else {
- ImageHandle imageMetadata = zoomLevelToImageHandle.values().iterator().next();
- Rectangle rectangle = new Rectangle(0, 0, imageMetadata.width, imageMetadata.height);
- return DPIUtil.scaleBounds(rectangle, zoom, imageMetadata.zoom);
}
+ return this.imageProvider.getBounds(zoom);
}
/**
@@ -1187,7 +1163,7 @@ Rectangle getBounds(int zoom) {
*/
@Deprecated
public Rectangle getBoundsInPixels() {
- return getBounds(getZoom());
+ return applyUsingAnyHandle(ImageHandle::getBounds);
}
/**
@@ -1244,22 +1220,7 @@ public ImageData getImageData (int zoom) {
if (zoomLevelToImageHandle.containsKey(zoom)) {
return zoomLevelToImageHandle.get(zoom).getImageData();
}
- if (imageProvider != null) {
- return imageProvider.getImageData(zoom);
- }
-
- return getScaledImageData(zoom);
-}
-
-private ImageData getScaledImageData (int zoom) {
- // if a GC is initialized with an Image (memGC != null), the image data must not be resized, because it would
- // be a destructive operation. Therefor, always the current image data must be returned
- if (memGC != null) {
- return getImageDataAtCurrentZoom();
- }
- TreeSet availableZooms = new TreeSet<>(zoomLevelToImageHandle.keySet());
- int closestZoom = Optional.ofNullable(availableZooms.higher(zoom)).orElse(availableZooms.lower(zoom));
- return scaleImageData(getImageMetadata(closestZoom).getImageData(), zoom, closestZoom);
+ return this.imageProvider.newImageData(zoom);
}
@@ -1284,7 +1245,7 @@ private ImageData getScaledImageData (int zoom) {
*/
@Deprecated
public ImageData getImageDataAtCurrentZoom() {
- return getImageMetadata(getZoom()).getImageData();
+ return applyUsingAnyHandle(ImageHandle::getImageData);
}
/**
@@ -1299,10 +1260,7 @@ public ImageData getImageDataAtCurrentZoom() {
*/
@Override
public int hashCode () {
- if(imageProvider != null) {
- return imageProvider.hashCode();
- }
- return (int)win32_getHandle(this, getZoom());
+ return imageProvider.hashCode();
}
static long createDIB(int width, int height, int depth) {
@@ -1736,6 +1694,10 @@ private ImageHandle init(ImageData i, int zoom) {
*/
@Override
public long internal_new_GC (GCData data) {
+ return this.imageProvider.configureGCData(data);
+}
+
+private long configureGC(GCData data, int zoom) {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
/*
* Create a new GC that can draw into the image.
@@ -1745,6 +1707,9 @@ public long internal_new_GC (GCData data) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
+ if(Device.strictChecks) {
+ checkImageTypeForValidCustomDrawing(zoom);
+ }
/* Create a compatible HDC for the device */
long hDC = device.internal_new_GC(null);
long imageDC = OS.CreateCompatibleDC(hDC);
@@ -1760,13 +1725,25 @@ public long internal_new_GC (GCData data) {
data.style |= SWT.LEFT_TO_RIGHT;
}
data.device = device;
- data.nativeZoom = initialNativeZoom;
+ data.nativeZoom = zoom;
data.image = this;
- data.font = SWTFontProvider.getSystemFont(device, initialNativeZoom);
+ data.font = SWTFontProvider.getSystemFont(device, zoom);
}
return imageDC;
}
+private void checkImageTypeForValidCustomDrawing(int zoom) {
+ String replacementInfo = "It should be created with an ImageGcDrawer (see SWT Snippet 384).";
+ if (imageProvider instanceof ImageDataProviderWrapper || imageProvider instanceof ImageFileNameProviderWrapper) {
+ String message = "***WARNING: Image initialized with ImageDataProvider or ImageFileNameProvider is not supposed to be modified.";
+ System.err.println(message + " " + replacementInfo);
+ } else if (!zoomLevelToImageHandle.isEmpty()
+ && (zoomLevelToImageHandle.size() != 1 || !zoomLevelToImageHandle.containsKey(zoom))) {
+ String message = "***WARNING: Images with handles created for multiple zooms should not be modified. ";
+ System.err.println(message + " " + replacementInfo);
+ }
+}
+
/**
* Invokes platform specific functionality to dispose a GC handle.
*
@@ -1799,10 +1776,7 @@ public void internal_dispose_GC (long hDC, GCData data) {
*/
@Override
public boolean isDisposed() {
- if (this.imageProvider != null) {
- return this.imageProvider.isDisposed();
- }
- return zoomLevelToImageHandle.isEmpty();
+ return !isInitialized || isDestroyed;
}
/**
@@ -1849,43 +1823,6 @@ public void setBackground(Color color) {
zoomLevelToImageHandle.values().forEach(imageHandle -> imageHandle.setBackground(backgroundColor));
}
-private ImageData scaleImageData(final ImageData imageData, int targetZoom, int currentZoom) {
- if (imageData == null || targetZoom == currentZoom || (device != null && !device.isAutoScalable())) return imageData;
- float scaleFactor = (float) targetZoom / (float) currentZoom;
- int width = imageData.width;
- int height = imageData.height;
- int scaledWidth = Math.round (width * scaleFactor);
- int scaledHeight = Math.round (height * scaleFactor);
- boolean useSmoothScaling = DPIUtil.isSmoothScalingEnabled() && imageData.getTransparencyType() != SWT.TRANSPARENCY_MASK;
- if (useSmoothScaling) {
- return scaleToUsingSmoothScaling(scaledWidth, scaledHeight, imageData);
- }
- return imageData.scaledTo (scaledWidth, scaledHeight);
-}
-
-private ImageData scaleToUsingSmoothScaling(int width, int height, ImageData imageData) {
- Image original = new Image (device, (ImageDataProvider) zoom -> imageData);
- /* Create a 24 bit image data with alpha channel */
- final ImageData resultData = new ImageData (width, height, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000));
- resultData.alphaData = new byte [width * height];
- Image resultImage = new Image (device, (ImageDataProvider) zoom -> resultData);
- GC gc = new GC (resultImage);
- gc.setAntialias (SWT.ON);
- gc.drawImage (original, 0, 0, imageData.width, imageData.height,
- /* E.g. destWidth here is effectively DPIUtil.autoScaleDown (scaledWidth), but avoiding rounding errors.
- * Nevertheless, we still have some rounding errors due to the point-based API GC#drawImage(..).
- */
- 0, 0, width, height, false);
- gc.dispose ();
- original.dispose ();
- ImageData result = resultImage.getImageData (resultImage.getZoom());
- resultImage.dispose ();
- return result;
-}
-
-private int getZoom() {
- return DPIUtil.getZoomForAutoscaleProperty(initialNativeZoom);
-}
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
@@ -1898,6 +1835,18 @@ public String toString () {
return "Image {" + zoomLevelToImageHandle + "}";
}
+ T applyUsingAnyHandle(Function function) {
+ if (zoomLevelToImageHandle.isEmpty()) {
+ ImageHandle temporaryHandle = this.imageProvider.newImageHandle(DPIUtil.getDeviceZoom());
+ try {
+ return function.apply(temporaryHandle);
+ } finally {
+ temporaryHandle.destroy();
+ }
+ }
+ return function.apply(zoomLevelToImageHandle.values().iterator().next());
+}
+
/**
* Invokes platform specific functionality to allocate a new image.
*
@@ -1916,88 +1865,162 @@ public String toString () {
* @noreference This method is not intended to be referenced by clients.
*/
public static Image win32_new(Device device, int type, long handle, int nativeZoom) {
- Image image = new Image(device, nativeZoom);
- image.type = type;
- image.new ImageHandle(handle, nativeZoom);
- image.device.registerResourceWithZoomSupport(image);
- return image;
+ return new Image(device, type, handle, nativeZoom);
}
private abstract class AbstractImageProviderWrapper {
- private boolean isDestroyed;
protected abstract Rectangle getBounds(int zoom);
- abstract ImageData getImageData(int zoom);
- abstract ImageHandle getImageMetadata(int zoom);
+
+ protected long configureGCData(GCData data) {
+ return configureGC(data, 100);
+ }
+
+ public Collection getPreservedZoomLevels() {
+ return Collections.emptySet();
+ }
+
+ abstract ImageData newImageData(int zoom);
+
abstract AbstractImageProviderWrapper createCopy(Image image);
- protected boolean isDisposed() {
- return !isInitialized || isDestroyed;
+ ImageData getScaledImageData (int zoom) {
+ // if a GC is initialized with an Image (memGC != null), the image data must not be resized, because it would
+ // be a destructive operation. Therefor, always the current image data must be returned
+ if (memGC != null) {
+ return getImageDataAtCurrentZoom();
+ }
+ TreeSet availableZooms = new TreeSet<>(zoomLevelToImageHandle.keySet());
+ int closestZoom = Optional.ofNullable(availableZooms.higher(zoom)).orElse(availableZooms.lower(zoom));
+ return DPIUtil.scaleImageData(device, getImageMetadata(closestZoom).getImageData(), zoom, closestZoom);
+ }
+
+ protected ImageHandle newImageHandle(int zoom) {
+ ImageData resizedData = getImageData(zoom);
+ return newImageHandle(resizedData, zoom);
}
- protected void destroy() {
- this.isDestroyed = true;
+ protected final ImageHandle newImageHandle(ImageData data, int zoom) {
+ if (type == SWT.ICON && data.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
+ // If the original type was an icon with transparency mask and re-scaling leads
+ // to image data without transparency mask, this will create invalid images
+ // so this fallback will "repair" the image data by explicitly passing
+ // the transparency mask created from the scaled image data
+ return initIconHandle(device, data, data.getTransparencyMask(), zoom);
+ } else {
+ return init(data, zoom);
+ }
+ }
+}
+
+private class ExistingImageHandleProviderWrapper extends AbstractImageProviderWrapper {
+
+ private final int width;
+ private final int height;
+ private final long handle;
+ private final int zoomForHandle;
+
+ public ExistingImageHandleProviderWrapper(long handle, int zoomForHandle) {
+ this.handle = handle;
+ this.zoomForHandle = zoomForHandle;
+ ImageHandle imageHandle = new ImageHandle(handle, zoomForHandle);
+
+ ImageData baseData = imageHandle.getImageData();
+ this.width = DPIUtil.scaleDown(baseData.width, zoomForHandle);
+ this.height = DPIUtil.scaleDown(baseData.height, zoomForHandle);
+ }
+
+ @Override
+ protected Rectangle getBounds(int zoom) {
+ Rectangle rectangle = new Rectangle(0, 0, width, height);
+ return DPIUtil.scaleUp(rectangle, zoom);
+ }
+
+ @Override
+ ImageData newImageData(int zoom) {
+ return getScaledImageData(zoom);
+ }
+
+ @Override
+ AbstractImageProviderWrapper createCopy(Image image) {
+ return image.new ExistingImageHandleProviderWrapper(handle, zoomForHandle);
+ }
+
+ @Override
+ public Collection getPreservedZoomLevels() {
+ return Collections.singleton(zoomForHandle);
}
}
private abstract class ImageFromImageDataProviderWrapper extends AbstractImageProviderWrapper {
+ private final Map cachedImageData = new HashMap<>();
protected abstract ElementAtZoom loadImageData(int zoom);
void initImage() {
// As the init call configured some Image attributes (e.g. type)
// it must be called
- ImageData imageDataAt100 = getImageData(100);
- init(imageDataAt100, 100);
- destroyHandleForZoom(100);
+ newImageData(100);
}
@Override
- ImageData getImageData(int zoom) {
- if (zoomLevelToImageHandle.containsKey(zoom)) {
- return zoomLevelToImageHandle.get(zoom).getImageData();
- }
- if (!zoomLevelToImageHandle.isEmpty()) {
- return getScaledImageData(zoom);
- }
- ElementAtZoom loadedImageData = loadImageData(zoom);
- return DPIUtil.scaleImageData(device, loadedImageData, zoom);
+ ImageData newImageData(int zoom) {
+ Function imageDataRetrieval = zoomToRetrieve -> {
+ ImageHandle handle = initializeHandleFromSource(zoomToRetrieve);
+ ImageData data = handle.getImageData();
+ handle.destroy();
+ return data;
+ };
+ return cachedImageData.computeIfAbsent(zoom, imageDataRetrieval);
}
@Override
- ImageHandle getImageMetadata(int zoom) {
- if (zoomLevelToImageHandle.containsKey(zoom)) {
- return zoomLevelToImageHandle.get(zoom);
- } else {
- ImageData scaledImageData = getImageData(zoom);
- ImageHandle imageHandle = init(scaledImageData, zoom);
- return imageHandle;
+ protected ImageHandle newImageHandle(int zoom) {
+ ImageData cachedData = cachedImageData.remove(zoom);
+ if (cachedData != null) {
+ return newImageHandle(cachedData, zoom);
}
+ return initializeHandleFromSource(zoom);
+ }
+
+ private ImageHandle initializeHandleFromSource(int zoom) {
+ ElementAtZoom imageDataAtZoom = loadImageData(zoom);
+ ImageData imageData = DPIUtil.scaleImageData(device, imageDataAtZoom.element(), zoom, imageDataAtZoom.zoom());
+ imageData = adaptImageDataIfDisabledOrGray(imageData);
+ return newImageHandle(imageData, zoom);
}
+
}
private class PlainImageDataProviderWrapper extends ImageFromImageDataProviderWrapper {
- private ImageData imageDataAt100;
+ private ImageData imageDataAtBaseZoom;
+ private int baseZoom;
PlainImageDataProviderWrapper(ImageData imageData) {
- this.imageDataAt100 = (ImageData) imageData.clone();
+ this(imageData, 100);
+ }
+
+ private PlainImageDataProviderWrapper(ImageData imageData, int zoom) {
+ this.imageDataAtBaseZoom = (ImageData) imageData.clone();
+ this.baseZoom = zoom;
initImage();
}
@Override
protected Rectangle getBounds(int zoom) {
- Rectangle rectangle = new Rectangle(0, 0, imageDataAt100.width, imageDataAt100.height);
+ Rectangle rectangle = new Rectangle(0, 0, imageDataAtBaseZoom.width, imageDataAtBaseZoom.height);
+ rectangle = DPIUtil.scaleDown(rectangle, baseZoom);
return DPIUtil.scaleUp(rectangle, zoom);
}
@Override
protected ElementAtZoom loadImageData(int zoom) {
- return new ElementAtZoom<>(imageDataAt100, 100);
+ return new ElementAtZoom<>(imageDataAtBaseZoom, baseZoom);
}
@Override
AbstractImageProviderWrapper createCopy(Image image) {
- return image.new PlainImageDataProviderWrapper(this.imageDataAt100);
+ return image.new PlainImageDataProviderWrapper(this.imageDataAtBaseZoom);
}
}
@@ -2061,13 +2084,14 @@ protected Rectangle getBounds(int zoom) {
@Override
AbstractImageProviderWrapper createCopy(Image image) {
- return new ImageDataLoaderStreamProviderWrapper(inputStreamData);
+ return image.new ImageDataLoaderStreamProviderWrapper(inputStreamData);
}
}
private class PlainImageProviderWrapper extends AbstractImageProviderWrapper {
private final int width;
private final int height;
+ private int baseZoom;
PlainImageProviderWrapper(int width, int height) {
if (width <= 0 || height <= 0) {
@@ -2078,6 +2102,16 @@ private class PlainImageProviderWrapper extends AbstractImageProviderWrapper {
type = SWT.BITMAP;
}
+ @Override
+ public Collection getPreservedZoomLevels() {
+ return Collections.singleton(baseZoom);
+ }
+
+ @Override
+ protected long configureGCData(GCData data) {
+ return configureGC(data, DPIUtil.getDeviceZoom());
+ }
+
@Override
protected Rectangle getBounds(int zoom) {
Rectangle rectangle = new Rectangle(0, 0, width, height);
@@ -2085,29 +2119,27 @@ protected Rectangle getBounds(int zoom) {
}
@Override
- ImageData getImageData(int zoom) {
- if (zoomLevelToImageHandle.isEmpty() || zoomLevelToImageHandle.containsKey(zoom)) {
- return getImageMetadata(zoom).getImageData();
+ ImageData newImageData(int zoom) {
+ if (zoomLevelToImageHandle.isEmpty()) {
+ return createBaseHandle(zoom).getImageData();
}
-
return getScaledImageData(zoom);
}
@Override
- ImageHandle getImageMetadata(int zoom) {
+ protected ImageHandle newImageHandle(int zoom) {
if (zoomLevelToImageHandle.isEmpty()) {
- long handle = initBaseHandle(zoom);
- ImageHandle imageHandle = new ImageHandle(handle, zoom);
- zoomLevelToImageHandle.put(zoom, imageHandle);
- return imageHandle;
- } else if(zoomLevelToImageHandle.containsKey(zoom)) {
- return zoomLevelToImageHandle.get(zoom);
- } else {
- ImageData resizedData = getImageData(zoom);
- ImageData newData = adaptImageDataIfDisabledOrGray(resizedData);
- init(newData, zoom);
- return zoomLevelToImageHandle.get(zoom);
+ return createBaseHandle(zoom);
}
+ return super.newImageHandle(zoom);
+ }
+
+ private ImageHandle createBaseHandle(int zoom) {
+ long handle = initBaseHandle(zoom);
+ baseZoom = zoom;
+ ImageHandle imageHandle = new ImageHandle(handle, zoom);
+ zoomLevelToImageHandle.put(zoom, imageHandle);
+ return imageHandle;
}
private long initBaseHandle(int zoom) {
@@ -2185,18 +2217,19 @@ Object getProvider() {
}
@Override
- final ImageData getImageData(int zoom) {
+ ImageData newImageData(int zoom) {
Function imageDataRetrival = zoomToRetrieve -> {
ImageHandle handle = initializeHandleFromSource(zoomToRetrieve);
ImageData data = handle.getImageData();
- destroyHandleForZoom(zoomToRetrieve);
+ handle.destroy();
return data;
};
return cachedImageData.computeIfAbsent(zoom, imageDataRetrival);
}
+
@Override
- final ImageHandle getImageMetadata(int zoom) {
+ protected ImageHandle newImageHandle(int zoom) {
ImageData cachedData = cachedImageData.remove(zoom);
if (cachedData != null) {
return init(cachedData, zoom);
@@ -2206,7 +2239,7 @@ final ImageHandle getImageMetadata(int zoom) {
private ImageHandle initializeHandleFromSource(int zoom) {
ElementAtZoom imageDataAtZoom = loadImageData(zoom);
- ImageData imageData = scaleImageData(imageDataAtZoom.element(), zoom, imageDataAtZoom.zoom());
+ ImageData imageData = DPIUtil.scaleImageData (device,imageDataAtZoom.element(), zoom, imageDataAtZoom.zoom());
imageData = adaptImageDataIfDisabledOrGray(imageData);
return init(imageData, zoom);
}
@@ -2223,6 +2256,9 @@ protected Rectangle getBounds(int zoom) {
private class ImageFileNameProviderWrapper extends BaseImageProviderWrapper {
ImageFileNameProviderWrapper(ImageFileNameProvider provider) {
super(provider, ImageFileNameProvider.class);
+ // Checks for the contract of the passed provider require
+ // checking for valid image data creation
+ newImageData(DPIUtil.getDeviceZoom());
}
@Override
@@ -2232,7 +2268,7 @@ protected ElementAtZoom loadImageData(int zoom) {
// Load at appropriate zoom via loader
if (fileForZoom.zoom() != zoom && ImageDataLoader.canLoadAtZoom(fileForZoom.element(), fileForZoom.zoom(), zoom)) {
ElementAtZoom imageDataAtZoom = ImageDataLoader.load(fileForZoom.element(), fileForZoom.zoom(), zoom);
- return new ElementAtZoom<>(adaptImageDataIfDisabledOrGray(imageDataAtZoom.element()), zoom);
+ return new ElementAtZoom<>(imageDataAtZoom.element(), zoom);
}
// Load at file zoom (native or via loader) and rescale
@@ -2247,14 +2283,14 @@ protected ElementAtZoom loadImageData(int zoom) {
imageDataAtZoom = ImageDataLoader.load(fileForZoom.element(), fileForZoom.zoom(), zoom);
} else {
imageDataAtZoom = new ElementAtZoom<>(nativeInitializedImage.getImageData(), fileForZoom.zoom());
- destroyHandleForZoom(zoom);
+ nativeInitializedImage.destroy();
}
return imageDataAtZoom;
}
@Override
public int hashCode() {
- return Objects.hash(provider, styleFlag, transparentPixel, getZoom());
+ return Objects.hash(provider, styleFlag, transparentPixel);
}
@Override
@@ -2476,6 +2512,7 @@ private class ImageGcDrawerWrapper extends DynamicImageProviderWrapper {
private ImageGcDrawer drawer;
private int width;
private int height;
+ private int currentZoom = 100;
ImageGcDrawerWrapper(ImageGcDrawer imageGcDrawer, int width, int height) {
checkProvider(imageGcDrawer, ImageGcDrawer.class);
@@ -2491,27 +2528,62 @@ protected Rectangle getBounds(int zoom) {
}
@Override
- ImageData getImageData(int zoom) {
+ protected long configureGCData(GCData data) {
+ return configureGC(data, currentZoom);
+ }
+
+ @Override
+ ImageData newImageData(int zoom) {
return getImageMetadata(zoom).getImageData();
}
@Override
- ImageHandle getImageMetadata(int zoom) {
- initialNativeZoom = zoom;
- Image image = new Image(device, width, height, zoom);
- GC gc = new GC(image, drawer.getGcStyle());
+ protected ImageHandle newImageHandle(int zoom) {
+ currentZoom = zoom;
+ int gcStyle = drawer.getGcStyle();
+ Image image;
+ if ((gcStyle & SWT.TRANSPARENT) != 0) {
+ int scaledHeight = DPIUtil.scaleUp(height, zoom);
+ int scaledWidth = DPIUtil.scaleUp(width, zoom);
+ /* Create a 24 bit image data with alpha channel */
+ final ImageData resultData = new ImageData (scaledWidth, scaledHeight, 24, new PaletteData (0xFF, 0xFF00, 0xFF0000));
+ resultData.alphaData = new byte [scaledWidth * scaledHeight];
+ image = new Image(device, resultData, zoom);
+ } else {
+ image = new Image(device, width, height);
+ }
+ GC gc = new GC(new DrawableWrapper(image, zoom), gcStyle);
try {
gc.data.nativeZoom = zoom;
drawer.drawOn(gc, width, height);
ImageData imageData = image.getImageMetadata(zoom).getImageData();
drawer.postProcess(imageData);
ImageData newData = adaptImageDataIfDisabledOrGray(imageData);
- init(newData, zoom);
+ return init(newData, zoom);
} finally {
gc.dispose();
image.dispose();
}
- return zoomLevelToImageHandle.get(zoom);
+ }
+
+ private class DrawableWrapper implements Drawable {
+ private final Image image;
+ private final int zoom;
+
+ public DrawableWrapper(Image image, int zoom) {
+ this.image = image;
+ this.zoom = zoom;
+ }
+
+ @Override
+ public long internal_new_GC(GCData data) {
+ return this.image.configureGC(data, zoom);
+ }
+
+ @Override
+ public void internal_dispose_GC(long handle, GCData data) {
+ this.image.internal_dispose_GC(handle, data);
+ }
}
@Override
@@ -2537,7 +2609,7 @@ public boolean equals(Object otherProvider) {
}
private class ImageHandle {
- private final long handle;
+ private long handle;
private final int zoom;
private int height;
private int width;
@@ -2552,6 +2624,10 @@ public ImageHandle(long handle, int zoom) {
setImageMetadataForHandle(this, zoom);
}
+ public Rectangle getBounds() {
+ return new Rectangle(0, 0, width, height);
+ }
+
private void setBackground(RGB color) {
if (transparentPixel == -1) return;
@@ -2883,5 +2959,14 @@ private boolean isDisposed() {
return this.handle == 0;
}
+ private void destroy() {
+ zoomLevelToImageHandle.remove(zoom, this);
+ if (type == SWT.ICON) {
+ OS.DestroyIcon (handle);
+ } else {
+ OS.DeleteObject (handle);
+ }
+ handle = 0;
+ }
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
index 799300b963d..99f44be4d7f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
@@ -763,7 +763,7 @@ private void addStringInPixels(PathHandle pathHandle, float x, float y) {
char[] buffer = string.toCharArray();
long hDC = device.internal_new_GC(null);
long [] family = new long [1];
- long gdipFont = GC.createGdipFont(hDC, SWTFontProvider.getFont(device, this.fontData, zoom).handle, 0, device.fontCollection, family, null);
+ long gdipFont = GC.createGdipFont(hDC, SWTFontProvider.getFontHandle(device, this.fontData, zoom), 0, device.fontCollection, family, null);
PointF point = new PointF();
point.X = x - (Gdip.Font_GetSize(gdipFont) / 6);
point.Y = y;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
index 0db4dc40e3a..23f745c6cc8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java
@@ -705,7 +705,7 @@ long createGdipBrush(Color color, int alpha) {
*/
public void draw (GC gc, int x, int y) {
checkLayout();
- drawInPixels(gc, DPIUtil.scaleUp(getDevice(), x, getZoom(gc)), DPIUtil.scaleUp(getDevice(), y, getZoom(gc)));
+ drawInPixels(gc, x, y);
}
/**
@@ -729,11 +729,11 @@ public void draw (GC gc, int x, int y) {
*/
public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) {
checkLayout();
- drawInPixels(gc, DPIUtil.scaleUp(getDevice(), x, getZoom(gc)), DPIUtil.scaleUp(getDevice(), y, getZoom(gc)), selectionStart, selectionEnd, selectionForeground, selectionBackground);
+ drawInPixels(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground);
}
-void drawInPixels (GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) {
- drawInPixels(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0);
+void drawInPixels (GC gc, int xInPoints, int yInPoints, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) {
+ drawInPixels(gc, xInPoints, yInPoints, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0);
}
/**
@@ -765,7 +765,7 @@ void drawInPixels (GC gc, int x, int y, int selectionStart, int selectionEnd, Co
*/
public void draw (GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) {
checkLayout();
- drawInPixels(gc, DPIUtil.scaleUp(getDevice(), x, getZoom(gc)), DPIUtil.scaleUp(getDevice(), y, getZoom(gc)), selectionStart, selectionEnd, selectionForeground, selectionBackground, flags);
+ drawInPixels(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, flags);
}
private int getNativeZoom(GC gc) {
@@ -783,11 +783,11 @@ private int getZoom() {
return DPIUtil.getZoomForAutoscaleProperty(nativeZoom);
}
-void drawInPixels (GC gc, int x, int y) {
- drawInPixels(gc, x, y, -1, -1, null, null);
+void drawInPixels (GC gc, int xInPoints, int yInPoints) {
+ drawInPixels(gc, xInPoints, yInPoints, -1, -1, null, null);
}
-void drawInPixels (GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) {
+void drawInPixels (GC gc, int xInPoints, int yInPoints, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) {
computeRuns(gc);
if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -795,7 +795,7 @@ void drawInPixels (GC gc, int x, int y, int selectionStart, int selectionEnd, Co
if (selectionBackground != null && selectionBackground.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
int length = text.length();
if (length == 0 && flags == 0) return;
- y += getScaledVerticalIndent();
+ yInPoints += verticalIndentInPoints;
long hdc = gc.handle;
Rectangle clip = gc.getClippingInPixels();
GCData data = gc.data;
@@ -835,14 +835,17 @@ void drawInPixels (GC gc, int x, int y, int selectionStart, int selectionEnd, Co
selectionEnd = translateOffset(Math.min(Math.max(0, selectionEnd), length - 1));
}
}
+ int x = DPIUtil.scaleUp(getDevice(), xInPoints, getZoom(gc));
RECT rect = new RECT();
OS.SetBkMode(hdc, OS.TRANSPARENT);
for (int line=0; line= clip.x) {
if (!run.lineBreak || run.softBreak) {
if (extents) {
- OS.SetRect(rect, drawX, drawY, drawX + run.width, drawY + lineHeightWithSpacing);
+ OS.SetRect(rect, drawX, drawY, drawX + run.width, drawYWithLineHeightWithSpacing);
}else {
- OS.SetRect(rect, drawX, drawY, drawX + run.width, drawY + lineHeight);
+ OS.SetRect(rect, drawX, drawY, drawX + run.width, drawYWithLineHeight);
}
if (gdip) {
drawRunBackgroundGDIP(run, gdipGraphics, rect, selectionStart, selectionEnd, alpha, gdipSelBackground, hasSelection);
@@ -1969,12 +1972,12 @@ long getItemFont (StyleItem item, GC gc) {
if (item.fallbackFont != 0) return item.fallbackFont;
final int zoom = getNativeZoom(gc);
if (item.style != null && item.style.font != null) {
- return Font.win32_new(item.style.font, zoom).handle;
+ return SWTFontProvider.getFontHandle(item.style.font, zoom);
}
if (this.font != null) {
- return Font.win32_new(this.font, zoom).handle;
+ return SWTFontProvider.getFontHandle(this.font, zoom);
}
- return SWTFontProvider.getSystemFont(device, zoom).handle;
+ return SWTFontProvider.getSystemFontHandle(device, zoom);
}
/**
@@ -2131,15 +2134,15 @@ public FontMetrics getLineMetrics (int lineIndex) {
long hDC = device.internal_new_GC(null);
long srcHdc = OS.CreateCompatibleDC(hDC);
TEXTMETRIC lptm = new TEXTMETRIC();
- Font availableFont = font != null ? font : device.systemFont;
- OS.SelectObject(srcHdc, availableFont.handle);
+ final int zoom = getZoom();
+ long availableFont = font != null ? SWTFontProvider.getFontHandle(font, zoom) : SWTFontProvider.getSystemFontHandle(device, zoom);
+ OS.SelectObject(srcHdc, availableFont);
metricsAdapter.GetTextMetrics(srcHdc, lptm);
OS.DeleteDC(srcHdc);
device.internal_dispose_GC(hDC, null);
- final int zoom = getZoom();
int ascentInPoints = Math.max(DPIUtil.scaleDown(this.device, lptm.tmAscent, zoom), this.ascent);
int descentInPoints = Math.max(DPIUtil.scaleDown(this.device, lptm.tmDescent, zoom), this.descent);
- int leadingInPoints = DPIUtil.scaleDown(this.device, lptm.tmInternalLeading, availableFont.zoom);
+ int leadingInPoints = DPIUtil.scaleDown(this.device, lptm.tmInternalLeading, zoom);
if (text.length() != 0) {
for (StyleItem run : runs[lineIndex]) {
if (run.ascentInPoints > ascentInPoints) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java
index ba47b8ce771..89a56015346 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java
@@ -71,6 +71,11 @@ public Font getFont(FontData fontData, int zoom) {
return font;
}
+ @Override
+ public Font getFont(long fontHandle, int zoom) {
+ return Font.win32_new(device, fontHandle, zoom);
+ }
+
private Font registerFont(FontData fontData, Font font) {
FontData clonedFontData = new FontData(fontData.toString());
fontsMap.put(clonedFontData, font);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontProvider.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontProvider.java
index 1f4cae17f0e..4901a2e01f0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontProvider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontProvider.java
@@ -16,6 +16,7 @@
import java.util.*;
import java.util.concurrent.*;
+import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
@@ -46,6 +47,10 @@ public static Font getSystemFont(Device device, int zoom) {
return getFontRegistry(device).getSystemFont(zoom);
}
+ public static long getSystemFontHandle(Device device, int zoom) {
+ return Font.win32_getHandle(getSystemFont(device, zoom));
+ }
+
/**
* Returns the font with the given font data for the given device at the
* specified zoom.
@@ -61,6 +66,32 @@ public static Font getFont(Device device, FontData fontData, int zoom) {
return getFontRegistry(device).getFont(fontData, zoom);
}
+ public static long getFontHandle(Device device, FontData fontData, int zoom) {
+ return Font.win32_getHandle(getFont(device, fontData, zoom));
+ }
+
+ public static long getFontHandle(Font font, int zoom) {
+ if (font == null) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ }
+ return Font.win32_getHandle(getFont(font.getDevice(), font.getFontData()[0], zoom));
+ }
+
+ /**
+ * Returns the font with the given fontHandle for the given device at the
+ * specified zoom.
+ *
+ * Note: This operation is not thread-safe. It must thus always be called
+ * from the same thread for the same device, such as the display's UI thread.
+ *
+ * @param device the device to retrieve the font for, must not be {@code null}
+ * @param fontHandle the handle to an existing font
+ * @param zoom the zoom for which the font shall be scaled
+ */
+ public static Font getFont(Device device, long fontHandle, int zoom) {
+ return getFontRegistry(device).getFont(fontHandle, zoom);
+ }
+
/**
* Disposes the font registry for the given device, if one exists.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontRegistry.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontRegistry.java
index 02a19ee2a1d..f045453bc9a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontRegistry.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/SWTFontRegistry.java
@@ -46,6 +46,18 @@ public interface SWTFontRegistry {
*/
Font getFont(FontData fontData, int zoom);
+
+ /**
+ * Provides a font optimally suited for the specified zoom. If the handle is yet unknown to
+ * the registry, the font will not be managed by the font registry. Only Fonts created in the
+ * font registry are managed by it and should not be disposed of externally.
+ *
+ * @param fontHandle the handle to an existing font
+ * @param zoom zoom in % of the standard resolution to determine the appropriate font
+ * @return the font best suited for the specified zoom
+ */
+ Font getFont(long fontHandle, int zoom);
+
/**
* Disposes all fonts managed by the font registry.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java
index 435a7ddb934..fcd71786440 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java
@@ -44,6 +44,7 @@ private Font getScaledFont(int zoom) {
private Font createAndCacheFont(int zoom) {
Font newFont = createFont(zoom);
+ customFontHandlesKeyMap.put(Font.win32_getHandle(newFont), this);
scaledFonts.put(zoom, newFont);
return newFont;
}
@@ -96,12 +97,8 @@ private long createSystemFontHandle(int zoom) {
}
private static boolean fetchSystemParametersInfo(NONCLIENTMETRICS info, int targetZoom) {
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1607) {
- return OS.SystemParametersInfoForDpi(OS.SPI_GETNONCLIENTMETRICS, NONCLIENTMETRICS.sizeof, info, 0,
- DPIUtil.mapZoomToDPI(targetZoom));
- } else {
- return OS.SystemParametersInfo(OS.SPI_GETNONCLIENTMETRICS, 0, info, 0);
- }
+ return OS.SystemParametersInfoForDpi(OS.SPI_GETNONCLIENTMETRICS, NONCLIENTMETRICS.sizeof, info, 0,
+ DPIUtil.mapZoomToDPI(targetZoom));
}
@Override
@@ -112,6 +109,7 @@ protected void dispose() {
private ScaledFontContainer systemFontContainer;
private Map customFontsKeyMap = new HashMap<>();
+ private Map customFontHandlesKeyMap = new HashMap<>();
private Device device;
ScalingSWTFontRegistry(Device device) {
@@ -137,6 +135,14 @@ public Font getFont(FontData fontData, int zoom) {
return container.getScaledFont(zoom);
}
+ @Override
+ public Font getFont(long fontHandle, int zoom) {
+ if (customFontHandlesKeyMap.containsKey(fontHandle)) {
+ return customFontHandlesKeyMap.get(fontHandle).getScaledFont(zoom);
+ }
+ return Font.win32_new(device, fontHandle, zoom);
+ }
+
@Override
public void dispose() {
customFontsKeyMap.values().forEach(ScaledFontContainer::dispose);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
index ca2f165452e..788d239be88 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
@@ -20,6 +20,7 @@
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
+import org.eclipse.swt.internal.win32.version.*;
/**
* Instances of this class represent a selectable user interface object that
@@ -1351,7 +1352,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long wParam, long lParam) {
int inset = 2;
int radius = 3;
- if (useDarkModeExplorerTheme && (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN11_21H2)) {
+ if (useDarkModeExplorerTheme && OsVersion.IS_WIN11_21H2) {
// On Win11, Light theme and Dark theme images have different sizes
inset = 1;
radius = 4;
@@ -1362,7 +1363,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long wParam, long lParam) {
int r = nmcd.right - inset;
int b = nmcd.bottom - inset;
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN11_21H2) {
+ if (OsVersion.IS_WIN11_21H2) {
// 'RoundRect' has left/top pixel reserved for border
l += 1;
t += 1;
@@ -1488,7 +1489,7 @@ static int getThemeStateId(int style, boolean pressed, boolean enabled) {
* The workaround is to use hot image in place of default.
*/
boolean hot = false;
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN11_21H2) {
+ if (OsVersion.IS_WIN11_21H2) {
if (!pressed && enabled) {
hot = true;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
index 4f0af0d4603..ade9c8d87e2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
@@ -152,7 +152,7 @@ public Font getFont () {
checkWidget();
if (font == null) {
long hFont = defaultFont ();
- return Font.win32_new (display, hFont, getZoom());
+ return Font.win32_new (display, hFont, getNativeZoom());
}
return font;
}
@@ -478,8 +478,7 @@ public void setFont (Font font) {
if (font != null && font.isDisposed ()) {
error (SWT.ERROR_INVALID_ARGUMENT);
}
- Shell shell = parent.getShell();
- this.font = font == null ? null : Font.win32_new(font, shell.nativeZoom);
+ this.font = font == null ? null : Font.win32_new(font, getNativeZoom());
if (hasFocus ()) setIMEFont ();
}
@@ -510,7 +509,7 @@ public void setImage (Image image) {
void setIMEFont () {
if (!OS.IsDBLocale) return;
long hFont = 0;
- if (font != null) hFont = font.handle;
+ if (font != null) hFont = SWTFontProvider.getFontHandle(font, getNativeZoom());
if (hFont == 0) hFont = defaultFont ();
long hwnd = parent.handle;
long hIMC = OS.ImmGetContext (hwnd);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index f360f696dd5..e257c77d309 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -1419,7 +1419,7 @@ LRESULT WM_GETFONT (long wParam, long lParam) {
if (result != null) return result;
long code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam);
if (code != 0) return new LRESULT (code);
- return new LRESULT (font != null ? font.handle : defaultFont ());
+ return new LRESULT (font != null ? SWTFontProvider.getFontHandle(font, getNativeZoom()) : defaultFont ());
}
@Override
@@ -1525,7 +1525,7 @@ LRESULT WM_PAINT (long wParam, long lParam) {
Control control = findBackgroundControl ();
if (control == null) control = this;
data.background = control.getBackgroundPixel ();
- data.font = Font.win32_new(display, OS.SendMessage (handle, OS.WM_GETFONT, 0, 0), nativeZoom);
+ data.font = SWTFontProvider.getFont(display, OS.SendMessage (handle, OS.WM_GETFONT, 0, 0), getNativeZoom());
data.uiState = (int)OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0);
if ((style & SWT.NO_BACKGROUND) != 0) {
/* This code is intentionally commented because it may be slow to copy bits from the screen */
@@ -1536,6 +1536,7 @@ LRESULT WM_PAINT (long wParam, long lParam) {
drawBackground (phdc [0], rect);
}
GC gc = createNewGC(phdc [0], data);
+
Event event = new Event ();
event.gc = gc;
event.setBounds(DPIUtil.scaleDown(new Rectangle(ps.left, ps.top, width, height), getZoom()));
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 8ba482a4713..e32faf76eef 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -721,7 +721,7 @@ int defaultBackground () {
}
long defaultFont() {
- return display.getSystemFont(getShell().nativeZoom).handle;
+ return SWTFontProvider.getSystemFontHandle(display, getNativeZoom());
}
int defaultForeground () {
@@ -1315,7 +1315,7 @@ public Font getFont () {
if (font != null) return font;
long hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
if (hFont == 0) hFont = defaultFont ();
- return Font.win32_new (display, hFont, getShell().nativeZoom);
+ return SWTFontProvider.getFont(display, hFont, getNativeZoom());
}
/**
@@ -1753,14 +1753,18 @@ public long internal_new_GC (GCData data) {
}
}
data.device = display;
- data.nativeZoom = nativeZoom;
+ data.nativeZoom = getNativeZoom();
int foreground = getForegroundPixel ();
if (foreground != OS.GetTextColor (hDC)) data.foreground = foreground;
Control control = findBackgroundControl ();
if (control == null) control = this;
int background = control.getBackgroundPixel ();
if (background != OS.GetBkColor (hDC)) data.background = background;
- data.font = font != null ? font : Font.win32_new (display, OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0));
+ if (font != null) {
+ data.font = font;
+ } else {
+ data.font = SWTFontProvider.getFont(display, OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0), data.nativeZoom);
+ }
data.uiState = (int)OS.SendMessage (hwnd, OS.WM_QUERYUISTATE, 0, 0);
}
return hDC;
@@ -2225,13 +2229,11 @@ public boolean print (GC gc) {
int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
OS.RedrawWindow (topHandle, null, 0, flags);
int printWindowFlags = 0;
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN8_1) {
- /*
- * Undocumented flag in windows, which also allows the capturing
- * of GPU-drawn areas, e.g. an embedded Edge WebView2.
- */
- printWindowFlags |= OS.PW_RENDERFULLCONTENT;
- }
+ /*
+ * Undocumented flag in windows, which also allows the capturing
+ * of GPU-drawn areas, e.g. an embedded Edge WebView2.
+ */
+ printWindowFlags |= OS.PW_RENDERFULLCONTENT;
printWidget (topHandle, hdc, gc, printWindowFlags);
if (gdipGraphics != 0) {
OS.RestoreDC(hdc, state);
@@ -3255,7 +3257,8 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags, boolean
public void setBounds (Rectangle rect) {
checkWidget ();
if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
- setBoundsInPixels(DPIUtil.scaleUp(rect, getZoom()));
+ int zoom = autoScaleDisabled ? parent.getZoom() : getZoom();
+ setBoundsInPixels(DPIUtil.scaleUp(rect, zoom));
}
void setBoundsInPixels (Rectangle rect) {
@@ -3330,7 +3333,7 @@ public void setCursor (Cursor cursor) {
}
void setDefaultFont () {
- long hFont = display.getSystemFont (getShell().nativeZoom).handle;
+ long hFont = SWTFontProvider.getSystemFontHandle(display, getNativeZoom());
OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
}
@@ -3432,12 +3435,12 @@ public void setFont (Font font) {
Font newFont = font;
if (newFont != null) {
if (newFont.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- newFont = Font.win32_new(newFont, getShell().nativeZoom);
+ newFont = Font.win32_new(newFont, getNativeZoom());
}
long hFont = 0;
if (newFont != null) {
if (newFont.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- hFont = newFont.handle;
+ hFont = Font.win32_getHandle(newFont);
}
this.font = newFont;
if (hFont == 0) hFont = defaultFont ();
@@ -5471,7 +5474,7 @@ LRESULT WM_SETCURSOR (long wParam, long lParam) {
if (control == null) return null;
Cursor cursor = control.findCursor ();
if (cursor != null) {
- OS.SetCursor (Cursor.win32_getHandle(cursor, getZoom()));
+ OS.SetCursor (Cursor.win32_getHandle(cursor, getNativeZoom()));
return LRESULT.ONE;
}
}
@@ -5869,7 +5872,7 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
if (!(widget instanceof Control control)) {
return;
}
- resizeFont(control, control.getShell().nativeZoom);
+ resizeFont(control, control.getNativeZoom());
Image image = control.backgroundImage;
if (image != null) {
@@ -5890,8 +5893,7 @@ private static void resizeFont(Control control, int newZoom) {
if (font == null) {
long currentFontHandle = OS.SendMessage (control.handle, OS.WM_GETFONT, 0, 0);
if (currentFontHandle != 0) {
- Font newFont = display.getSystemFont(newZoom);
- long newFontHandle = newFont.handle;
+ long newFontHandle = SWTFontProvider.getSystemFontHandle(display, newZoom);
OS.SendMessage(control.handle, OS.WM_SETFONT, newFontHandle, 1);
}
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index 5d2c82aadc4..766f9176730 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -25,6 +25,7 @@
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.ole.win32.*;
import org.eclipse.swt.internal.win32.*;
+import org.eclipse.swt.internal.win32.version.*;
/**
* Instances of this class are responsible for managing the
@@ -533,11 +534,7 @@ public class Display extends Device implements Executor {
private static int ICON_SIZE_AT_100 = retrieveDefaultIconSize();
private static int retrieveDefaultIconSize() {
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1607) {
- return OS.GetSystemMetricsForDpi(OS.SM_CXICON, DPIUtil.mapZoomToDPI(100));
- } else {
- return 32;
- }
+ return OS.GetSystemMetricsForDpi(OS.SM_CXICON, DPIUtil.mapZoomToDPI(100));
}
/* Skinning support */
@@ -2162,7 +2159,7 @@ public static boolean isSystemDarkTheme () {
/*
* The registry settings, and Dark Theme itself, is present since Win10 1809
*/
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
+ if (OsVersion.IS_WIN10_1809) {
int[] result = OS.readRegistryDwords(OS.HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme");
if (result!=null) {
@@ -5396,16 +5393,12 @@ private boolean setMonitorSpecificScaling(boolean activate) {
}
private boolean setDPIAwareness(int desiredDpiAwareness) {
- if (OS.WIN32_BUILD < OS.WIN32_BUILD_WIN10_1607) {
- System.err.println("***WARNING: the OS version does not support setting DPI awareness.");
- return false;
- }
if (desiredDpiAwareness == OS.GetThreadDpiAwarenessContext()) {
return true;
}
if (desiredDpiAwareness == OS.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) {
// "Per Monitor V2" only available in more recent Windows version
- boolean perMonitorV2Available = OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809;
+ boolean perMonitorV2Available = OsVersion.IS_WIN10_1809;
if (!perMonitorV2Available) {
System.err.println("***WARNING: the OS version does not support DPI awareness mode PerMonitorV2.");
return false;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java
index 6185d628325..f51f0406187 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java
@@ -509,7 +509,7 @@ void setBackgroundPixel (int pixel) {
@Override
public void setFont (Font font) {
super.setFont (font);
- hFont = font != null ? font.handle : 0;
+ hFont = font != null ? SWTFontProvider.getFontHandle(font, getNativeZoom()) : 0;
layoutItems (0, true);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
index 1edfe032ac2..10d783274ee 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
@@ -26,7 +26,7 @@
* when a string is selected. A list may be single or multi select.
*
* Styles:
- * SINGLE, MULTI
+ * SINGLE, MULTI, NO_SEARCH
* Events:
* Selection, DefaultSelection
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
index 18fefed3cf5..6cb9cf52dd9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
@@ -19,6 +19,7 @@
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
+import org.eclipse.swt.internal.win32.version.*;
/**
* Instances of this class represent the "windows"
@@ -581,11 +582,11 @@ void createBalloonTipHandle () {
void setTitleColoring() {
int attributeID = 0;
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_2004) {
+ if (OsVersion.IS_WIN10_2004) {
// Documented since build 20348, but was already present since build 19041
final int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
attributeID = DWMWA_USE_IMMERSIVE_DARK_MODE;
- } else if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
+ } else if (OsVersion.IS_WIN10_1809) {
// Undocumented value
attributeID = 19;
} else {
@@ -2659,7 +2660,7 @@ LRESULT WM_SETCURSOR (long wParam, long lParam) {
RECT rect = new RECT ();
OS.GetClientRect (handle, rect);
if (OS.PtInRect (rect, pt)) {
- OS.SetCursor (Cursor.win32_getHandle(cursor, getZoom()));
+ OS.SetCursor (Cursor.win32_getHandle(cursor, getNativeZoom()));
switch (msg) {
case OS.WM_LBUTTONDOWN:
case OS.WM_RBUTTONDOWN:
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index 849d89b63d9..2f01d1ee3ce 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -59,7 +59,7 @@
*
*
* Styles:
- * SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL, NO_SCROLL
+ * SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL, NO_SCROLL, NO_SEARCH
* Events:
* Selection, DefaultSelection, SetData, MeasureItem, EraseItem, PaintItem
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
index 13f029f9a0f..216f75f6f7c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
@@ -157,8 +157,8 @@ void destroyWidget () {
}
long fontHandle (int index) {
- if (cellFont != null && cellFont [index] != null) return cellFont [index].handle;
- if (font != null) return font.handle;
+ if (cellFont != null && cellFont [index] != null) return SWTFontProvider.getFontHandle(cellFont[index], getNativeZoom());
+ if (font != null) return SWTFontProvider.getFontHandle(font, getNativeZoom());
return -1;
}
@@ -870,8 +870,7 @@ public void setFont (Font font){
error (SWT.ERROR_INVALID_ARGUMENT);
}
Font oldFont = this.font;
- Shell shell = parent.getShell();
- Font newFont = (font == null ? font : Font.win32_new(font, shell.nativeZoom));
+ Font newFont = (font == null ? font : Font.win32_new(font, getNativeZoom()));
if (oldFont == newFont) return;
this.font = newFont;
if (oldFont != null && oldFont.equals (newFont)) return;
@@ -936,7 +935,7 @@ public void setFont (int index, Font font) {
}
Font oldFont = cellFont [index];
if (oldFont == font) return;
- cellFont [index] = font == null ? font : Font.win32_new(font, nativeZoom);
+ cellFont [index] = font == null ? font : Font.win32_new(font, getNativeZoom());
if (oldFont != null && oldFont.equals (font)) return;
if (font != null) parent.setCustomDraw (true);
if ((parent.style & SWT.VIRTUAL) != 0) cached = true;
@@ -1282,10 +1281,9 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
}
Font[] cellFonts = tableItem.cellFont;
if (cellFonts != null) {
- Shell shell = tableItem.parent.getShell();
for (int index = 0; index < cellFonts.length; index++) {
Font cellFont = cellFonts[index];
- cellFonts[index] = cellFont == null ? null : Font.win32_new(cellFont, shell.nativeZoom);
+ cellFonts[index] = cellFont == null ? null : Font.win32_new(cellFont, tableItem.getNativeZoom());
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
index f340d38e918..11f841b8613 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
@@ -823,7 +823,7 @@ public void setCursor(Cursor newCursor) {
checkWidget();
clientCursor = newCursor;
if (newCursor != null) {
- if (inEvent) OS.SetCursor (Cursor.win32_getHandle(clientCursor, getZoom()));
+ if (inEvent) OS.SetCursor (Cursor.win32_getHandle(clientCursor, getNativeZoom()));
}
}
@@ -892,7 +892,7 @@ long transparentProc (long hwnd, long msg, long wParam, long lParam) {
break;
case OS.WM_SETCURSOR:
if (clientCursor != null) {
- OS.SetCursor (Cursor.win32_getHandle(clientCursor, getZoom()));
+ OS.SetCursor (Cursor.win32_getHandle(clientCursor, getNativeZoom()));
return 1;
}
if (resizeCursor != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index d85ed201706..ef7f6ca9d8d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -62,7 +62,7 @@
*
*
* Styles:
- * SINGLE, MULTI, CHECK, FULL_SELECTION, VIRTUAL, NO_SCROLL
+ * SINGLE, MULTI, CHECK, FULL_SELECTION, VIRTUAL, NO_SCROLL, NO_SEARCH
* Events:
* Selection, DefaultSelection, Collapse, Expand, SetData, MeasureItem, EraseItem, PaintItem, EmptinessChanged
*
@@ -2811,7 +2811,7 @@ boolean findCell (int x, int y, TreeItem [] item, int [] index, RECT [] cellRect
itemRect [0].top = boundsInPixels.y;
itemRect [0].bottom = boundsInPixels.y + boundsInPixels.height;
} else {
- itemRect [0] = item [0].getBounds (order [index [0]], true, false, false, false, false, hDC);
+ itemRect [0] = item [0].getBounds (order [index [0]], true, true, false, false, false, hDC);
}
if (itemRect [0].right > cellRect [0].right) found = true;
quit = true;
@@ -4663,7 +4663,7 @@ void setCursor () {
* is IDC_ARROW.
*/
Cursor cursor = findCursor ();
- long hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : Cursor.win32_getHandle(cursor, getZoom());
+ long hCursor = cursor == null ? OS.LoadCursor (0, OS.IDC_ARROW) : Cursor.win32_getHandle(cursor, getNativeZoom());
OS.SetCursor (hCursor);
}
@@ -7397,6 +7397,8 @@ LRESULT wmNotify (NMHDR hdr, long wParam, long lParam) {
if (hdr.hwndFrom == itemToolTipHandle && itemToolTipHandle != 0) {
LRESULT result = wmNotifyToolTip (hdr, wParam, lParam);
if (result != null) return result;
+ } else if (hdr.code == OS.TTN_SHOW) {
+ return positionTooltip(hdr, wParam, lParam, false);
}
if (hdr.hwndFrom == hwndHeader && hwndHeader != 0) {
LRESULT result = wmNotifyHeader (hdr, wParam, lParam);
@@ -8145,31 +8147,94 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long wParam, long lParam) {
return wmNotifyToolTip (nmcd, lParam);
}
case OS.TTN_SHOW: {
- LRESULT result = super.wmNotify (hdr, wParam, lParam);
- if (result != null) return result;
- int pos = OS.GetMessagePos ();
- POINT pt = new POINT();
- OS.POINTSTOPOINT (pt, pos);
- OS.ScreenToClient (handle, pt);
- int [] index = new int [1];
- TreeItem [] item = new TreeItem [1];
- RECT [] cellRect = new RECT [1], itemRect = new RECT [1];
- if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) {
- RECT toolRect = toolTipRect (itemRect [0]);
- OS.MapWindowPoints (handle, 0, toolRect, 2);
- int width = toolRect.right - toolRect.left;
- int height = toolRect.bottom - toolRect.top;
- int flags = OS.SWP_NOACTIVATE | OS.SWP_NOZORDER | OS.SWP_NOSIZE;
- if (isCustomToolTip ()) flags &= ~OS.SWP_NOSIZE;
- OS.SetWindowPos (itemToolTipHandle, 0, toolRect.left, toolRect.top, width, height, flags);
- return LRESULT.ONE;
- }
- return result;
+ return positionTooltip(hdr, wParam, lParam, true);
}
}
return null;
}
+private LRESULT positionTooltip(NMHDR hdr, long wParam, long lParam, boolean managedTooltip) {
+ LRESULT result = super.wmNotify (hdr, wParam, lParam);
+ if (result != null) return result;
+ int flags = OS.SWP_NOACTIVATE | OS.SWP_NOZORDER | OS.SWP_NOSIZE;
+ if (isCustomToolTip () || !managedTooltip) flags &= ~OS.SWP_NOSIZE;
+ int pos = OS.GetMessagePos ();
+ POINT pt = new POINT();
+ OS.POINTSTOPOINT (pt, pos);
+ OS.ScreenToClient (handle, pt);
+ int [] index = new int [1];
+ TreeItem [] item = new TreeItem [1];
+ RECT [] cellRect = new RECT [1], itemRect = new RECT [1];
+ if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) {
+ RECT toolRect = managedTooltip ? toolTipRect(itemRect [0]) : itemRect [0];
+ OS.MapWindowPoints (handle, 0, toolRect, 2);
+ // Retrieve the monitor containing the cursor position, as tool tip placement
+ // must occur on the same monitor to avoid potential infinite loops. When a tool tip
+ // appears on a different monitor than the cursor, the operating system may
+ // attempt to re-scale it based on that monitor's settings. This re-scaling
+ // triggers additional display messages to SWT, creating an infinite loop
+ // of positioning and re-scaling events.
+ // Refer: https://github.com/eclipse-platform/eclipse.platform.swt/issues/557
+ Point cursorLocation = display.getCursorLocation();
+ Rectangle monitorBounds = cursorLocation instanceof MonitorAwarePoint monitorAwarePoint
+ ? getContainingMonitorBoundsInMultiZoomCoordinateSystem(monitorAwarePoint)
+ : getContainingMonitorBoundsInSingleZoomCoordinateSystem(cursorLocation);
+ if (monitorBounds != null) {
+ Rectangle adjustedTooltipBounds = fitTooltipBoundsIntoMonitor(toolRect, monitorBounds);
+ OS.SetWindowPos (hdr.hwndFrom, 0, adjustedTooltipBounds.x, adjustedTooltipBounds.y, adjustedTooltipBounds.width, adjustedTooltipBounds.height, flags);
+ result = LRESULT.ONE;
+ }
+ } else if (!managedTooltip) {
+ // If managedTooltip is false and the cursor is not over the valid part of the
+ // target cell, Windows may still try to display the default tooltip. Since we
+ // can't prevent it from showing at this point, we set its bounds to zero to
+ // effectively hide it.
+ flags |= OS.SWP_NOMOVE;
+ OS.SetWindowPos (hdr.hwndFrom, 0, 0, 0, 0, 0, flags);
+ result = LRESULT.ONE;
+ }
+ return result;
+}
+
+/**
+ * Adjust the tool tip to fit in a single monitor either by shifting its position or by adjusting it's width.
+ */
+private Rectangle fitTooltipBoundsIntoMonitor(RECT tooltipBounds, Rectangle monitorBounds) {
+ int tooltipWidth = tooltipBounds.right - tooltipBounds.left;
+ int tooltipHeight = tooltipBounds.bottom - tooltipBounds.top;
+ if (tooltipBounds.left < monitorBounds.x) {
+ tooltipBounds.left = monitorBounds.x;
+ }
+ int monitorBoundsRightEnd = monitorBounds.x + monitorBounds.width;
+ if (tooltipBounds.right > monitorBoundsRightEnd) {
+ if (tooltipWidth <= monitorBounds.width) {
+ tooltipBounds.left = monitorBoundsRightEnd - tooltipWidth;
+ } else {
+ tooltipBounds.left = monitorBounds.x;
+ }
+ tooltipWidth = monitorBoundsRightEnd - tooltipBounds.left;
+ }
+ return new Rectangle(tooltipBounds.left, tooltipBounds.top, tooltipWidth, tooltipHeight);
+}
+
+private Rectangle getContainingMonitorBoundsInSingleZoomCoordinateSystem(Point point) {
+ int zoom = getZoom();
+ point = DPIUtil.scaleUp(point, zoom);
+ for (Monitor monitor : display.getMonitors()) {
+ Rectangle monitorBounds = DPIUtil.scaleUp(monitor.getBounds(), zoom);
+ if (monitorBounds.contains(point)) {
+ return monitorBounds;
+ }
+ }
+ return null;
+}
+
+private Rectangle getContainingMonitorBoundsInMultiZoomCoordinateSystem(MonitorAwarePoint point) {
+ Monitor monitor = point.getMonitor();
+ return new Rectangle(monitor.x, monitor.y, DPIUtil.scaleUp(monitor.width, monitor.zoom),
+ DPIUtil.scaleUp(monitor.height, monitor.zoom));
+}
+
LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) {
switch (nmcd.dwDrawStage) {
case OS.CDDS_PREPAINT: {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
index 148468585c0..1d7b8daf7c6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
@@ -316,8 +316,8 @@ void destroyWidget () {
}
long fontHandle (int index) {
- if (cellFont != null && cellFont [index] != null) return cellFont [index].handle;
- if (font != null) return font.handle;
+ if (cellFont != null && cellFont [index] != null) return SWTFontProvider.getFontHandle(cellFont[index], getNativeZoom());
+ if (font != null) return SWTFontProvider.getFontHandle(font, getNativeZoom());
return -1;
}
@@ -1388,8 +1388,7 @@ public void setFont (Font font){
error (SWT.ERROR_INVALID_ARGUMENT);
}
Font oldFont = this.font;
- Shell shell = parent.getShell();
- Font newFont = (font == null ? font : Font.win32_new(font, shell.nativeZoom));
+ Font newFont = (font == null ? font : Font.win32_new(font, getNativeZoom()));
if (oldFont == newFont) return;
this.font = newFont;
if (oldFont != null && oldFont.equals (font)) return;
@@ -1445,8 +1444,7 @@ public void setFont (int index, Font font) {
}
Font oldFont = cellFont [index];
if (oldFont == font) return;
- Shell shell = parent.getShell();
- cellFont [index] = font == null ? font : Font.win32_new(font, shell.nativeZoom);
+ cellFont [index] = font == null ? font : Font.win32_new(font, getNativeZoom());
if (oldFont != null && oldFont.equals (font)) return;
if (font != null) parent.customDraw = true;
if ((parent.style & SWT.VIRTUAL) != 0) cached = true;
@@ -1828,10 +1826,9 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
}
Font[] cellFonts = treeItem.cellFont;
if (cellFonts != null) {
- Shell shell = treeItem.parent.getShell();
for (int index = 0; index < cellFonts.length; index++) {
Font cellFont = cellFonts[index];
- cellFonts[index] = cellFont == null ? null : Font.win32_new(cellFont, shell.nativeZoom);
+ cellFonts[index] = cellFont == null ? null : Font.win32_new(cellFont, treeItem.getNativeZoom());
}
}
for (TreeItem item : treeItem.getItems()) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index 490c84087d7..0b063f369cd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -65,6 +65,7 @@ public abstract class Widget {
* @noreference This field is not intended to be referenced by clients.
*/
public int nativeZoom;
+ boolean autoScaleDisabled = false;
int style, state;
Display display;
EventTable eventTable;
@@ -132,6 +133,9 @@ public abstract class Widget {
/* Bidi flag and for auto text direction */
static final int AUTO_TEXT_DIRECTION = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
+ private static final String DATA_AUTOSCALE_DISABLED = "AUTOSCALE_DISABLED";
+ private static final String DATA_NATIVE_ZOOM = "NATIVE_ZOOM";
+
/* Initialize the Common Controls DLL */
static {
INITCOMMONCONTROLSEX icce = new INITCOMMONCONTROLSEX ();
@@ -182,9 +186,11 @@ public Widget (Widget parent, int style) {
checkParent (parent);
this.style = style;
this.nativeZoom = parent != null ? parent.nativeZoom : DPIUtil.getNativeDeviceZoom();
+ this.autoScaleDisabled = parent.autoScaleDisabled;
display = parent.display;
reskinWidget ();
notifyCreationTracker();
+ this.setData(DATA_NATIVE_ZOOM, this.nativeZoom);
}
void _addListener (int eventType, Listener listener) {
@@ -1457,6 +1463,10 @@ public void setData (String key, Object value) {
}
}
if (key.equals(SWT.SKIN_CLASS) || key.equals(SWT.SKIN_ID)) this.reskin(SWT.ALL);
+
+ if (DATA_AUTOSCALE_DISABLED.equals(key)) {
+ autoScaleDisabled = Boolean.parseBoolean(value.toString());
+ }
}
boolean sendFocusEvent (int type) {
@@ -2686,36 +2696,38 @@ void notifyDisposalTracker() {
}
GC createNewGC(long hDC, GCData data) {
- data.nativeZoom = nativeZoom;
+ data.nativeZoom = getNativeZoom();
+ if (autoScaleDisabled && data.font != null) {
+ data.font = SWTFontProvider.getFont(display, data.font.getFontData()[0], 100);
+ }
return GC.win32_new(hDC, data);
}
+int getNativeZoom() {
+ if (autoScaleDisabled) {
+ return 100;
+ }
+ return nativeZoom;
+}
+
int getZoom() {
+ if (autoScaleDisabled) {
+ return 100;
+ }
return DPIUtil.getZoomForAutoscaleProperty(nativeZoom);
}
private static void handleDPIChange(Widget widget, int newZoom, float scalingFactor) {
widget.nativeZoom = newZoom;
+ widget.setData(DATA_NATIVE_ZOOM, newZoom);
}
int getSystemMetrics(int nIndex) {
- /*
- * DPI dependent metrics were introduced after 2016 version of windows 10
- */
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1607) {
- return OS.GetSystemMetricsForDpi(nIndex, DPIUtil.mapZoomToDPI(nativeZoom));
- }
- return OS.GetSystemMetrics(nIndex);
+ return OS.GetSystemMetricsForDpi(nIndex, DPIUtil.mapZoomToDPI(nativeZoom));
}
boolean adjustWindowRectEx(RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle) {
- /*
- * DPI-dependent version of the method was introduced with Windows 10 Version 1607
- */
- if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1607) {
- return OS.AdjustWindowRectExForDpi (lpRect, dwStyle, bMenu, dwExStyle, DPIUtil.mapZoomToDPI(nativeZoom));
- }
- return OS.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
+ return OS.AdjustWindowRectExForDpi (lpRect, dwStyle, bMenu, dwExStyle, DPIUtil.mapZoomToDPI(nativeZoom));
}
diff --git a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
index 6c6497fbe6b..a84fd767e96 100644
--- a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt; singleton:=true
-Bundle-Version: 3.130.0.qualifier
+Bundle-Version: 3.130.100.qualifier
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
DynamicImport-Package: org.eclipse.swt.accessibility2
diff --git a/bundles/org.eclipse.swt/forceQualifierUpdate.txt b/bundles/org.eclipse.swt/forceQualifierUpdate.txt
index 07d7b4dfdbe..6061536f9d5 100644
--- a/bundles/org.eclipse.swt/forceQualifierUpdate.txt
+++ b/bundles/org.eclipse.swt/forceQualifierUpdate.txt
@@ -2,3 +2,4 @@ https://github.com/eclipse-platform/eclipse.platform.swt/issues/1093
Pick-up legal file unification in native fragments from: https://github.com/eclipse-platform/eclipse.platform.swt/pull/1144
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/2595
Pick-up localization file fixes in native fragments in: https://github.com/eclipse-platform/eclipse.platform.swt/pull/2007
+https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/3011
diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml
index 7c634f6ea7b..29756220efb 100644
--- a/bundles/org.eclipse.swt/pom.xml
+++ b/bundles/org.eclipse.swt/pom.xml
@@ -16,11 +16,11 @@
org.eclipse.platform
eclipse.platform.swt
- 4.36.0-SNAPSHOT
+ 4.37.0-SNAPSHOT
../../
org.eclipse.swt
- 3.130.0-SNAPSHOT
+ 3.130.100-SNAPSHOT
eclipse-plugin
diff --git a/examples/.settings_shared/org.eclipse.jdt.core.prefs b/examples/.settings_shared/org.eclipse.jdt.core.prefs
index 8ed1a2c764a..3dabb243161 100644
--- a/examples/.settings_shared/org.eclipse.jdt.core.prefs
+++ b/examples/.settings_shared/org.eclipse.jdt.core.prefs
@@ -19,6 +19,7 @@ org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
@@ -47,12 +48,25 @@ org.eclipse.jdt.core.compiler.problem.incompatibleOwningContract=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=info
org.eclipse.jdt.core.compiler.problem.insufficientResourceAnalysis=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
@@ -108,6 +122,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverridin
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLambdaParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
diff --git a/examples/org.eclipse.swt.examples.ole.win32/pom.xml b/examples/org.eclipse.swt.examples.ole.win32/pom.xml
index def280e7e8d..ecac8a9be8b 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/pom.xml
+++ b/examples/org.eclipse.swt.examples.ole.win32/pom.xml
@@ -16,7 +16,7 @@
org.eclipse.platform
eclipse.platform.swt
- 4.36.0-SNAPSHOT
+ 4.37.0-SNAPSHOT
../../
org.eclipse.swt.examples.ole.win32
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
index 52931b9d485..a51d60a0023 100644
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
@@ -14,7 +14,9 @@
package org.eclipse.swt.examples.ole.win32;
-import org.eclipse.swt.ole.win32.*;
+import org.eclipse.swt.ole.win32.OLE;
+import org.eclipse.swt.ole.win32.OleAutomation;
+import org.eclipse.swt.ole.win32.Variant;
/**
* Wrapper for an OleAutomation object used to send commands
@@ -76,7 +78,6 @@ class OleWebBrowser {
*
*
* @param oleAutomation the OleAutomation object for this control.
- * @param oleControlSite the OleControlSite object for this control.
*/
public OleWebBrowser(OleAutomation oleAutomation) {
this.oleAutomation = oleAutomation;
@@ -207,8 +208,6 @@ public void Navigate(String url) {
/**
* Refreshes the currently viewed page.
- *
- * @return the platform-defined result code for the "Refresh" method invocation
*/
public void Refresh(){
// dispid= 4294966746, type=METHOD, name="Refresh"
@@ -219,8 +218,6 @@ public void Refresh(){
/**
* Aborts loading of the currnet page.
- *
- * @return the platform-defined result code for the "Stop" method invocation
*/
public void Stop() {
// dispid=106, type=METHOD, name="Stop"
diff --git a/examples/org.eclipse.swt.examples.views/src/org/eclipse/swt/examples/controls/CustomControlView.java b/examples/org.eclipse.swt.examples.views/src/org/eclipse/swt/examples/controls/CustomControlView.java
index a2cbd7cff2b..6f9d0d595de 100644
--- a/examples/org.eclipse.swt.examples.views/src/org/eclipse/swt/examples/controls/CustomControlView.java
+++ b/examples/org.eclipse.swt.examples.views/src/org/eclipse/swt/examples/controls/CustomControlView.java
@@ -14,8 +14,9 @@
package org.eclipse.swt.examples.controls;
-import org.eclipse.swt.examples.controlexample.*;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.examples.controlexample.CustomControlExample;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
/**
* CustomControls is a simple demonstration
@@ -30,7 +31,7 @@ public class CustomControlView extends ControlView {
/**
* Create the example
*
- * @see ViewPart#createPartControl
+ * @see ViewPart#createPartControl(Composite)
*/
@Override
public void createPartControl(Composite frame) {
diff --git a/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF b/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
index e06318dc6e8..6857f743ceb 100644
--- a/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.SWTStandaloneExampleSet.name
Bundle-SymbolicName: org.eclipse.swt.examples; singleton:=true
-Bundle-Version: 3.108.800.qualifier
+Bundle-Version: 3.108.900.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-17
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java
index a3c12619033..91a038532c8 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTable.java
@@ -60,9 +60,9 @@
* instead of up-front. This can provide significant performance improvements for
* tables that are very large or for which TableItem population is
* expensive (for example, retrieving values from an external source).
- *
+ *
* Here is an example of using a Table with style VIRTUAL:
- *
+ *
* final Table table = new Table (parent, SWT.VIRTUAL | SWT.BORDER);
* table.setItemCount (1000000);
* table.addListener (SWT.SetData, new Listener () {
@@ -73,20 +73,20 @@
* System.out.println (item.getText ());
* }
* });
- *
- *
+ *
+ *
* Note that although this class is a subclass of Composite,
* it does not normally make sense to add Control children to
* it, or set a layout on it, unless implementing something like a cell
* editor.
- *
+ *
*
* Styles:
* SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL, NO_SCROLL
* Events:
* Selection, DefaultSelection, SetData, MeasureItem, EraseItem, PaintItem
*
- *
+ *
* Note: Only one of the styles SINGLE, and MULTI may be specified.
*
* IMPORTANT: This class is not intended to be subclassed.
@@ -3844,7 +3844,7 @@ void setHeaderImageHeight (int value) {
* it visible may not actually cause it to be displayed.
*
*
- * @param show the new visibility state
+ * @param value the new visibility state
*
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -3970,7 +3970,7 @@ boolean setItemHeight (int value) {
* it visible may not actually cause it to be displayed.
*
*
- * @param show the new visibility state
+ * @param value the new visibility state
*
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java
index 5c98a217e71..d95c51a6cd8 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableColumn.java
@@ -35,13 +35,13 @@
/**
* Instances of this class represent a column in a table widget.
- *
+ *
* Styles:
* LEFT, RIGHT, CENTER
* Events:
* Move, Resize, Selection
*
- *
+ *
* Note: Only one of the styles LEFT, RIGHT and CENTER may be specified.
*
* IMPORTANT: This class is not intended to be subclassed.
@@ -679,7 +679,7 @@ public void setMoveable (boolean moveable) {
* cannot be dragged by the user but may be resized
* by the programmer.
*
- * @param resizable the resize attribute
+ * @param value the resize attribute
*
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -756,7 +756,7 @@ public void setToolTipText (String string) {
/**
* Sets the width of the receiver.
*
- * @param width the new width
+ * @param value the new width
*
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java
index 9d492249a58..792124ac4ff 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/CTableItem.java
@@ -553,7 +553,7 @@ public Color getBackground () {
/**
* Returns the background color at the given column index in the receiver.
*
- * @param index the column index
+ * @param columnIndex the column index
* @return the background color
*
* @exception SWTException
@@ -605,7 +605,7 @@ Rectangle getBounds (boolean checkData) {
* Returns a rectangle describing the receiver's size and location
* relative to its parent at a column in the table.
*
- * @param index the index that specifies the column
+ * @param columnIndex the index that specifies the column
* @return the receiver's bounding column rectangle
*
* @exception SWTException
@@ -818,7 +818,7 @@ Font getFont (boolean checkData) {
* Returns the font that the receiver will use to paint textual information
* for the specified cell in this item.
*
- * @param index the column index
+ * @param columnIndex the column index
* @return the receiver's font
*
* @exception SWTException
@@ -869,7 +869,7 @@ public Color getForeground () {
*
* Returns the foreground color at the given column index in the receiver.
*
- * @param index the column index
+ * @param columnIndex the column index
* @return the foreground color
*
* @exception SWTException
@@ -950,7 +950,7 @@ public Image getImage () {
* Returns the image stored at the given column index in the receiver,
* or null if the image has not been set or if the column does not exist.
*
- * @param index the column index
+ * @param columnIndex the column index
* @return the image stored at the given column index in the receiver
*
* @exception SWTException
@@ -975,7 +975,7 @@ Image getImage (int columnIndex, boolean checkData) {
* table. An empty rectangle is returned if index exceeds
* the index of the table's last column.
*
- * @param index the index that specifies the column
+ * @param columnIndex the index that specifies the column
* @return the receiver's bounding image rectangle
*
* @exception SWTException
@@ -1096,7 +1096,7 @@ public String getText () {
* Returns the text stored at the given column index in the receiver,
* or empty string if the text has not been set.
*
- * @param index the column index
+ * @param columnIndex the column index
* @return the text stored at the given column index in the receiver
*
* @exception SWTException
@@ -1122,7 +1122,7 @@ String getText (int columnIndex, boolean checkData) {
* table. An empty rectangle is returned if index exceeds
* the index of the table's last column.
*
- * @param index the index that specifies the column
+ * @param columnIndex the index that specifies the column
* @return the receiver's bounding text rectangle
*
* @exception SWTException
@@ -1653,7 +1653,7 @@ public void setBackground (Color color) {
* to the color specified by the argument, or to the default system color for the item
* if the argument is null.
*
- * @param index the column index
+ * @param columnIndex the column index
* @param color the new color (or null)
*
* @exception IllegalArgumentException
@@ -1692,7 +1692,7 @@ public void setBackground (int columnIndex, Color color) {
* Sets the checked state of the checkbox for this item. This state change
* only applies if the Table was created with the SWT.CHECK style.
*
- * @param checked the new checked state of the checkbox
+ * @param value the new checked state of the checkbox
*
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -1768,7 +1768,7 @@ public void setFont (Font font) {
* argument, or to the default font for that kind of control if the
* argument is null.
*
- * @param index the column index
+ * @param columnIndex the column index
* @param font the new font (or null)
*
* @exception IllegalArgumentException
@@ -1846,7 +1846,7 @@ public void setForeground (Color color) {
* to the color specified by the argument, or to the default system color for the item
* if the argument is null.
*
- * @param index the column index
+ * @param columnIndex the column index
* @param color the new color (or null)
*
* @exception IllegalArgumentException
@@ -1889,7 +1889,7 @@ public void setForeground (int columnIndex, Color color) {
* Sets the grayed state of the checkbox for this item. This state change
* only applies if the Table was created with the SWT.CHECK style.
*
- * @param grayed the new grayed state of the checkbox;
+ * @param value the new grayed state of the checkbox;
*
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -1916,7 +1916,7 @@ public void setImage (Image value) {
/**
* Sets the image for multiple columns in the table.
*
- * @param images the array of new images
+ * @param value the array of new images
*
* @exception IllegalArgumentException
* ERROR_NULL_ARGUMENT - if the array of images is null
@@ -1939,8 +1939,8 @@ public void setImage (Image[] value) {
/**
* Sets the receiver's image at a column.
*
- * @param index the column index
- * @param image the new image
+ * @param columnIndex the column index
+ * @param value the new image
*
* @exception IllegalArgumentException
* ERROR_INVALID_ARGUMENT - if the image has been disposed
@@ -2046,7 +2046,6 @@ public void setImage (int columnIndex, Image value) {
*
* @param indent the new indent
*
- *
* @exception SWTException
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -2065,8 +2064,8 @@ public void setImageIndent (int indent) {
/**
* Sets the receiver's text at a column
*
- * @param index the column index
- * @param string the new text
+ * @param columnIndex the column index
+ * @param value the new text
*
* @exception IllegalArgumentException
* ERROR_NULL_ARGUMENT - if the text is null
@@ -2125,7 +2124,7 @@ public void setText (String value) {
/**
* Sets the text for multiple columns in the table.
*
- * @param strings the array of new strings
+ * @param value the array of new strings
*
* @exception IllegalArgumentException
* ERROR_NULL_ARGUMENT - if the text is null
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
index 18cb76d71ad..3b6a480982e 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
@@ -121,10 +121,7 @@ public String[] getValues() {
}
/**
* Opens the dialog in the given state. Sets Text widget contents
- * and dialog behaviour accordingly.
- *
- * @param dialogState int
- * The state the dialog should be opened in.
+ * and dialog behavior accordingly.
*/
public String[] open() {
createTextWidgets();
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java
index c6677a25e56..822b543ee71 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/clipboard/ClipboardExample.java
@@ -30,7 +30,6 @@
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageDataProvider;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
@@ -62,38 +61,6 @@ public class ClipboardExample {
Label status;
static final int HSIZE = 100, VSIZE = 60;
-static final class AutoScaleImageDataProvider implements ImageDataProvider {
- ImageData imageData;
- int currentZoom;
- public AutoScaleImageDataProvider (ImageData data) {
- this.imageData = data;
- this.currentZoom = getDeviceZoom ();
- }
-
- @Override
- public ImageData getImageData (int zoom) {
- return autoScaleImageData(imageData, zoom, currentZoom);
- }
-
- static ImageData autoScaleImageData (ImageData imageData, int targetZoom, int currentZoom) {
- if (imageData == null || targetZoom == currentZoom) return imageData;
- float scaleFactor = ((float) targetZoom)/((float) currentZoom);
- return imageData.scaledTo (Math.round (imageData.width * scaleFactor), Math.round (imageData.height * scaleFactor));
- }
-
- static int getDeviceZoom () {
- int zoom = 100;
- String value = System.getProperty ("org.eclipse.swt.internal.deviceZoom");
- if (value != null) {
- try {
- zoom = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- }
- }
- return zoom;
- }
-}
public static void main( String[] args) {
Display display = new Display();
@@ -476,8 +443,8 @@ void createImageTransfer(Composite copyParent, Composite pasteParent){
b.addSelectionListener(widgetSelectedAdapter(e -> {
if (copyImage[0] != null) {
status.setText("");
- // Fetch ImageData at current zoom and save in the clip-board.
- clipboard.setContents(new Object[] {copyImage[0].getImageDataAtCurrentZoom()}, new Transfer[] {ImageTransfer.getInstance()});
+ // Fetch ImageData and save in the clip-board.
+ clipboard.setContents(new Object[] {copyImage[0].getImageData()}, new Transfer[] {ImageTransfer.getInstance()});
} else {
status.setText("No image to copy");
}
@@ -540,8 +507,7 @@ void createImageTransfer(Composite copyParent, Composite pasteParent){
pasteImage[0].dispose();
}
status.setText("");
- // Consume the ImageData at current zoom as-is.
- pasteImage[0] = new Image(e.display, new AutoScaleImageDataProvider(imageData));
+ pasteImage[0] = new Image(e.display, imageData);
pasteVBar.setEnabled(true);
pasteHBar.setEnabled(true);
pasteOrigin.x = 0; pasteOrigin.y = 0;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorListener.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorListener.java
index 6105285e4d2..811bee1c51d 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorListener.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorListener.java
@@ -17,8 +17,8 @@
/**
* Used to perform an action after an item in a Menu has been selected.
*
- * @see org.eclipse.swt.examples.graphics.ColorMenu.java
- * @see org.eclipse.swt.examples.graphics.GraphicsBackground.java
+ * @see org.eclipse.swt.examples.graphics.ColorMenu
+ * @see org.eclipse.swt.examples.graphics.GraphicsBackground
*/
public interface ColorListener {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java
index 185e95880a7..3e2be7f1356 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java
@@ -282,7 +282,7 @@ public MenuItemListener(Control parent){
*
* @param cl
* A ColorListener
- * @see org.eclipse.swt.examples.graphics.ColorListener.java
+ * @see org.eclipse.swt.examples.graphics.ColorListener
*/
public void setColorListener(ColorListener cl) {
this.colorListener = cl;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
index 15a313907c1..9451b18d44a 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
@@ -265,7 +265,7 @@ public ToolTipHandler(Shell parent) {
/**
* Enables customized hover help for a specified control
*
- * @control the control on which to enable hoverhelp
+ * @param control the control on which to enable hoverhelp
*/
public void activateHoverHelp(final Control control) {
/*
@@ -347,7 +347,6 @@ public void mouseHover (MouseEvent event) {
* Sets the location for a hovering shell
* @param shell the object that is to hover
* @param position the position of a widget to hover over
- * @return the top-left location for a hovering box
*/
private void setHoverLocation(Shell shell, Point position) {
Rectangle displayBounds = shell.getDisplay().getBounds();
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
index b3225e70dc4..4312e2596dd 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
@@ -162,8 +162,9 @@ private final void mouseSegmentFinished(MouseEvent event) {
/**
* Draws a continuous segment from points[0] to points[1].
* Assumes points[0] has been drawn already.
- *
- * @post points[0] will refer to the same point as points[1]
+ *
+ * post-condition: points[0] will refer to the same point as points[1]
+ *
*/
protected void renderContinuousSegment() {
/* A lazy but effective line drawing algorithm */
@@ -239,7 +240,7 @@ private final void abortRetrigger() {
/**
* Template method: Renders a point.
- * @param point, the point to render
+ * @param point the point to render
*/
protected abstract void render(Point point);
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java
index de93ba76e87..509c7692539 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/DragPaintSession.java
@@ -40,7 +40,7 @@ public abstract class DragPaintSession extends BasicPaintSession {
/**
* Constructs a PaintSession.
*
- * @param getPaintSurface() the drawing surface to use
+ * @param paintSurface the drawing surface to use
*/
protected DragPaintSession(PaintSurface paintSurface) {
super(paintSurface);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/EllipseFigure.java
index 5510c05c3d4..e229069e320 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/EllipseFigure.java
@@ -14,8 +14,10 @@
package org.eclipse.swt.examples.paint;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
/**
* 2D Ellipse object
@@ -28,7 +30,8 @@ public class EllipseFigure extends Figure {
* These objects are defined by any two diametrically opposing corners of a box
* bounding the ellipse.
*
- * @param color the color for this object
+ * @param foregroundColor the foreground color for this object
+ * @param backgroundColor the background color for this object
* @param lineStyle the line style for this object
* @param x1 the virtual X coordinate of the first corner
* @param y1 the virtual Y coordinate of the first corner
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/LineFigure.java
index 41a4b0b214e..97bfc8fd10b 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/LineFigure.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/LineFigure.java
@@ -14,8 +14,10 @@
package org.eclipse.swt.examples.paint;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Region;
/**
* 2D Line object
@@ -27,7 +29,8 @@ public class LineFigure extends Figure {
* Constructs a Line
* These objects are defined by their two end-points.
*
- * @param color the color for this object
+ * @param foregroundColor the foreground color for this object
+ * @param backgroundColor the background color for this object
* @param lineStyle the line style for this object
* @param x1 the virtual X coordinate of the first end-point
* @param y1 the virtual Y coordinate of the first end-point
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSurface.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSurface.java
index 16ac9d46797..50455c66fd9 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSurface.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintSurface.java
@@ -64,7 +64,7 @@ public class PaintSurface {
* and may have SWT.V_SCROLL and/or SWT.H_SCROLL.
*
* @param paintCanvas the Canvas object in which to render
- * @param paintStatus the PaintStatus object to use for providing user feedback
+ * @param statusText the status text to use for providing user feedback
* @param fillColor the color to fill the canvas with initially
*/
public PaintSurface(Canvas paintCanvas, Text statusText, Color fillColor) {
@@ -374,7 +374,7 @@ public boolean isRubberbandHidden() {
/**
* Handles a horizontal scroll event
*
- * @param scrollbar the horizontal scroll bar that posted this event
+ * @param scrollBar the horizontal scroll bar that posted this event
*/
public void scrollHorizontally(ScrollBar scrollBar) {
if (image == null) return;
@@ -393,7 +393,7 @@ public void scrollHorizontally(ScrollBar scrollBar) {
/**
* Handles a vertical scroll event
*
- * @param scrollbar the vertical scroll bar that posted this event
+ * @param scrollBar the vertical scroll bar that posted this event
*/
public void scrollVertically(ScrollBar scrollBar) {
if (image == null) return;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PencilTool.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PencilTool.java
index a252da53e91..81022348706 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PencilTool.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PencilTool.java
@@ -26,7 +26,7 @@ public class PencilTool extends ContinuousPaintSession implements PaintTool {
* Constructs a pencil tool.
*
* @param toolSettings the new tool settings
- * @param getPaintSurface() the PaintSurface we will render on.
+ * @param paintSurface the PaintSurface we will render on.
*/
public PencilTool(ToolSettings toolSettings, PaintSurface paintSurface) {
super(paintSurface);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RectangleFigure.java
index 7d28561614d..47413bddd47 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RectangleFigure.java
@@ -14,8 +14,10 @@
package org.eclipse.swt.examples.paint;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
/**
* 2D Rectangle object
@@ -27,7 +29,8 @@ public class RectangleFigure extends Figure {
* Constructs a Rectangle
* These objects are defined by any two diametrically opposing corners.
*
- * @param color the color for this object
+ * @param foregroundColor the foreground color for this object
+ * @param backgroundColor the background color for this object
* @param lineStyle the line style for this object
* @param x1 the virtual X coordinate of the first corner
* @param y1 the virtual Y coordinate of the first corner
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
index 79d297aa115..0071cc30e3a 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
@@ -14,8 +14,10 @@
package org.eclipse.swt.examples.paint;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
/**
* 2D Rectangle object
@@ -27,7 +29,8 @@ public class RoundedRectangleFigure extends Figure {
* Constructs a Rectangle
* These objects are defined by any two diametrically opposing corners.
*
- * @param color the color for this object
+ * @param foregroundColor the foreground color for this object
+ * @param backgroundColor the background color for this object
* @param lineStyle the line style for this object
* @param x1 the virtual X coordinate of the first corner
* @param y1 the virtual Y coordinate of the first corner
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
index 247ef8b6d80..3a3c0210e4a 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
@@ -14,7 +14,9 @@
package org.eclipse.swt.examples.paint;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Region;
/**
* 2D Line object
@@ -28,7 +30,7 @@ public class SolidPolygonFigure extends Figure {
*
* @param color the color for this object
* @param vertices the array of vertices making up the polygon
- * @param numPoint the number of valid points in the array (n >= 3)
+ * @param numPoints the number of valid points in the array (n >= 3)
*/
public SolidPolygonFigure(Color color, Point[] vertices, int numPoints) {
this.color = color;
diff --git a/examples/org.eclipse.swt.snippets/Snippets.md b/examples/org.eclipse.swt.snippets/Snippets.md
index 6229a212c8d..44ae96a950d 100644
--- a/examples/org.eclipse.swt.snippets/Snippets.md
+++ b/examples/org.eclipse.swt.snippets/Snippets.md
@@ -214,6 +214,8 @@ To contribute a new snippet, [create a snippet contribution as a pull request](h
- [draw an image scaled to half size and double size](https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet355.java) – [(preview)](https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/examples/org.eclipse.swt.snippets/previews/Snippet355.png "Preview for Snippet 355")
- [draw an image at various zoom/dpi levels](https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet367.java) – [(preview)](https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/examples/org.eclipse.swt.snippets/previews/Snippet367.png "Preview for Snippet 367")
- [draw a disabled/grayed image at various zoom levels](https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet382.java) – [(preview)](https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/examples/org.eclipse.swt.snippets/previews/Snippet382.png "Preview for Snippet 382")
+- [compare algorithms for rendering disabled images](https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet384.java) – [(preview)](https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/examples/org.eclipse.swt.snippets/previews/Snippet384.png "Preview for Snippet 384")
+- [draw an image with watermark using ImageGcProvider](https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet385.java) – [(preview)](https://github.com/eclipse-platform/eclipse.platform.swt/blob/master/examples/org.eclipse.swt.snippets/previews/Snippet385.png "Preview for Snippet 385")
### **ImageData**
- [display an animated GIF](https://github.com/eclipse-platform/eclipse.platform.swt/tree/master/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java)
diff --git a/examples/org.eclipse.swt.snippets/previews/Snippet384.png b/examples/org.eclipse.swt.snippets/previews/Snippet384.png
new file mode 100644
index 00000000000..ae202979753
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/previews/Snippet384.png differ
diff --git a/examples/org.eclipse.swt.snippets/previews/Snippet385.png b/examples/org.eclipse.swt.snippets/previews/Snippet385.png
new file mode 100644
index 00000000000..0e9437c7c6b
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/previews/Snippet385.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/aaa_linear_gradient_255x32.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/aaa_linear_gradient_255x32.png
new file mode 100644
index 00000000000..1add147a238
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/aaa_linear_gradient_255x32.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/battery-charge-level-75-percent-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/battery-charge-level-75-percent-icon.png
new file mode 100644
index 00000000000..91338fd31e9
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/battery-charge-level-75-percent-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/checkmark-male-user-color-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/checkmark-male-user-color-icon.png
new file mode 100644
index 00000000000..7b0bcd94e46
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/checkmark-male-user-color-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/civil-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/civil-icon.png
new file mode 100644
index 00000000000..f91510fa69c
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/civil-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/color-wheel-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/color-wheel-icon.png
new file mode 100644
index 00000000000..8db89f1c506
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/color-wheel-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/coreldraw-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/coreldraw-icon.png
new file mode 100644
index 00000000000..65ef6de7ba3
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/coreldraw-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/electric-switch-color-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/electric-switch-color-icon.png
new file mode 100644
index 00000000000..45174050249
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/electric-switch-color-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/file-manager-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/file-manager-icon.png
new file mode 100644
index 00000000000..c371e6e5f35
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/file-manager-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/magnet-magnetic-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/magnet-magnetic-icon.png
new file mode 100644
index 00000000000..49604619e08
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/magnet-magnetic-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/man-woman-toilet-color-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/man-woman-toilet-color-icon.png
new file mode 100644
index 00000000000..d22c76ffba0
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/man-woman-toilet-color-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/medal-color-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/medal-color-icon.png
new file mode 100644
index 00000000000..79c287db25e
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/medal-color-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/message-bubble-white-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/message-bubble-white-icon.png
new file mode 100644
index 00000000000..3bd42a5cb05
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/message-bubble-white-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/padlock-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/padlock-icon.png
new file mode 100644
index 00000000000..642d0c03227
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/padlock-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/pig-piggy-color-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/pig-piggy-color-icon.png
new file mode 100644
index 00000000000..a1f33d93e69
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/pig-piggy-color-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/piggy-saving-euro-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/piggy-saving-euro-icon.png
new file mode 100644
index 00000000000..5ae35393e0c
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/piggy-saving-euro-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/rooster-color-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/rooster-color-icon.png
new file mode 100644
index 00000000000..34f22ff3a6d
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/rooster-color-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet384/images/science-atom-icon.png b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/science-atom-icon.png
new file mode 100644
index 00000000000..7241336aae0
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet384/images/science-atom-icon.png differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet385/black.jpg b/examples/org.eclipse.swt.snippets/resources/Snippet385/black.jpg
new file mode 100644
index 00000000000..23a2db3809b
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet385/black.jpg differ
diff --git a/examples/org.eclipse.swt.snippets/resources/Snippet385/red.jpeg b/examples/org.eclipse.swt.snippets/resources/Snippet385/red.jpeg
new file mode 100644
index 00000000000..faf1140693b
Binary files /dev/null and b/examples/org.eclipse.swt.snippets/resources/Snippet385/red.jpeg differ
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java
index 3f6d1603356..955d65a9a20 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet215.java
@@ -38,7 +38,8 @@ public static void main(String[] args) {
/* Take the screen shot */
GC gc = new GC(display);
- final Image image = new Image(display, display.getBounds());
+ Rectangle rect = display.getBounds();
+ final Image image = new Image(display, rect.width, rect.height);
gc.copyArea(image, 0, 0);
gc.dispose();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java
index ea8d2dc31c5..1052dff110a 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet292.java
@@ -55,7 +55,8 @@ public static void main(String[] args) {
button.addListener (SWT.Selection, e -> {
Image image = label.getImage ();
if (image != null) image.dispose ();
- image = new Image (display, group.getBounds ());
+ Rectangle rect = group.getBounds();
+ image = new Image (display, rect.width, rect.height);
GC gc = new GC (image);
boolean success = group.print (gc);
gc.dispose ();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet367.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet367.java
index fc5b6aee5b5..54b53dc1d39 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet367.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet367.java
@@ -36,6 +36,8 @@ public class Snippet367 {
private static final String IMAGE_PATH_200 = IMAGES_ROOT + IMAGE_200;
public static void main (String [] args) {
+ final Display display = new Display ();
+
final ImageFileNameProvider filenameProvider = zoom -> {
switch (zoom) {
case 100:
@@ -65,7 +67,17 @@ public static void main (String [] args) {
gc.drawLine(3, 3, width - 3, height - 3);
};
- final Display display = new Display ();
+ Image imageWithDataProvider = new Image (display, imageDataProvider);
+ final ImageGcDrawer transparentImageGcDrawer = new ImageGcDrawer() {
+ @Override
+ public void drawOn(GC gc, int width, int height) {
+ gc.drawImage(imageWithDataProvider, 0, 0);
+ }
+ @Override
+ public int getGcStyle() {
+ return SWT.TRANSPARENT;
+ }
+ };
final Shell shell = new Shell (display);
shell.setText("Snippet367");
shell.setLayout (new GridLayout (3, false));
@@ -99,13 +111,17 @@ public static void main (String [] args) {
new Button(shell, SWT.NONE).setImage (new Image (display, filenameProvider));
new Label (shell, SWT.NONE).setText ("ImageDataProvider:");
- new Label (shell, SWT.NONE).setImage (new Image (display, imageDataProvider));
- new Button(shell, SWT.NONE).setImage (new Image (display, imageDataProvider));
+ new Label (shell, SWT.NONE).setImage (imageWithDataProvider);
+ new Button(shell, SWT.NONE).setImage (imageWithDataProvider);
new Label (shell, SWT.NONE).setText ("ImageGcDrawer:");
new Label (shell, SWT.NONE).setImage (new Image (display, imageGcDrawer, 20, 20));
new Button(shell, SWT.NONE).setImage (new Image (display, imageGcDrawer, 20, 20));
+ new Label (shell, SWT.NONE).setText ("Transparent ImageGcDrawer:");
+ new Label (shell, SWT.NONE).setImage (new Image (display, transparentImageGcDrawer, 20, 20));
+ new Button(shell, SWT.NONE).setImage (new Image (display, transparentImageGcDrawer, 20, 20));
+
createSeparator(shell);
new Label (shell, SWT.NONE).setText ("1. Canvas\n(PaintListener)");
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet382.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet382.java
index 821cfcec277..502f14dfe65 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet382.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet382.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.swt.snippets;
+import java.util.function.*;
+
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
@@ -64,6 +66,22 @@ public static void main (String [] args) {
final Display display = new Display ();
+ final Image imageWithFileNameProvider = new Image (display, filenameProvider);
+ final Supplier disabledImageWithFileNameProvider = () -> new Image (display,imageWithFileNameProvider, SWT.IMAGE_DISABLE);
+ final Supplier greyImageWithFileNameProvider = () -> new Image (display,imageWithFileNameProvider, SWT.IMAGE_GRAY);
+
+ final Image imageWithDataProvider = new Image (display, imageDataProvider);
+ final Image disabledImageWithDataProvider = new Image (display,imageWithDataProvider, SWT.IMAGE_DISABLE);
+ final Image greyImageWithDataProvider = new Image (display,imageWithDataProvider, SWT.IMAGE_GRAY);
+
+ final Image imageWithData = new Image (display, IMAGE_PATH_100);
+ final Image disabledImageWithData = new Image (display,imageWithData, SWT.IMAGE_DISABLE);
+ final Image greyImageWithData = new Image (display,imageWithData, SWT.IMAGE_GRAY);
+
+ final Supplier imageWithDataCopy = () -> new Image (display, imageWithDataProvider, SWT.IMAGE_COPY);
+ final Supplier disabledImageWithDataCopy = () -> new Image (display,disabledImageWithDataProvider, SWT.IMAGE_COPY);
+ final Supplier greyImageWithDataCopy = () -> new Image (display,greyImageWithDataProvider, SWT.IMAGE_COPY);
+
final ImageGcDrawer imageGcDrawer = (gc, width, height) -> {
gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
gc.fillRectangle(0, 0, width, height);
@@ -71,6 +89,25 @@ public static void main (String [] args) {
gc.drawRectangle(4, 4, width - 8, height - 8);
};
+ final Image imageWithGcDrawer = new Image (display, imageGcDrawer, 16, 16);
+ final Image disabledImageWithGcDrawer = new Image (display, imageWithGcDrawer, SWT.IMAGE_DISABLE);
+ final Image greyImageWithGcDrawer = new Image (display, imageWithGcDrawer, SWT.IMAGE_GRAY);
+
+ final ImageGcDrawer transparentImageGcDrawer = new ImageGcDrawer() {
+ @Override
+ public void drawOn(GC gc, int width, int height) {
+ gc.drawImage(imageWithDataProvider, 0, 0);
+ }
+ @Override
+ public int getGcStyle() {
+ return SWT.TRANSPARENT;
+ }
+ };
+
+ final Image imageWithTransparentGcDrawer = new Image (display, transparentImageGcDrawer, 16, 16);
+ final Image disabledImageWithTransparentGcDrawer = new Image (display, imageWithTransparentGcDrawer, SWT.IMAGE_DISABLE);
+ final Image greyImageWithTransparentGcDrawer = new Image (display, imageWithTransparentGcDrawer, SWT.IMAGE_GRAY);
+
final Shell shell = new Shell (display);
shell.setText("Snippet382");
shell.setLayout (new GridLayout (3, false));
@@ -80,57 +117,58 @@ public void handleEvent(Event e) {
if (e.type == SWT.Paint) {
GC mainGC = e.gc;
GCData gcData = mainGC.getGCData();
- final Image imageWithFileNameProvider = new Image (display, filenameProvider);
- final Image disabledImageWithFileNameProvider = new Image (display,imageWithFileNameProvider, SWT.IMAGE_DISABLE);
- final Image greyImageWithFileNameProvider = new Image (display,imageWithFileNameProvider, SWT.IMAGE_GRAY);
-
- final Image imageWithDataProvider = new Image (display, imageDataProvider);
- final Image disabledImageWithDataProvider = new Image (display,imageWithDataProvider, SWT.IMAGE_DISABLE);
- final Image greyImageWithDataProvider = new Image (display,imageWithDataProvider, SWT.IMAGE_GRAY);
-
- final Image imageWithData = new Image (display, IMAGE_PATH_100);
- final Image disabledImageWithData = new Image (display,imageWithData, SWT.IMAGE_DISABLE);
- final Image greyImageWithData = new Image (display,imageWithData, SWT.IMAGE_GRAY);
-
- final Image imageWithGcDrawer = new Image (display, imageGcDrawer, 16, 16);
- final Image disabledImageWithGcDrawer = new Image (display, imageWithGcDrawer, SWT.IMAGE_DISABLE);
- final Image greyImageWithGcDrawer = new Image (display, imageWithGcDrawer, SWT.IMAGE_GRAY);
+ gcData.nativeZoom = 100;
try {
+ mainGC.drawText("--ImageFileNameProvider--", 20, 20);
drawImages(mainGC, gcData, "Normal",40, imageWithFileNameProvider);
- drawImages(mainGC, gcData, "Disabled",80, disabledImageWithFileNameProvider);
- drawImages(mainGC, gcData, "Greyed",120, greyImageWithFileNameProvider);
-
- drawImages(mainGC, gcData, "Normal",160, imageWithDataProvider);
- drawImages(mainGC, gcData, "Disabled",200, disabledImageWithDataProvider);
- drawImages(mainGC, gcData, "Greyed",240, greyImageWithDataProvider);
-
- drawImages(mainGC, gcData, "Normal",280, imageWithDataProvider);
- drawImages(mainGC, gcData, "Disabled",320, disabledImageWithData);
- drawImages(mainGC, gcData, "Greyed",360, greyImageWithData);
-
- drawImages(mainGC, gcData, "Normal", 400, imageWithGcDrawer);
- drawImages(mainGC, gcData, "Disabled", 440, disabledImageWithGcDrawer);
- drawImages(mainGC, gcData, "Greyed", 480, greyImageWithGcDrawer);
+ drawImages(mainGC, gcData, "Disabled",80, disabledImageWithFileNameProvider.get());
+ drawImages(mainGC, gcData, "Greyed",120, greyImageWithFileNameProvider.get());
+
+ mainGC.drawText("--ImageDataProvider--", 20, 150);
+ drawImages(mainGC, gcData, "Normal",180, imageWithDataProvider);
+ drawImages(mainGC, gcData, "Disabled",220, disabledImageWithDataProvider);
+ drawImages(mainGC, gcData, "Greyed",260, greyImageWithDataProvider);
+
+ mainGC.drawText("--Image with ImageData--", 20, 290);
+ drawImages(mainGC, gcData, "Normal",320, imageWithData);
+ drawImages(mainGC, gcData, "Disabled",360, disabledImageWithData);
+ drawImages(mainGC, gcData, "Greyed",400, greyImageWithData);
+
+ mainGC.drawText("--ImageDataProvider Copy--", 20, 430);
+ drawImages(mainGC, gcData, "Normal",460, imageWithDataCopy.get());
+ drawImages(mainGC, gcData, "Disabled",500, disabledImageWithDataCopy.get());
+ drawImages(mainGC, gcData, "Greyed",540, greyImageWithDataCopy.get());
+
+ mainGC.drawText("--ImageGcDrawer--", 20, 570);
+ drawImages(mainGC, gcData, "Normal", 600, imageWithGcDrawer);
+ drawImages(mainGC, gcData, "Disabled", 640, disabledImageWithGcDrawer);
+ drawImages(mainGC, gcData, "Greyed", 680, greyImageWithGcDrawer);
+
+ mainGC.drawText("--Transparent ImageGcDrawer--", 20, 710);
+ drawImages(mainGC, gcData, "Normal", 740, imageWithTransparentGcDrawer);
+ drawImages(mainGC, gcData, "Disabled", 780, disabledImageWithTransparentGcDrawer);
+ drawImages(mainGC, gcData, "Greyed", 820, greyImageWithTransparentGcDrawer);
} finally {
mainGC.dispose ();
}
}
}
- private void drawImages(GC mainGC, GCData gcData, String text, int y, final Image imageWithFileNameProvider) {
+ private void drawImages(GC mainGC, GCData gcData, String text, int y, final Image image) {
gcData.nativeZoom = 100;
mainGC.drawText(text, 0, y);
- mainGC.drawImage(imageWithFileNameProvider, 50, y);
+ mainGC.drawImage(image, 50, y);
gcData.nativeZoom = 150;
- mainGC.drawImage(imageWithFileNameProvider, 100, (int) (y/1.5));
+ mainGC.drawImage(image, 100, (int) (y/1.5));
gcData.nativeZoom = 200;
- mainGC.drawImage(imageWithFileNameProvider, 150, y/2);
+ mainGC.drawImage(image, 150, y/2);
+ gcData.nativeZoom = 100;
}
};
shell.addListener(SWT.Paint, l);
- shell.setSize(400, 550);
+ shell.setSize(400, 750);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet384.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet384.java
new file mode 100644
index 00000000000..df7b8dc5fac
--- /dev/null
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet384.java
@@ -0,0 +1,448 @@
+/*******************************************************************************
+ * Copyright (c) 2025 Vector Informatik GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.swt.snippets;
+
+import java.io.*;
+import java.util.*;
+import java.util.List;
+import java.util.function.*;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Comparison of algorithms for disabling images (grayed-out, desaturated, etc.)
+ *
+ * Various parameters can be adjusted, and the background color can be selected to match typical Eclipse themes light, dark, and darker.
+ *
+ * Usage
+ *
+ * Select a folder containing images. Example images are provided in:
+ * /org.eclipse.swt.snippets/resources/Snippet384/images
+ * Adjust the algorithms parameters to experiment with different disabled effects. Defaults match what is used in Eclipse.
+ * Switch between themes to see how the result looks on various backgrounds.
+ *
+ *
+ * This snippet was created to help evaluate and pick a new image-disabling algorithm for Eclipse.
+ *
+ * Related discussion:
+ * https://github.com/eclipse-platform/eclipse.platform.swt/discussions/1741
+ *
+ *
+ * Pull Request:
+ * https://github.com/eclipse-platform/eclipse.platform.swt/pull/1936
+ *
+ *
+ * For a complete list of SWT example snippets, visit:
+ * https://www.eclipse.org/swt/snippets/
+ *
+ */
+public class Snippet384 {
+
+ private static Display display = new Display();
+
+ private static final Color LIGHT_THEME_BACKGROUND = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+ private static final Color DARK_THEME_GRAY = new Color(47, 47, 47);
+ private static final Color DARK_THEME_GRAY_DARKER = new Color(72, 72, 76);
+
+ // colors and thresholds used in the current Win32/macOS algorithm
+ private static final RGB GRAY_LOW = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW).getRGB(); // == RGB(160, 160, 160) on Windows
+ private static final RGB GRAY_HIGH = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).getRGB(); // == RGB(240, 240,240) on Windows
+ private static final int WIN32_COCOA_THRESHOLD = 98304; // == 3 * 2^15, this is the threshold used in the legacy win32/macOS disabling algorithm
+ private static final int BACKGROUND_THRESHOLD = GRAY_HIGH.red * GRAY_HIGH.red + GRAY_HIGH.green + GRAY_HIGH.green + GRAY_HIGH.blue * GRAY_HIGH.blue; // == on windows 240^2 * 3
+ private static final int MAX_BRIGHTNESS = 255 * 255 * 3;
+
+ // change these to adjust the sliders default values
+ private static final int ADJUSTABLE_THRESHOLD_LOW_DEFAULT = WIN32_COCOA_THRESHOLD;
+ private static final int ADJUSTABLE_THRESHOLD_HIGH_DEFAULT = BACKGROUND_THRESHOLD;
+ private static final RGB ADDITIONAL_GRAY_MID_DEFAULT = new RGB(214, 214, 214); // seems to be good middle ground
+
+ private static final int HSB_DISABLING_BRIGHTNESS_DEFAULT = 90;
+ private static final int HSB_DISABLING_ALPHA_DEFAULT = 50;
+ private static final int HSB_DISABLING_SATURATION_DEFAULT = 20;
+
+ private static final int ECLIPSE_RENDER_MOJOE_BRIGHTNESS_DEFAULT = 290;
+ private static final int ECLIPSE_RENDER_MOJO_ALPHA_DEFAULT = 100;
+
+ public static void main(String[] args) {
+
+ Shell shell = new Shell(display);
+ shell.setText("Disabled Icon Viewer"); //$NON-NLS-1$
+ shell.setLayout(new GridLayout(1, false));
+
+ DirectoryDialog directoryDialog = new DirectoryDialog(shell);
+ directoryDialog.setText("Select Image Folder"); //$NON-NLS-1$
+ directoryDialog.setMessage("Select a folder containing images"); //$NON-NLS-1$
+ directoryDialog.setFilterPath(new File("resources/Snippet384/images").getAbsolutePath());
+ String selectedDirectory = directoryDialog.open();
+
+ if (selectedDirectory == null) {
+ System.out.println("No folder selected, exiting..."); //$NON-NLS-1$
+ display.dispose();
+ return;
+ }
+
+ Map> imageRowStorage = new HashMap<>();
+ List originalImages = loadImagesFromFolder(selectedDirectory, display);
+
+ // define PixelTransformers
+ HSBConversionDisablingTransformer desaturatedTransformer = new HSBConversionDisablingTransformer(HSB_DISABLING_BRIGHTNESS_DEFAULT / 100.f, HSB_DISABLING_ALPHA_DEFAULT / 100.f, HSB_DISABLING_SATURATION_DEFAULT / 100.f);
+ GTKDisablingTransformer gtkTransformer = new GTKDisablingTransformer();
+ ThresholdBasedDisablingTransformer win32MacTransformer = new ThresholdBasedDisablingTransformer(GRAY_LOW, GRAY_HIGH, GRAY_HIGH, WIN32_COCOA_THRESHOLD, WIN32_COCOA_THRESHOLD, 1.f);
+ EclipseRenderMojoDisablingTransformer eclipseMojoTransformer = new EclipseRenderMojoDisablingTransformer(ECLIPSE_RENDER_MOJOE_BRIGHTNESS_DEFAULT / 100f, ECLIPSE_RENDER_MOJO_ALPHA_DEFAULT / 100.f);
+ HSBConversionDisablingTransformer hsbTransformer = new HSBConversionDisablingTransformer(HSB_DISABLING_BRIGHTNESS_DEFAULT / 100.f, HSB_DISABLING_ALPHA_DEFAULT / 100.f, HSB_DISABLING_SATURATION_DEFAULT / 100.f);
+ ThresholdBasedDisablingTransformer adjThreshAdditGray = new ThresholdBasedDisablingTransformer(GRAY_LOW, ADDITIONAL_GRAY_MID_DEFAULT, GRAY_HIGH, ADJUSTABLE_THRESHOLD_LOW_DEFAULT, ADJUSTABLE_THRESHOLD_HIGH_DEFAULT, 1.f);
+
+ // create transformed icon rows
+ Composite imagesComposite = new Composite(shell, SWT.NONE);
+ imagesComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ imagesComposite.setLayout(new GridLayout(2, false));
+ addTransformationRow(imagesComposite, "Original Images:", rgba -> rgba, originalImages, imageRowStorage);
+ addTransformationRow(imagesComposite, "(current) Desaturated, Eclipse Default:", desaturatedTransformer, originalImages, imageRowStorage);
+ addTransformationRow(imagesComposite, "(legacy) Win32/macOS:", win32MacTransformer, originalImages, imageRowStorage);
+ addTransformationRow(imagesComposite, "(legacy) GTK+:", gtkTransformer, originalImages, imageRowStorage);
+ addTransformationRow(imagesComposite, "(legacy) Eclipse Pre-Disabling Mojo:", eclipseMojoTransformer, originalImages, imageRowStorage);
+ addTransformationRow(imagesComposite, "(experimental) HSB Transformation:", hsbTransformer, originalImages, imageRowStorage);
+ addTransformationRow(imagesComposite, "(experimental) Adjustable Threshold + 3rd Gray Tone:", adjThreshAdditGray, originalImages, imageRowStorage);
+
+ // add sliders
+ Composite eclipseMojoSliderComposite = new Composite(shell, SWT.NONE);
+ eclipseMojoSliderComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ eclipseMojoSliderComposite.setLayout(new GridLayout(9, false));
+ Scale eclipsePreDisablingBrightness = addScale(eclipseMojoSliderComposite, "Eclipse Mojo Brightness %:", 40, 350, ECLIPSE_RENDER_MOJOE_BRIGHTNESS_DEFAULT);
+ Scale eclipsePreDisablingAlpha = addScale(eclipseMojoSliderComposite, "Eclipse Mojo Alpha %:", 0, 100, ECLIPSE_RENDER_MOJO_ALPHA_DEFAULT);
+
+ Composite hsbSliderComposite = new Composite(shell, SWT.NONE);
+ hsbSliderComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ hsbSliderComposite.setLayout(new GridLayout(9, false));
+ Scale hsbDisablingBrightness = addScale(hsbSliderComposite, "HSB Brightness %:", 40, 140, HSB_DISABLING_BRIGHTNESS_DEFAULT);
+ Scale hsbDisablingSaturation = addScale(hsbSliderComposite, "HSB Saturation %:", 0, 100, HSB_DISABLING_SATURATION_DEFAULT);
+ Scale hsbDisablingAlpha = addScale(hsbSliderComposite, "HSB Alpha %:", 0, 100, HSB_DISABLING_ALPHA_DEFAULT);
+
+ Composite adjThreshAddGraySliderComposite = new Composite(shell, SWT.NONE);
+ adjThreshAddGraySliderComposite.setLayout(new GridLayout(12, false));
+ adjThreshAddGraySliderComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ Scale lowScale = addScale(adjThreshAddGraySliderComposite, "Adjustable Threshold Low:", 0, MAX_BRIGHTNESS, WIN32_COCOA_THRESHOLD);
+ Scale highScale = addScale(adjThreshAddGraySliderComposite, "Adjustable Threshold High:", 0, MAX_BRIGHTNESS, ADJUSTABLE_THRESHOLD_HIGH_DEFAULT);
+ Scale thirdGray = addScale(adjThreshAddGraySliderComposite, "3rd Gray (set R,G,B to):", GRAY_LOW.red, GRAY_HIGH.red, ADDITIONAL_GRAY_MID_DEFAULT.red);
+ Scale adjThreshAlphaChange = addScale(adjThreshAddGraySliderComposite, "Alpha %:", 0, 100, 100);
+
+ // update images on slider change
+ addImageUpdateScaleListener(hsbDisablingBrightness, hsbTransformer, value -> hsbTransformer.setBrightnessChange(value / 100.f), imageRowStorage, originalImages);
+ addImageUpdateScaleListener(hsbDisablingAlpha, hsbTransformer, value -> hsbTransformer.setAlphaChange(value / 100.f), imageRowStorage, originalImages);
+ addImageUpdateScaleListener(hsbDisablingSaturation, hsbTransformer, value -> hsbTransformer.setSaturationChange(value / 100.f), imageRowStorage, originalImages);
+
+ addImageUpdateScaleListener(eclipsePreDisablingBrightness, eclipseMojoTransformer, value -> eclipseMojoTransformer.setBrightnessChange(value / 100.f), imageRowStorage, originalImages);
+ addImageUpdateScaleListener(eclipsePreDisablingAlpha, eclipseMojoTransformer, value -> eclipseMojoTransformer.setAlphaChange(value / 100.f), imageRowStorage, originalImages);
+
+ addImageUpdateScaleListener(lowScale, adjThreshAdditGray, adjThreshAdditGray::setThresholdLow, imageRowStorage, originalImages);
+ addImageUpdateScaleListener(highScale, adjThreshAdditGray, adjThreshAdditGray::setThresholdHigh, imageRowStorage, originalImages);
+ addImageUpdateScaleListener(thirdGray, adjThreshAdditGray, value -> adjThreshAdditGray.setGrayMid(new RGB(value, value, value)), imageRowStorage, originalImages);
+ addImageUpdateScaleListener(adjThreshAlphaChange, adjThreshAdditGray, value -> adjThreshAdditGray.setAlphaChange(value / 100.f), imageRowStorage, originalImages);
+
+ // combo box for theme selection
+ Combo themeCombo = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
+ themeCombo.setItems("Light Theme", "Dark Theme", "Darker Theme");
+ themeCombo.select(0);
+ themeCombo.addListener(SWT.Selection, e -> {
+ int selected = themeCombo.getSelectionIndex();
+ switch (selected) {
+ case 1:
+ shell.setBackground(DARK_THEME_GRAY);
+ imagesComposite.setBackground(DARK_THEME_GRAY_DARKER);
+ break;
+ case 2:
+ shell.setBackground(DARK_THEME_GRAY_DARKER);
+ imagesComposite.setBackground(DARK_THEME_GRAY);
+ break;
+ default:
+ shell.setBackground(LIGHT_THEME_BACKGROUND);
+ imagesComposite.setBackground(LIGHT_THEME_BACKGROUND);
+ }
+ });
+
+ shell.open();
+ shell.layout();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ originalImages.forEach(Image::dispose);
+ display.dispose();
+ }
+
+ private static void addTransformationRow(Composite parent, String labelText, PixelTransformer transformer,
+ List originalImages, Map> imageRowStorage) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(labelText);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(originalImages.size(), false));
+
+ List transformedImageLabels = new ArrayList<>(originalImages.size());
+ for (Image original : originalImages) {
+ Image transformed = transformImage(original, transformer);
+ Label imageLabel = new Label(composite, SWT.NONE);
+ imageLabel.setImage(transformed);
+ transformedImageLabels.add(imageLabel);
+ }
+ imageRowStorage.put(transformer, transformedImageLabels);
+ }
+
+ private static void addImageUpdateScaleListener(Scale scale, PixelTransformer transformer, IntConsumer transformerUpdateMethod, Map> transformedImageStorage, List imagesToTransformOnUpdate ) {
+ scale.addListener(SWT.Selection, e -> {
+ int scaleValue = scale.getSelection();
+ transformerUpdateMethod.accept(scaleValue);
+ updateImageRow(transformer, transformedImageStorage, imagesToTransformOnUpdate);
+ });
+ }
+
+ private static Scale addScale(Composite parent, String labelText, int minimum, int maximum, int init) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(labelText);
+ Scale scale = new Scale(parent, SWT.HORIZONTAL);
+ scale.setMinimum(minimum);
+ scale.setMaximum(maximum);
+ scale.setSelection(init);
+ Text lowValue = new Text(parent, SWT.NONE);
+ lowValue.setEditable(false);
+ lowValue.setText(String.valueOf(init));
+
+ scale.addListener(SWT.Selection, e -> {
+ int selection = scale.getSelection();
+ lowValue.setText(String.valueOf(selection));
+ lowValue.requestLayout();
+ });
+
+ return scale;
+ }
+
+ private static void updateImageRow(PixelTransformer transformer, Map> imageRowStorage,
+ List originalImages) {
+ List imageLabels = imageRowStorage.getOrDefault(transformer, List.of());
+
+ for (int i = 0; i < originalImages.size(); i++) {
+ Image transformed = transformImage(originalImages.get(i), transformer);
+ Label imageLabel = imageLabels.get(i);
+ imageLabel.getImage().dispose();
+ imageLabel.setImage(transformed);
+ }
+ }
+
+ @FunctionalInterface
+ public static interface PixelTransformer {
+ RGBA transform(RGBA originalRgba);
+ }
+
+ /*
+ * Legacy GTK+ disabling algorithm used in Linux
+ */
+ public static class GTKDisablingTransformer implements PixelTransformer {
+ private double reductionFactor = 0.5d;
+
+ public void setReductionFactor(double reductionFactor) {
+ this.reductionFactor = reductionFactor;
+ }
+
+ @Override
+ public RGBA transform(RGBA originalRgba) {
+ int red = originalRgba.rgb.red;
+ int green = originalRgba.rgb.green;
+ int blue = originalRgba.rgb.blue;
+ int alpha = originalRgba.alpha;
+
+ return new RGBA((int) Math.round(red * reductionFactor), (int) Math.round(green * reductionFactor),
+ (int) Math.round(blue * reductionFactor), (int) Math.round(alpha * reductionFactor));
+ }
+ }
+
+ /*
+ * Legacy Win32/MacOS disabling algorithm but with additional parameters:
+ * adjustable thresholds, 3rd gray tone and adjustable gray tones
+ */
+ public static class ThresholdBasedDisablingTransformer implements PixelTransformer {
+ private RGB grayLow;
+ private RGB grayMid;
+ private RGB grayHigh;
+ private int thresholdLow;
+ private int thresholdHigh;
+ private float alphaChange;
+
+ public ThresholdBasedDisablingTransformer(RGB grayLow, RGB grayMid, RGB grayHigh, int thresholdLow,
+ int thresholdHigh, float alphaChange) {
+ this.grayLow = grayLow;
+ this.grayMid = grayMid;
+ this.grayHigh = grayHigh;
+ this.thresholdLow = thresholdLow;
+ this.thresholdHigh = thresholdHigh;
+ this.alphaChange = alphaChange;
+ }
+
+ public void setThresholdLow(int thresholdLow) {
+ this.thresholdLow = thresholdLow;
+ }
+
+ public void setThresholdHigh(int thresholdHigh) {
+ this.thresholdHigh = thresholdHigh;
+ }
+
+ public void setGrayMid(RGB grayMid) {
+ this.grayMid = grayMid;
+ }
+
+ public void setAlphaChange(float alphaChange) {
+ this.alphaChange = alphaChange;
+ }
+
+ @Override
+ public RGBA transform(RGBA originalRgba) {
+ int red = originalRgba.rgb.red;
+ int green = originalRgba.rgb.green;
+ int blue = originalRgba.rgb.blue;
+ int alpha = originalRgba.alpha;
+
+ RGBA disabled;
+ int squareDist = red * red + green * green + blue * blue;
+ if (squareDist < thresholdLow) {
+ disabled = new RGBA(grayLow.red, grayLow.green, grayLow.blue, (int) (alphaChange * alpha));
+ } else if (squareDist < thresholdHigh) {
+ disabled = new RGBA(grayMid.red, grayMid.green, grayMid.blue, (int) (alphaChange * alpha));
+ } else {
+ disabled = new RGBA(grayHigh.red, grayHigh.green, grayHigh.blue, (int) (alphaChange * alpha));
+ }
+ return disabled;
+ }
+ }
+
+ /*
+ * HSB conversion disabling
+ */
+ public static class HSBConversionDisablingTransformer implements PixelTransformer {
+ private float brightnessChange;
+ private float alphaChange;
+ private float saturationChange;
+
+ public HSBConversionDisablingTransformer(float brightnessChange, float alphaChange, float saturationChange) {
+ this.saturationChange = saturationChange;
+ this.brightnessChange = brightnessChange;
+ this.alphaChange = alphaChange;
+ }
+
+ public void setBrightnessChange(float brightnessChange) {
+ this.brightnessChange = brightnessChange;
+ }
+
+ public void setAlphaChange(float alphaChange) {
+ this.alphaChange = alphaChange;
+ }
+
+ public void setSaturationChange(float saturationChange) {
+ this.saturationChange = saturationChange;
+ }
+
+ @Override
+ public RGBA transform(RGBA originalRgba) {
+ float[] hsba = originalRgba.getHSBA();
+
+ hsba[1] *= saturationChange;
+ hsba[2] *= brightnessChange;
+ hsba[3] *= alphaChange;
+
+ hsba[1] = Math.min(hsba[1], 1.f);
+ hsba[2] = Math.min(hsba[2], 1.f);
+ hsba[3] = Math.min(hsba[3], 255.f);
+
+ return new RGBA(hsba[0], hsba[1], hsba[2], hsba[3]);
+ }
+ }
+
+ /*
+ * Legacy Eclipse pre-disabling Mojo (offline disabling for icons delivered with eclipse)
+ */
+ public static class EclipseRenderMojoDisablingTransformer implements PixelTransformer {
+ private float brightnessChange;
+ private float alphaChange;
+
+ public EclipseRenderMojoDisablingTransformer(float brightnessChange, float alphaChange) {
+ this.brightnessChange = brightnessChange;
+ this.alphaChange = alphaChange;
+ }
+
+ public void setBrightnessChange(float brightnessChange) {
+ this.brightnessChange = brightnessChange;
+ }
+
+ public void setAlphaChange(float alphaChange) {
+ this.alphaChange = alphaChange;
+ }
+
+ @Override
+ public RGBA transform(RGBA rgba) {
+ float saturation = 0.3f;
+ float contrast = 0.2f;
+ // float brightness = 2.9f;
+
+ // adjust saturation
+ float[] hsba = rgba.getHSBA();
+ hsba[1] *= saturation;
+ rgba = new RGBA(hsba[0], hsba[1], hsba[2], hsba[3]);
+
+ // adjust contrast and brightness
+ rgba.rgb.blue = (int) Math.min(Math.max((contrast * (rgba.rgb.blue * brightnessChange - 128) + 128), 0), 255);
+ rgba.rgb.red = (int) Math.min(Math.max((contrast * (rgba.rgb.red * brightnessChange - 128) + 128), 0), 255);
+ rgba.rgb.green = (int) Math.min(Math.max((contrast * (rgba.rgb.green * brightnessChange - 128) + 128), 0), 255);
+ rgba.alpha = (int) (alphaChange * rgba.alpha);
+
+ return rgba;
+ }
+ }
+
+ public static Image transformImage(Image originalImage, PixelTransformer transformer) {
+ ImageData originalData = originalImage.getImageData();
+ ImageData transformedData = new ImageData(originalData.width, originalData.height, 24,
+ new PaletteData(0xFF, 0xFF00, 0xFF0000));
+
+ for (int y = 0; y < originalData.height; y++) {
+ for (int x = 0; x < originalData.width; x++) {
+ int pixelValue = originalData.getPixel(x, y);
+ RGB originalRGB = originalData.palette.getRGB(pixelValue);
+ RGBA originalRGBA = new RGBA(originalRGB.red, originalRGB.green, originalRGB.blue,
+ originalData.getAlpha(x, y));
+ RGBA transformedRGBA = transformer.transform(originalRGBA);
+ int newPixelValue = transformedData.palette.getPixel(transformedRGBA.rgb);
+ transformedData.setPixel(x, y, newPixelValue);
+ transformedData.setAlpha(x, y, transformedRGBA.alpha);
+ }
+ }
+ return new Image(originalImage.getDevice(), transformedData);
+ }
+
+ private static List loadImagesFromFolder(String folderPath, Display display) {
+ File folder = new File(folderPath);
+ File[] files = folder.listFiles();
+ return Arrays.stream(files).filter(File::isFile)
+ .filter(Snippet384::isImage)
+ .map(file -> new Image(display, file.getAbsolutePath()))
+ .toList();
+ }
+
+ private static boolean isImage(File file) {
+ List imageExtensions = List.of(".jpg", ".jpeg", ".png", ".gif", ".bmp");
+ String fileName = file.getName().toLowerCase();
+ return imageExtensions.stream().anyMatch(fileName::endsWith);
+ }
+
+}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet385.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet385.java
new file mode 100644
index 00000000000..c4669a835cd
--- /dev/null
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet385.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2025 Yatta Solutions
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Yatta Solutions - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.snippets;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Demonstration how to custom draw images
+ *
+ * Snippet to show how to draw on an image loaded from the file system which has
+ * multiple variants for different zoom levels. Mainly relevant on Windows, as
+ * it uses the Windows-only monitor-specific scaling mode.
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ */
+public class Snippet385 {
+
+ public static void main(String[] args) {
+ System.setProperty("swt.autoScale.updateOnRuntime", "true");
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setText("Watermark over Image using GC");
+ shell.setSize(1200, 900);
+
+ final ImageFileNameProvider filenameProvider = zoom -> {
+ String path = null;
+ switch (zoom) {
+ case 150:
+ path = "resources/Snippet385/red.jpeg";
+ break;
+ case 100:
+ path = "resources/Snippet385/black.jpg";
+ break;
+ default:
+ path = "resources/Snippet385/black.jpg";
+ }
+ return path;
+ };
+ Image loadedImage = new Image(display, filenameProvider);
+
+ int width = loadedImage.getBounds().width;
+ int height = loadedImage.getBounds().height;
+
+ Image composedImage = new Image(display, (gc, iX, iY) -> {
+ gc.drawImage(loadedImage, 0, 0);
+
+ gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
+ Font font = new Font(display, "Arial", 24, SWT.BOLD);
+ gc.setFont(font);
+ gc.setAlpha(128); // semi-transparent
+ String watermark = "WATERMARK";
+ Point extent = gc.textExtent(watermark);
+ int x = (width - extent.x) / 2;
+ int y = (height - extent.y) / 2;
+ gc.drawText(watermark, x, y, SWT.DRAW_TRANSPARENT);
+ font.dispose();
+ }, width, height);
+
+ shell.addPaintListener(e -> {
+ e.gc.drawImage(composedImage, 0, 0);
+ });
+
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+
+ loadedImage.dispose();
+ composedImage.dispose();
+ display.dispose();
+ }
+}
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetExplorer.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetExplorer.java
index 5a01541bf35..b306cc46f52 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetExplorer.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetExplorer.java
@@ -37,38 +37,39 @@
*/
public class SnippetExplorer {
- private static final String USAGE_EXPLANATION = "Welcome to the SnippetExplorer!\n"
- + "\n"
- + "This tool will help you to explore and test the large collection of SWT example Snippets. "
- + "You can use the text field on top to filter the Snippets by there description or Snippet number. "
- + "To start a Snippet you can either double click its entry, press enter or use the button below. "
- + "It is also possible to start multiple Snippets at once. (exact behavior depends on selected Snippet-Runner)\n"
- + "\n"
- + "It is recommended to start the Snippet Explorer connected to a console since some of the Snippets "
- + "print useful informations to the console or do not open a window at all.\n"
- + "\n"
- + "The Explorer supports (dependent on your OS and environment) different modes to start Snippets. Those runners are:\n"
- + "\n"
- + " \u2022 Thread Runner: Snippets are executed as threads of the Explorer.\n"
- + "\t- This runner is only available if the environment supports multiple Displays at the same time. (only Windows at the moment)\n"
- + "\t- Multiple Snippets can be run parallel using this runner.\n"
- + "\t- All running Snippets are closed when the explorer exits.\n"
- + "\t- If to many Snippets are run in parallel SWT may run out of handles.\n"
- + "\t- If a Snippet calls System.exit it will also force the explorer itself and all other running Snippets to exit as well.\n"
- + "\n"
- + " \u2022 Process Runner: Snippets are executed as separate processes.\n"
- + "\t- This runner is only available if a JRE was found which can be used to start the Snippets.\n"
- + "\t- Multiple Snippets can be run parallel using this runner.\n"
- + "\t- This runner is more likely to fail Snippet launch due to incomplete classpath or other launch problems.\n"
- + "\t- When the explorer exits it try to close all running Snippets but has less control over it as the Thread runner.\n"
- + "\t- Unlike the Thread runner the Process runner is resisted to faulty Snippets. (e.g. Snippets calling System.exit)\n"
- + "\n"
- + " \u2022 Serial Runner: Snippets are executed one after another instead of the explorer.\n"
- + "\t- This runner is always available.\n"
- + "\t- Cannot run Snippets parallel.\n"
- + "\t- To run Snippets the explorer gets closed, executes the selected Snippets one after another in the same JVM "
- + "and after the last Snippet has finished restarts the Snippet Explorer.\n"
- + "\t- A Snippet calling System.exit will stop the Snippet chain and the explorer itself can not restart.";
+ private static final String USAGE_EXPLANATION = """
+ Welcome to the SnippetExplorer!
+
+ This tool will help you to explore and test the large collection of SWT example Snippets. \
+ You can use the text field on top to filter the Snippets by there description or Snippet number. \
+ To start a Snippet you can either double click its entry, press enter or use the button below. \
+ It is also possible to start multiple Snippets at once. (exact behavior depends on selected Snippet-Runner)
+
+ It is recommended to start the Snippet Explorer connected to a console since some of the Snippets \
+ print useful informations to the console or do not open a window at all.
+
+ The Explorer supports (dependent on your OS and environment) different modes to start Snippets. Those runners are:
+
+ \u2022 Thread Runner: Snippets are executed as threads of the Explorer.
+ - This runner is only available if the environment supports multiple Displays at the same time. (only Windows at the moment)
+ - Multiple Snippets can be run parallel using this runner.
+ - All running Snippets are closed when the explorer exits.
+ - If to many Snippets are run in parallel SWT may run out of handles.
+ - If a Snippet calls System.exit it will also force the explorer itself and all other running Snippets to exit as well.
+
+ \u2022 Process Runner: Snippets are executed as separate processes.
+ - This runner is only available if a JRE was found which can be used to start the Snippets.
+ - Multiple Snippets can be run parallel using this runner.
+ - This runner is more likely to fail Snippet launch due to incomplete classpath or other launch problems.
+ - When the explorer exits it try to close all running Snippets but has less control over it as the Thread runner.
+ - Unlike the Thread runner the Process runner is resisted to faulty Snippets. (e.g. Snippets calling System.exit)
+
+ \u2022 Serial Runner: Snippets are executed one after another instead of the explorer.
+ - This runner is always available.
+ - Cannot run Snippets parallel.
+ - To run Snippets the explorer gets closed, executes the selected Snippets one after another in the same JVM \
+ and after the last Snippet has finished restarts the Snippet Explorer.
+ - A Snippet calling System.exit will stop the Snippet chain and the explorer itself can not restart.""";
/** Max length for Snippet description in the main table. */
private static final int MAX_DESCRIPTION_LENGTH_IN_TABLE = 80;
@@ -235,7 +236,7 @@ private void initialize() {
createControls(shell);
- final String[] columns = new String[] { "Name", "Description" };
+ final String[] columns = { "Name", "Description" };
for (String col : columns) {
final TableColumn tableCol = new TableColumn(snippetTable, SWT.NONE);
tableCol.setText(col);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetLauncher.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetLauncher.java
index 07675ac2357..7402d377761 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetLauncher.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/SnippetLauncher.java
@@ -58,15 +58,9 @@ public static void main (String [] args) {
System.out.println(source.substring(start, end-3));
boolean skip = false;
String platform = SWT.getPlatform();
- if (source.contains("PocketPC")) {
- platform = "PocketPC";
- skip = true;
- } else if (source.contains("OpenGL")) {
+ if (source.contains("OpenGL")) {
platform = "OpenGL";
skip = true;
- } else if (source.contains("JavaXPCOM")) {
- platform = "JavaXPCOM";
- skip = true;
} else {
String [] platforms = {"win32", "gtk"};
for (String platformId : platforms) {
@@ -81,7 +75,8 @@ public static void main (String [] args) {
System.out.println("...skipping " + platform + " example...");
continue;
}
- } catch (Exception e) {
+ } catch (IOException e) {
+ e.printStackTrace();
}
}
Method method = null;
diff --git a/features/org.eclipse.swt.tools.feature/feature.xml b/features/org.eclipse.swt.tools.feature/feature.xml
index a09ec37968f..df4b0b6849e 100644
--- a/features/org.eclipse.swt.tools.feature/feature.xml
+++ b/features/org.eclipse.swt.tools.feature/feature.xml
@@ -23,10 +23,6 @@
id="org.eclipse.swt.tools"
version="0.0.0"/>
-
-
diff --git a/local-build/local-build-parent/pom.xml b/local-build/local-build-parent/pom.xml
index 02173c036f5..0e0b0e50fd8 100644
--- a/local-build/local-build-parent/pom.xml
+++ b/local-build/local-build-parent/pom.xml
@@ -14,7 +14,7 @@
org.eclipse.platform
eclipse.platform.swt
- 4.36.0-SNAPSHOT
+ 4.37.0-SNAPSHOT
../../
eclipse.platform.swt.localbuild
diff --git a/pom.xml b/pom.xml
index 3724bbbdb02..6b001175f80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
org.eclipse
eclipse-platform-parent
- 4.36.0-SNAPSHOT
+ 4.37.0-SNAPSHOT
../eclipse-platform-parent
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug491167_TableCursorScrolling.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug491167_TableCursorScrolling.java
index 64660d3a423..fed8ce69685 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug491167_TableCursorScrolling.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug491167_TableCursorScrolling.java
@@ -15,10 +15,19 @@
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.custom.ControlEditor;
+import org.eclipse.swt.custom.TableCursor;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
/**
* This class demonstrates TableCursor
@@ -47,8 +56,8 @@ public void run() {
/**
* Creates the main window's contents
- *
- * @param widget.shell
+ *
+ * @param shell
* the main window
*/
private void createContents(Shell shell) {
@@ -128,7 +137,7 @@ public void keyPressed(KeyEvent event) {
/**
* The application entry point
- *
+ *
* @param args
* the command line arguments
*/
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug516480_KeydownRussianlayout.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug516480_KeydownRussianlayout.java
index 5a1a504cdf4..7e94983e63d 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug516480_KeydownRussianlayout.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug516480_KeydownRussianlayout.java
@@ -14,14 +14,16 @@
package org.eclipse.swt.tests.gtk.snippets;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Thomas Singer
+ */
public class Bug516480_KeydownRussianlayout {
- /**
- * @author Thomas Singer
- */
+
public static void main(String[] args) {
final Display display = new Display();
@@ -31,12 +33,9 @@ public static void main(String[] args) {
final StyledText text = new StyledText(shell, SWT.BORDER);
text.setText("hello world");
- text.addListener(SWT.KeyDown, new Listener() {
- @Override
- public void handleEvent(Event event) {
- System.out.println("event.character = " + (int)event.character);
- System.out.println("event.keyCode = " + event.keyCode);
- }
+ text.addListener(SWT.KeyDown, event -> {
+ System.out.println("event.character = " + (int)event.character);
+ System.out.println("event.keyCode = " + event.keyCode);
});
shell.setSize(300, 200);
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug518961_RTTest.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug518961_RTTest.java
index 41a2d29832f..032df4bba1c 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug518961_RTTest.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug518961_RTTest.java
@@ -26,7 +26,7 @@
1) Uncomment line with "UNCOMMENT THIS".
2) Get hold of nebula rich text project. (found inside org.eclipse.nebula)
edit .classpath and add:
-
+ {@code }
(This can be done via auto fix.
Before Fix: When running, error messages thrown into console.
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531667_CanvasPrint_does_not_work.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531667_CanvasPrint_does_not_work.java
index 97a6567e6fa..f7ac986b7cf 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531667_CanvasPrint_does_not_work.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531667_CanvasPrint_does_not_work.java
@@ -81,7 +81,7 @@ private static Composite canvas(Display display, Shell shell) {
private static void snapshot(Display display, Composite composite, String filename) {
Rectangle bounds = composite.getBounds();
- Image image = new Image(display, bounds);
+ Image image = new Image(display, bounds.width, bounds.height);
GC gc = new GC(image);
composite.print(gc);
gc.dispose();
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java
index 9b3909a12a6..0189e328306 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java
@@ -27,12 +27,12 @@
* no longer paint sliders correctly when scrolling.
*
* Steps to reproduce:
+ *
*
* Run the snippet.
* Resize the pop-up {@link Shell}, so that scrollbars can still be used.
* Scroll with mouse drag, observe that the sliders of the scrollbars don't move.
*
- *
* Expected results: Scrollbar sliders move during scrolling.
* Actual results: Scrollbar sliders don't move when scrolling.
*/
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ControlPrintBroken.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ControlPrintBroken.java
index a8241329b75..c24c3620e8b 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ControlPrintBroken.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ControlPrintBroken.java
@@ -84,7 +84,7 @@ private static Composite canvas(Display display, Shell shell) {
private static void snapshot(Display display, Composite composite, String filename) {
Rectangle bounds = composite.getBounds();
- Image image = new Image(display, bounds);
+ Image image = new Image(display, bounds.width, bounds.height);
GC gc = new GC(image);
composite.print(gc);
gc.dispose();
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ImageLoaderStriping.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ImageLoaderStriping.java
index d4fb5cc5284..0ad5c1f5088 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ImageLoaderStriping.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547529_ImageLoaderStriping.java
@@ -20,6 +20,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
@@ -72,7 +73,8 @@ public void widgetSelected(SelectionEvent e) {
}
private static void saveImage(Control control, String filename, int format) {
- Image image = new Image(control.getDisplay(), control.getBounds());
+ Rectangle bounds = control.getBounds();
+ Image image = new Image(control.getDisplay(), bounds.width, bounds.height);
GC gc = new GC(image);
control.print(gc);
gc.dispose();
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547557_ShellPrintGC.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547557_ShellPrintGC.java
index d8ace87a95a..d28589f9d02 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547557_ShellPrintGC.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547557_ShellPrintGC.java
@@ -66,7 +66,7 @@ public void widgetSelected(SelectionEvent e) {
private static void saveImage(Shell shell, String filename, int format) {
Rectangle bounds = shell.getBounds();
- Image image = new Image(shell.getDisplay(), bounds);
+ Image image = new Image(shell.getDisplay(), bounds.width, bounds.height);
// Printing the client area will result in a warning and only the client area being printed
// Image image = new Image(shell.getDisplay(), shell.getClientArea());
GC gc = new GC(image);
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_CrashShellReparent.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_CrashShellReparent.java
index d8ef6bb0edf..a0048422bbb 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_CrashShellReparent.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_CrashShellReparent.java
@@ -24,15 +24,16 @@
/**
* Description: After fixing the memory leak in bug 573697, we observed crashes
- * on shell re-parenting. In particular, {@link Decorations#fixAccelGroup()}
- * destroyed {@link Decorations#accelGroup} while still in use by GTK.
+ * on shell re-parenting. In particular, in the GTK implementation of
+ * {@link Decorations}'s the method {@code fixAccelGroup()} destroyed
+ * {@code accelGroup} while still in use by GTK.
*
* Steps to reproduce:
+ *
*
* Run the snippet.
* No JDK crash should occur.
*
- *
* Expected results: Standard out has text "No crash occurred.", the JDK did not crash.
* Actual results: The JDK crashed in GTK+ method {@code g_type_check_instance()}.
*/
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuDispose.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuDispose.java
index dac3a83feef..7531c610b33 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuDispose.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuDispose.java
@@ -27,11 +27,11 @@
* standard error stream.
*
* Steps to reproduce:
+ *
*
* Run the snippet.
* No JDK crash should occur, no {@code GLib CRITICAL} errors should be printed on standard error stream.
*
- *
* Expected results: Standard error has no {@code GLib CRITICAL} errors, the JDK did not crash.
* Actual results: The JDK either crashed or {@code GLib CRITICAL} errors are printed on standard error stream.
*/
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuLeak.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuLeak.java
index 246b17bf6f4..ab6b4be80b0 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuLeak.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug573697_MenuBar_MenuLeak.java
@@ -23,15 +23,15 @@
import org.eclipse.swt.widgets.Shell;
/**
- * Description: In bug 573697, we observed a native memory leak cased by {@link Decorations#accelGroup}
- * not being unreferenced.
+ * Description: In bug 573697, we observed a native memory leak caused in the GTK implementation of {@link Decorations}
+ * by the field {@code accelGroup} not being unreferenced.
*
* Steps to reproduce:
+ *
*
* Run the snippet.
* No native memory leak should be detected by e.g. {code valgrind} or {@code jemalloc}.
*
- *
* Expected results: No native memory leak should be detected by e.g. {code valgrind} or {@code jemalloc}.
* Actual results: {@code jemalloc} reports a native memory leak, e.g.:
*
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug579283_TestToolbarOverflow_itemEnablement.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug579283_TestToolbarOverflow_itemEnablement.java
index 3826a9bafcf..a4a983e85b5 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug579283_TestToolbarOverflow_itemEnablement.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug579283_TestToolbarOverflow_itemEnablement.java
@@ -27,10 +27,11 @@
import org.eclipse.swt.widgets.ToolItem;
/**
- * Description: Toolbar items in a toolbar overflow submenu (enabled with style flag {@link SWT.WRAP})
+ * Description: Toolbar items in a toolbar overflow submenu (enabled with style flag {@link SWT#WRAP})
* do not show correct image enablement.
*
* Steps to reproduce:
+ *
*
* Run the snippet.
* Resize the {@link Shell}, so that only some of the icons are visible.
@@ -40,7 +41,6 @@
* Click one of the overflow submenu items.
* Show the overflow menu again, observe that the image of the clicked item is not changed.
*
- *
* Expected results: Images of disabled buttons should appear grayed out.
* Images should change on overflow submenu item click.
* Text and tooltip of an overflow submenu item should also change on click.
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Issue346_JvmCrashRemovingMenuItemAccelerators.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Issue346_JvmCrashRemovingMenuItemAccelerators.java
index 32b16e01eb7..6f9cd74a460 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Issue346_JvmCrashRemovingMenuItemAccelerators.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Issue346_JvmCrashRemovingMenuItemAccelerators.java
@@ -29,9 +29,7 @@
* Set SWT_GTK4=1 in the environment to run on GTK4
* Run the snippet
* Click the menu items a few times and it will eventually crash with the
- * following segfault:
- *
- *
+ * following segfault:
*
* Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
* C [libgtk-4.so.1+0x213053] gtk_shortcut_controller_remove_shortcut+0x53
@@ -40,6 +38,7 @@
* j org.eclipse.swt.internal.gtk4.GTK4.gtk_shortcut_controller_remove_shortcut(JJ)V+0
* j org.eclipse.swt.widgets.MenuItem.setAccelerator(I)V+39
*
+ *
*
*
* Tested on GTK 4.6.8 (Fedora 36)
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java
index 35c2ad2356b..15b1bc75352 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java
@@ -21,7 +21,7 @@
import org.junit.Test;
import org.junit.runners.MethodSorters;
-/** Convenience class for easy copy & paste */
+/** Convenience class for easy copy & paste */
@FixMethodOrder(MethodSorters.JVM)
public class MJ_Template extends MJ_root {
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java
index bb284110c12..e3ea5725329 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java
@@ -36,7 +36,7 @@
import org.junit.Test;
import org.junit.runners.MethodSorters;
-/** Convenience class for easy copy & paste */
+/** Convenience class for easy copy & paste */
@FixMethodOrder(MethodSorters.JVM)
public class MJ_Tree extends MJ_root {
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java
index aa19d2c843f..a517ed9942b 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2024 Yatta Solutions
+ * Copyright (c) 2024, 2025 Yatta Solutions and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,18 +13,19 @@
*******************************************************************************/
package org.eclipse.swt.tests.junit;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assume.assumeFalse;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.internal.DPIUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
/**
* Automated Test Suite for class org.eclipse.swt.internal.DPIUtil
@@ -32,18 +33,18 @@
* @see org.eclipse.swt.internal.DPIUtil
*/
@SuppressWarnings("restriction")
+@DisabledOnOs(value = org.junit.jupiter.api.condition.OS.LINUX, disabledReason = "Linux uses Cairo auto scaling, thus DPIUtil scaling is disabled")
public class DPIUtilTests {
private int deviceZoom;
- @Before
+ @BeforeEach
public void setup() {
- assumeFalse("Linux uses Cairo auto scaling, thus DPIUtil scaling is disabled", SwtTestUtil.isLinux);
deviceZoom = DPIUtil.getDeviceZoom();
DPIUtil.setDeviceZoom(200);
}
- @After
+ @AfterEach
public void tearDown() {
DPIUtil.setDeviceZoom(deviceZoom);
}
@@ -55,24 +56,24 @@ public void scaleDownFloatArray() {
float[] valueAt100 = new float[] { 1, 1.5f, 2 };
float[] scaledValue = DPIUtil.autoScaleDown(valueAt200);
- assertArrayEquals(String.format("Scaling down float array from device zoom (%d) to 100 failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue, .001f);
+ assertArrayEquals(valueAt100, scaledValue, .001f, String.format("Scaling down float array from device zoom (%d) to 100 failed",
+ DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200);
- assertArrayEquals(String.format("Scaling down float array from device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue, .001f);
+ assertArrayEquals(valueAt100, scaledValue, .001f, String.format("Scaling down float array from device zoom (%d) to 100 with device failed",
+ DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleDown(valueAt200, 200);
- assertArrayEquals("Scaling down float array from 200 failed", valueAt100, scaledValue, .001f);
+ assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 200 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200);
- assertArrayEquals("Scaling down float array from 200 with device failed", valueAt100, scaledValue, .001f);
+ assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 200 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt150, 150);
- assertArrayEquals("Scaling down float array from 150 failed", valueAt100, scaledValue, .001f);
+ assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 150 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150);
- assertArrayEquals("Scaling down float array from 150 with device failed", valueAt100, scaledValue, .001f);
+ assertArrayEquals(valueAt100, scaledValue, .001f, "Scaling down float array from 150 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt100, 100);
- assertSame("Scaling down float array without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down float array without zoom change failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100);
- assertSame("Scaling down float array without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down float array without zoom change with device failed");
}
@Test
@@ -83,24 +84,23 @@ public void scaleDownInteger() {
int scaledValue = DPIUtil.autoScaleDown(valueAt200);
assertEquals(
- String.format("Scaling down integer from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt100, scaledValue);
+ valueAt100, scaledValue, String.format("Scaling down integer from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200);
- assertEquals(String.format("Scaling down integer from device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue);
+ assertEquals(
+ valueAt100, scaledValue, String.format("Scaling down integer from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleDown(valueAt200, 200);
- assertEquals("Scaling down integer from 200 failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down integer from 200 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200);
- assertEquals("Scaling down integer from 200 with device failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down integer from 200 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt150, 150);
- assertEquals("Scaling down integer from 150 failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down integer from 150 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150);
- assertEquals("Scaling down integer from 150 with device failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down integer from 150 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt100, 100);
- assertSame("Scaling down integer without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down integer without zoom change failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100);
- assertSame("Scaling down integer without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down integer without zoom change with device failed");
}
@Test
@@ -110,25 +110,24 @@ public void scaleDownFloat() {
float valueAt100 = 5f;
float scaledValue = DPIUtil.autoScaleDown(valueAt200);
- assertEquals(
- String.format("Scaling down float from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f,
+ String.format("Scaling down float from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200);
- assertEquals(String.format("Scaling down float from device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, String
+ .format("Scaling down float from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleDown(valueAt200, 200);
- assertEquals("Scaling down float from 200 failed", valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 200 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200);
- assertEquals("Scaling down float from 200 with device failed", valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 200 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt150, 150);
- assertEquals("Scaling down float from 150 failed", valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 150 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150);
- assertEquals("Scaling down float from 150 with device failed", valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, "Scaling down float from 150 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt100, 100);
- assertEquals("Scaling down float without zoom change failed", valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, "Scaling down float without zoom change failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100);
- assertEquals("Scaling down float without zoom change with device failed", valueAt100, scaledValue, .001f);
+ assertEquals(valueAt100, scaledValue, .001f, "Scaling down float without zoom change with device failed");
}
@Test
@@ -138,25 +137,24 @@ public void scaleDownPoint() {
Point valueAt100 = new Point(5, 7);
Point scaledValue = DPIUtil.autoScaleDown(valueAt200);
- assertEquals(
- String.format("Scaling down Point from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue,
+ String.format("Scaling down Point from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200);
- assertEquals(String.format("Scaling down Point from device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, String
+ .format("Scaling down Point from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleDown(valueAt200, 200);
- assertEquals("Scaling down Point from 200 failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Point from 200 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200);
- assertEquals("Scaling down Point from 200 with device failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Point from 200 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt150, 150);
- assertEquals("Scaling down Point from 150 failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Point from 150 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150);
- assertEquals("Scaling down Point from 150 with device failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Point from 150 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt100, 100);
- assertSame("Scaling down Point without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down Point without zoom change failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100);
- assertSame("Scaling down Point without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down Point without zoom change with device failed");
}
@Test
@@ -166,24 +164,24 @@ public void scaleDownRectangle() {
Rectangle valueAt100 = new Rectangle(50, 75, 5, 7);
Rectangle scaledValue = DPIUtil.autoScaleDown(valueAt200);
- assertEquals(String.format("Scaling down Rectangle from device zoom (%d) to 100 failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue,
+ String.format("Scaling down Rectangle from device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleDown((Device) null, valueAt200);
- assertEquals(String.format("Scaling down Rectangle from device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, String.format(
+ "Scaling down Rectangle from device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleDown(valueAt200, 200);
- assertEquals("Scaling down Rectangle from 200 failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 200 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt200, 200);
- assertEquals("Scaling down Rectangle from 200 with device failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 200 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt150, 150);
- assertEquals("Scaling down Rectangle from 150 failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 150 failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt150, 150);
- assertEquals("Scaling down Rectangle from 150 with device failed", valueAt100, scaledValue);
+ assertEquals(valueAt100, scaledValue, "Scaling down Rectangle from 150 with device failed");
scaledValue = DPIUtil.scaleDown(valueAt100, 100);
- assertSame("Scaling down Rectangle without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down Rectangle without zoom change failed");
scaledValue = DPIUtil.scaleDown((Device) null, valueAt100, 100);
- assertSame("Scaling down Rectangle without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling down Rectangle without zoom change with device failed");
}
@Test
@@ -193,25 +191,24 @@ public void scaleUpIntArray() {
int[] valueAt100 = new int[] { 5, 6, 7 };
int[] scaledValue = DPIUtil.autoScaleUp(valueAt100);
- assertArrayEquals(
- String.format("Scaling up int array to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt200, scaledValue);
+ assertArrayEquals(valueAt200, scaledValue,
+ String.format("Scaling up int array to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100);
- assertArrayEquals(String.format("Scaling up int array to device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt200, scaledValue);
+ assertArrayEquals(valueAt200, scaledValue, String
+ .format("Scaling up int array to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleUp(valueAt100, 200);
- assertArrayEquals("Scaling up int array to 200 failed", valueAt200, scaledValue);
+ assertArrayEquals(valueAt200, scaledValue, "Scaling up int array to 200 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200);
- assertArrayEquals("Scaling up int array to 200 with device failed", valueAt200, scaledValue);
+ assertArrayEquals(valueAt200, scaledValue, "Scaling up int array to 200 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 150);
- assertArrayEquals("Scaling up int array to 150 failed", valueAt150, scaledValue);
+ assertArrayEquals(valueAt150, scaledValue, "Scaling up int array to 150 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150);
- assertArrayEquals("Scaling up int array to 150 with device failed", valueAt150, scaledValue);
+ assertArrayEquals(valueAt150, scaledValue, "Scaling up int array to 150 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 100);
- assertSame("Scaling up int array without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up int array without zoom change failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100);
- assertSame("Scaling up int array without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up int array without zoom change with device failed");
}
@Test
@@ -221,24 +218,24 @@ public void scaleUpInteger() {
int valueAt100 = 5;
int scaledValue = DPIUtil.autoScaleUp(valueAt100);
- assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue,
+ String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100);
- assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, String
+ .format("Scaling up integer to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleUp(valueAt100, 200);
- assertEquals("Scaling up integer to 200 failed", valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, "Scaling up integer to 200 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200);
- assertEquals("Scaling up integer to 200 with device failed", valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, "Scaling up integer to 200 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 150);
- assertEquals("Scaling up integer to 150 failed", valueAt150, scaledValue);
+ assertEquals(valueAt150, scaledValue, "Scaling up integer to 150 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150);
- assertEquals("Scaling up integer to 150 with device failed", valueAt150, scaledValue);
+ assertEquals(valueAt150, scaledValue, "Scaling up integer to 150 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 100);
- assertSame("Scaling up integer without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up integer without zoom change failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100);
- assertSame("Scaling up integer without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue,"Scaling up integer without zoom change with device failed");
}
@Test
@@ -248,24 +245,24 @@ public void scaleUpFloat() {
float valueAt100 = 5;
float scaledValue = DPIUtil.autoScaleUp(valueAt100);
- assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt200, scaledValue, 0.001f);
+ assertEquals(valueAt200, scaledValue, 0.001f,
+ String.format("Scaling up integer to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100);
- assertEquals(String.format("Scaling up integer to device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt200, scaledValue, 0.001f);
+ assertEquals(valueAt200, scaledValue, 0.001f, String
+ .format("Scaling up integer to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleUp(valueAt100, 200);
- assertEquals("Scaling up integer to 200 failed", valueAt200, scaledValue, 0.001f);
+ assertEquals(valueAt200, scaledValue, 0.001f, "Scaling up integer to 200 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200);
- assertEquals("Scaling up integer to 200 with device failed", valueAt200, scaledValue, 0.001f);
+ assertEquals(valueAt200, scaledValue, 0.001f, "Scaling up integer to 200 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 150);
- assertEquals("Scaling up integer to 150 failed", valueAt150, scaledValue, 0.001f);
+ assertEquals(valueAt150, scaledValue, 0.001f, "Scaling up integer to 150 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150);
- assertEquals("Scaling up integer to 150 with device failed", valueAt150, scaledValue, 0.001f);
+ assertEquals(valueAt150, scaledValue, 0.001f, "Scaling up integer to 150 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 100);
- assertEquals("Scaling up integer without zoom change failed", valueAt100, scaledValue, 0.001f);
+ assertEquals(valueAt100, scaledValue, 0.001f, "Scaling up integer without zoom change failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100);
- assertEquals("Scaling up integer without zoom change with device failed", valueAt100, scaledValue, 0.001f);
+ assertEquals(valueAt100, scaledValue, 0.001f, "Scaling up integer without zoom change with device failed");
}
@Test
@@ -275,24 +272,24 @@ public void scaleUpPoint() {
Point valueAt100 = new Point(5, 7);
Point scaledValue = DPIUtil.autoScaleUp(valueAt100);
- assertEquals(String.format("Scaling up Point to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue,
+ String.format("Scaling up Point to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100);
- assertEquals(String.format("Scaling up Point to device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, String
+ .format("Scaling up Point to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleUp(valueAt100, 200);
- assertEquals("Scaling up Point to 200 failed", valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, "Scaling up Point to 200 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200);
- assertEquals("Scaling up Point to 200 with device failed", valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, "Scaling up Point to 200 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 150);
- assertEquals("Scaling up Point to 150 failed", valueAt150, scaledValue);
+ assertEquals(valueAt150, scaledValue, "Scaling up Point to 150 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150);
- assertEquals("Scaling up Point to 150 with device failed", valueAt150, scaledValue);
+ assertEquals(valueAt150, scaledValue, "Scaling up Point to 150 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 100);
- assertSame("Scaling up Point without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up Point without zoom change failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100);
- assertSame("Scaling up Point without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up Point without zoom change with device failed");
}
@Test
@@ -302,24 +299,23 @@ public void scaleUpRectangle() {
Rectangle valueAt100 = new Rectangle(50, 75, 5, 7);
Rectangle scaledValue = DPIUtil.autoScaleUp(valueAt100);
- assertEquals(
- String.format("Scaling up Rectangle to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()),
- valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue,
+ String.format("Scaling up Rectangle to device zoom (%d) to 100 failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.autoScaleUp((Device) null, valueAt100);
- assertEquals(String.format("Scaling up Rectangle to device zoom (%d) to 100 with device failed",
- DPIUtil.getDeviceZoom()), valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, String
+ .format("Scaling up Rectangle to device zoom (%d) to 100 with device failed", DPIUtil.getDeviceZoom()));
scaledValue = DPIUtil.scaleUp(valueAt100, 200);
- assertEquals("Scaling up Rectangle to 200 failed", valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, "Scaling up Rectangle to 200 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 200);
- assertEquals("Scaling up Rectangle to 200 with device failed", valueAt200, scaledValue);
+ assertEquals(valueAt200, scaledValue, "Scaling up Rectangle to 200 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 150);
- assertEquals("Scaling up Rectangle to 150 failed", valueAt150, scaledValue);
+ assertEquals(valueAt150, scaledValue, "Scaling up Rectangle to 150 failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 150);
- assertEquals("Scaling up Rectangle to 150 with device failed", valueAt150, scaledValue);
+ assertEquals(valueAt150, scaledValue, "Scaling up Rectangle to 150 with device failed");
scaledValue = DPIUtil.scaleUp(valueAt100, 100);
- assertSame("Scaling up Rectangle without zoom change failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up Rectangle without zoom change failed");
scaledValue = DPIUtil.scaleUp((Device) null, valueAt100, 100);
- assertSame("Scaling up Rectangle without zoom change with device failed", valueAt100, scaledValue);
+ assertSame(valueAt100, scaledValue, "Scaling up Rectangle without zoom change with device failed");
}
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java
index fc3bdeaa009..122e4a1eade 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java
@@ -452,7 +452,6 @@ public static boolean waitEvent(Runnable trigger, Control control, int swtEvent,
* arrive *before* you call this function, and it will
* fail to receive event.
* @param shell the Shell to wait for
- * @return true if Shell became active within timeout
*/
public static void waitShellActivate(Runnable trigger, Shell shell) {
final int timeoutInMsec = 3000;
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
index 35adebff18c..b7a61a4452b 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
@@ -591,7 +591,10 @@ public void test_LocationListener_changed() {
shell.open();
browser.setText("Hello world");
boolean passed = waitForPassCondition(changedFired::get);
- assertTrue("LocationListener.changed() event was never fired", passed);
+ String errorMsg = String.format(
+ "LocationListener.changed() event was never fired. Browser URL after waitForPassCondition: %s",
+ browser.getUrl());
+ assertTrue(errorMsg, passed);
}
@Test
public void test_LocationListener_changed_twoSetTextCycles() {
@@ -654,10 +657,12 @@ public void test_LocationListener_then_ProgressListener() {
AtomicBoolean locationChanged = new AtomicBoolean(false);
AtomicBoolean progressChanged = new AtomicBoolean(false);
AtomicBoolean progressChangedAfterLocationChanged = new AtomicBoolean(false);
+ AtomicReference browserTextOnCompletedEvent = new AtomicReference<>();
browser.addLocationListener(changedAdapter(event -> locationChanged.set(true)));
browser.addProgressListener(completedAdapter(event -> {
+ browserTextOnCompletedEvent.set(browser.getText());
if (locationChanged.get()) {
progressChangedAfterLocationChanged.set(true);
}
@@ -671,8 +676,9 @@ public void test_LocationListener_then_ProgressListener() {
String errorMsg = "\nUnexpected listener states. Expecting true for all, but have:\n"
+ "Location changed: " + locationChanged.get() + "\n"
+ "ProgressChangedAfterLocationChanged: " + progressChangedAfterLocationChanged.get() + "\n"
- + "progressChanged: " + progressChanged.get();
-
+ + "progressChanged: " + progressChanged.get() + "\n"
+ + "browser text on completed event: " + browserTextOnCompletedEvent.get() + "\n"
+ + "browser text after waitForPassCondition: " + browser.getText();
assertTrue(errorMsg, progressChangedAfterLocationChanged.get());
}
@@ -986,6 +992,7 @@ public void completed(ProgressEvent event) {
@Test
public void test_ProgressListener_completed_Called() {
AtomicBoolean childCompleted = new AtomicBoolean(false);
+ AtomicReference browserTextOnChangedEvent = new AtomicReference<>();
ProgressListener l = new ProgressListener() {
@Override
@@ -995,14 +1002,16 @@ public void completed(ProgressEvent event) {
@Override
public void changed(ProgressEvent event) {
-
+ browserTextOnChangedEvent.set(browser.getText());
}
};
browser.addProgressListener(l);
browser.setText("This test ensures that the completed listener is called.");
shell.open();
boolean passed = waitForPassCondition(childCompleted::get);
- assertTrue(passed);
+ String errorMsg = "Browser text before completed: " + browserTextOnChangedEvent.get() +
+ "\nBrowser text after completed: " + browser.getText();
+ assertTrue(errorMsg, passed);
}
@Test
@@ -1031,7 +1040,7 @@ public void test_StatusTextListener_addAndRemove() {
* 3) Upon compleation of page load, move cursor across whole shell.
* (Note, in current jUnit, browser sometimes only takes up half the shell).
* 4) StatusTextListener should get triggered. Test passes.
- * 5) Else timeout & fail.
+ * 5) Else timeout and fail.
*
* Set variable "debug_show_browser" to true to see this being performed at human-observable speed.
*
@@ -1161,7 +1170,7 @@ public void test_setTextContainingScript_applicationLayerProgressListenerMustSee
browser.setText("""
-
+
Hello, World!
@@ -1746,6 +1755,18 @@ public void test_getText_html() {
getText_helper(testString, testString);
}
+/**
+ * Ensure getText() works even if consumer-level scripting is disabled. Needed
+ * on platforms where getText() implementation is JavaScript-based, e.g. Edge:
+ * https://github.com/eclipse-platform/eclipse.platform.swt/issues/2029
+ */
+@Test
+public void test_getText_javscriptDisabled() {
+ browser.setJavascriptEnabled(false);
+ String testString = "helloWorld ";
+ getText_helper(testString, testString);
+}
+
/** Ensure we get webpage before javascript processed it.
* E.g JS would add 'style' tag to body after processing. */
@Test
@@ -2242,8 +2263,8 @@ function callCustomFunction() {
/**
* Test for stacked (cascaded) calls between Java and JS i.e. java calls JS
* which calls Java which calls JS and so on.
- *
- * @see https://github.com/eclipse-platform/eclipse.platform.swt/issues/1919
+ *
+ * See {@code https://github.com/eclipse-platform/eclipse.platform.swt/issues/1919}
*
*/
@Test
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
index f4900529746..536d4f9715c 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
@@ -280,8 +280,8 @@ public void test_checkSize() {
*
* We define two {@link CTabFolder tab folders}, of which one has a nested tab folder.
* We validate that selecting the nested tab does not break selection highlight for the top-level tabs.
- *
- * @see org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting
+ *
+ * See also {@code org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting}
*/
@Test
public void test_nestedTabHighlighting () {
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java
index 984beb1dba4..63378e94ae1 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,16 +13,15 @@
*******************************************************************************/
package org.eclipse.swt.tests.junit;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Automated Test Suite for class org.eclipse.swt.events.TypedEvent
@@ -31,12 +30,12 @@
*/
public class Test_org_eclipse_swt_events_TypedEvent {
-@Before
+@BeforeEach
public void setUp() {
shell = new Shell();
}
-@After
+@AfterEach
public void tearDown() {
shell.dispose();
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
index 5a52c53a757..4d225025354 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
@@ -137,10 +137,8 @@ public void test_ConstructorLorg_eclipse_swt_graphics_DeviceI() {
@Test
public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII() {
// Test new Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY)
- int numFormats = SwtTestUtil.imageFormats.length;
String fileName = SwtTestUtil.imageFilenames[0];
- for (int i=0; i new Image(display, -1, 10));
+ assertSWTProblem("Incorrect exception thrown for width < 0", SWT.ERROR_INVALID_ARGUMENT, e);
+
+ e = assertThrows(IllegalArgumentException.class, () -> new Image(display, 0, 10));
+ assertSWTProblem("Incorrect exception thrown for width == 0", SWT.ERROR_INVALID_ARGUMENT, e);
+
+ e = assertThrows(IllegalArgumentException.class, () -> new Image(display, 10, -1));
+ assertSWTProblem("Incorrect exception thrown for height < 0", SWT.ERROR_INVALID_ARGUMENT, e);
+
+ e = assertThrows(IllegalArgumentException.class, () -> new Image(display, 10, 0));
+ assertSWTProblem("Incorrect exception thrown for height == 0", SWT.ERROR_INVALID_ARGUMENT, e);
+
+ // valid images
+ image = new Image(null, 10, 10);
+ image.dispose();
+
+ image = new Image(display, 10, 10);
+ image.dispose();
+}
+
@Test
public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData() {
IllegalArgumentException e;
@@ -256,7 +283,7 @@ public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream
String firstFile = SwtTestUtil.invalidImageFilenames[0];
Display[] displays = { display, null };
- for (int j = 0; j < displays.length; j++) {
+ for (Display display : displays) {
for (String format : SwtTestUtil.imageFormats) {
try (InputStream stream = SwtTestUtil.class.getResourceAsStream(firstFile + "." + format)) {
e = assertThrows(SWTException.class, () -> new Image(display, stream));
@@ -316,8 +343,7 @@ public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String()
// create valid images
for (Display display : displays) {
for (String fileName : SwtTestUtil.imageFilenames) {
- for (int i = 0; i < SwtTestUtil.imageFormats.length; i++) {
- String format = SwtTestUtil.imageFormats[i];
+ for (String format : SwtTestUtil.imageFormats) {
String pathName = getPath(fileName + "." + format).toString();
Image image = new Image(display, pathName);
image.dispose();
@@ -412,6 +438,23 @@ public void test_ConstructorLorg_eclipse_swt_graphics_Device_ImageGcDrawer() {
image.dispose();
}
+@Test
+public void test_ConstructorLorg_eclipse_swt_graphics_DeviceImageI() throws IOException {
+ byte[] bytes = Files.readAllBytes(Path.of(getPath("collapseall.png")));
+ Image sourceImage = new Image(display, new ByteArrayInputStream(bytes));
+ Image copiedImage = new Image(display, sourceImage, SWT.IMAGE_COPY);
+ Image targetImage = new Image(display, 1, 1);
+ GC gc = new GC(targetImage);
+ gc.drawImage(sourceImage, 0, 0);
+ gc.drawImage(targetImage, 0, 0);
+
+ assertEquals(0, imageDataComparator().compare(sourceImage.getImageData(), copiedImage.getImageData()));
+
+ sourceImage.dispose();
+ copiedImage.dispose();
+ targetImage.dispose();
+}
+
@Test
public void test_equalsLjava_lang_Object() {
Image image = null;
@@ -522,7 +565,7 @@ public void test_getBounds() {
image.dispose();
assertEquals(bounds, bounds1);
- image = new Image(display, bounds);
+ image = new Image(display, bounds.width, bounds.height);
bounds1 = image.getBounds();
image.dispose();
assertEquals(bounds, bounds1);
@@ -694,7 +737,7 @@ void getImageData_int(int zoom) {
assertEquals(":a: Size of ImageData returned from Image.getImageData(int) method doesn't return matches with bounds in Pixel values.", scaleBounds(bounds, zoom, 100), boundsAtZoom);
// creates second bitmap image and compare size of imageData
- image = new Image(display, bounds);
+ image = new Image(display, bounds.width, bounds.height);
imageDataAtZoom = image.getImageData(zoom);
boundsAtZoom = new Rectangle(0, 0, imageDataAtZoom.width, imageDataAtZoom.height);
bounds = image.getBounds();
@@ -868,10 +911,8 @@ public void test_toString() {
/** Test implementation **/
void getImageData1() {
- int numFormats = SwtTestUtil.imageFormats.length;
String fileName = SwtTestUtil.imageFilenames[0];
- for (int i=0; i {
+ return imagePath;
+ };
+ ImageDataProvider dataProvider = __ -> {
+ try (InputStream imageStream = Files.newInputStream(Path.of(imagePath))) {
+ return new ImageData(imageStream);
+ } catch (IOException e) {
+ }
+ return null;
+ };
+ Image fileNameProviderImage = new Image(display, imageFileNameProvider);
+ Image dataImage = new Image(display, dataProvider.getImageData(100));
+ ImageData dataFromFileNameProviderImage = fileNameProviderImage.getImageData(100);
+ ImageData dataFromImageWithSimpleData = dataImage.getImageData(100);
+ assertEquals(0, imageDataComparator().compare(dataFromFileNameProviderImage, dataFromImageWithSimpleData));
+
+ fileNameProviderImage.dispose();
+ dataImage.dispose();
+}
+
+
private Comparator imageDataComparator() {
return Comparator.comparingInt(d -> d.width) //
.thenComparing(d -> d.height) //
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java
index abd5fa9e893..7f6519abfc6 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java
@@ -27,7 +27,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
@@ -60,9 +59,10 @@ public void setUp() {
/**
* Tests {@link ImageData#blit}:
* creates a random image and tests over all combinations of depth,format,scale
+ * @throws Exception
*/
@Test
-public void test_blit() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+public void test_blit() throws Exception {
List tests = new ArrayList<>();
// Compose a list of all supported formats
@@ -117,9 +117,10 @@ public void test_blit() throws NoSuchMethodException, SecurityException, Illegal
/**
* Tests {@link ImageData#blit}:
* Ensures that (MSB_FIRST, LSB_FIRST) round trip produces original.
+ * @throws Exception
*/
@Test
-public void test_blit_MsbLsb() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+public void test_blit_MsbLsb() throws Exception {
List tests = new ArrayList<>();
{
for (int depth : indexedDepths) {
@@ -218,10 +219,8 @@ public void test_ConstructorLjava_io_InputStream() throws IOException {
assertThrows("No exception thrown for invalid InputStream", SWTException.class, () ->new ImageData(stream1));
}
- int numFormats = SwtTestUtil.imageFormats.length;
String fileName = SwtTestUtil.imageFilenames[0];
- for (int i=0; i loaderListenerCalled = true;
- try {
- loader.addImageLoaderListener(null);
- fail("No exception thrown for addImageLoaderListener with null argument");
- } catch (IllegalArgumentException e) {
- }
-
+ assertThrows(IllegalArgumentException.class, () -> loader.addImageLoaderListener(null),
+ "No exception thrown for addImageLoaderListener with null argument");
assertFalse(":a:", loader.hasListeners());
loader.addImageLoaderListener(loaderListener);
assertTrue(":b:", loader.hasListeners());
@@ -66,13 +64,13 @@ public void test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderList
loaderListenerCalled = false;
try (InputStream stream = SwtTestUtil.class.getResourceAsStream("interlaced_target.png")) {
loader.load(stream);
- } catch (IOException e) {}
+ }
assertTrue(":c:", loaderListenerCalled);
loaderListenerCalled = false;
try (InputStream stream = SwtTestUtil.class.getResourceAsStream("target.png")) {
loader.load(stream);
- } catch (IOException e) {}
+ }
assertFalse(":d:", loaderListenerCalled);
loaderListenerCalled = false;
@@ -84,86 +82,61 @@ public void test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderList
}
@Test
-public void test_loadLjava_io_InputStream() {
- ImageLoader loader = new ImageLoader();
- try (InputStream stream = null) {
- loader.load(stream);
- fail("No exception thrown for load inputStream == null");
- } catch (IllegalArgumentException | IOException e) {
- }
+public void test_loadLjava_io_InputStream() throws IOException {
+ ImageLoader loader = new ImageLoader();
+ assertThrows(IllegalArgumentException.class, () -> loader.load((InputStream) null),
+ "No exception thrown for load inputStream == null");
- try (InputStream stream = SwtTestUtil.class.getResourceAsStream("empty.txt")) {
- loader.load(stream);
- fail("No exception thrown for load from invalid inputStream");
- } catch (IOException|SWTException e) {
- }
+ try (InputStream stream = SwtTestUtil.class.getResourceAsStream("empty.txt")) {
+ assertThrows(SWTException.class, () -> loader.load(stream),
+ "No exception thrown for load from invalid inputStream");
+ }
- int numFormats = SwtTestUtil.imageFormats.length;
- String fileName = SwtTestUtil.imageFilenames[0];
- for (int i = 0; i < numFormats; i++) {
- String format = SwtTestUtil.imageFormats[i];
- try (InputStream stream = SwtTestUtil.class.getResourceAsStream(fileName + "." + format)) {
- loader.load(stream);
- } catch (IOException e) {
- }
+ String fileName = SwtTestUtil.imageFilenames[0];
+ for (String format : SwtTestUtil.imageFormats) {
+ try (InputStream stream = SwtTestUtil.class.getResourceAsStream(fileName + "." + format)) {
+ loader.load(stream);
}
+ }
}
@Test
public void test_loadLjava_lang_String() {
ImageLoader loader = new ImageLoader();
String filename = null;
- try {
- loader.load(filename);
- fail("No exception thrown for load filename == null");
- } catch (IllegalArgumentException e) {
- }
+ assertThrows(IllegalArgumentException.class, () -> loader.load(filename),
+ "No exception thrown for load filename == null");
}
@Test
-public void test_saveLjava_io_OutputStreamI() {
+public void test_saveLjava_io_OutputStreamI() throws IOException {
ImageLoader loader = new ImageLoader();
- ByteArrayOutputStream outStream = null;
- try {
- try {
- loader.save(outStream, 0);
- fail("No exception thrown for save outputStream == null");
- } catch (IllegalArgumentException e) {
- }
- outStream = new ByteArrayOutputStream();
- try {
- loader.save(outStream, -1);
- fail("No exception thrown for save to invalid outputStream format");
- } catch (SWTException e) {
+ OutputStream outStream1 = null;
+ assertThrows(IllegalArgumentException.class, () -> loader.save(outStream1, 0),
+ "No exception thrown for save outputStream == null");
+
+ OutputStream outStream2 = new ByteArrayOutputStream();
+ assertThrows(SWTException.class, () -> loader.save(outStream2, -1),
+ "No exception thrown for save to invalid outputStream format");
+
+ boolean jpgSupported = Arrays.asList(SwtTestUtil.imageFormats).contains("jpg");
+ if (jpgSupported) {
+ String filename = SwtTestUtil.imageFilenames[0];
+ // must use jpg since save is not implemented yet in png format
+ String filetype = "jpg";
+ try (InputStream inStream = SwtTestUtil.class.getResourceAsStream(filename + "." + filetype)) {
+ loader.load(inStream);
}
- boolean jpgSupported = false;
- for (String imageFormat : SwtTestUtil.imageFormats) {
- if (imageFormat.equals("jpg")) {
- jpgSupported = true;
+ OutputStream outStream = new ByteArrayOutputStream();
+ int i = 0;
+ for (String format : SwtTestUtil.imageFormats) {
+ if (format.equals(filetype)) {
+ // save using the appropriate format
+ loader.save(outStream, i++);
break;
}
}
- if (jpgSupported) {
- String filename = SwtTestUtil.imageFilenames[0];
- // must use jpg since save is not implemented yet in png format
- String filetype = "jpg";
- try (InputStream inStream = SwtTestUtil.class.getResourceAsStream(filename + "." + filetype)) {
- loader.load(inStream);
- } catch (IOException e) {}
- for (int i = 0; i < SwtTestUtil.imageFormats.length; i++) {
- if (SwtTestUtil.imageFormats[i].equals(filetype)) {
- // save using the appropriate format
- loader.save(outStream, i);
- break;
- }
- }
- }
- } finally {
- try {
- outStream.close();
- } catch (Exception e) {
- }
}
}
@@ -171,11 +144,8 @@ public void test_saveLjava_io_OutputStreamI() {
public void test_saveLjava_lang_StringI() {
ImageLoader loader = new ImageLoader();
String filename = null;
- try {
- loader.save(filename, 0);
- fail("No exception thrown for save filename == null");
- } catch (IllegalArgumentException e) {
- }
+ assertThrows(IllegalArgumentException.class, () -> loader.save(filename, 0),
+ "No exception thrown for save filename == null");
}
/**
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_TextLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_TextLayout.java
index 9fb04790187..3bf72505b9d 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_TextLayout.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_TextLayout.java
@@ -1009,7 +1009,8 @@ public void test_bug568740_multilineTextStyle() {
private Image draw(TextLayout layout, int antialias) {
GC gc = null;
try {
- Image image = new Image(display, layout.getBounds());
+ Rectangle rect = layout.getBounds();
+ Image image = new Image(display, rect.width, rect.height);
gc = new GC(image);
gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
gc.fillRectangle(image.getBounds());
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java
index 7bc0e07dd54..0eba5c93641 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java
@@ -14,10 +14,12 @@
*******************************************************************************/
package org.eclipse.swt.tests.junit;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.util.Arrays;
import java.util.stream.Collectors;
@@ -29,7 +31,7 @@
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.printing.Printer;
import org.eclipse.swt.printing.PrinterData;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Automated Test Suite for class org.eclipse.swt.printing.Printer
@@ -40,117 +42,87 @@ public class Test_org_eclipse_swt_printing_Printer {
@Test
public void test_Constructor() {
- boolean exceptionThrown = false;
- String detail = "";
if (Printer.getDefaultPrinterData() == null) {
/* There aren't any printers, so verify that the
* constructor throws an ERROR_NO_HANDLES SWTError.
*/
- try {
- Printer printer = new Printer();
- printer.dispose();
- } catch (SWTError ex) {
- if (ex.code == SWT.ERROR_NO_HANDLES) exceptionThrown = true;
- }
- assertTrue("ERROR_NO_HANDLES not thrown", exceptionThrown);
+ SWTError ex = assertThrows(SWTError.class, ()->new Printer());
+ assertEquals(SWT.ERROR_NO_HANDLES, ex.code, "ERROR_NO_HANDLES not thrown");
} else {
/* There is at least a default printer, so verify that
* the constructor does not throw any exceptions.
*/
- try {
- Printer printer = new Printer();
- printer.dispose();
- } catch (Throwable ex) {
- exceptionThrown = true;
- detail = ex.getMessage();
- }
- assertFalse("Exception thrown: " + detail, exceptionThrown);
+ Printer printer = new Printer();
+ assertNotNull(printer );
+ printer.dispose();
}
}
@Test
public void test_ConstructorLorg_eclipse_swt_printing_PrinterData() {
- boolean exceptionThrown = false;
- String detail = "";
PrinterData data = Printer.getDefaultPrinterData();
if (data == null) {
/* There aren't any printers, so verify that the
* constructor throws an ERROR_NO_HANDLES SWTError.
*/
- try {
- Printer printer = new Printer(data);
- printer.dispose();
- } catch (SWTError ex) {
- if (ex.code == SWT.ERROR_NO_HANDLES) exceptionThrown = true;
- }
- assertTrue("ERROR_NO_HANDLES not thrown", exceptionThrown);
+ SWTError ex = assertThrows(SWTError.class, ()-> new Printer(data));
+ assertEquals(SWT.ERROR_NO_HANDLES, ex.code, "ERROR_NO_HANDLES not thrown");
} else {
/* There is at least a default printer, so verify that
* the constructor does not throw any exceptions.
*/
- try {
- Printer printer = new Printer(data);
- printer.dispose();
- } catch (Throwable ex) {
- exceptionThrown = true;
- detail = ex.getMessage();
- }
- assertFalse("Exception thrown: " + detail, exceptionThrown);
+ Printer printer = new Printer(data);
+ assertNotNull(printer);
+ printer.dispose();
}
}
@Test
public void test_computeTrimIIII() {
PrinterData data = Printer.getDefaultPrinterData();
- // if there aren't any printers, don't do this test
- if (data == null) return;
+ assumeTrue (data != null, "if there aren't any printers, don't do this test");
Printer printer = new Printer(data);
Rectangle trim = printer.computeTrim(0, 0, 10, 10);
- assertTrue("trim width or height is incorrect", trim.width >= 10 && trim.height >= 10);
+ assertTrue(trim.width >= 10 && trim.height >= 10, "trim width or height is incorrect");
printer.dispose();
}
@Test
public void test_getBounds() {
PrinterData data = Printer.getDefaultPrinterData();
- // if there aren't any printers, don't do this test
- if (data == null) return;
+ assumeTrue (data != null, "if there aren't any printers, don't do this test");
Printer printer = new Printer(data);
Rectangle bounds = printer.getBounds();
- assertTrue("bounds width or height is zero", bounds.width > 0 && bounds.height > 0);
+ assertTrue(bounds.width > 0 && bounds.height > 0, "bounds width or height is zero");
printer.dispose();
}
@Test
public void test_getClientArea() {
PrinterData data = Printer.getDefaultPrinterData();
- // if there aren't any printers, don't do this test
- if (data == null) return;
+ assumeTrue (data != null, "if there aren't any printers, don't do this test");
Printer printer = new Printer(data);
Rectangle clientArea = printer.getClientArea();
- assertTrue("clientArea width or height is zero", clientArea.width > 0 && clientArea.height > 0);
+ assertTrue(clientArea.width > 0 && clientArea.height > 0, "clientArea width or height is zero");
printer.dispose();
}
@Test
public void test_getDPI() {
PrinterData data = Printer.getDefaultPrinterData();
- // if there aren't any printers, don't do this test
- if (data == null) return;
+ assumeTrue (data != null, "if there aren't any printers, don't do this test");
Printer printer = new Printer(data);
Point dpi = printer.getDPI();
- assertTrue("dpi x or y is zero", dpi.x > 0 && dpi.y > 0);
+ assertTrue(dpi.x > 0 && dpi.y > 0, "dpi x or y is zero");
printer.dispose();
}
@Test
public void test_getPrinterData() {
PrinterData data = Printer.getDefaultPrinterData();
- // if there aren't any printers, don't do this test
- if (data == null) return;
+ assumeTrue (data != null, "if there aren't any printers, don't do this test");
Printer printer = new Printer(data);
- assertTrue("getPrinterData != data used in constructor",
- data == printer.getPrinterData());
+ assertTrue(data == printer.getPrinterData(), "getPrinterData != data used in constructor");
printer.dispose();
}
@@ -191,26 +163,24 @@ public void test_getPrinterList() {
});
}
PrinterData[] list = printerStream.toArray(PrinterData[]::new);
- String printerNames = Arrays.stream(list).map(String::valueOf).collect(Collectors.joining(", "));
- assertEquals("printer list contains items even though there are no printers, printers from list are: "+printerNames,
- 0 , list.length);
+ String printerNames = Arrays.stream(list).map(String::valueOf).collect(Collectors.joining(", "));
+ assertEquals(0 , list.length, "printer list contains items even though there are no printers, printers from list are: "+printerNames);
} else {
/* If there is at least a default printer, verify
* that the printer list is not empty.
*/
PrinterData list[] = Printer.getPrinterList();
- assertTrue("printer list is empty", list.length > 0);
+ assertTrue(list.length > 0, "printer list is empty");
}
}
@Test
public void test_isAutoScalable() {
PrinterData data = Printer.getDefaultPrinterData();
- // if there aren't any printers, don't do this test
- if (data == null) return;
+ assumeTrue (data != null, "if there aren't any printers, don't do this test");
Printer printer = new Printer(data);
boolean isAutoScalable = printer.isAutoScalable();
- assertFalse("SWT doesnot auto-scale for Printer devices", isAutoScalable);
+ assertFalse(isAutoScalable, "SWT doesnot auto-scale for Printer devices");
printer.dispose();
}
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java
index b8d60fbe285..ea9dd4b09bd 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java
@@ -14,11 +14,11 @@
*******************************************************************************/
package org.eclipse.swt.tests.junit;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.swt.printing.PrinterData;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Automated Test Suite for class org.eclipse.swt.printing.PrinterData
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
index a9fe25c74ec..f40ab7f586a 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
@@ -63,7 +63,7 @@ public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
int[] cases = {SWT.DROP_DOWN, SWT.SIMPLE};
for (int i = 0; i < cases.length; i++) {
combo = new Combo(shell, cases[i]);
- assertEquals(":a:" + String.valueOf(i), cases[i], (combo.getStyle() & cases[i]));
+ assertEquals(String.valueOf(i), cases[i], (combo.getStyle() & cases[i]));
}
}
@@ -73,11 +73,11 @@ public void test_addLjava_lang_String() {
combo.add(null));
combo.add("");
- assertArrayEquals(":a:", new String[]{""}, combo.getItems());
+ assertArrayEquals(new String[]{""}, combo.getItems());
combo.add("");
- assertArrayEquals(":b:", new String[]{"", ""}, combo.getItems());
+ assertArrayEquals(new String[]{"", ""}, combo.getItems());
combo.add("fred");
- assertArrayEquals(":c:", new String[]{"", "", "fred"}, combo.getItems());
+ assertArrayEquals(new String[]{"", "", "fred"}, combo.getItems());
}
@@ -179,7 +179,7 @@ public void widgetDefaultSelected(SelectionEvent event) {
assertThrows(IllegalArgumentException.class, () -> combo.addSelectionListener(null));
combo.addSelectionListener(listener);
combo.select(0);
- assertFalse(":a:", listenerCalled);
+ assertFalse(listenerCalled);
combo.removeSelectionListener(listener);
assertThrows(IllegalArgumentException.class, () -> combo.removeSelectionListener(null));
}
@@ -191,7 +191,7 @@ public void test_addSelectionListenerWidgetSelectedAdapterLorg_eclipse_swt_event
combo.addSelectionListener(listener);
combo.select(0);
- assertFalse(":a:", listenerCalled);
+ assertFalse(listenerCalled);
combo.removeSelectionListener(listener);
listenerCalled = false;
@@ -205,14 +205,14 @@ public void test_clearSelection() {
for (int i = 0; i < number; i++)
combo.add("fred" + i);
combo.clearSelection();
- assertEquals(":a:",new Point(0, 0), combo.getSelection());
+ assertEquals(new Point(0, 0), combo.getSelection());
combo.setSelection(new Point(0, 5));
- assertEquals(":b:",new Point(0, 0), combo.getSelection()); //nothing is selected
+ assertEquals(new Point(0, 0), combo.getSelection()); //nothing is selected
combo.setText("some text");
combo.setSelection(new Point(0, 5));
- assertEquals(":c:",new Point(0, 5), combo.getSelection());
+ assertEquals(new Point(0, 5), combo.getSelection());
combo.clearSelection();
- assertEquals(":d:", combo.getSelection().x, combo.getSelection().y);
+ assertEquals(combo.getSelection().x, combo.getSelection().y);
}
@Override
@@ -236,7 +236,7 @@ public void test_copy() {
combo.copy();
combo.setSelection(new Point(0,0));
combo.paste();
- assertEquals(":a:","23123456", combo.getText());
+ assertEquals("23123456", combo.getText());
}
@Test
@@ -252,7 +252,7 @@ public void test_cut() {
combo.setText("123456");
combo.setSelection(new Point(1,3));
combo.cut();
- assertEquals(":a:","1456", combo.getText());
+ assertEquals("1456", combo.getText());
}
@Test
@@ -263,7 +263,7 @@ public void test_deselectAll() {
combo.select(0);
combo.select(2);
combo.deselectAll();
- assertEquals(":a:",-1, combo.getSelectionIndex());
+ assertEquals(-1, combo.getSelectionIndex());
}
@Test
public void test_deselectI() {
@@ -282,9 +282,9 @@ public void test_deselectI() {
combo.add("fred" + i);
for (int i = 0; i < number; i++) {
combo.select(i);
- assertEquals(":a:" + i,i, combo.getSelectionIndex());
+ assertEquals("index "+i,i, combo.getSelectionIndex());
combo.deselect(i);
- assertEquals(":b:" + i,-1, combo.getSelectionIndex());
+ assertEquals("index "+i,-1, combo.getSelectionIndex());
}
}
@@ -298,17 +298,17 @@ public void test_getChildren() {
public void test_getItemCount() {
int number = 10;
for (int i = 0; i < number; i++) {
- assertEquals(":a:" + i,i, combo.getItemCount());
+ assertEquals("index "+i,i, combo.getItemCount());
combo.add("fred" + i);
}
- assertEquals(":aa:", number, combo.getItemCount());
+ assertEquals(number, combo.getItemCount());
for (int i = 0; i < number; i++) {
- assertEquals(":b:" + i, number-i, combo.getItemCount());
+ assertEquals("index "+i, number-i, combo.getItemCount());
combo.remove(0);
}
combo.removeAll();
- assertEquals(":c:", 0, combo.getItemCount());
+ assertEquals(0, combo.getItemCount());
}
@Test
@@ -335,10 +335,10 @@ public void test_getItems() {
combo.add("2");
combo.add("3");
String[] items = combo.getItems();
- assertEquals(":a:", 3, items.length);
- assertEquals(":a:", "1", items[0]);
- assertEquals(":a:", "2", items[1]);
- assertEquals(":a:", "3", items[2]);
+ assertEquals(3, items.length);
+ assertEquals("1", items[0]);
+ assertEquals("2", items[1]);
+ assertEquals("3", items[2]);
}
@Test
@@ -351,7 +351,7 @@ public void test_getSelection() {
combo.setText("123456");
combo.setSelection(new Point(1,3));
combo.getSelection();
- assertEquals(":a:", new Point(1,3), combo.getSelection());
+ assertEquals(new Point(1,3), combo.getSelection());
}
@Test
@@ -403,7 +403,7 @@ public void test_getText() {
String[] cases = {"", "fred", "fredfred"};
for (int i = 0; i < cases.length; i++) {
combo.setText(cases[i]);
- assertEquals(":a:" + String.valueOf(i), cases[i], combo.getText());
+ assertEquals(String.valueOf(i), cases[i], combo.getText());
}
}
@@ -415,7 +415,7 @@ public void test_getTextHeight() {
@Test
public void test_getTextLimit() {
combo.setTextLimit(3);
- assertEquals(":a:", 3, combo.getTextLimit());
+ assertEquals(3, combo.getTextLimit());
}
@Test
@@ -472,18 +472,18 @@ public void test_indexOfLjava_lang_StringI() {
for (int i = 0; i < number; i++)
combo.add("fred" + i);
for (int i = 0; i < number; i++)
- assertEquals(":a:" + i, i, combo.indexOf("fred" + i, 0));
+ assertEquals("index " + i, i, combo.indexOf("fred" + i, 0));
for (int i = 0; i < number; i++)
- assertEquals(":b:" + i, -1, combo.indexOf("fred" + i, i + 1));
+ assertEquals("index " + i, -1, combo.indexOf("fred" + i, i + 1));
for (int i = 0; i < number; i++)
combo.add("fred" + i);
for (int i = 0; i < 3; i++)
- assertEquals(":a:" + i, i, combo.indexOf("fred" + i, 0));
+ assertEquals("index " + i, i, combo.indexOf("fred" + i, 0));
for (int i = 3; i < number; i++)
- assertEquals(":b:" + i, i, combo.indexOf("fred" + i, 3));
+ assertEquals("index " + i, i, combo.indexOf("fred" + i, 3));
for (int i = 0; i < number; i++)
- assertEquals(":b:" + i, i, combo.indexOf("fred" + i, i));
+ assertEquals("index " + i, i, combo.indexOf("fred" + i, i));
}
@Test
@@ -499,9 +499,9 @@ public void test_paste() {
combo.setText("123456");
combo.setSelection(new Point(1,3));
combo.cut();
- assertEquals(":a:", "1456", combo.getText());
+ assertEquals("1456", combo.getText());
combo.paste();
- assertEquals(":a:", "123456", combo.getText());
+ assertEquals("123456", combo.getText());
}
@Test
@@ -509,7 +509,7 @@ public void test_removeAll() {
combo.add("1");
combo.add("2");
combo.removeAll();
- assertEquals(":a:", 0, combo.getItems().length);
+ assertEquals(0, combo.getItems().length);
}
@Test
@@ -671,7 +671,7 @@ public void test_selectI() {
combo.add("456");
combo.add("789");
combo.select(1);
- assertEquals(":a:", 1, combo.getSelectionIndex());
+ assertEquals(1, combo.getSelectionIndex());
// indices out of range are ignored
combo.select(10);
@@ -857,7 +857,7 @@ public void test_setItemILjava_lang_String() {
combo.add("fred");
for (int i = 0; i < number; i++)
combo.setItem(i, "fred" + i);
- assertArrayEquals(":a:", new String[]{"fred0", "fred1", "fred2", "fred3", "fred4"}, combo.getItems());
+ assertArrayEquals(new String[]{"fred0", "fred1", "fred2", "fred3", "fred4"}, combo.getItems());
}
@Test
@@ -869,17 +869,17 @@ public void test_setItemILjava_lang_String() {
for (int i = 0 ; i< items.length; i++){
combo.setItems(items[i]);
- assertArrayEquals(":a:" + i, items[i], combo.getItems());}
+ assertArrayEquals("index" + i, items[i], combo.getItems());}
}
@Test
public void test_setOrientationI() {
combo.setOrientation(SWT.RIGHT_TO_LEFT);
if ((combo.getStyle() & SWT.MIRRORED) != 0) {
- assertEquals(":a:", SWT.RIGHT_TO_LEFT, combo.getOrientation());
+ assertEquals(SWT.RIGHT_TO_LEFT, combo.getOrientation());
}
combo.setOrientation(SWT.LEFT_TO_RIGHT);
- assertEquals(":b:", SWT.LEFT_TO_RIGHT, combo.getOrientation());
+ assertEquals(SWT.LEFT_TO_RIGHT, combo.getOrientation());
}
@Test
@@ -891,10 +891,10 @@ public void test_setSelectionLorg_eclipse_swt_graphics_Point() {
for (int i = 0; i < number; i++)
combo.add("fred" + i);
combo.setSelection(new Point(0, 5));
- assertEquals(":a:", new Point(0, 0), combo.getSelection());
+ assertEquals(new Point(0, 0), combo.getSelection());
combo.setText("some text");
combo.setSelection(new Point(0, 5));
- assertEquals(":b:", new Point(0, 5), combo.getSelection());
+ assertEquals(new Point(0, 5), combo.getSelection());
}
@Test
@@ -903,7 +903,7 @@ public void test_setTextLimitI() {
combo.setTextLimit(0));
combo.setTextLimit(3);
- assertEquals(":a:", 3, combo.getTextLimit());
+ assertEquals(3, combo.getTextLimit());
}
@Test
@@ -914,21 +914,21 @@ public void test_setTextLjava_lang_String() {
String[] cases = {"", "fred", "fred0"};
for (int i = 0; i < cases.length; i++) {
combo.setText(cases[i]);
- assertEquals(":a:" + i, cases[i], combo.getText());
+ assertEquals("index" + i, cases[i], combo.getText());
}
for (int i = 0; i < 5; i++) {
combo.add("fred");
}
for (int i = 0; i < cases.length; i++) {
combo.setText(cases[i]);
- assertEquals(":b:" + i,cases[i], combo.getText());
+ assertEquals("index" + i,cases[i], combo.getText());
}
for (int i = 0; i < 5; i++) {
combo.add("fred" + i);
}
for (int i = 0; i < cases.length; i++) {
combo.setText(cases[i]);
- assertEquals(":c:" + i, cases[i], combo.getText());
+ assertEquals("index" + i, cases[i], combo.getText());
}
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
index 4ea9aa598da..e4b8ba0c7c9 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
@@ -197,6 +197,18 @@ public boolean setFocus() {
button2.dispose();
}
+/*
+ * See https://github.com/eclipse-platform/eclipse.platform.swt/issues/2162
+ */
+@Test
+public void test_bug2162_transparentStyle() {
+ Composite c = new Composite(shell, SWT.TRANSPARENT);
+ c.addPaintListener(e -> {});
+
+ shell.setLayout(new FillLayout());
+ shell.open();
+}
+
protected Composite getElementExpectedToHaveFocusAfterSetFocusOnParent(Composite visibleChild) {
return visibleChild;
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java
index 1d51966aae9..556fe2f1873 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java
@@ -21,6 +21,8 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
@@ -123,9 +125,9 @@ public void test_setDefaultButtonLorg_eclipse_swt_widgets_Button() {
public void test_setImageLorg_eclipse_swt_graphics_Image() {
assertNull(":a:", decorations.getImage());
loadImages();
- decorations.setImage(images[0]);
- assertTrue(":b:", images[0] == decorations.getImage());
- assertTrue(":c:", images[1] != decorations.getImage());
+ decorations.setImage(images.get(0));
+ assertTrue(":b:", images.get(0) == decorations.getImage());
+ assertTrue(":c:", images.get(1) != decorations.getImage());
decorations.setImage(null);
assertNull(":d:", decorations.getImage());
freeImages();
@@ -189,7 +191,7 @@ public void test_setVisibleZ() {
/* custom */
Decorations decorations;
-Image[] images = new Image [SwtTestUtil.imageFormats.length*SwtTestUtil.imageFilenames.length];
+private List images = new ArrayList<>();
@Override
protected void setWidget(Widget w) {
@@ -201,15 +203,10 @@ protected void setWidget(Widget w) {
// this method must be private or protected so the auto-gen tool keeps it
private void loadImages() {
- int numFormats = SwtTestUtil.imageFormats.length;
- int numFiles = SwtTestUtil.imageFilenames.length;
- for (int i=0; i
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -2343,7 +2341,7 @@ public void test_showSelection() {
/* custom */
List list;
/**
- * Test if 'deselect(u, v)' is the same as 'for (i=u; i<=v; ++i) deselect(i);'
+ * Test if {@code deselect(u, v)} is the same as {@code for (i=u; i<=v; ++i) deselect(i);}
*/
protected void deselectII_helper(
String[] items,
@@ -2383,8 +2381,8 @@ protected List setSingleList() {
return list;
}
/**
- * Similar to deselectII_helper, checks if select(u, v) is the same as
- * for (i=u; i<=v; ++i) select(i)
+ * Similar to deselectII_helper, checks if {@code select(u, v)} is the same as
+ * {@code for (i=u; i<=v; ++i) select(i)}
*/
protected void selectII_helper(
String[] items,
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java
index 52de7765744..2fe0304dc6b 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java
@@ -59,9 +59,6 @@ public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){
/**
* Makes the dialog visible and brings it to the front
* of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
*/
@Test
public void test_open(){
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Spinner.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Spinner.java
index 14c91d7387e..680908edf5c 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Spinner.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Spinner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 Red Hat, Inc. and others.
+ * Copyright (c) 2000, 2025 Red Hat, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,7 @@
package org.eclipse.swt.tests.junit;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Spinner;
@@ -37,23 +37,13 @@ public void setUp() {
@Override
@Test
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- spinner = new Spinner(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- int[] cases = {0, SWT.READ_ONLY, SWT.WRAP};
+ assertThrows("No exception thrown for parent == null", IllegalArgumentException.class,
+ () -> new Spinner(null, 0));
+ int[] cases = { 0, SWT.READ_ONLY, SWT.WRAP };
for (int style : cases)
spinner = new Spinner(shell, style);
}
- @Override
- @Test
- public void test_computeSizeIIZ() {
- // super class test is sufficient
- }
-
@Test
public void test_getIncrement() {
int [] cases = {5,100,1000,1};
@@ -72,13 +62,9 @@ public void test_getDigits() {
spinner.setDigits(digits);
assertEquals(digits, spinner.getDigits());
}
- try{
- spinner.setDigits(-1);
- fail("setDigits should have failed with illegal Argument");
- }
- catch(IllegalArgumentException e){
- assertEquals(cases[cases.length-1], spinner.getDigits());
- }
+ assertThrows("setDigits should have failed with illegal Argument", IllegalArgumentException.class,
+ () -> spinner.setDigits(-1));
+ assertEquals(cases[cases.length-1], spinner.getDigits());
}
@Test
@@ -132,11 +118,8 @@ public void test_getTextLimit() {
spinner.setTextLimit(value);
assertEquals(value, spinner.getTextLimit());
}
- try {
- spinner.setTextLimit(0);
- fail("setTextLimit should have caused an expection with value 0");
- } catch (Exception e) {
- }
+ assertThrows("setTextLimit should have caused an expection with value 0", IllegalArgumentException.class,
+ () -> spinner.setTextLimit(0));
}
@Test
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/memoryleak/Test_Memory_Leak.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/memoryleak/Test_Memory_Leak.java
index 326a7cc3d0e..ac03dbfc945 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/memoryleak/Test_Memory_Leak.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/memoryleak/Test_Memory_Leak.java
@@ -10,7 +10,7 @@
/**
* Test Widgets for memory leaks. Used when updating dispose logic.
*
- * Due to lack of better alternative, the current mechanism creates & disposes a widget in a loop.
+ * Due to lack of better alternative, the current mechanism creates and disposes a widget in a loop.
* If the test makes it to the end without crashing your system, then you have no (major?) leaks.
*
* Run these on demand if updating dispose logic of a particular widget.
@@ -35,7 +35,7 @@ public class Test_Memory_Leak {
*
* If you have a memory leak in the dispoal logic, then the loop eventually slows down and the test crashes.
* You would see 'memory pressure' errors. The Java process of the jUnit would grow significantly (100's of mbs)
- * On my machine with Intel i7 & 16 GB of ram, this occurs at the ~420th iteration.
+ * On my machine with Intel i7 and 16 GB of ram, this occurs at the ~420th iteration.
* (although with my testing, without memory leaks, it grows a little bit (by 100mb by end of test)).
*/
@Test
diff --git a/tests/org.eclipse.swt.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.swt.tests/META-INF/MANIFEST.MF
index bdf1f3bdb90..cf91c273eb4 100644
--- a/tests/org.eclipse.swt.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.swt.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse SWT Tests
Bundle-SymbolicName: org.eclipse.swt.tests
-Bundle-Version: 3.107.800.qualifier
+Bundle-Version: 3.107.900.qualifier
Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.swt.tests.junit,
org.eclipse.swt.tests.junit.performance
@@ -14,6 +14,7 @@ Require-Bundle: org.junit;bundle-version="4.13.2",
junit-platform-suite-api;bundle-version="1.12.0",
junit-platform-suite-commons;bundle-version="1.12.0",
junit-platform-suite-engine;bundle-version="1.12.0",
+ org.opentest4j;bundle-version="1.3.0",
org.eclipse.swt;bundle-version="3.120.0",
org.eclipse.test;bundle-version="3.6.200",
org.eclipse.test.performance;bundle-version="3.13.0"
diff --git a/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug529534_CTabFolder_topRight_wrapped.java b/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug529534_CTabFolder_topRight_wrapped.java
index b48c05dd68e..dedb750fca2 100644
--- a/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug529534_CTabFolder_topRight_wrapped.java
+++ b/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Bug529534_CTabFolder_topRight_wrapped.java
@@ -96,7 +96,7 @@ public static void main(String[] args) {
private static Image image(Display display, int shapeColor) {
Rectangle bounds = new Rectangle(0, 0, 16, 16);
- Image image = new Image(display, bounds);
+ Image image = new Image(display, bounds.width, bounds.height);
GC gc = new GC(image);
gc.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(bounds);
diff --git a/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Issue0445_HiDPISmoothScaling.java b/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Issue0445_HiDPISmoothScaling.java
index 936eaf7e2f0..4a7c419fca6 100644
--- a/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Issue0445_HiDPISmoothScaling.java
+++ b/tests/org.eclipse.swt.tests/ManualTests/org/eclipse/swt/tests/manual/Issue0445_HiDPISmoothScaling.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2022 Mat Booth and others.
+ * Copyright (c) 2022, 2025 Mat Booth and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,7 +20,6 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageDataProvider;
-import org.eclipse.swt.internal.DPIUtil;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
@@ -42,11 +41,9 @@
*
* On Linux you may need to run this with GDK_SCALE=2 set in the environment.
*
- * @see Issue
- * #445 for details.
+ *
+ * For details see: {@code https://github.com/eclipse-platform/eclipse.platform.swt/issues/445}.
*/
-@SuppressWarnings("restriction")
public class Issue0445_HiDPISmoothScaling {
public static void main(String[] args) {
@@ -59,7 +56,6 @@ public static void main(String[] args) {
shell.setSize(100, 100);
shell.setLayout(new GridLayout(1, true));
- System.out.println("Device Zoom: " + DPIUtil.getDeviceZoom());
ImageDataProvider provider1x = zoom -> {
if (zoom == 100) {
diff --git a/tests/org.eclipse.swt.tests/pom.xml b/tests/org.eclipse.swt.tests/pom.xml
index 9193420d25b..702d75c383a 100644
--- a/tests/org.eclipse.swt.tests/pom.xml
+++ b/tests/org.eclipse.swt.tests/pom.xml
@@ -16,11 +16,11 @@
org.eclipse.platform
eclipse.platform.swt.localbuild
- 4.36.0-SNAPSHOT
+ 4.37.0-SNAPSHOT
../../local-build/local-build-parent/
org.eclipse.swt.tests
- 3.107.800-SNAPSHOT
+ 3.107.900-SNAPSHOT
eclipse-test-plugin