summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 00:27:06 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 00:27:06 +0000
commit6dac6b125016cd3c398fe8715ac9a32142a85652 (patch)
treebf80e8b0151fd3c31d2ec51d5edeb1e4b0d39e07
parent1a5db8cc22d8a87d230f5a239bf25fcd7bec7846 (diff)
downloadchromium_src-6dac6b125016cd3c398fe8715ac9a32142a85652.zip
chromium_src-6dac6b125016cd3c398fe8715ac9a32142a85652.tar.gz
chromium_src-6dac6b125016cd3c398fe8715ac9a32142a85652.tar.bz2
linux: explicitly unhighlight buttons before disabling
If your mouse is hovering the back button when the button is disabled (i.e. you click back and it takes some time for the navigate to go through), when the button is re-enabled GTK restores the highlighted state to the button. I reproduced this in a very simplified naive app on the bug and had the same result, so I think this workaround is ok. BUG=13729 TEST=do the actions listed in the bug Review URL: http://codereview.chromium.org/1521016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43786 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index f12e96d..ebde04c 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -303,8 +303,16 @@ void BrowserToolbarGtk::EnabledStateChangedForCommand(int id, bool enabled) {
widget = home_->widget();
break;
}
- if (widget)
+ if (widget) {
+ if (!enabled && GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT) {
+ // If we're disabling a widget, GTK will helpfully restore it to its
+ // previous state when we re-enable it, even if that previous state
+ // is the prelight. This looks bad. See the bug for a simple repro.
+ // http://code.google.com/p/chromium/issues/detail?id=13729
+ gtk_widget_set_state(widget, GTK_STATE_NORMAL);
+ }
gtk_widget_set_sensitive(widget, enabled);
+ }
}
// MenuGtk::Delegate -----------------------------------------------------------