Skip to content

Commit 1a7bc84

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 a6dd128 commit 1a7bc84

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
@@ -5261,6 +5261,7 @@ private long openThemeData(final char[] themeName) {
52615261
return OS.OpenThemeData(hwndMessage, themeName, dpi);
52625262
}
52635263
}
5264+
52645265
/**
52655266
* {@return whether rescaling of shells at runtime when the DPI scaling of a
52665267
* shell's monitor changes is activated for this device}
@@ -5286,8 +5287,15 @@ public boolean isRescalingAtRuntime() {
52865287
* @param activate whether rescaling shall be activated or deactivated
52875288
* @return whether activating or deactivating the rescaling was successful
52885289
* @since 3.127
5290+
* @deprecated this method should not be used as it needs to be called already
5291+
* during instantiation to take proper effect
52895292
*/
5293+
@Deprecated(since = "2025-03", forRemoval = true)
52905294
public boolean setRescalingAtRuntime(boolean activate) {
5295+
return setMonitorSpecificScaling(activate);
5296+
}
5297+
5298+
private boolean setMonitorSpecificScaling(boolean activate) {
52915299
int desiredApiAwareness = activate ? OS.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 : OS.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
52925300
if (setDPIAwareness(desiredApiAwareness)) {
52935301
rescalingAtRuntime = activate;

0 commit comments

Comments
 (0)