mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-12-17 23:28:26 +08:00
fix(fullscreen): On Mac OS X, green window control defaults to fullscreen
This commit is contained in:
parent
5d11a1ece9
commit
65078fd7d1
3 changed files with 36 additions and 4 deletions
|
|
@ -71,13 +71,35 @@ class ToolbarBack extends React.Component
|
||||||
|
|
||||||
class ToolbarWindowControls extends React.Component
|
class ToolbarWindowControls extends React.Component
|
||||||
@displayName: 'ToolbarWindowControls'
|
@displayName: 'ToolbarWindowControls'
|
||||||
|
constructor: (@props) ->
|
||||||
|
@state = {alt: false}
|
||||||
|
|
||||||
|
componentDidMount: =>
|
||||||
|
if process.platform is 'darwin'
|
||||||
|
window.addEventListener('keydown', @_onAlt)
|
||||||
|
window.addEventListener('keyup', @_onAlt)
|
||||||
|
|
||||||
|
componentWillUnmount: =>
|
||||||
|
if process.platform is 'darwin'
|
||||||
|
window.removeEventListener('keydown', @_onAlt)
|
||||||
|
window.removeEventListener('keyup', @_onAlt)
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
<div name="ToolbarWindowControls" className="toolbar-window-controls">
|
<div name="ToolbarWindowControls" className="toolbar-window-controls alt-#{@state.alt}">
|
||||||
<button className="close" onClick={ -> atom.close()}></button>
|
<button className="close" onClick={ -> atom.close()}></button>
|
||||||
<button className="minimize" onClick={ -> atom.minimize()}></button>
|
<button className="minimize" onClick={ -> atom.minimize()}></button>
|
||||||
<button className="maximize" onClick={ -> atom.maximize()}></button>
|
<button className="maximize" onClick={@_onMaximize}></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
_onAlt: (event) =>
|
||||||
|
@setState(alt: event.altKey) if @state.alt isnt event.altKey
|
||||||
|
|
||||||
|
_onMaximize: (event) =>
|
||||||
|
if process.platform is 'darwin' and not event.altKey
|
||||||
|
atom.setFullScreen(!atom.isFullScreen())
|
||||||
|
else
|
||||||
|
atom.maximize()
|
||||||
|
|
||||||
class ToolbarMenuControl extends React.Component
|
class ToolbarMenuControl extends React.Component
|
||||||
@displayName: 'ToolbarMenuControl'
|
@displayName: 'ToolbarMenuControl'
|
||||||
render: =>
|
render: =>
|
||||||
|
|
|
||||||
BIN
static/images/application-frame/fullscreen@2x.png
Normal file
BIN
static/images/application-frame/fullscreen@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
|
|
@ -107,10 +107,15 @@ atom-workspace {
|
||||||
.minimize {
|
.minimize {
|
||||||
background-image: url("images/application-frame/minimize@1x.png");
|
background-image: url("images/application-frame/minimize@1x.png");
|
||||||
}
|
}
|
||||||
|
.maximize {
|
||||||
|
background-image: url("images/application-frame/fullscreen@1x.png");
|
||||||
|
}
|
||||||
|
&.alt-true {
|
||||||
.maximize {
|
.maximize {
|
||||||
background-image: url("images/application-frame/maximize@1x.png");
|
background-image: url("images/application-frame/maximize@1x.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (-webkit-min-device-pixel-ratio: 2) {
|
@media (-webkit-min-device-pixel-ratio: 2) {
|
||||||
.toolbar-window-controls {
|
.toolbar-window-controls {
|
||||||
|
|
@ -120,11 +125,16 @@ atom-workspace {
|
||||||
.minimize {
|
.minimize {
|
||||||
background-image: url("images/application-frame/minimize@2x.png");
|
background-image: url("images/application-frame/minimize@2x.png");
|
||||||
}
|
}
|
||||||
|
.maximize {
|
||||||
|
background-image: url("images/application-frame/fullscreen@2x.png");
|
||||||
|
}
|
||||||
|
&.alt-true {
|
||||||
.maximize {
|
.maximize {
|
||||||
background-image: url("images/application-frame/maximize@2x.png");
|
background-image: url("images/application-frame/maximize@2x.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body.is-blurred {
|
body.is-blurred {
|
||||||
.toolbar-window-controls {
|
.toolbar-window-controls {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue