Skip to content

Commit 8ff51cb

Browse files
akoch-yattaamartya4256
authored andcommitted
Adaption
1 parent 04af941 commit 8ff51cb

6 files changed

Lines changed: 88 additions & 10 deletions

File tree

binaries/org.eclipse.swt.win32.win32.x86_64/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.swt;bundle-version="[3.128.0,4.0.0)"
33
Bundle-Name: %fragmentName
44
Bundle-Vendor: %providerName
55
Bundle-SymbolicName: org.eclipse.swt.win32.win32.x86_64; singleton:=true
6-
Bundle-Version: 3.132.0.qualifier
6+
Bundle-Version: 3.133.0.qualifier
77
Bundle-ManifestVersion: 2
88
Bundle-Localization: fragment
99
Export-Package:

bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3528,9 +3528,22 @@ NSTouch findTouchWithId(NSArray touches, NSObject identity) {
35283528
}
35293529

35303530
/**
3531+
* Sets the autoscaling mode for this widget.
3532+
* <p>
3533+
* On Cocoa, autoscaling cannot be configured at the widget level.
3534+
* This method is therefore not supported on these platforms and has no effect.
3535+
* </p>
3536+
*
3537+
* @param autoscalingMode
3538+
* the autoscaling mode to request; this argument is accepted but
3539+
* ignored on this platform
3540+
*
3541+
* @return {@code false} to indicate that autoscaling mode cannot be changed
3542+
* on GTK or Cocoa
3543+
*
35313544
* @since 3.133
35323545
*/
3533-
public boolean setAutoscaleDisabled(boolean autoscaleDisabled) {
3546+
public boolean setAutoscalingMode(AutoscalingMode autoscalingMode) {
35343547
return false;
35353548
}
35363549

bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.eclipse.swt.graphics.*;
2121
import org.eclipse.swt.internal.*;
2222
import org.eclipse.swt.internal.cocoa.*;
23-
import org.eclipse.swt.internal.win32.*;
2423

2524
/**
2625
* Instances of this class represent the "windows"

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/AutoscalingMode.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
package org.eclipse.swt.graphics;
22

3+
4+
/**
5+
* Defines the autoscaling behavior used when rendering or computing layout
6+
* for widgets or graphics that support DPI‑aware scaling.
7+
* <p>
8+
* This mode determines whether autoscaling logic is applied, disabled, or
9+
* inherited from a parent component. It allows callers to explicitly control
10+
* how scaling should be handled in contexts where DPI, zoom factors, or
11+
* user accessibility settings may influence size computation.
12+
* </p>
13+
*
14+
* <ul>
15+
* <li><b>{@link #ENABLED}</b> – Autoscaling is explicitly enabled.
16+
* Values (such as coordinates, dimensions, or layout metrics) will be
17+
* adjusted according to the effective scaling factor.</li>
18+
*
19+
* <li><b>{@link #DISABLED}</b> – Autoscaling is explicitly disabled.
20+
* Values will be used as-is without applying any scaling
21+
* transformations.</li>
22+
*
23+
* <li><b>{@link #DISABLED_INHERITED}</b> – Autoscaling is disabled for this
24+
* component, but the decision originates from a parent or owner context.
25+
* This is typically used to indicate that the disabled state was not set
26+
* explicitly at this level but inherited from upstream configuration.</li>
27+
* </ul>
28+
*
29+
* @since 3.133
30+
*/
31+
332
public enum AutoscalingMode {
433
ENABLED,
534
DISABLED,

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5144,9 +5144,22 @@ void gtk_label_set_align(long label, float xAlign, float yAlign) {
51445144
}
51455145

51465146
/**
5147-
* @since 3.132
5147+
* Sets the autoscaling mode for this widget.
5148+
* <p>
5149+
* On GTK, autoscaling cannot be configured at the widget level.
5150+
* This method is therefore not supported on these platforms and has no effect.
5151+
* </p>
5152+
*
5153+
* @param autoscalingMode
5154+
* the autoscaling mode to request; this argument is accepted but
5155+
* ignored on this platform
5156+
*
5157+
* @return {@code false} to indicate that autoscaling mode cannot be changed
5158+
* on GTK or Cocoa
5159+
*
5160+
* @since 3.133
51485161
*/
5149-
public boolean setAutoscaleDisabled(boolean autoscaleDisabled) {
5162+
public boolean setAutoscalingMode(AutoscalingMode autoscalingMode) {
51505163
return false;
51515164
}
51525165

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,16 +1285,21 @@ public Object getData(String key) {
12851285
@Override
12861286
public void setData(String key, Object value) {
12871287
super.setData(key, value);
1288-
if (DATA_AUTOSCALE_DISABLED.equals(key) || PROPOGATE_AUTOSCALE_DISABLED.equals(key)) {
1289-
boolean autoScaleDisabled = Boolean.parseBoolean(getData(DATA_AUTOSCALE_DISABLED).toString());
1290-
boolean propagateAutoscaleDisabled = Boolean.parseBoolean(getData(PROPOGATE_AUTOSCALE_DISABLED).toString());
1288+
if (DATA_AUTOSCALE_DISABLED.equals(key)) {
1289+
boolean autoScaleDisabled = Boolean.parseBoolean(value.toString());
12911290
if (autoScaleDisabled) {
1292-
autoscalingMode = propagateAutoscaleDisabled ? AutoscalingMode.DISABLED_INHERITED : AutoscalingMode.DISABLED;
1291+
Object autoscaleDisablementValue = getData(PROPOGATE_AUTOSCALE_DISABLED);
1292+
boolean propagateAutoscaling = autoscaleDisablementValue != null && Boolean.parseBoolean(autoscaleDisablementValue.toString());
1293+
autoscalingMode = propagateAutoscaling ? AutoscalingMode.DISABLED_INHERITED : AutoscalingMode.DISABLED;
12931294
this.nativeZoom = 100;
12941295
} else {
12951296
autoscalingMode = AutoscalingMode.ENABLED;
12961297
this.nativeZoom = getShellZoom();
12971298
}
1299+
} else if (PROPOGATE_AUTOSCALE_DISABLED.equals(key)) {
1300+
boolean propagateAutoscaling = value != null && Boolean.parseBoolean(value.toString());
1301+
autoscalingMode = propagateAutoscaling ? AutoscalingMode.DISABLED_INHERITED : AutoscalingMode.DISABLED;
1302+
this.nativeZoom = 100;
12981303
}
12991304
}
13001305

@@ -3361,7 +3366,26 @@ private void fitInParentBounds(Rectangle boundsInPixels, int zoom) {
33613366
}
33623367

33633368
/**
3364-
* @since 3.132
3369+
* Sets the autoscaling mode for this control.
3370+
* <p>
3371+
* The autoscaling mode determines whether this control participates in DPI‑based
3372+
* scaling logic. When autoscaling is disabled (either explicitly or through
3373+
* inheritance), the control is forced to use a zoom level of {@code 100}%.
3374+
* When autoscaling is enabled, the control adopts the zoom level of its parent
3375+
* shell.
3376+
* </p>
3377+
*
3378+
* <p>
3379+
* Calling this method updates both the internal autoscaling mode and the
3380+
* effective native zoom factor used for layout or rendering computations.
3381+
* </p>
3382+
*
3383+
* @param autoscalingMode
3384+
* the new autoscaling mode to apply; must not be {@code null}
3385+
*
3386+
* @return always {@code true}, indicating the mode was successfully applied
3387+
*
3388+
* @since 3.133
33653389
*/
33663390
public boolean setAutoscalingMode(AutoscalingMode autoscalingMode) {
33673391
this.autoscalingMode = autoscalingMode;

0 commit comments

Comments
 (0)