File tree 1 file changed +21
-0
lines changed
arduino-core/src/processing/app/windows
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 35
35
import java .util .LinkedList ;
36
36
import java .util .List ;
37
37
38
+ import com .sun .jna .Native ;
39
+ import com .sun .jna .win32 .StdCallLibrary ;
40
+ import com .sun .jna .win32 .W32APIOptions ;
38
41
39
42
public class Platform extends processing .app .Platform {
40
43
@@ -228,4 +231,22 @@ public void fixSettingsLocation() throws Exception {
228
231
229
232
Files .move (oldSettingsFolder , settingsFolder .toPath ());
230
233
}
234
+
235
+ // Need to extend com.sun.jna.platform.win32.User32 to access
236
+ // Win32 function GetDpiForSystem()
237
+ interface ExtUser32 extends StdCallLibrary , com .sun .jna .platform .win32 .User32 {
238
+ ExtUser32 INSTANCE = (ExtUser32 ) Native .loadLibrary ("user32" , ExtUser32 .class , W32APIOptions .DEFAULT_OPTIONS );
239
+
240
+ public int GetDpiForSystem ();
241
+ }
242
+
243
+ @ Override
244
+ public int getSystemDPI () {
245
+ try {
246
+ return ExtUser32 .INSTANCE .GetDpiForSystem ();
247
+ } catch (Throwable e ) {
248
+ // DPI detection failed, fall back with default
249
+ return super .getSystemDPI ();
250
+ }
251
+ }
231
252
}
You can’t perform that action at this time.
0 commit comments