Use XDG_CURRENT_DESKTOP to determine if the desktop environment is Unity
https://chromium-review.googlesource.com/682615
This commit is contained in:
parent
e35b128fa3
commit
fa3d9d32ae
1 changed files with 17 additions and 2 deletions
|
@ -8,9 +8,22 @@
|
||||||
#include "ui/views/widget/native_widget_aura.h"
|
#include "ui/views/widget/native_widget_aura.h"
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
|
#include "base/environment.h"
|
||||||
|
#include "base/nix/xdg_util.h"
|
||||||
#include "ui/views/linux_ui/linux_ui.h"
|
#include "ui/views/linux_ui/linux_ui.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool IsDesktopEnvironmentUnity() {
|
||||||
|
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||||
|
base::nix::DesktopEnvironment desktop_env =
|
||||||
|
base::nix::GetDesktopEnvironment(env.get());
|
||||||
|
return desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
ViewsDelegate::ViewsDelegate() {
|
ViewsDelegate::ViewsDelegate() {
|
||||||
|
@ -104,8 +117,10 @@ bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
// On Ubuntu Unity, the system always provides a title bar for maximized
|
// On Ubuntu Unity, the system always provides a title bar for maximized
|
||||||
// windows.
|
// windows.
|
||||||
views::LinuxUI* ui = views::LinuxUI::instance();
|
if (!maximized)
|
||||||
return maximized && ui && ui->UnityIsRunning();
|
return false;
|
||||||
|
static bool is_desktop_environment_unity = IsDesktopEnvironmentUnity();
|
||||||
|
return is_desktop_environment_unity;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue