Skip to content

Commit

Permalink
Deprecate insufficient Display#setRescalingAtRuntime() method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
HeikoKlare committed Jan 14, 2025
1 parent a6dd128 commit 1a7bc84
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6858,7 +6858,10 @@ public boolean isRescalingAtRuntime() {
* @param activate whether rescaling shall be activated or deactivated
* @return whether activating or deactivating the rescaling was successful
* @since 3.127
* @deprecated this method should not be used as it needs to be called already
* during instantiation to take proper effect
*/
@Deprecated(since = "2025-03", forRemoval = true)
public boolean setRescalingAtRuntime(boolean activate) {
// not implemented for Cocoa
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6294,7 +6294,10 @@ public boolean isRescalingAtRuntime() {
* @param activate whether rescaling shall be activated or deactivated
* @return whether activating or deactivating the rescaling was successful
* @since 3.127
* @deprecated this method should not be used as it needs to be called already
* during instantiation to take proper effect
*/
@Deprecated(since = "2025-03", forRemoval = true)
public boolean setRescalingAtRuntime(boolean activate) {
// not implemented for GTK
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5261,6 +5261,7 @@ private long openThemeData(final char[] themeName) {
return OS.OpenThemeData(hwndMessage, themeName, dpi);
}
}

/**
* {@return whether rescaling of shells at runtime when the DPI scaling of a
* shell's monitor changes is activated for this device}
Expand All @@ -5286,8 +5287,15 @@ public boolean isRescalingAtRuntime() {
* @param activate whether rescaling shall be activated or deactivated
* @return whether activating or deactivating the rescaling was successful
* @since 3.127
* @deprecated this method should not be used as it needs to be called already
* during instantiation to take proper effect
*/
@Deprecated(since = "2025-03", forRemoval = true)
public boolean setRescalingAtRuntime(boolean activate) {
return setMonitorSpecificScaling(activate);
}

private boolean setMonitorSpecificScaling(boolean activate) {
int desiredApiAwareness = activate ? OS.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 : OS.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
if (setDPIAwareness(desiredApiAwareness)) {
rescalingAtRuntime = activate;
Expand Down

0 comments on commit 1a7bc84

Please sign in to comment.