Mercurial > pidgin.yaz
changeset 27177:211b59ac6345
Apply patch that adds support for keyboard navigation for the status icon.
Fixes #6515.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 10 Jun 2009 03:40:27 +0000 |
parents | db373b572015 |
children | 65a79c501f58 |
files | COPYRIGHT ChangeLog pidgin/eggtrayicon.c pidgin/gtkdocklet-x11.c |
diffstat | 4 files changed, 62 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Wed Jun 10 01:07:29 2009 +0000 +++ b/COPYRIGHT Wed Jun 10 03:40:27 2009 +0000 @@ -510,6 +510,7 @@ Ma Xuan Jared Yanovich Timmy Yee +Li Yuan Nickolai Zeldovich Tom Zickel Marco Ziech
--- a/ChangeLog Wed Jun 10 01:07:29 2009 +0000 +++ b/ChangeLog Wed Jun 10 03:40:27 2009 +0000 @@ -99,6 +99,7 @@ collapse buddy groups or contacts. (Peter Ruibal) * Support saving animated custom smileys as animated images or animated custom smileys. (Andrea Piccinelli) + * Support for keyboard navigation on the status icon. (Li Yuan) Finch: * The hardware cursor is updated correctly. This will be useful
--- a/pidgin/eggtrayicon.c Wed Jun 10 01:07:29 2009 +0000 +++ b/pidgin/eggtrayicon.c Wed Jun 10 03:40:27 2009 +0000 @@ -400,9 +400,35 @@ static gboolean transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - gdk_window_clear_area (widget->window, event->area.x, event->area.y, - event->area.width, event->area.height); - return FALSE; + GtkWidget *focus_child = NULL; + gint border_width, x, y, width, height; + gboolean retval = FALSE; + + gdk_window_clear_area (widget->window, event->area.x, event->area.y, + event->area.width, event->area.height); + + if (GTK_WIDGET_CLASS (parent_class)->expose_event) + retval = GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); + + if (GTK_CONTAINER (widget)->focus_child) + focus_child = GTK_CONTAINER (GTK_CONTAINER (widget)->focus_child)->focus_child; + if (focus_child && GTK_WIDGET_HAS_FOCUS (focus_child)) + { + border_width = GTK_CONTAINER (widget)->border_width; + + x = widget->allocation.x + border_width; + y = widget->allocation.y + border_width; + + width = widget->allocation.width - 2 * border_width; + height = widget->allocation.height - 2 * border_width; + + gtk_paint_focus (widget->style, widget->window, + GTK_WIDGET_STATE (widget), + &event->area, widget, "tray_icon", + x, y, width, height); + } + + return retval; } static void
--- a/pidgin/gtkdocklet-x11.c Wed Jun 10 01:07:29 2009 +0000 +++ b/pidgin/gtkdocklet-x11.c Wed Jun 10 03:40:27 2009 +0000 @@ -32,6 +32,7 @@ #include "eggtrayicon.h" #include "gtkdocklet.h" +#include <gdk/gdkkeysyms.h> #define SHORT_EMBED_TIMEOUT 5000 #define LONG_EMBED_TIMEOUT 15000 @@ -89,6 +90,33 @@ return TRUE; } +static gboolean +docklet_x11_pressed_cb(GtkWidget *button, GdkEventKey *event) +{ + guint state, keyval; + + state = event->state & gtk_accelerator_get_default_mod_mask(); + keyval = event->keyval; + if (state == 0 && + (keyval == GDK_Return || + keyval == GDK_KP_Enter || + keyval == GDK_ISO_Enter || + keyval == GDK_space || + keyval == GDK_KP_Space)) + { + pidgin_docklet_clicked(1); + return TRUE; + } + + return FALSE; +} + +static void +docklet_x11_popup_cb(GtkWidget *button) +{ + pidgin_docklet_clicked(3); +} + static void docklet_x11_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) { @@ -259,11 +287,14 @@ docklet = egg_tray_icon_new(PIDGIN_NAME); box = gtk_event_box_new(); image = gtk_image_new(); + GTK_WIDGET_SET_FLAGS (image, GTK_CAN_FOCUS); g_signal_connect(G_OBJECT(docklet), "embedded", G_CALLBACK(docklet_x11_embedded_cb), NULL); g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_x11_destroyed_cb), NULL); g_signal_connect(G_OBJECT(docklet), "size-allocate", G_CALLBACK(docklet_x11_resize_icon), NULL); g_signal_connect(G_OBJECT(box), "button-press-event", G_CALLBACK(docklet_x11_clicked_cb), NULL); + g_signal_connect(G_OBJECT(box), "key-press-event", G_CALLBACK(docklet_x11_pressed_cb), NULL); + g_signal_connect(G_OBJECT(box), "popup-menu", G_CALLBACK(docklet_x11_popup_cb), NULL); gtk_container_add(GTK_CONTAINER(box), image); gtk_container_add(GTK_CONTAINER(docklet), box);