Skip to content

Commit 382fe01

Browse files
committed
Deprecate insufficient Display#setRescalingAtRuntime() method
The method Display#setRescalingAtRuntime() allows to activate the monitor-specific scaling mechanism on Windows. This must, however, actually be activated before the Display is instantiated, like it is done during the Display constructor execution if the system property for global activation of monitor-specific scaling is specified. In consequence, calling #setRescalingAtRuntime() does not take the full intended effect. This change deprecates the method so that the system property needs to be set for proper initialization of the monitor-specific scaling functionality.
1 parent d7be959 commit 382fe01

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6858,7 +6858,10 @@ public boolean isRescalingAtRuntime() {
68586858
* @param activate whether rescaling shall be activated or deactivated
68596859
* @return whether activating or deactivating the rescaling was successful
68606860
* @since 3.127
6861+
* @deprecated this method should not be used as it needs to be called already
6862+
* during instantiation to take proper effect
68616863
*/
6864+
@Deprecated(since = "2025-03", forRemoval = true)
68626865
public boolean setRescalingAtRuntime(boolean activate) {
68636866
// not implemented for Cocoa
68646867
return false;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6294,7 +6294,10 @@ public boolean isRescalingAtRuntime() {
62946294
* @param activate whether rescaling shall be activated or deactivated
62956295
* @return whether activating or deactivating the rescaling was successful
62966296
* @since 3.127
6297+
* @deprecated this method should not be used as it needs to be called already
6298+
* during instantiation to take proper effect
62976299
*/
6300+
@Deprecated(since = "2025-03", forRemoval = true)
62986301
public boolean setRescalingAtRuntime(boolean activate) {
62996302
// not implemented for GTK
63006303
return false;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5270,6 +5270,7 @@ private long openThemeData(final char[] themeName) {
52705270
return OS.OpenThemeData(hwndMessage, themeName, dpi);
52715271
}
52725272
}
5273+
52735274
/**
52745275
* {@return whether rescaling of shells at runtime when the DPI scaling of a
52755276
* shell's monitor changes is activated for this device}
@@ -5295,8 +5296,15 @@ public boolean isRescalingAtRuntime() {
52955296
* @param activate whether rescaling shall be activated or deactivated
52965297
* @return whether activating or deactivating the rescaling was successful
52975298
* @since 3.127
5299+
* @deprecated this method should not be used as it needs to be called already
5300+
* during instantiation to take proper effect
52985301
*/
5302+
@Deprecated(since = "2025-03", forRemoval = true)
52995303
public boolean setRescalingAtRuntime(boolean activate) {
5304+
return setMonitorSpecificScaling(activate);
5305+
}
5306+
5307+
private boolean setMonitorSpecificScaling(boolean activate) {
53005308
int desiredApiAwareness = activate ? OS.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 : OS.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
53015309
if (setDPIAwareness(desiredApiAwareness)) {
53025310
rescalingAtRuntime = activate;

0 commit comments

Comments
 (0)