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

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

Issue 62075: Un-hover the current highlighted tab when the mouse leaves the tabstrip. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 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/gtk/tabs/tab_strip_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/tabs/tab_strip_gtk.cc
===================================================================
--- chrome/browser/gtk/tabs/tab_strip_gtk.cc (revision 13178)
+++ chrome/browser/gtk/tabs/tab_strip_gtk.cc (working copy)
@@ -76,8 +76,10 @@
G_CALLBACK(OnMotionNotify), this);
g_signal_connect(G_OBJECT(tabstrip_.get()), "button-press-event",
G_CALLBACK(OnButtonPress), this);
+ g_signal_connect(G_OBJECT(tabstrip_.get()), "leave-notify-event",
+ G_CALLBACK(OnLeaveNotify), this);
gtk_widget_add_events(tabstrip_.get(),
- GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK);
+ GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_widget_show_all(tabstrip_.get());
bounds_ = GetInitialWidgetBounds(tabstrip_.get());
@@ -383,9 +385,9 @@
}
// static
-gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e,
+gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event,
TabStripGtk* tabstrip) {
- ChromeCanvasPaint canvas(e);
+ ChromeCanvasPaint canvas(event);
if (canvas.isEmpty())
return TRUE;
@@ -487,3 +489,18 @@
return TRUE;
}
+
+// static
+gboolean TabStripGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event,
+ TabStripGtk* tabstrip) {
+ // A leave-notify-event is generated on mouse click, which sets the mode to
+ // GDK_CROSSING_GRAB. Ignore this event because it doesn't meant the mouse
+ // has left the tabstrip.
+ if (tabstrip->hover_index_ != -1 && event->mode != GDK_CROSSING_GRAB) {
+ tabstrip->GetTabAt(tabstrip->hover_index_)->SetHovering(false);
+ tabstrip->hover_index_ = -1;
+ gtk_widget_queue_draw(tabstrip->tabstrip_.get());
+ }
+
+ return TRUE;
+}
« no previous file with comments | « chrome/browser/gtk/tabs/tab_strip_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698