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

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

Issue 10180011: Support painting panels with chromium themes on GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 8 years, 7 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') | chrome/browser/ui/panels/native_panel.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 gtk_window_iconify(window_); 902 gtk_window_iconify(window_);
903 } 903 }
904 904
905 void BrowserWindowGtk::Restore() { 905 void BrowserWindowGtk::Restore() {
906 if (IsMaximized()) 906 if (IsMaximized())
907 UnMaximize(); 907 UnMaximize();
908 else if (IsMinimized()) 908 else if (IsMinimized())
909 gtk_window_deiconify(window_); 909 gtk_window_deiconify(window_);
910 } 910 }
911 911
912 bool BrowserWindowGtk::ShouldDrawContentDropShadow() { 912 bool BrowserWindowGtk::ShouldDrawContentDropShadow() const {
913 return !IsMaximized() && UseCustomFrame(); 913 return !IsMaximized() && UseCustomFrame();
914 } 914 }
915 915
916 void BrowserWindowGtk::EnterFullscreen( 916 void BrowserWindowGtk::EnterFullscreen(
917 const GURL& url, FullscreenExitBubbleType type) { 917 const GURL& url, FullscreenExitBubbleType type) {
918 // gtk_window_(un)fullscreen asks the window manager to toggle the EWMH 918 // gtk_window_(un)fullscreen asks the window manager to toggle the EWMH
919 // for fullscreen windows. Not all window managers support this. 919 // for fullscreen windows. Not all window managers support this.
920 gtk_window_fullscreen(window_); 920 gtk_window_fullscreen(window_);
921 fullscreen_exit_bubble_type_ = type; 921 fullscreen_exit_bubble_type_ = type;
922 } 922 }
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); 2444 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
2445 } 2445 }
2446 2446
2447 bool BrowserWindowGtk::IsBookmarkBarSupported() const { 2447 bool BrowserWindowGtk::IsBookmarkBarSupported() const {
2448 return browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR); 2448 return browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR);
2449 } 2449 }
2450 2450
2451 bool BrowserWindowGtk::UsingCustomPopupFrame() const { 2451 bool BrowserWindowGtk::UsingCustomPopupFrame() const {
2452 ThemeServiceGtk* theme_provider = ThemeServiceGtk::GetFrom( 2452 ThemeServiceGtk* theme_provider = ThemeServiceGtk::GetFrom(
2453 browser()->profile()); 2453 browser()->profile());
2454 return !theme_provider->UsingNativeTheme() && 2454 return !theme_provider->UsingNativeTheme() && browser()->is_type_popup();
2455 (browser()->is_type_popup() || browser()->is_type_panel());
2456 } 2455 }
2457 2456
2458 BrowserTitlebar* BrowserWindowGtk::CreateBrowserTitlebar() { 2457 BrowserTitlebar* BrowserWindowGtk::CreateBrowserTitlebar() {
2459 return new BrowserTitlebar(this, window_); 2458 return new BrowserTitlebar(this, window_);
2460 } 2459 }
2461 2460
2462 bool BrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { 2461 bool BrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) {
2463 if (!UseCustomFrame()) 2462 if (!UseCustomFrame())
2464 return false; 2463 return false;
2465 2464
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 } else { 2508 } else {
2510 *edge = GDK_WINDOW_EDGE_SOUTH_EAST; 2509 *edge = GDK_WINDOW_EDGE_SOUTH_EAST;
2511 } 2510 }
2512 return true; 2511 return true;
2513 } 2512 }
2514 2513
2515 NOTREACHED(); 2514 NOTREACHED();
2516 return false; 2515 return false;
2517 } 2516 }
2518 2517
2519 bool BrowserWindowGtk::UseCustomFrame() { 2518 bool BrowserWindowGtk::UseCustomFrame() const {
2520 // We don't use the custom frame for app mode windows or app window popups. 2519 // We don't use the custom frame for app mode windows or app window popups.
2521 return use_custom_frame_pref_.GetValue() && !browser_->is_app(); 2520 return use_custom_frame_pref_.GetValue() && !browser_->is_app();
2522 } 2521 }
2523 2522
2524 bool BrowserWindowGtk::BoundsMatchMonitorSize() { 2523 bool BrowserWindowGtk::BoundsMatchMonitorSize() {
2525 // A screen can be composed of multiple monitors. 2524 // A screen can be composed of multiple monitors.
2526 GdkScreen* screen = gtk_window_get_screen(window_); 2525 GdkScreen* screen = gtk_window_get_screen(window_);
2527 gint monitor_num = gdk_screen_get_monitor_at_window(screen, 2526 gint monitor_num = gdk_screen_get_monitor_at_window(screen,
2528 gtk_widget_get_window(GTK_WIDGET(window_))); 2527 gtk_widget_get_window(GTK_WIDGET(window_)));
2529 2528
(...skipping 21 matching lines...) Expand all
2551 GtkWidget* parent = gtk_widget_get_parent(bookmark_bar_->widget()); 2550 GtkWidget* parent = gtk_widget_get_parent(bookmark_bar_->widget());
2552 if (parent != target_parent) { 2551 if (parent != target_parent) {
2553 if (parent) 2552 if (parent)
2554 gtk_container_remove(GTK_CONTAINER(parent), bookmark_bar_->widget()); 2553 gtk_container_remove(GTK_CONTAINER(parent), bookmark_bar_->widget());
2555 2554
2556 gtk_box_pack_end(GTK_BOX(target_parent), bookmark_bar_->widget(), 2555 gtk_box_pack_end(GTK_BOX(target_parent), bookmark_bar_->widget(),
2557 FALSE, FALSE, 0); 2556 FALSE, FALSE, 0);
2558 } 2557 }
2559 } 2558 }
2560 2559
2561 BrowserWindowGtk::TitleDecoration BrowserWindowGtk::GetWindowTitle(
2562 std::string* title) const {
2563 *title = UTF16ToUTF8(browser()->GetWindowTitleForCurrentTab());
2564 return PLAIN_TEXT;
2565 }
2566
2567 // static 2560 // static
2568 bool BrowserWindowGtk::GetCustomFramePrefDefault() { 2561 bool BrowserWindowGtk::GetCustomFramePrefDefault() {
2569 // Ideally, we'd use the custom frame by default and just fall back on using 2562 // Ideally, we'd use the custom frame by default and just fall back on using
2570 // system decorations for the few (?) tiling window managers where the custom 2563 // system decorations for the few (?) tiling window managers where the custom
2571 // frame doesn't make sense (e.g. awesome, ion3, ratpoison, xmonad, etc.) or 2564 // frame doesn't make sense (e.g. awesome, ion3, ratpoison, xmonad, etc.) or
2572 // other WMs where it has issues (e.g. Fluxbox -- see issue 19130). The EWMH 2565 // other WMs where it has issues (e.g. Fluxbox -- see issue 19130). The EWMH
2573 // _NET_SUPPORTING_WM property makes it easy to look up a name for the current 2566 // _NET_SUPPORTING_WM property makes it easy to look up a name for the current
2574 // WM, but at least some of the WMs in the latter group don't set it. 2567 // WM, but at least some of the WMs in the latter group don't set it.
2575 // Instead, we default to using system decorations for all WMs and 2568 // Instead, we default to using system decorations for all WMs and
2576 // special-case the ones where the custom frame should be used. 2569 // special-case the ones where the custom frame should be used.
2577 ui::WindowManagerName wm_type = ui::GuessWindowManager(); 2570 ui::WindowManagerName wm_type = ui::GuessWindowManager();
2578 return (wm_type == ui::WM_BLACKBOX || 2571 return (wm_type == ui::WM_BLACKBOX ||
2579 wm_type == ui::WM_COMPIZ || 2572 wm_type == ui::WM_COMPIZ ||
2580 wm_type == ui::WM_ENLIGHTENMENT || 2573 wm_type == ui::WM_ENLIGHTENMENT ||
2581 wm_type == ui::WM_METACITY || 2574 wm_type == ui::WM_METACITY ||
2582 wm_type == ui::WM_MUTTER || 2575 wm_type == ui::WM_MUTTER ||
2583 wm_type == ui::WM_OPENBOX || 2576 wm_type == ui::WM_OPENBOX ||
2584 wm_type == ui::WM_XFWM4); 2577 wm_type == ui::WM_XFWM4);
2585 } 2578 }
2586 2579
2587 // static 2580 // static
2588 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2581 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2589 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2582 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2590 browser_window_gtk->Init(); 2583 browser_window_gtk->Init();
2591 return browser_window_gtk; 2584 return browser_window_gtk;
2592 } 2585 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | chrome/browser/ui/panels/native_panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698