Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 174223004: linux_aura: Default to system titlebars under some window managers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | ui/base/x/x11_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 return titlebar_->widget(); 1521 return titlebar_->widget();
1522 } 1522 }
1523 1523
1524 // static 1524 // static
1525 void BrowserWindowGtk::RegisterProfilePrefs( 1525 void BrowserWindowGtk::RegisterProfilePrefs(
1526 user_prefs::PrefRegistrySyncable* registry) { 1526 user_prefs::PrefRegistrySyncable* registry) {
1527 bool custom_frame_default = false; 1527 bool custom_frame_default = false;
1528 // Avoid checking the window manager if we're not connected to an X server (as 1528 // Avoid checking the window manager if we're not connected to an X server (as
1529 // is the case in Valgrind tests). 1529 // is the case in Valgrind tests).
1530 if (ui::XDisplayExists()) 1530 if (ui::XDisplayExists())
1531 custom_frame_default = GetCustomFramePrefDefault(); 1531 custom_frame_default = ui::GetCustomFramePrefDefault();
1532 1532
1533 registry->RegisterBooleanPref( 1533 registry->RegisterBooleanPref(
1534 prefs::kUseCustomChromeFrame, 1534 prefs::kUseCustomChromeFrame,
1535 custom_frame_default, 1535 custom_frame_default,
1536 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 1536 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
1537 } 1537 }
1538 1538
1539 WebContents* BrowserWindowGtk::GetDisplayedTab() { 1539 WebContents* BrowserWindowGtk::GetDisplayedTab() {
1540 return contents_container_->tab(); 1540 return contents_container_->tab();
1541 } 1541 }
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 2348
2349 void BrowserWindowGtk::OnUseCustomChromeFrameChanged() { 2349 void BrowserWindowGtk::OnUseCustomChromeFrameChanged() {
2350 UpdateCustomFrame(); 2350 UpdateCustomFrame();
2351 ui::SetHideTitlebarWhenMaximizedProperty( 2351 ui::SetHideTitlebarWhenMaximizedProperty(
2352 ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window_)), 2352 ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window_)),
2353 UseCustomFrame() ? ui::HIDE_TITLEBAR_WHEN_MAXIMIZED : 2353 UseCustomFrame() ? ui::HIDE_TITLEBAR_WHEN_MAXIMIZED :
2354 ui::SHOW_TITLEBAR_WHEN_MAXIMIZED); 2354 ui::SHOW_TITLEBAR_WHEN_MAXIMIZED);
2355 } 2355 }
2356 2356
2357 // static 2357 // static
2358 bool BrowserWindowGtk::GetCustomFramePrefDefault() {
2359 // Ideally, we'd use the custom frame by default and just fall back on using
2360 // system decorations for the few (?) tiling window managers where the custom
2361 // frame doesn't make sense (e.g. awesome, ion3, ratpoison, xmonad, etc.) or
2362 // other WMs where it has issues (e.g. Fluxbox -- see issue 19130). The EWMH
2363 // _NET_SUPPORTING_WM property makes it easy to look up a name for the current
2364 // WM, but at least some of the WMs in the latter group don't set it.
2365 // Instead, we default to using system decorations for all WMs and
2366 // special-case the ones where the custom frame should be used.
2367 ui::WindowManagerName wm_type = ui::GuessWindowManager();
2368 return (wm_type == ui::WM_BLACKBOX ||
2369 wm_type == ui::WM_COMPIZ ||
2370 wm_type == ui::WM_ENLIGHTENMENT ||
2371 wm_type == ui::WM_METACITY ||
2372 wm_type == ui::WM_MUFFIN ||
2373 wm_type == ui::WM_MUTTER ||
2374 wm_type == ui::WM_OPENBOX ||
2375 wm_type == ui::WM_XFWM4);
2376 }
2377
2378 // static
2379 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2358 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2380 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2359 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2381 browser_window_gtk->Init(); 2360 browser_window_gtk->Init();
2382 return browser_window_gtk; 2361 return browser_window_gtk;
2383 } 2362 }
2384 2363
2385 // static 2364 // static
2386 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( 2365 chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType(
2387 chrome::HostDesktopType desktop_type) { 2366 chrome::HostDesktopType desktop_type) {
2388 return desktop_type; 2367 return desktop_type;
2389 } 2368 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | ui/base/x/x11_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698