Skip to content

Commit bd8847d

Browse files
author
Qian Xu
committed
use a workaround to fix anti-alias font rendering problem for browser window
1 parent 960e210 commit bd8847d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lib/windows.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const registry = {}
66
const windowDefaults = {
77
width: 900, height: 680,
88
autoHideMenuBar: true,
9+
backgroundColor: '#FFF', // https://github.com/electron/electron/issues/10025
910
webPreferences: {
1011
nodeIntegration: false
1112
}
@@ -19,7 +20,7 @@ function createOrActivate(name, url, options = {}) {
1920
}
2021

2122
function create(name, url, options = {}) {
22-
const windowOptions = _.mergeWith({}, windowDefaults, options)
23+
const windowOptions = _.merge({}, windowDefaults, options)
2324
const win = new BrowserWindow(windowOptions)
2425
registry[name] = win
2526
win.on('closed', () => delete registry[name])
@@ -45,14 +46,19 @@ function activate(win) {
4546
if (_.isString(win)) {
4647
win = get(win)
4748
}
48-
if (win.isMinimized()) {
49-
win.restore()
49+
let success = false
50+
if (win && !win.isDestroyed()) {
51+
if (win.isMinimized()) {
52+
win.restore()
53+
}
54+
win.focus()
55+
success = true
5056
}
51-
win.focus()
57+
return success
5258
}
5359

5460
function setDefaults(value) {
55-
Object.assign(windowDefaults, value)
61+
_.merge(windowDefaults, value)
5662
}
5763

5864
module.exports = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "electron-utils",
33
"description": "Useful utilities for developing Electron apps and modules",
4-
"version": "1.0.8",
4+
"version": "1.0.9",
55
"license": "Apache-2.0",
66
"keywords": ["electron", "helper", "util"],
77
"homepage": "https://github.com/stanleyxu2005/electron-utils",

0 commit comments

Comments
 (0)