New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement titleBarStyle without using NSFullSizeContentViewWindowMask #5557

Merged
merged 2 commits into from May 17, 2016

Conversation

Projects
None yet
3 participants
@zcbenz
Contributor

zcbenz commented May 17, 2016

This is inspired from brave/muon@7fa16af.

Instead of using the NSFullSizeContentViewWindowMask style to hide the titlebar, this PR treats window with titleBarStyle as normal frameless window but shows the window buttons instead.

Close #3009.

@zcbenz zcbenz merged commit 3fedea4 into master May 17, 2016

8 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
electron-linux-arm Build #3245255 succeeded in 36s
Details
electron-linux-ia32 Build #3245256 succeeded in 34s
Details
electron-linux-x64 Build #3245257 succeeded in 109s
Details
electron-mas-x64 Build #1190 succeeded in 5 min 39 sec
Details
electron-osx-x64 Build #1192 succeeded in 6 min 13 sec
Details
electron-win-ia32 Build #202 succeeded in 6 min 5 sec
Details
electron-win-x64 Build #195 succeeded in 6 min 8 sec
Details

@zcbenz zcbenz deleted the osx-buttons branch May 17, 2016

@PalmerAL PalmerAL referenced this pull request May 25, 2016

Closed

URL truncation issue #56

@saghul

This comment has been minimized.

Contributor

saghul commented May 25, 2016

For those who ended up here and want the old (ie, having the invisible title bar draggable) behavior back, here is a trick to avoid modifying your HTML:

// Trick to make the transparent title bar draggable
const titleBarHack =
    'var div = document.createElement("div");' +
    'div.style.position = "absolute";' +
    'div.style.top = 0;' +
    'div.style.height = "23px";' +
    'div.style.width = "100%";' +
    'div.style["-webkit-app-region"] = "drag";' +
    'document.body.appendChild(div);';

...

    // make the transparent title bar draggable
    mainWindow.webContents.on('did-finish-load', function() {
        if (process.platform === 'darwin') {
            mainWindow.webContents.executeJavaScript(titleBarHack);
        }
    });

You will need to adjust the height for the hidden-insert style.

@@ -438,22 +451,17 @@ - (void)drawRect:(NSRect)dirtyRect {
if (closable) {
styleMask |= NSClosableWindowMask;
}
if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) {
// The window without titlebar is treated the same with frameless window.
set_has_frame(false);

This comment has been minimized.

@bridiver

bridiver Jun 15, 2016

Contributor

this also prevents the title from being set in NativeWindowMac::SetTitle which drops these windows out of the window menu

BeatPlus added a commit to protonmail-desktop/application that referenced this pull request May 1, 2017

kontrollanten added a commit to protonmail-desktop/application that referenced this pull request Sep 3, 2017

kontrollanten pushed a commit to protonmail-desktop/application that referenced this pull request Sep 3, 2017

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