popup-menu patch for gnome-popup-menu.c



Here's a patch for gnome-popup-menu.c that makes the popup menu appear
when the popup-menu signal is emitted on the parent widget (I've not
explained this very well at all...)

iain
-- 
but tv says "surface irony" is funny...don't you watch saturday night
live, man?
Index: libgnomeui/ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/ChangeLog,v
retrieving revision 1.1776
diff -U2 -r1.1776 ChangeLog
--- libgnomeui/ChangeLog	2002/01/16 14:04:46	1.1776
+++ libgnomeui/ChangeLog	2002/01/18 20:07:10
@@ -1,2 +1,9 @@
+2002-01-18  Iain Holmes  <iain ximian com>
+
+	* gnome-popup-menu.c (gnome_popup_menu_attach): Add GDK_KEY_PRESS_MASK
+	to the ev_widget. Connect to the popup-menu signal.
+	(popup_menu_pressed): Call the real_popup_button_pressed function with
+	ev == NULL.
+
 2002-01-16  Richard Hult  <rhult codefactory se>
 
Index: libgnomeui/gnome-popup-menu.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-popup-menu.c,v
retrieving revision 1.40
diff -U2 -r1.40 gnome-popup-menu.c
--- libgnomeui/gnome-popup-menu.c	2001/12/09 21:29:46	1.40
+++ libgnomeui/gnome-popup-menu.c	2002/01/18 20:07:10
@@ -202,4 +202,12 @@
 
 static gint
+popup_menu_pressed (GtkWidget *widget, gpointer data)
+{
+	gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "popup_menu");
+
+	return real_popup_button_pressed (widget, NULL, data);
+}
+
+static gint
 relay_popup_button_pressed (GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
@@ -331,9 +339,13 @@
 	 */
 
-	gtk_widget_add_events (ev_widget, GDK_BUTTON_PRESS_MASK);
+	gtk_widget_add_events (ev_widget, GDK_BUTTON_PRESS_MASK |
+			       GDK_KEY_PRESS_MASK);
 
 	gtk_signal_connect (GTK_OBJECT (widget), "button_press_event",
 			    GTK_SIGNAL_FUNC (popup_button_pressed), popup);
 
+	g_signal_connect (G_OBJECT (widget), "popup_menu",
+			  G_CALLBACK (popup_menu_pressed), popup);
+	
 	if (ev_widget != widget)
 	  gtk_signal_connect_while_alive (GTK_OBJECT (ev_widget), "button_press_event",


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