Skip to content

When window's transparent property is true, can not emit 'maximize' or 'unmaximize' event correctly #23275

Closed

Description

@xland

Win 10
Electron 7.1.3,8.2.3

When window's transparent property is true,
can not emit 'maximize' or 'unmaximize' event correctly.

Minimize runnable code:

  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    transparent:true,
  })
  mainWindow.loadFile('index.html');
  mainWindow.on("maximize", () => {
    console.log(1);
  });
  mainWindow.on("unmaximize", () => {
    console.log(2);
  });
  setTimeout(()=>{
    mainWindow.maximize();
  },1200)

Activity

  1. ramenski commented on May 18, 2020

    @ramenski

    I have the same problem. (frame: false, transparent: true)

    But when I double-clicked on element with -webkit-app-region: drag; events emit correctly.

  2. tzach-chase commented on May 28, 2020

    @tzach-chase

    A possible workaround is to manually trigger the event when calling maximize() (and other methods):

    onMaximize() {
      mainWindow.maximize();
      mainWindow.emit('maximize');
    }
    

    I did notice another issue: When double-clicking a draggable area a resize event is triggered then followed by two maximize events.

  3. amrbashir commented on Jun 22, 2020

    @amrbashir

    The issue still exists on electron 9.0.0, setting transparent to true also disables the window snapping/docking to edges of screen.

    @tzach-chase I tired your workaround with no luck so far.

  4. amrbashir commented on Jun 22, 2020

    @amrbashir

    This workaround submitted in #12854 , fixes the issues with maximizing.

  5. electron-triage commented on Mar 9, 2021

    @electron-triage

    The Electron version reported on this issue is no longer supported. See our supported versions documentation.

    If this is still reproducible on a supported version, please open a new issue with any other new information that a maintainer should know.

    Thank you for taking the time to report this issue and helping to make Electron better! Your help is appreciated.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions