1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

getting app.window.create ready for M36+

This commit is contained in:
cTn 2014-06-24 15:15:22 +02:00
parent 8422e5d10c
commit a6bada4667

View file

@ -1,12 +1,8 @@
/*
resizable: false - Keep in mind this only disables the side/corner resizing via mouse, nothing more
maxWidth / maxHeight - is defined to prevent application reaching maximized state through window manager
We are setting Bounds through setBounds method after window was created because on linux setting Bounds as
window.create property seemed to fail, probably because "previous" bounds was used instead according to docs.
bounds - Size and position of the content in the window (excluding the titlebar).
If an id is also specified and a window with a matching id has been shown before, the remembered bounds of the window will be used instead.
Size calculation for innerBounds seems to be faulty, app was designed for 960x625, using arbitrary values to make innerBounds happy for now
arbitrary values do match the windows ui, how it will affect other OSs is currently unknown
*/
function start_app() {
chrome.app.window.create('main.html', {
@ -29,6 +25,31 @@ function start_app() {
}
});
});
/* code belowis chrome 36+ ready, till this is enforced in manifest we have to use the old version
chrome.app.window.create('main.html', {
id: 'main-window',
frame: 'chrome',
innerBounds: {
minWidth: 974,
minHeight: 632
}
}, function(createdWindow) {
createdWindow.onClosed.addListener(function() {
// connectionId is passed from the script side through the chrome.runtime.getBackgroundPage refference
// allowing us to automatically close the port when application shut down
// save connectionId in separate variable before app_window is destroyed
var connectionId = app_window.serial.connectionId;
if (connectionId > 0) {
chrome.serial.disconnect(connectionId, function(result) {
console.log('SERIAL: Connection closed - ' + result);
});
}
});
});
*/
}
chrome.app.runtime.onLaunched.addListener(function() {