Merge pull request #495 from feross/osx-fullscreenst
OS X: Make controls use full window in fullscreen
This commit is contained in:
10
main/ipc.js
10
main/ipc.js
@@ -45,8 +45,8 @@ function init () {
|
|||||||
setBounds(bounds, maximize)
|
setBounds(bounds, maximize)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('setAspectRatio', function (e, aspectRatio, extraSize) {
|
ipcMain.on('setAspectRatio', function (e, aspectRatio) {
|
||||||
setAspectRatio(aspectRatio, extraSize)
|
setAspectRatio(aspectRatio)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('setBadge', function (e, text) {
|
ipcMain.on('setBadge', function (e, text) {
|
||||||
@@ -206,10 +206,10 @@ function setBounds (bounds, maximize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAspectRatio (aspectRatio, extraSize) {
|
function setAspectRatio (aspectRatio) {
|
||||||
log('setAspectRatio %o %o', aspectRatio, extraSize)
|
log('setAspectRatio %o', aspectRatio)
|
||||||
if (windows.main) {
|
if (windows.main) {
|
||||||
windows.main.setAspectRatio(aspectRatio, extraSize)
|
windows.main.setAspectRatio(aspectRatio)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ function toggleFullScreen (flag) {
|
|||||||
log('toggleFullScreen %s', flag)
|
log('toggleFullScreen %s', flag)
|
||||||
if (windows.main && windows.main.isVisible()) {
|
if (windows.main && windows.main.isVisible()) {
|
||||||
flag = flag != null ? flag : !windows.main.isFullScreen()
|
flag = flag != null ? flag : !windows.main.isFullScreen()
|
||||||
|
if (flag) {
|
||||||
|
// Allows the window to use the full screen in fullscreen mode (OS X).
|
||||||
|
windows.main.setAspectRatio(0)
|
||||||
|
}
|
||||||
windows.main.setFullScreen(flag)
|
windows.main.setFullScreen(flag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -441,6 +441,10 @@ function setupIpc () {
|
|||||||
|
|
||||||
ipcRenderer.on('fullscreenChanged', function (e, isFullScreen) {
|
ipcRenderer.on('fullscreenChanged', function (e, isFullScreen) {
|
||||||
state.window.isFullScreen = isFullScreen
|
state.window.isFullScreen = isFullScreen
|
||||||
|
if (!isFullScreen) {
|
||||||
|
// Aspect ratio gets reset in fullscreen mode, so restore it (OS X)
|
||||||
|
ipcRenderer.send('setAspectRatio', state.playing.aspectRatio)
|
||||||
|
}
|
||||||
update()
|
update()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1079,6 +1083,7 @@ function setDimensions (dimensions) {
|
|||||||
|
|
||||||
ipcRenderer.send('setAspectRatio', aspectRatio)
|
ipcRenderer.send('setAspectRatio', aspectRatio)
|
||||||
ipcRenderer.send('setBounds', {x: null, y: null, width, height})
|
ipcRenderer.send('setBounds', {x: null, y: null, width, height})
|
||||||
|
state.playing.aspectRatio = aspectRatio
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreBounds () {
|
function restoreBounds () {
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ function getDefaultPlayState () {
|
|||||||
subtitles: {
|
subtitles: {
|
||||||
tracks: [], /* subtitles file (Buffer) */
|
tracks: [], /* subtitles file (Buffer) */
|
||||||
enabled: false
|
enabled: false
|
||||||
}
|
},
|
||||||
|
aspectRatio: 0 /* aspect ratio of the video */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user