Skip to content

Commit

Permalink
Remove darwin mojave checkbox fix. This is now implemented properly u…
Browse files Browse the repository at this point in the history
…pstream
  • Loading branch information
Thomas101 committed Dec 18, 2018
1 parent 0605a96 commit 91058f4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 76 deletions.
60 changes: 3 additions & 57 deletions src/app/src/Windows/WaveboxWindow.js
Expand Up @@ -22,7 +22,6 @@ const privWindow = Symbol('privWindow')
const privBrowserWindowId = Symbol('privBrowserWindowId')
const privLocationSaver = Symbol('privLocationSaver')
const privLastTimeInFocus = Symbol('privLastTimeInFocus')
const privMojaveCheckboxFix = Symbol('privMojaveCheckboxFix')
const privMinMaxLast = Symbol('privMinMaxLast')

const waveboxWindowManager = new WaveboxWindowManager()
Expand Down Expand Up @@ -73,43 +72,10 @@ class WaveboxWindow extends EventEmitter {
this[privBrowserWindowId] = null
this[privLastTimeInFocus] = 0
this[privLocationSaver] = new WaveboxWindowLocationSaver(saverTag)
this[privMojaveCheckboxFix] = settingsStore.getState().launched.app.darwinMojaveCheckboxFix
this[privMinMaxLast] = null

// Events
ipcMain.on(WB_WINDOW_MIN_MAX_DBL_CLICK, this._handleMinMaxDoubleClickWindow)

// Mojave fix for issues/817
// This fix will need to remain in for a version after chromium has been updated as anyone
// who has had the fix applied will still have the webcontents at 0.001 zoom.
// See @Thomas101 for more info
if (process.platform === 'darwin') {
this.on('tab-created', (evt, tabId) => {
const wc = webContents.fromId(tabId)
if (!wc || wc.isDestroyed()) { return }

wc.on('did-start-navigation', (evt, url, isInPlace, isMainFrame) => {
if (isMainFrame) {
evt.sender.getZoomFactor((factor) => {
const corrected = this._getDarwinMojaveCorrectedZoomLevel(factor, this[privMojaveCheckboxFix])
if (corrected !== factor) {
if (evt.sender.isDestroyed()) { return }
evt.sender.setZoomFactor(corrected)
}
})
}
})
wc.on('dom-ready', (evt) => {
evt.sender.getZoomFactor((factor) => {
const corrected = this._getDarwinMojaveCorrectedZoomLevel(factor, this[privMojaveCheckboxFix])
if (corrected !== factor) {
if (evt.sender.isDestroyed()) { return }
evt.sender.setZoomFactor(corrected)
}
})
})
})
}
}

/**
Expand Down Expand Up @@ -650,7 +616,7 @@ class WaveboxWindow extends EventEmitter {
const wc = webContents.fromId(webContentsId)
if (!wc || wc.isDestroyed()) { return this }
wc.getZoomFactor((factor) => {
wc.setZoomFactor(this._getDarwinMojaveCorrectedZoomLevel(factor + 0.1, this[privMojaveCheckboxFix]))
wc.setZoomFactor(factor + 0.1)
})
return this
}
Expand All @@ -665,7 +631,7 @@ class WaveboxWindow extends EventEmitter {
const wc = webContents.fromId(webContentsId)
if (!wc || wc.isDestroyed()) { return this }
wc.getZoomFactor((factor) => {
wc.setZoomFactor(this._getDarwinMojaveCorrectedZoomLevel(factor - 0.1, this[privMojaveCheckboxFix]))
wc.setZoomFactor(factor - 0.1)
})
return this
}
Expand All @@ -679,30 +645,10 @@ class WaveboxWindow extends EventEmitter {
if (!webContentsId) { return this }
const wc = webContents.fromId(webContentsId)
if (!wc || wc.isDestroyed()) { return this }
wc.setZoomFactor(this._getDarwinMojaveCorrectedZoomLevel(1.0, this[privMojaveCheckboxFix]))
wc.setZoomFactor(1.0)
return this
}

/**
* Sanitizes the zoom level for macOS mojave to work around issues/817
* @param zoom: the zoom we want to apply
* @param enabled: true if the fix should be applied
* @return the zoom we should apply
*/
_getDarwinMojaveCorrectedZoomLevel (zoom, enabled) {
// Make sure we sanitize the zoom correctly - as upgrades will lose the sanitized value
const sanitizedZoom = Math.round(zoom * 10) / 10
if (Platform.isDarwinMojave() && enabled) {
if (sanitizedZoom === 1.0) {
return 1.001
} else {
return sanitizedZoom
}
} else {
return sanitizedZoom
}
}

/* ****************************************************************************/
// Query
/* ****************************************************************************/
Expand Down
Expand Up @@ -61,7 +61,6 @@ class AdvancedSettingsSection extends React.Component {
'enableWindowOpeningEngine',
'enableMouseNavigationDarwin',
'polyfillUserAgents',
'darwinMojaveCheckboxFix',
'concurrentServiceLoadLimit',
'searchProvider',
'experimentalMicrosoftHTTP'
Expand Down Expand Up @@ -195,15 +194,6 @@ class AdvancedSettingsSection extends React.Component {
settingsActions.sub.app.setEnableWindowOpeningEngine(toggled)
}}
checked={app.enableWindowOpeningEngine} />
{Platform.isDarwinMojave() ? (
<SettingsListItemSwitch
label='macOS Mojave checkbox fix (Requires Restart)'
onChange={(evt, toggled) => {
showRestart()
settingsActions.sub.app.setDarwinMojaveCheckboxFix(toggled)
}}
checked={app.darwinMojaveCheckboxFix} />
) : undefined}
<SettingsListItemSwitch
label='Experimental Download Handler'
onChange={(evt, toggled) => settingsActions.sub.os.setUseAsyncDownloadHandler(toggled)}
Expand Down
Expand Up @@ -172,14 +172,6 @@ class AppSettingsActions extends CoreSettingsActions {
this.dispatchUpdate('polyfillUserAgents', enable)
}

/**
* Sets whether to apply the mojave checkbox fix
* @param enable: true to enable
*/
setDarwinMojaveCheckboxFix (enable) {
this.dispatchUpdate('darwinMojaveCheckboxFix', enable)
}

/**
* Sets the concurrent load limit for services
* @param limit: the new limit. 0 for auto. Infinity for no limit
Expand Down
1 change: 0 additions & 1 deletion src/shared/Models/Settings/AppSettings.js
Expand Up @@ -104,7 +104,6 @@ class AppSettings extends Model {
get enableWindowOpeningEngine () { return this._value_('enableWindowOpeningEngine', true) }
get enableMouseNavigationDarwin () { return this._value_('enableMouseNavigationDarwin', true) }
get polyfillUserAgents () { return this._value_('polyfillUserAgents', true) }
get darwinMojaveCheckboxFix () { return this._value_('darwinMojaveCheckboxFix', true) }
get concurrentServiceLoadLimit () { return this._value_('concurrentServiceLoadLimit', 0) }
get concurrentServiceLoadLimitIsAuto () { return this.concurrentServiceLoadLimit === 0 }
get concurrentServiceLoadLimitIsNone () { return this.concurrentServiceLoadLimit === -1 }
Expand Down

0 comments on commit 91058f4

Please sign in to comment.