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

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 132023010: linux_aura: Fixes a couple of issues with the button border integration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move dangling comment Created 6 years, 11 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
Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 1ae080f809992c9a08f3ecf787232b6124c448cd..423b68b1b08f4d6e4fd7a9afe4cac4ccbdc6cf26 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -528,8 +528,8 @@ gfx::Image Gtk2UI::GetIconForContentType(
}
views::Border* Gtk2UI::CreateNativeBorder(
- views::CustomButton* owning_button,
- views::Border* border) {
+ views::LabelButton* owning_button,
+ views::LabelButtonBorder* border) {
return new Gtk2Border(this, owning_button, border);
}
@@ -1182,6 +1182,7 @@ SkBitmap Gtk2UI::GenerateGTKIcon(int base_id) const {
if (gtk_state == GTK_STATE_ACTIVE || gtk_state == GTK_STATE_PRELIGHT) {
SkBitmap border = DrawGtkButtonBorder(gtk_state,
+ false,
default_bitmap.width(),
default_bitmap.height());
canvas.drawBitmap(border, 0, 0);
@@ -1209,6 +1210,7 @@ SkBitmap Gtk2UI::GenerateToolbarBezel(int gtk_state, int sizing_idr) const {
SkCanvas canvas(retval);
SkBitmap border = DrawGtkButtonBorder(
gtk_state,
+ false,
default_bitmap.width(),
default_bitmap.height());
canvas.drawBitmap(border, 0, 0);
@@ -1248,7 +1250,9 @@ void Gtk2UI::GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const {
}
SkBitmap Gtk2UI::DrawGtkButtonBorder(int gtk_state,
- int width, int height) const {
+ bool focused,
+ int width,
+ int height) const {
// Create a temporary GTK button to snapshot
GtkWidget* window = gtk_offscreen_window_new();
GtkWidget* button = gtk_button_new();
@@ -1259,6 +1263,13 @@ SkBitmap Gtk2UI::DrawGtkButtonBorder(int gtk_state,
gtk_widget_show(button);
gtk_widget_show(window);
+ if (focused) {
+ // We can't just use gtk_widget_grab_focus() here because that sets
+ // gtk_widget_is_focus(), but not gtk_widget_has_focus(), which is what the
+ // GtkButton's paint checks.
+ GTK_WIDGET_SET_FLAGS(button, GTK_HAS_FOCUS);
+ }
+
gtk_widget_set_state(button, static_cast<GtkStateType>(gtk_state));
GdkPixmap* pixmap = gtk_widget_get_snapshot(button, NULL);

Powered by Google App Engine
This is Rietveld 408576698