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

Unified Diff: chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc

Issue 7640004: Gtk: Make click target of tabs match their appearance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: single space after period Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/tabs/tab_strip_gtk.h ('k') | chrome/browser/ui/tabs/tab_resources.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index 142e4cbc226b9c4cab5852c44e35050752dc9aae..d1eb188fcee1790196e0560cb0e2809a91b437c3 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -750,6 +750,8 @@ void TabStripGtk::Init() {
-1 };
ui::SetDestTargetList(tabstrip_.get(), targets);
+ g_signal_connect(tabstrip_.get(), "map",
+ G_CALLBACK(OnMapThunk), this);
g_signal_connect(tabstrip_.get(), "expose-event",
G_CALLBACK(OnExposeThunk), this);
g_signal_connect(tabstrip_.get(), "size-allocate",
@@ -1006,6 +1008,8 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents,
} else {
Layout();
}
+
+ ReStack();
}
void TabStripGtk::TabDetachedAt(TabContentsWrapper* contents, int index) {
@@ -1017,6 +1021,13 @@ void TabStripGtk::TabDetachedAt(TabContentsWrapper* contents, int index) {
GetTabAt(index)->set_closing(true);
}
+void TabStripGtk::ActiveTabChanged(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index,
+ bool user_gesture) {
+ ReStack();
+}
+
void TabStripGtk::TabSelectionChanged(const TabStripSelectionModel& old_model) {
// We have "tiny tabs" if the tabs are so tiny that the unselected ones are
// a different size to the selected ones.
@@ -1075,6 +1086,7 @@ void TabStripGtk::TabMoved(TabContentsWrapper* contents,
tab_data_.insert(tab_data_.begin() + to_index, data);
GenerateIdealBounds();
StartMoveTabAnimation(from_index, to_index);
+ ReStack();
}
void TabStripGtk::TabChangedAt(TabContentsWrapper* contents, int index,
@@ -1580,6 +1592,26 @@ bool TabStripGtk::IsCursorInTabStripZone() const {
return bds.Contains(cursor_point);
}
+void TabStripGtk::ReStack() {
+ if (!GTK_WIDGET_REALIZED(tabstrip_.get())) {
+ // If the window isn't realized yet, we can't stack them yet. It will be
+ // done by the OnMap signal handler.
+ return;
+ }
+ int tab_count = GetTabCount();
+ TabGtk* active_tab = NULL;
+ for (int i = tab_count - 1; i >= 0; --i) {
+ TabGtk* tab = GetTabAt(i);
+ if (tab->IsActive())
+ active_tab = tab;
+ else
+ tab->Raise();
+ }
+ if (active_tab)
+ active_tab->Raise();
+}
+
+
void TabStripGtk::AddMessageLoopObserver() {
if (!added_as_message_loop_observer_) {
MessageLoopForUI::current()->AddObserver(this);
@@ -1937,6 +1969,10 @@ void TabStripGtk::FinishAnimation(TabStripGtk::TabAnimation* animation,
Layout();
}
+void TabStripGtk::OnMap(GtkWidget* widget) {
+ ReStack();
+}
+
gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) {
if (gdk_region_empty(event->region))
return TRUE;
« no previous file with comments | « chrome/browser/ui/gtk/tabs/tab_strip_gtk.h ('k') | chrome/browser/ui/tabs/tab_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698