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

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

Issue 8537022: GTK: Shave ~15ms off each tab change. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: move comment to description Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <dlfcn.h> 9 #include <dlfcn.h>
10 #include <string> 10 #include <string>
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 // TODO(estade): after we manage browser activation, add a check to make sure 1246 // TODO(estade): after we manage browser activation, add a check to make sure
1247 // we are the active browser before calling RestoreFocus(). 1247 // we are the active browser before calling RestoreFocus().
1248 if (!browser_->tabstrip_model()->closing_all()) { 1248 if (!browser_->tabstrip_model()->closing_all()) {
1249 new_contents->view()->RestoreFocus(); 1249 new_contents->view()->RestoreFocus();
1250 if (new_contents->find_tab_helper()->find_ui_active()) 1250 if (new_contents->find_tab_helper()->find_ui_active())
1251 browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); 1251 browser_->GetFindBarController()->find_bar()->SetFocusAndSelection();
1252 } 1252 }
1253 1253
1254 // Update all the UI bits. 1254 // Update all the UI bits.
1255 UpdateTitleBar(); 1255 UpdateTitleBar();
1256 UpdateToolbar(new_contents, true);
1257 MaybeShowBookmarkBar(false); 1256 MaybeShowBookmarkBar(false);
1258 } 1257 }
1259 1258
1260 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { 1259 void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
1261 // Do nothing if we're in the process of closing the browser window. 1260 // Do nothing if we're in the process of closing the browser window.
1262 if (!window_) 1261 if (!window_)
1263 return; 1262 return;
1264 1263
1265 bool is_active = (GTK_WIDGET(window_)->window == active_window); 1264 bool is_active = (GTK_WIDGET(window_)->window == active_window);
1266 bool changed = (is_active != is_active_); 1265 bool changed = (is_active != is_active_);
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 GdkScreen* screen = gtk_window_get_screen(window_); 2345 GdkScreen* screen = gtk_window_get_screen(window_);
2347 gint monitor_num = gdk_screen_get_monitor_at_window(screen, 2346 gint monitor_num = gdk_screen_get_monitor_at_window(screen,
2348 GTK_WIDGET(window_)->window); 2347 GTK_WIDGET(window_)->window);
2349 2348
2350 GdkRectangle monitor_size; 2349 GdkRectangle monitor_size;
2351 gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor_size); 2350 gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor_size);
2352 return bounds_.size() == gfx::Size(monitor_size.width, monitor_size.height); 2351 return bounds_.size() == gfx::Size(monitor_size.width, monitor_size.height);
2353 } 2352 }
2354 2353
2355 void BrowserWindowGtk::PlaceBookmarkBar(bool is_floating) { 2354 void BrowserWindowGtk::PlaceBookmarkBar(bool is_floating) {
2356 GtkWidget* parent = gtk_widget_get_parent(bookmark_bar_->widget()); 2355 GtkWidget* target_parent = NULL;
2357 if (parent)
2358 gtk_container_remove(GTK_CONTAINER(parent), bookmark_bar_->widget());
2359
2360 if (!is_floating) { 2356 if (!is_floating) {
2361 // Place the bookmark bar at the end of |window_vbox_|; this happens after 2357 // Place the bookmark bar at the end of |window_vbox_|; this happens after
2362 // we have placed the render area at the end of |window_vbox_| so we will 2358 // we have placed the render area at the end of |window_vbox_| so we will
2363 // be above the render area. 2359 // be above the render area.
2364 gtk_box_pack_end(GTK_BOX(window_vbox_), bookmark_bar_->widget(), 2360 target_parent = window_vbox_;
2365 FALSE, FALSE, 0);
2366 } else { 2361 } else {
2367 // Place the bookmark bar at the end of the render area; this happens after 2362 // Place the bookmark bar at the end of the render area; this happens after
2368 // the tab contents container has been placed there so we will be 2363 // the tab contents container has been placed there so we will be
2369 // above the webpage (in terms of y). 2364 // above the webpage (in terms of y).
2370 gtk_box_pack_end(GTK_BOX(render_area_vbox_), bookmark_bar_->widget(), 2365 target_parent = render_area_vbox_;
2366 }
2367
2368 GtkWidget* parent = gtk_widget_get_parent(bookmark_bar_->widget());
2369 if (parent != target_parent) {
2370 if (parent)
2371 gtk_container_remove(GTK_CONTAINER(parent), bookmark_bar_->widget());
2372
2373 gtk_box_pack_end(GTK_BOX(target_parent), bookmark_bar_->widget(),
2371 FALSE, FALSE, 0); 2374 FALSE, FALSE, 0);
2372 } 2375 }
2373 } 2376 }
2374 2377
2375 void BrowserWindowGtk::ShowSettingsMenu(GtkWidget* widget, 2378 void BrowserWindowGtk::ShowSettingsMenu(GtkWidget* widget,
2376 GdkEventButton* event) { 2379 GdkEventButton* event) {
2377 // Nothing to do. Panel window will override this. 2380 // Nothing to do. Panel window will override this.
2378 } 2381 }
2379 2382
2380 BrowserWindowGtk::TitleDecoration BrowserWindowGtk::GetWindowTitle( 2383 BrowserWindowGtk::TitleDecoration BrowserWindowGtk::GetWindowTitle(
(...skipping 22 matching lines...) Expand all
2403 wm_type == ui::WM_OPENBOX || 2406 wm_type == ui::WM_OPENBOX ||
2404 wm_type == ui::WM_XFWM4); 2407 wm_type == ui::WM_XFWM4);
2405 } 2408 }
2406 2409
2407 // static 2410 // static
2408 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2411 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2409 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2412 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2410 browser_window_gtk->Init(); 2413 browser_window_gtk->Init();
2411 return browser_window_gtk; 2414 return browser_window_gtk;
2412 } 2415 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698