pidgin: cb3ab2e4: Apply patch that adds support for keyboa...

qulogic at pidgin.im qulogic at pidgin.im
Thu Jun 11 01:10:38 EDT 2009


-----------------------------------------------------------------
Revision: cb3ab2e4edfc08a797d16af58ef5273c5e930b91
Ancestor: 887e07e33e197965af1d590e4936f6c082494ea7
Author: qulogic at pidgin.im
Date: 2009-06-10T03:40:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cb3ab2e4edfc08a797d16af58ef5273c5e930b91

Modified files:
        COPYRIGHT ChangeLog pidgin/eggtrayicon.c
        pidgin/gtkdocklet-x11.c

ChangeLog: 

Apply patch that adds support for keyboard navigation for the status icon.

Fixes #6515.

-------------- next part --------------
============================================================
--- COPYRIGHT	869f15b4a0a50ab9901fd0aac605f49491fc9047
+++ COPYRIGHT	2146d78ee4672debf86a9962d484981925486a4d
@@ -510,6 +510,7 @@ Timmy Yee
 Ma Xuan
 Jared Yanovich
 Timmy Yee
+Li Yuan
 Nickolai Zeldovich
 Tom Zickel
 Marco Ziech
============================================================
--- ChangeLog	d4fec986630c11bd8686866ce5d99593f514e8d6
+++ ChangeLog	cf8d2b95ac979162250007bf291fb0a2a08af2ee
@@ -99,6 +99,7 @@ version 2.6.0 (??/??/2009):
 	  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
============================================================
--- pidgin/eggtrayicon.c	e17a340f5753e581d665b65d069f445d56893048
+++ pidgin/eggtrayicon.c	1276757bcfb0af4067d8fc1ff3a6c07e738dddd7
@@ -400,9 +400,35 @@ transparent_expose_event (GtkWidget *wid
 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
============================================================
--- pidgin/gtkdocklet-x11.c	71cf10cd25d151fb7c5d87bf3549dd77ec61591b
+++ pidgin/gtkdocklet-x11.c	93adf70aab1b416bfb4f4311a6dec2423d5935db
@@ -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,7 +90,34 @@ docklet_x11_clicked_cb(GtkWidget *button
 	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)
 {
 	const gchar *icon_name = NULL;
@@ -259,11 +287,14 @@ docklet_x11_create(gboolean recreate)
 	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);
 


More information about the Commits mailing list