From ddee2f424b1e8be53d427bde0448b72df3387937 Mon Sep 17 00:00:00 2001 From: cTn Date: Fri, 14 Feb 2014 14:18:19 +0100 Subject: [PATCH] linux bugfixes + docs --- background.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/background.js b/background.js index 39408cd2a2..3cbdfb3618 100644 --- a/background.js +++ b/background.js @@ -1,14 +1,26 @@ +/* + 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. +*/ function start_app() { chrome.app.window.create('main.html', { id: 'main-window', frame: 'none', resizable: false, - minWidth: 962, - minHeight: 650, maxWidth: 962, maxHeight: 650 - }, function(window_child) { - window_child.onClosed.addListener(function() { + }, function(main_window) { + // set window size + main_window.setBounds({'width': 962, 'height': 650}); + + // bind events + main_window.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