File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Eclipse SWT PI/win32/org/eclipse/swt/internal/win32
Eclipse SWT/win32/org/eclipse/swt/widgets Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,7 @@ public class OS extends C {
370
370
public static final short DMDUP_VERTICAL = 2 ;
371
371
public static final short DMDUP_HORIZONTAL = 3 ;
372
372
public static final int DPI_AWARENESS_CONTEXT_UNAWARE = 24592 ;
373
+ public static final int DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED = 1073766416 ;
373
374
public static final int DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 24593 ;
374
375
public static final int DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18 ;
375
376
public static final int DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34 ;
Original file line number Diff line number Diff line change @@ -233,6 +233,13 @@ public RGB open () {
233
233
234
234
display .externalEventLoop = true ;
235
235
display .sendPreExternalEventDispatchEvent ();
236
+
237
+ /* Temporarily setting the thread dpi awareness to gdi scaling because window dialog has weird resize handling */
238
+ long currentDpiAwarenessContext = OS .GetThreadDpiAwarenessContext ();
239
+ if (display .isRescalingAtRuntime ()) {
240
+ currentDpiAwarenessContext = OS .SetThreadDpiAwarenessContext (OS .DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED );
241
+ }
242
+
236
243
/* Open the dialog */
237
244
boolean success = OS .ChooseColor (lpcc );
238
245
display .externalEventLoop = false ;
@@ -270,6 +277,11 @@ public RGB open () {
270
277
rgb = new RGB (red , green , blue );
271
278
}
272
279
280
+ /* Reset the dpi awareness context */
281
+ if (display .isRescalingAtRuntime ()) {
282
+ OS .SetThreadDpiAwarenessContext (currentDpiAwarenessContext );
283
+ }
284
+
273
285
/* Free the CCHookProc */
274
286
callback .dispose ();
275
287
Original file line number Diff line number Diff line change @@ -226,6 +226,13 @@ public FontData open () {
226
226
227
227
display .externalEventLoop = true ;
228
228
display .sendPreExternalEventDispatchEvent ();
229
+
230
+ /* Temporarily setting the thread dpi awareness to gdi scaling because window dialog has weird resize handling */
231
+ long currentDpiAwarenessContext = OS .GetThreadDpiAwarenessContext ();
232
+ if (display .isRescalingAtRuntime ()) {
233
+ currentDpiAwarenessContext = OS .SetThreadDpiAwarenessContext (OS .DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED );
234
+ }
235
+
229
236
/* Open the dialog */
230
237
boolean success = OS .ChooseFont (lpcf );
231
238
display .externalEventLoop = false ;
@@ -279,6 +286,11 @@ public FontData open () {
279
286
}
280
287
}
281
288
289
+ /* Reset the dpi awareness context */
290
+ if (display .isRescalingAtRuntime ()) {
291
+ OS .SetThreadDpiAwarenessContext (currentDpiAwarenessContext );
292
+ }
293
+
282
294
/* Free the OS memory */
283
295
if (lpLogFont != 0 ) OS .HeapFree (hHeap , 0 , lpLogFont );
284
296
You can’t perform that action at this time.
0 commit comments