From 48d73bf5c180f2d6cca3dcba56d4482f98998f6a Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Tue, 13 Sep 2016 14:05:40 -0700 Subject: [PATCH] - Custom titlebar is now toggle-able (requires restart) - Fixed issue where menu text could be selected --- app/extensions/brave/locales/en-US/preferences.properties | 1 + app/locale.js | 1 + js/about/preferences.js | 6 +++++- js/components/main.js | 6 +++--- js/constants/appConfig.js | 1 + js/constants/settings.js | 1 + js/stores/appStore.js | 3 ++- less/navigationBar.less | 1 + 8 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/extensions/brave/locales/en-US/preferences.properties b/app/extensions/brave/locales/en-US/preferences.properties index 46271a55510..0a2efa0157a 100644 --- a/app/extensions/brave/locales/en-US/preferences.properties +++ b/app/extensions/brave/locales/en-US/preferences.properties @@ -192,6 +192,7 @@ flashAllowAlways=Allow until {{time}} alwaysAllow=Always allow alwaysDeny=Always deny appearanceSettings=Appearance Settings +disableCustomTitlebar=Disable custom titlebar (requires browser restart) autoHideMenuBar=Hide the menu bar by default disableTitleMode=Disable auto title bar tabsSettings=Tabs Settings diff --git a/app/locale.js b/app/locale.js index 6ab7016475a..467db344949 100644 --- a/app/locale.js +++ b/app/locale.js @@ -156,6 +156,7 @@ var rendererIdentifiers = function () { 'lookupSelection', // Other identifiers 'urlCopied', + 'disableCustomTitlebar', 'autoHideMenuBar', 'unexpectedErrorWindowReload', 'updateChannel', diff --git a/js/about/preferences.js b/js/about/preferences.js index cfd19e1269a..57901d876b1 100644 --- a/js/about/preferences.js +++ b/js/about/preferences.js @@ -549,6 +549,9 @@ class GeneralTab extends ImmutableComponent {
+ { + isWindows ? : null + } { isDarwin ? null : } @@ -1337,7 +1340,8 @@ class AboutPreferences extends React.Component { }) aboutActions.changeSetting(key, value) if (key === settings.DO_NOT_TRACK || key === settings.HARDWARE_ACCELERATION_ENABLED || - key === settings.PDFJS_ENABLED || key === settings.SMOOTH_SCROLL_ENABLED) { + key === settings.PDFJS_ENABLED || key === settings.SMOOTH_SCROLL_ENABLED || + key === settings.DISABLE_CUSTOM_TITLEBAR) { ipc.send(messages.PREFS_RESTART, key, value) } if (key === settings.PAYMENTS_ENABLED) { diff --git a/js/components/main.js b/js/components/main.js index d1ac473e461..1a1e40e73d3 100644 --- a/js/components/main.js +++ b/js/components/main.js @@ -749,8 +749,8 @@ class Main extends ImmutableComponent { const braverySettings = siteSettings.activeSettings(activeSiteSettings, this.props.appState, appConfig) const loginRequiredDetail = activeFrame ? basicAuthState.getLoginRequiredDetail(this.props.appState, activeFrame.get('tabId')) : null - const menubarEnabled = isWindows - const menubarVisible = menubarEnabled && (!getSetting(settings.AUTO_HIDE_MENU) || this.props.windowState.getIn(['ui', 'menubar', 'isVisible'])) + const customTitlebarEnabled = isWindows && !getSetting(settings.DISABLE_CUSTOM_TITLEBAR) + const menubarVisible = customTitlebarEnabled && (!getSetting(settings.AUTO_HIDE_MENU) || this.props.windowState.getIn(['ui', 'menubar', 'isVisible'])) const menubarTemplate = menubarVisible ? this.props.appState.getIn(['menu', 'template']) : null const menubarSelectedLabel = this.props.windowState.getIn(['ui', 'menubar', 'selectedLabel']) @@ -856,7 +856,7 @@ class Main extends ImmutableComponent {
{ - menubarEnabled + customTitlebarEnabled ? : null } diff --git a/js/constants/appConfig.js b/js/constants/appConfig.js index 455143251d1..9194733515e 100644 --- a/js/constants/appConfig.js +++ b/js/constants/appConfig.js @@ -86,6 +86,7 @@ module.exports = { 'general.show-home-button': false, 'general.useragent.value': null, // Set at runtime 'general.autohide-menu': true, + 'general.disable-custom-titlebar': false, 'search.default-search-engine': 'Google', 'search.offer-search-suggestions': false, // false by default for privacy reasons 'tabs.switch-to-new-tabs': false, diff --git a/js/constants/settings.js b/js/constants/settings.js index d586fe30ba3..ca4243e9299 100644 --- a/js/constants/settings.js +++ b/js/constants/settings.js @@ -11,6 +11,7 @@ const settings = { DEFAULT_DOWNLOAD_SAVE_PATH: 'general.downloads.default-save-path', AUTO_HIDE_MENU: 'general.autohide-menu', DISABLE_TITLE_MODE: 'general.disable-title-mode', + DISABLE_CUSTOM_TITLEBAR: 'general.disable-custom-titlebar', // Search tab DEFAULT_SEARCH_ENGINE: 'search.default-search-engine', OFFER_SEARCH_SUGGESTIONS: 'search.offer-search-suggestions', diff --git a/js/stores/appStore.js b/js/stores/appStore.js index 9a7bf025e12..1280e4a9e9c 100644 --- a/js/stores/appStore.js +++ b/js/stores/appStore.js @@ -126,6 +126,7 @@ const createWindow = (browserOpts, defaults, frameOpts, windowState) => { browserOpts.height = browserOpts.height < minHeight ? minHeight : browserOpts.height const autoHideMenuBarSetting = isDarwin || getSetting(settings.AUTO_HIDE_MENU) + const isCustomTitlebarDisabled = !isWindows || getSetting(settings.DISABLE_CUSTOM_TITLEBAR) const windowProps = { // smaller min size for "modal" windows @@ -138,7 +139,7 @@ const createWindow = (browserOpts, defaults, frameOpts, windowState) => { autoHideMenuBar: autoHideMenuBarSetting, title: appConfig.name, webPreferences: defaults.webPreferences, - frame: !isWindows + frame: isCustomTitlebarDisabled } if (process.platform === 'linux') { diff --git a/less/navigationBar.less b/less/navigationBar.less index 6ab8038a3a7..aa9939b596d 100644 --- a/less/navigationBar.less +++ b/less/navigationBar.less @@ -416,6 +416,7 @@ .menubar { display: inline-block; cursor: default; + -webkit-user-select: none; .menubarItem { color: black;