This commit is contained in:
Feross Aboukhadijeh
2016-03-05 17:42:03 -08:00
parent fd300ed724
commit 4f1dfc8c1e

View File

@@ -4,18 +4,6 @@ var windows = require('./windows')
var app = electron.app var app = electron.app
function onWindowShow () {
debug('onWindowShow')
getMenuItem('Full Screen').enabled = true
getMenuItem('Float on Top').enabled = true
}
function onWindowHide () {
debug('onWindowHide')
getMenuItem('Full Screen').enabled = false
getMenuItem('Float on Top').enabled = false
}
function toggleFullScreen () { function toggleFullScreen () {
debug('toggleFullScreen') debug('toggleFullScreen')
if (windows.main && windows.main.isVisible()) { if (windows.main && windows.main.isVisible()) {
@@ -23,14 +11,9 @@ function toggleFullScreen () {
} }
} }
function onToggleFullScreen () {
getMenuItem('Full Screen').checked = windows.main.isFullScreen()
windows.main.send('fullscreenChanged', windows.main.isFullScreen())
}
// Sets whether the window should always show on top of other windows // Sets whether the window should always show on top of other windows
function toggleAlwaysOnTop () { function toggleFloatOnTop () {
debug('toggleAlwaysOnTop %s') debug('toggleFloatOnTop %s')
if (windows.main) { if (windows.main) {
windows.main.setAlwaysOnTop(!windows.main.isAlwaysOnTop()) windows.main.setAlwaysOnTop(!windows.main.isAlwaysOnTop())
getMenuItem('Float on Top').checked = windows.main.isAlwaysOnTop() getMenuItem('Float on Top').checked = windows.main.isAlwaysOnTop()
@@ -52,6 +35,27 @@ function reloadWindow () {
} }
} }
function addFakeDevice (device) {
windows.main.send('addFakeDevice', device)
}
function onWindowShow () {
debug('onWindowShow')
getMenuItem('Full Screen').enabled = true
getMenuItem('Float on Top').enabled = true
}
function onWindowHide () {
debug('onWindowHide')
getMenuItem('Full Screen').enabled = false
getMenuItem('Float on Top').enabled = false
}
function onToggleFullScreen () {
getMenuItem('Full Screen').checked = windows.main.isFullScreen()
windows.main.send('fullscreenChanged', windows.main.isFullScreen())
}
function getMenuItem (label) { function getMenuItem (label) {
for (var i = 0; i < appMenu.items.length; i++) { for (var i = 0; i < appMenu.items.length; i++) {
var menuItem = appMenu.items[i].submenu.items.find(function (item) { var menuItem = appMenu.items[i].submenu.items.find(function (item) {
@@ -61,10 +65,6 @@ function getMenuItem (label) {
} }
} }
function addFakeDevice (device) {
windows.main.send('addFakeDevice', device)
}
function getMenuTemplate () { function getMenuTemplate () {
var template = [ var template = [
{ {
@@ -153,7 +153,7 @@ function getMenuTemplate () {
{ {
label: 'Float on Top', label: 'Float on Top',
type: 'checkbox', type: 'checkbox',
click: toggleAlwaysOnTop click: toggleFloatOnTop
}, },
{ {
type: 'separator' type: 'separator'