Index: gcalctool/gtk.c
===================================================================
--- gcalctool/gtk.c	(revision 1782)
+++ gcalctool/gtk.c	(working copy)
@@ -1082,18 +1082,7 @@
 }
 
 
-/*ARGSUSED*/
 static void
-button_cb(GtkWidget *widget)
-{
-    struct button *n;
-    
-    n = (struct button *) g_object_get_data(G_OBJECT(widget), "button");
-    do_button(n, 0);
-}
-
-
-static void
 help_display(void)
 {
     GError *error = NULL;
@@ -2122,6 +2111,59 @@
 
 
 /*ARGSUSED*/
+static void
+menu_pos_func(GtkMenu *menu, gint *x, gint *y,
+              gboolean *push_in, gpointer user_data)
+{
+    GdkPoint *loc = (GdkPoint *) user_data;
+
+    *x = loc->x;
+    *y = loc->y;
+}
+
+
+/*ARGSUSED*/
+static void
+button_cb(GtkWidget *widget, GdkEventButton *event)
+{
+    struct button *n;
+    enum menu_type mtype;
+    GtkWidget *menu;
+    GdkPoint loc;
+    
+    n = (struct button *) g_object_get_data(G_OBJECT(widget), "button");
+    mtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "mtype"));
+    
+    if (mtype == M_NONE) {
+        do_button(n, 0);
+    } else {
+        /* If gcalctool is being driven by gok, the on-screen keyboard 
+         * assistive technology, it's possible that the event returned by 
+         * gtk_get_current_event() is NULL. If this is the case, we need 
+         * to fudge the popping up on the menu associated with this menu 
+         * button.
+         */
+
+        update_constants_menu();
+        update_functions_menu();
+        update_memory_menus();
+
+        menu = X->menus[mtype];
+        if (event == NULL) {
+            gdk_window_get_origin(widget->window, &loc.x, &loc.y);
+            loc.x += widget->allocation.x;
+            loc.y += widget->allocation.y;
+            gtk_menu_popup(GTK_MENU(menu), NULL, NULL, menu_pos_func,
+                           (gpointer) &loc, 0, gtk_get_current_event_time());
+        } else if (event->button == 1) {
+            gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
+                           event->button, event->time);
+        }
+    }
+}
+
+
+/*ARGSUSED*/
 static gboolean
 kframe_key_press_cb(GtkWidget *widget, GdkEventKey *event)
 {
@@ -2185,7 +2227,7 @@
         while (button_widgets[i].accelerator_keys[j] != 0) {
             if (button_widgets[i].accelerator_keys[j] == event->keyval &&
                 (button_widgets[i].accelerator_mods[j] & ~GDK_SHIFT_MASK) == state) {
-                button_cb(button);
+                button_cb(button, NULL);
                 return(TRUE);
             }
             j++;
@@ -2292,40 +2334,7 @@
 }
 
 
-/*ARGSUSED*/
 static void
-menu_pos_func(GtkMenu *menu, gint *x, gint *y,
-              gboolean *push_in, gpointer user_data)
-{
-    GdkPoint *loc = (GdkPoint *) user_data;
-
-    *x = loc->x;
-    *y = loc->y;
-}
-
-
-static void
-show_menu_for_button(GtkWidget *widget, GdkEventKey *event)
-{
-    GdkPoint loc;
-    GtkWidget *menu;
-    enum menu_type mtype;
-    
-    update_constants_menu();
-    update_functions_menu();
-    update_memory_menus();
-
-    mtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "mtype"));
-    menu = X->menus[mtype];
-    gdk_window_get_origin(widget->window, &loc.x, &loc.y);
-    loc.x += widget->allocation.x;
-    loc.y += widget->allocation.y;
-    gtk_menu_popup(GTK_MENU(menu), NULL, NULL, menu_pos_func,
-                   (gpointer) &loc, event->keyval, event->time);
-}
-
-
-static void
 show_precision_frame()      /* Display Set Precision popup. */
 {
     if (!GTK_WIDGET_VISIBLE(X->spframe)) {
@@ -2343,55 +2352,6 @@
     gtk_entry_set_text(GTK_ENTRY(X->regs[n]), str);
 }
 
-
-/*ARGSUSED*/
-static void 
-menu_button_button_press_cb(GtkButton *widget)
-{
-    GtkWidget *menu;
-    GdkEventButton *event = (GdkEventButton *) gtk_get_current_event();
-    enum menu_type mtype;
-
-    mtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "mtype"));
-    menu = X->menus[mtype];
-
-/* If gcalctool is being driven by gok, the on-screen keyboard 
- * assistive technology, it's possible that the event returned by 
- * gtk_get_current_event() is NULL. If this is the case, we need 
- * to fudge the popping up on the menu associated with this menu 
- * button.
- */
-    
-    // FIXME: merge with show_menu_for_button()
-
-    update_constants_menu();
-    update_functions_menu();
-    update_memory_menus();
-
-    if (event == NULL) {
-        gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
-                       1, gtk_get_current_event_time());
-    } else if (event->button == 1) {
-        gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
-                       event->button, event->time);
-    }
-}
-
-
-/*ARGSUSED*/
-static gboolean
-menu_button_key_press_cb(GtkWidget *widget, GdkEventKey *event)
-{
-    if (event->keyval == GDK_space) {
-        show_menu_for_button(widget, event);
-
-        return(TRUE);
-    }
-
-    return(FALSE);
-}
-
-
 /* Handle menu bar menu selection. */
 
 /*ARGSUSED*/
@@ -2926,8 +2886,6 @@
      */
     CONNECT_SIGNAL(kframe_key_press_cb);
     CONNECT_SIGNAL(button_cb);
-    CONNECT_SIGNAL(menu_button_button_press_cb);
-    CONNECT_SIGNAL(menu_button_key_press_cb);
     CONNECT_SIGNAL(menu_item_select_cb);
     CONNECT_SIGNAL(menu_item_deselect_cb);
     CONNECT_SIGNAL(mode_radio_cb);
Index: glade/gcalctool.glade
===================================================================
--- glade/gcalctool.glade	(revision 1781)
+++ glade/gcalctool.glade	(working copy)
@@ -4021,8 +4021,7 @@
 	      <accessibility>
 		<atkproperty name="AtkObject::accessible_name" translatable="yes">User-defined functions</atkproperty>
 	      </accessibility>
-	      <signal name="clicked" handler="menu_button_button_press_cb"/>
-	      <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+	      <signal name="clicked" handler="button_cb"/>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox13">
@@ -4097,8 +4096,7 @@
 	      <accessibility>
 		<atkproperty name="AtkObject::accessible_name" translatable="yes">Shift left</atkproperty>
 	      </accessibility>
-	      <signal name="clicked" handler="menu_button_button_press_cb"/>
-	      <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+	      <signal name="clicked" handler="button_cb"/>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox11">
@@ -4173,8 +4171,7 @@
 	      <accessibility>
 		<atkproperty name="AtkObject::accessible_name" translatable="yes">Shift right</atkproperty>
 	      </accessibility>
-	      <signal name="clicked" handler="menu_button_button_press_cb"/>
-	      <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+	      <signal name="clicked" handler="button_cb"/>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox10">
@@ -4249,8 +4246,7 @@
 	      <accessibility>
 		<atkproperty name="AtkObject::accessible_name" translatable="yes">Constants</atkproperty>
 	      </accessibility>
-	      <signal name="clicked" handler="menu_button_button_press_cb"/>
-	      <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+	      <signal name="clicked" handler="button_cb"/>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox12">
@@ -4325,8 +4321,7 @@
 	      <accessibility>
 		<atkproperty name="AtkObject::accessible_name" translatable="yes">Accuracy</atkproperty>
 	      </accessibility>
-	      <signal name="clicked" handler="menu_button_button_press_cb"/>
-	      <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+	      <signal name="clicked" handler="button_cb"/>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox14">
@@ -5456,8 +5451,7 @@
 		  <accessibility>
 		    <atkproperty name="AtkObject::accessible_name" translatable="yes">Exchange with register</atkproperty>
 		  </accessibility>
-		  <signal name="clicked" handler="menu_button_button_press_cb"/>
-		  <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+		  <signal name="clicked" handler="button_cb"/>
 
 		  <child>
 		    <widget class="GtkHBox" id="hbox18">
@@ -5532,8 +5526,7 @@
 		  <accessibility>
 		    <atkproperty name="AtkObject::accessible_name" translatable="yes">Retreive from register</atkproperty>
 		  </accessibility>
-		  <signal name="clicked" handler="menu_button_button_press_cb"/>
-		  <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+		  <signal name="clicked" handler="button_cb"/>
 
 		  <child>
 		    <widget class="GtkHBox" id="hbox19">
@@ -5631,8 +5624,7 @@
 		  <accessibility>
 		    <atkproperty name="AtkObject::accessible_name" translatable="yes">Store to register</atkproperty>
 		  </accessibility>
-		  <signal name="clicked" handler="menu_button_button_press_cb"/>
-		  <signal name="key-press-event" handler="menu_button_key_press_cb"/>
+		  <signal name="clicked" handler="button_cb"/>
 
 		  <child>
 		    <widget class="GtkHBox" id="hbox20">
