{"action":"created","issue":{"url":"https://api.github.com/repos/atom/electron/issues/4345","repository_url":"https://api.github.com/repos/atom/electron","labels_url":"https://api.github.com/repos/atom/electron/issues/4345/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/4345/comments","events_url":"https://api.github.com/repos/atom/electron/issues/4345/events","html_url":"https://github.com/atom/electron/issues/4345","id":130943196,"number":4345,"title":"unminimize doesn't work during drag operation on window","user":{"login":"lukeapage","id":309321,"avatar_url":"https://avatars.githubusercontent.com/u/309321?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeapage","html_url":"https://github.com/lukeapage","followers_url":"https://api.github.com/users/lukeapage/followers","following_url":"https://api.github.com/users/lukeapage/following{/other_user}","gists_url":"https://api.github.com/users/lukeapage/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeapage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeapage/subscriptions","organizations_url":"https://api.github.com/users/lukeapage/orgs","repos_url":"https://api.github.com/users/lukeapage/repos","events_url":"https://api.github.com/users/lukeapage/events{/privacy}","received_events_url":"https://api.github.com/users/lukeapage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-03T07:48:38Z","updated_at":"2016-02-04T20:44:30Z","closed_at":null,"body":"I am trying to replicate titlebar functionality in a frameless window in order to remove the borders on the window.\r\n\r\nWhen a frameless window is maximised, I am awaiting a mousedown on the titlebar and starting a drag operation. On the first mouse move I am unmaximising the window, but it has no effect.\r\n\r\ne.g. browser side\r\n\r\n```\r\n$('#titlebar').on('mousedown', function() {\r\n   ipcRenderer.send('startdrag');\r\n});\r\n```\r\n\r\nmain thread\r\n\r\n```\r\nipcMain.on('startdrag', (event, offset) => {\r\n    log.debug('starting window drag');\r\n\r\n    if (leftMouseDown) {\r\n\r\n        const browserWindow = BrowserWindow.getFocusedWindow(); //BrowserWindow.fromWebContents(event.sender);\r\n\r\n        function onDrag(x, y) {\r\n\r\n            const winX = x - offset.x;\r\n            const winY = y - offset.y;\r\n\r\n            if (browserWindow.isMaximized()) {\r\n                log.debug('maximised during drag - unmaximize');\r\n                browserWindow.unmaximize();\r\n            }\r\n\r\n            browserWindow.setPosition(winX, winY);\r\n        }\r\n\r\n        function onUp() {\r\n            mouse.removeListener('left-up', onUp);\r\n            mouse.removeListener('left-drag', onDrag);\r\n            log.debug('browser window drag finish');\r\n        }\r\n\r\n        mouse.on('left-drag', onDrag);\r\n        mouse.on('left-up', onUp);\r\n    }\r\n});\r\n```\r\n\r\nbut it seems that\r\na)\r\n```\r\nbrowserWindow.unmaximize();\r\n```\r\nhas no effect (it doesn't change the size)\r\n\r\nb)\r\nThe window frame is shown when dragging (I guess it should be reproducible by maximising a frameless window and then dragging?)\r\ne.g. maximise and set position programmatically\r\n![image](https://cloud.githubusercontent.com/assets/309321/12775967/5d31de20-ca52-11e5-8b91-12640d6a044c.png)\r\nthen manually resize.. gone!\r\n![image](https://cloud.githubusercontent.com/assets/309321/12775981/7922ded6-ca52-11e5-856d-fee238d8dbbc.png)\r\n\r\nI can work-around the problem by doing\r\n```\r\nbrowserWindow.setSize(100, 100);\r\n```\r\ninstead of \r\n```\r\nbrowserWindow.unmaximize();\r\n```\r\n\r\nand of course I can make that solution a bit better by remembering the size before maximising.. but I guess I shouldn't have to?"},"comment":{"url":"https://api.github.com/repos/atom/electron/issues/comments/180041856","html_url":"https://github.com/atom/electron/issues/4345#issuecomment-180041856","issue_url":"https://api.github.com/repos/atom/electron/issues/4345","id":180041856,"user":{"login":"lukeapage","id":309321,"avatar_url":"https://avatars.githubusercontent.com/u/309321?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeapage","html_url":"https://github.com/lukeapage","followers_url":"https://api.github.com/users/lukeapage/followers","following_url":"https://api.github.com/users/lukeapage/following{/other_user}","gists_url":"https://api.github.com/users/lukeapage/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeapage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeapage/subscriptions","organizations_url":"https://api.github.com/users/lukeapage/orgs","repos_url":"https://api.github.com/users/lukeapage/repos","events_url":"https://api.github.com/users/lukeapage/events{/privacy}","received_events_url":"https://api.github.com/users/lukeapage/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T20:44:30Z","updated_at":"2016-02-04T20:44:30Z","body":"As per - https://www.npmjs.com/package/electron-drag\n\nDoes css auto restore when dragging maximised then?\n"}}