Always create offscreen window frameless #8250

Merged
merged 3 commits into from Dec 29, 2016

Projects

None yet

3 participants

@gerhardberger
Member

This PR creates the browser window in offscreen mode always without a frame, since in offscreen mode the frame is not accessible, so this way, the window size will be consistent. #8224

@gerhardberger gerhardberger creates offscreen window frameless
1ef0f6b
@Mr0grog
Contributor
Mr0grog commented Dec 21, 2016 edited

Should this also document that all offscreen windows are frameless in the BrowserWindow constructor doc and the offscreen guide?

atom/browser/api/atom_api_window.cc
@@ -90,6 +90,15 @@ Window::Window(v8::Isolate* isolate, v8::Local<v8::Object> 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)) {
@kevinsawicki
kevinsawicki Dec 21, 2016 Contributor

This line could just be:

if (web_preferences.Get("offscreen", &offscreen) && offscreen) {

This style is used in atom/browser/web_contents_preferences.cc

gerhardberger added some commits Dec 21, 2016
@gerhardberger gerhardberger use only one if statement f819087
@gerhardberger gerhardberger adds note to offscreen tutorial
7e82e12
@gerhardberger
Member

@kevinsawicki thanks, I changed it!

Also added a note to the tutorial that the window is frameless in offscreen mode.

@kevinsawicki kevinsawicki merged commit 6ea1bac into electron:master Dec 29, 2016

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@kevinsawicki
Contributor

Thanks for this @gerhardberger 👍 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment