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

Unified Diff: chrome/browser/ui/gtk/avatar_menu_item_gtk.cc

Issue 8921003: Linux/Gtk: Drawing a focus-ring around the avatar menu items to highlight selection. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years 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/avatar_menu_item_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/ui/gtk/avatar_menu_item_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/avatar_menu_item_gtk.cc (revision 113987)
+++ chrome/browser/ui/gtk/avatar_menu_item_gtk.cc (working copy)
@@ -120,7 +120,6 @@
gboolean AvatarMenuItemGtk::OnProfileFocusIn(GtkWidget* widget,
GdkEventFocus* event) {
- gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &highlighted_color_);
if (item_.active)
ShowEditLink();
@@ -129,7 +128,6 @@
gboolean AvatarMenuItemGtk::OnProfileFocusOut(GtkWidget* widget,
GdkEventFocus* event) {
- gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, unhighlighted_color_);
if (item_.active)
ShowStatusLabel();
@@ -201,6 +199,22 @@
weak_factory_.GetWeakPtr()));
}
+gboolean AvatarMenuItemGtk::OnEventBoxExpose(GtkWidget* widget,
+ GdkEventExpose* event) {
+ // Draw the focus rectangle.
+ if (gtk_widget_has_focus(widget)) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
Elliot Glaysher 2011/12/12 20:48:24 Thank you for getting this right. (Sadly, there's
+ gtk_paint_focus(widget->style, widget->window,
+ gtk_widget_get_state(widget),
+ &event->area, widget, NULL,
+ 0, 0,
+ allocation.width, allocation.height);
+ }
+
+ return TRUE;
+}
+
void AvatarMenuItemGtk::Init(GtkThemeService* theme_service) {
widget_.Own(gtk_event_box_new());
@@ -216,6 +230,8 @@
G_CALLBACK(OnProfileFocusOutThunk), this);
g_signal_connect(widget_.get(), "key-press-event",
G_CALLBACK(OnProfileKeyPressThunk), this);
+ g_signal_connect_after(widget_.get(), "expose-event",
+ G_CALLBACK(OnEventBoxExposeThunk), this);
GtkWidget* item_hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
GdkPixbuf* avatar_pixbuf = NULL;
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_item_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698