high dpi detection
This commit is contained in:
parent
f8b4827cf2
commit
997847e146
3 changed files with 6 additions and 3 deletions
6
index.js
6
index.js
|
@ -1,5 +1,5 @@
|
||||||
require('v8-compile-cache');
|
require('v8-compile-cache');
|
||||||
const { app } = require('electron');
|
const { app, screen } = require('electron');
|
||||||
|
|
||||||
// Analytics for debugging.
|
// Analytics for debugging.
|
||||||
const ElectronSentry = require("@sentry/electron");
|
const ElectronSentry = require("@sentry/electron");
|
||||||
|
@ -61,7 +61,6 @@ switch (app.cfg.get("visual.hw_acceleration")) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creating the Application Window and Calling all the Functions
|
// Creating the Application Window and Calling all the Functions
|
||||||
function CreateWindow() {
|
function CreateWindow() {
|
||||||
if (app.isQuiting) { app.quit(); return; }
|
if (app.isQuiting) { app.quit(); return; }
|
||||||
|
@ -82,6 +81,9 @@ app.commandLine.appendSwitch('js-flags', '--max-old-space-size=1024')
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
if (app.isQuiting) { app.quit(); return; }
|
if (app.isQuiting) { app.quit(); return; }
|
||||||
|
app.commandLine.appendSwitch('high-dpi-support', 1)
|
||||||
|
app.commandLine.appendSwitch('force-device-scale-factor', 1)
|
||||||
|
|
||||||
console.log('[Cider] Application is Ready. Creating Window.')
|
console.log('[Cider] Application is Ready. Creating Window.')
|
||||||
if (!app.isPackaged) {
|
if (!app.isPackaged) {
|
||||||
console.info('[Cider] Running in development mode.')
|
console.info('[Cider] Running in development mode.')
|
||||||
|
|
|
@ -194,6 +194,8 @@ const CiderBase = {
|
||||||
ipcMain.on('setScreenScale', (event, scale) => {
|
ipcMain.on('setScreenScale', (event, scale) => {
|
||||||
win.webContents.setZoomFactor(parseFloat(scale))
|
win.webContents.setZoomFactor(parseFloat(scale))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
win.webContents.setZoomFactor(screen.getPrimaryDisplay().scaleFactor)
|
||||||
return win
|
return win
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2574,4 +2574,3 @@ webGPU().then()
|
||||||
|
|
||||||
let screenWidth = screen.width;
|
let screenWidth = screen.width;
|
||||||
let screenHeight = screen.height;
|
let screenHeight = screen.height;
|
||||||
ipcRenderer.send("setScreenScale" , (screenHeight * 16 / 9) / (1536))
|
|
Loading…
Add table
Add a link
Reference in a new issue