mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +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
|
||||
@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: =>
|
||||
<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="minimize" onClick={ -> atom.minimize()}></button>
|
||||
<button className="maximize" onClick={ -> atom.maximize()}></button>
|
||||
<button className="maximize" onClick={@_onMaximize}></button>
|
||||
</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
|
||||
@displayName: 'ToolbarMenuControl'
|
||||
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 |
|
@ -108,7 +108,12 @@ atom-workspace {
|
|||
background-image: url("images/application-frame/minimize@1x.png");
|
||||
}
|
||||
.maximize {
|
||||
background-image: url("images/application-frame/maximize@1x.png");
|
||||
background-image: url("images/application-frame/fullscreen@1x.png");
|
||||
}
|
||||
&.alt-true {
|
||||
.maximize {
|
||||
background-image: url("images/application-frame/maximize@1x.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +126,12 @@ atom-workspace {
|
|||
background-image: url("images/application-frame/minimize@2x.png");
|
||||
}
|
||||
.maximize {
|
||||
background-image: url("images/application-frame/maximize@2x.png");
|
||||
background-image: url("images/application-frame/fullscreen@2x.png");
|
||||
}
|
||||
&.alt-true {
|
||||
.maximize {
|
||||
background-image: url("images/application-frame/maximize@2x.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue