From c3c01eeaf88116a3f114a46ec2a900936be56bde Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Tue, 30 Jun 2009 00:20:18 +0000 Subject: GTK custom frame: Don't show the border when maximized. Enlarge the close button's clickable area when maximized. BUG= http://crbug.com/14646 and http://crbug.com/15628 TEST=maximize, turn on custom frame. The top right most pixel on the screen should be clickable and should close the window. There should be no border around the web contents. Review URL: http://codereview.chromium.org/150078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19567 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/browser_titlebar.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'chrome/browser/gtk/browser_titlebar.cc') diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc index 222f249..86d4ba9 100644 --- a/chrome/browser/gtk/browser_titlebar.cc +++ b/chrome/browser/gtk/browser_titlebar.cc @@ -41,6 +41,11 @@ const int kOTRBottomSpacing = 2; // it on the left, and between it and the tabstrip on the right). const int kOTRSideSpacing = 2; +// The thickness of the custom frame border; we need it here to enlarge the +// close button whent the custom frame border isn't showing but the custom +// titlebar is showing. +const int kFrameBorderThickness = 4; + gboolean OnMouseMoveEvent(GtkWidget* widget, GdkEventMotion* event, BrowserWindowGtk* browser_window) { // Reset to the default mouse cursor. @@ -124,6 +129,10 @@ void BrowserTitlebar::Init() { IDR_MINIMIZE_H, buttons_hbox, IDS_XPFRAME_MINIMIZE_TOOLTIP)); + GtkRequisition req; + gtk_widget_size_request(close_button_->widget(), &req); + close_button_default_width_ = req.width; + gtk_box_pack_end(GTK_BOX(container_), titlebar_buttons_box_, FALSE, FALSE, 0); @@ -162,6 +171,11 @@ void BrowserTitlebar::UpdateTitlebarAlignment() { } else { gtk_alignment_set_padding(GTK_ALIGNMENT(titlebar_alignment_), 0, 0, 0, 0); } + + int close_button_width = close_button_default_width_; + if (using_custom_frame_ && browser_window_->IsMaximized()) + close_button_width += kFrameBorderThickness; + gtk_widget_set_size_request(close_button_->widget(), close_button_width, -1); } // static -- cgit v1.1