[evolution-patches] FWD: Seeking review for bug 45631, "activate popup menu in mail composer's to/cc"



Hi, Mike

  This patch will enhance the keyboard navigation of evolution which is
one part of our group's tasks.
  
  The patch is created by Maxx, one of our developer group, it  looks
okay for me. Since e-text will exist in the predictable future, could
you please take some time to  review this patch by Maxx? 

  
Thanks
Gilbert
--- Begin Message ---

--
Best Regards
Maxx

--- Begin Message ---
  • From: Yiming Cao <maxx cao sun com>
  • To: evolution-patches <evolution-patches ximian com>
  • Cc: Yiming Cao <maxx cao sun com>
  • Subject: Seeking review for bug 45631, "activate popup menu in mail composer's to/cc"
  • Date: Thu, 31 Jul 2003 11:25:04 +0800
Hi,

This patch fixes bug 45631, "shift+f10 in composer's to/cc/bcc
should be able to activate the popup menu."

The patch applies to gal/e-text (from trunk). Please review, thanks.

--
Best Regards
Maxx

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.796
diff -u -r1.796 ChangeLog
--- ChangeLog	28 Jul 2003 21:22:17 -0000	1.796
+++ ChangeLog	31 Jul 2003 03:22:18 -0000
@@ -1,3 +1,11 @@
+2003-07-31  Maxx Cao  <maxx cao sun com>
+
+	* gal/e-text/e-text.c (e_text_event): filter S-F10 key binding, and
+	show popup menu.
+	(popup_menu_placement_cb): function added to adjust popup menu position.
+	(popup_targets_received): show popup menu in different ways, according
+	to whether it's invoked by mouse click or key binding.
+
 2003-07-11  Suresh Chandrasekharan  <suresh chandrasekharan sun com>
 
 	* gal/util/e-iconv.c : Fix for #46168 some additional locale aliases 
Index: gal/e-text/e-text.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-text/e-text.c,v
retrieving revision 1.145
diff -u -r1.145 e-text.c
--- gal/e-text/e-text.c	14 May 2003 00:42:36 -0000	1.145
+++ gal/e-text/e-text.c	31 Jul 2003 03:22:22 -0000
@@ -43,6 +43,7 @@
 #include <string.h>
 #include <glib-object.h>
 #include <gdk/gdkx.h> /* for BlackPixel */
+#include <gdk/gdkkeysyms.h>
 #include <gtk/gtkclipboard.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkselection.h>
@@ -2148,6 +2149,27 @@
 		break;
 	case GDK_KEY_PRESS: /* Fall Through */
 	case GDK_KEY_RELEASE:
+
+		/* Handle S-F10 key binding here. */
+
+		if (event->type == GDK_KEY_PRESS 
+		    && event->key.keyval == GDK_F10 
+		    && (event->key.state&GDK_SHIFT_MASK)){
+
+			/* Simulate a GdkEventButton here, so that we can call e_text_do_popup directly */
+
+			GdkEventButton *button = g_new0 (GdkEventButton, 1);
+			button->type = GDK_BUTTON_PRESS;
+			button->time = GDK_CURRENT_TIME;
+			button->button = 0;
+			
+			if (text->handle_popup) {
+				e_text_do_popup (text, button, 0);
+				return TRUE;
+			}
+			
+		}
+
 		if (text->editing) {
 			GdkEventKey key;
 			gint ret;
@@ -2517,6 +2539,22 @@
 }
 
 static void
+popup_menu_placement_cb (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
+{
+	EText *text = E_TEXT(user_data);
+	GnomeCanvasItem *item = &text->item;
+	GnomeCanvas *parent = item->canvas;
+
+	if (parent){
+		gdk_window_get_origin (((GtkWidget*) parent)->window, x, y);
+		*x += item->x1 + text->width/2;
+		*y += item->y1 + text->height/2;
+	}
+
+	return;
+}
+
+static void
 popup_targets_received (GtkClipboard     *clipboard,
 			GtkSelectionData *data,
 			gpointer          user_data)
@@ -2587,9 +2625,17 @@
 		     button, position,
 		     popup_menu);
 
-      gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
-		      NULL, NULL,
-		      button->button, GDK_CURRENT_TIME);
+      /* If invoked by S-F10 key binding, button will be 0. */
+      if (button->button == 0){
+      	      gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
+			      popup_menu_placement_cb, (gpointer)text,
+			      button->button, GDK_CURRENT_TIME);
+	      g_free (button);
+      } else {
+	      gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
+			      NULL, NULL,
+			      button->button, GDK_CURRENT_TIME);
+      }
 
       g_object_unref (text);
 }

--- End Message ---

--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]