Skip to content
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

auto re-enable maximizable even if set to false #22646

Closed
3 tasks done
RoderickQiu opened this issue Mar 11, 2020 · 3 comments · Fixed by #22677
Closed
3 tasks done

auto re-enable maximizable even if set to false #22646

RoderickQiu opened this issue Mar 11, 2020 · 3 comments · Fixed by #22677

Comments

@RoderickQiu
Copy link

RoderickQiu commented Mar 11, 2020

Preflight Checklist

Issue Details

  • Electron Version:
    • 7.1.14
  • Operating System:
    • macOS 10.15.2

Expected Behavior

maximizable property should always work.

Actual Behavior

maximizable property will be ignored when some other properties are changed to the window or an alert is shown.

To Reproduce

From #11756.

If i create a window like this:

win = new BrowserWindow({ title: "My App", backgroundColor:'#FF0000', maximizable:false, width: 400, height: 200, resizable: false})

The window maximize button get disabled as wanted, but if we active the alert function inside

the index.html file by putting <script> alert("test"); </script> inside the file then the maximize button get enabled again and we can use it again.

Also, for other kinds of code, like

var mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    maximizable: false,
    webPreferences: {
      nodeIntegration: true
    }
  })

nativeTheme.on('updated', function theThemeHasChanged() {
    if (nativeTheme.shouldUseDarkColors) {
      if (mainWindow != null) {
        mainWindow.setBackgroundColor('#393939');
      }
    } else {
      if (mainWindow != null) {
        mainWindow.setBackgroundColor('#fefefe');
      }
    }
  })

can also produce this problem.
(how to: set dark mode / light mode, and then maximizable property is ignored.)

Additional Information

These are extremely old resources that I found:

@codebytere
Copy link
Member

@RoderickQiu some research tells me this is becuase the maximizable setting does not persist through an NSWindow redraw event, which is triggered when a user changes between light and dark modes as discussed here:

When the user changes the system appearance, the system automatically asks each window and view to redraw itself.

I'll see what i can do.

@RoderickQiu
Copy link
Author

OK thank you. I'll wait.

Though this problem doesn't only appear for dark mode changes. (But to solve one of trigger condition is good too.)

Is this problem here for many conditions because many functions need a redraw?

@codebytere
Copy link
Member

codebytere commented Mar 13, 2020

@RoderickQiu fix for the theme change issue is up - the alert issue may lie with Chromium unfortunately though

@sofianguy sofianguy moved this from Unsorted Issues to Fixed for Next Release in 7.2.x Apr 3, 2020
@sofianguy sofianguy added this to Fixed in 9.0.0-beta.10 in 9-x-y Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
7.2.x
Fixed for Next Release
9-x-y
Fixed in 9.0.0-beta.10
Development

Successfully merging a pull request may close this issue.

3 participants