Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Adds rounded borders to the top corners for Windows 7 #4342

Merged
merged 1 commit into from
Oct 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions app/common/lib/platformUtil.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict'

const os = require('os')

/**
* Get list of styles which should be applied to root window div
* return array of strings (each being a class name)
*/
module.exports.getPlatformStyles = () => {
const platform = os.platform()
const styleList = ['platform--' + platform]

switch (platform) {
case 'win32':
if (/6.1./.test(os.release())) {
styleList.push('win7')
} else {
styleList.push('win10')
}
}

return styleList
}

module.exports.isDarwin = () => {
return os.platform() === 'darwin'
}

module.exports.isWindows = () => {
return os.platform() === 'win32'
}
16 changes: 1 addition & 15 deletions app/renderer/components/windowCaptionButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class WindowCaptionButtons extends ImmutableComponent {
this.onMinimizeClick = this.onMinimizeClick.bind(this)
this.onMaximizeClick = this.onMaximizeClick.bind(this)
this.onCloseClick = this.onCloseClick.bind(this)
this.osClass = this.getPlatformCssClass()
}

get maximizeTitle () {
Expand All @@ -25,19 +24,6 @@ class WindowCaptionButtons extends ImmutableComponent {
: 'windowCaptionButtonMaximize'
}

getPlatformCssClass () {
switch (os.platform()) {
case 'win32':
if (/6.1./.test(os.release())) {
return 'win7'
} else {
return 'win10'
}
default:
return 'hidden'
}
}

onMinimizeClick (e) {
currentWindow.minimize()
}
Expand All @@ -62,7 +48,7 @@ class WindowCaptionButtons extends ImmutableComponent {
fullscreen: this.props.windowMaximized,
windowCaptionButtons: true
})}>
<div className={'container ' + this.osClass}>
<div className='container'>
<button
className={cx({
fullscreen: this.props.windowMaximized,
Expand Down
11 changes: 6 additions & 5 deletions js/components/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const windowActions = require('../actions/windowActions')
const Main = require('./main')
const SiteTags = require('../constants/siteTags')
const config = require('../constants/config')
const cx = require('../lib/classSet.js')
const cx = require('../lib/classSet')
const { getPlatformStyles } = require('../../app/common/lib/platformUtil')

class Window extends React.Component {
constructor (props) {
Expand Down Expand Up @@ -55,10 +56,10 @@ class Window extends React.Component {
let classes = {}
classes['windowContainer'] = true

// Possible values for process.platform are:
// darwin, freebsd, linux, sunos, win32
// https://nodejs.org/api/process.html#process_process_platform
classes['platform--' + process.platform] = true
const platformClasses = getPlatformStyles()
platformClasses.forEach((className) => {
classes[className] = true
})

return <div id='windowContainer' className={cx(classes)} >
<Main windowState={this.state.immutableData.windowState}
Expand Down
Loading