From 1ef0f6beff4d6c7e7835ba1232c389fb60b31829 Mon Sep 17 00:00:00 2001 From: gellert Date: Tue, 20 Dec 2016 23:43:52 +0100 Subject: [PATCH 1/3] creates offscreen window frameless --- atom/browser/api/atom_api_window.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 3358f108573..985bc563cbb 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -90,6 +90,15 @@ Window::Window(v8::Isolate* isolate, v8::Local wrapper, if (options.Get("transparent", &transparent)) web_preferences.Set("transparent", transparent); + // Offscreen windows are always created frameless. + bool offscreen; + if (web_preferences.Get("offscreen", &offscreen)) { + if (offscreen) { + auto window_options = const_cast(options); + window_options.Set(options::kFrame, false); + } + } + // Creates the WebContents used by BrowserWindow. web_contents = WebContents::Create(isolate, web_preferences); } From f81908711b3cbbf149140b8360960a10189b53d5 Mon Sep 17 00:00:00 2001 From: gellert Date: Wed, 21 Dec 2016 23:15:05 +0100 Subject: [PATCH 2/3] use only one if statement --- atom/browser/api/atom_api_window.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 985bc563cbb..49ebe464c3e 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -92,11 +92,9 @@ Window::Window(v8::Isolate* isolate, v8::Local wrapper, // Offscreen windows are always created frameless. bool offscreen; - if (web_preferences.Get("offscreen", &offscreen)) { - if (offscreen) { - auto window_options = const_cast(options); - window_options.Set(options::kFrame, false); - } + if (web_preferences.Get("offscreen", &offscreen) && offscreen) { + auto window_options = const_cast(options); + window_options.Set(options::kFrame, false); } // Creates the WebContents used by BrowserWindow. From 7e82e124684b8c9896f7ca9ccc97c8fc1ceb9950 Mon Sep 17 00:00:00 2001 From: gellert Date: Wed, 21 Dec 2016 23:15:39 +0100 Subject: [PATCH 3/3] adds note to offscreen tutorial --- docs/tutorial/offscreen-rendering.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/tutorial/offscreen-rendering.md b/docs/tutorial/offscreen-rendering.md index e47967bd35b..4c3024bdc68 100644 --- a/docs/tutorial/offscreen-rendering.md +++ b/docs/tutorial/offscreen-rendering.md @@ -12,6 +12,8 @@ when there is nothing happening on a webpage, no frames are generated. The maximum frame rate is 60, because above that there is no benefit, just performance loss. +**Note:** An offscreen window is always created as a [Frameless Window](../api/frameless-window.md). + ## Two modes of rendering ### GPU accelerated