summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.cc13
-rw-r--r--chrome/browser/gtk/gtk_chrome_button.cc3
-rw-r--r--chrome/browser/gtk/gtk_chrome_button.h2
-rw-r--r--chrome/browser/gtk/hover_controller_gtk.cc6
4 files changed, 18 insertions, 6 deletions
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
index 954b5f9..d177fab 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/gtk/gtk_chrome_shrinkable_hbox.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/gtk_util.h"
+#include "chrome/browser/gtk/hover_controller_gtk.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/browser/gtk/view_id_util.h"
#include "chrome/browser/profile.h"
@@ -67,7 +68,8 @@ gint WidthForIconCount(gint icon_count) {
class BrowserActionButton : public NotificationObserver,
public ImageLoadingTracker::Observer,
- public ExtensionContextMenuModel::PopupDelegate {
+ public ExtensionContextMenuModel::PopupDelegate,
+ public MenuGtk::Delegate {
public:
BrowserActionButton(BrowserActionsToolbarGtk* toolbar,
Extension* extension)
@@ -177,6 +179,11 @@ class BrowserActionButton : public NotificationObserver,
}
private:
+ // MenuGtk::Delegate implementation.
+ virtual void StoppedShowing() {
+ gtk_chrome_button_unset_paint_state(GTK_CHROME_BUTTON(button_.get()));
+ }
+
// Returns true to prevent further processing of the event that caused us to
// show the popup, or false to continue processing.
bool ShowPopup(bool devtools) {
@@ -222,7 +229,9 @@ class BrowserActionButton : public NotificationObserver,
action->toolbar_->browser(),
action));
action->context_menu_.reset(
- new MenuGtk(NULL, action->context_menu_model_.get()));
+ new MenuGtk(action, action->context_menu_model_.get()));
+ gtk_chrome_button_set_paint_state(GTK_CHROME_BUTTON(action->button_.get()),
+ GTK_STATE_PRELIGHT);
action->context_menu_->Popup(widget, event);
return TRUE;
diff --git a/chrome/browser/gtk/gtk_chrome_button.cc b/chrome/browser/gtk/gtk_chrome_button.cc
index f2b94e4..a8bd49d 100644
--- a/chrome/browser/gtk/gtk_chrome_button.cc
+++ b/chrome/browser/gtk/gtk_chrome_button.cc
@@ -106,7 +106,8 @@ static gboolean gtk_chrome_button_expose(GtkWidget* widget,
} else {
double effective_hover_state = paint_state == GTK_STATE_PRELIGHT ?
1.0 : 0.0;
- if (priv->hover_state >= 0.0)
+ // |paint_state| overrides |hover_state|.
+ if (priv->hover_state >= 0.0 && priv->paint_state < 0)
effective_hover_state = priv->hover_state;
if (paint_state == GTK_STATE_ACTIVE) {
diff --git a/chrome/browser/gtk/gtk_chrome_button.h b/chrome/browser/gtk/gtk_chrome_button.h
index 56ef67c..762f238 100644
--- a/chrome/browser/gtk/gtk_chrome_button.h
+++ b/chrome/browser/gtk/gtk_chrome_button.h
@@ -51,7 +51,7 @@ void gtk_chrome_button_set_use_gtk_rendering(GtkChromeButton* button,
// Sets the partial hover state of the button. The acceptable range is 0.0 to
// 1.0. If |state| is outside of that range, then revert the button to normal
-// hovering.
+// hovering. This can be overridden by gtk_chrome_button_set_paint_state.
void gtk_chrome_button_set_hover_state(GtkChromeButton* button,
gdouble state);
diff --git a/chrome/browser/gtk/hover_controller_gtk.cc b/chrome/browser/gtk/hover_controller_gtk.cc
index 0be9da9..50a8f1a 100644
--- a/chrome/browser/gtk/hover_controller_gtk.cc
+++ b/chrome/browser/gtk/hover_controller_gtk.cc
@@ -101,10 +101,12 @@ gboolean HoverControllerGtk::OnEnter(GtkWidget* widget,
gboolean HoverControllerGtk::OnLeave(GtkWidget* widget,
GdkEventCrossing* event) {
// When the user is holding a mouse button, we don't want to animate.
- if (event->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
+ if (event->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) {
hover_animation_.Reset();
- else
+ gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0);
+ } else {
hover_animation_.Hide();
+ }
return FALSE;
}