prevent secondary selection claim after "add to sender" dialog
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 8 Dec 2001 22:40:08 +0000 (22:40 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 8 Dec 2001 22:40:08 +0000 (22:40 +0000)
popped up. this is because there's a GDK_BUTTON_RELEASE pending.
we trick GTK by simulating a click at (0, 0) in the textview.

ChangeLog.claws
configure.in
src/textview.c

index 6986fdf1894f86068bf59a94824ca81ccfb3517b..3bfaddd8a64c3bc858f44a7f35a93e3c0ce1f407 100644 (file)
@@ -1,3 +1,10 @@
+2001-12-08 [alfons]    0.6.5claws65
+
+       * src/textview.c
+               prevent secondary selection claim after "add to sender" dialog
+               popped up. this is because there's a GDK_BUTTON_RELEASE pending.
+               we trick GTK by simulating a click at (0, 0) in the textview.
+
 2001-12-08 [hoa]       0.6.5claws64
 
        * src/folder.c
index 325d7ab1a24df79eddb0691450d6acb0e14675c3..541154556dc21aa2b9da1ba67650e15fe8d808ef 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws64
+EXTRA_VERSION=claws65
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index d6d12e3fe346d61423f78e1e5a320ad9b13ed8f0..3af5cc4e3493ed25c295b30d45f678aacf16bf1f 100644 (file)
@@ -1464,14 +1464,31 @@ static void textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                                if (!g_strncasecmp(uri->uri, "mailto:", 7)) {
                                        if (event->button == 3) {
                                                gchar *fromname, *fromaddress;
+                                               GdkEventButton tmpev;   
+                                               
                                                /* extract url */
                                                fromaddress = g_strdup(uri->uri + 7);
                                                /* Hiroyuki: please put this function in utils.c! */
                                                fromname = procheader_get_fromname(fromaddress);
                                                extract_address(fromaddress);
                                                g_message("adding from textview %s <%s>", fromname, fromaddress);
-                                               // Add to address book - Match
+                                               /* Add to address book - Match */
                                                addressbook_add_contact( fromname, fromaddress, NULL );
+                                               
+                                               /* force press and release at (0, 0) to work around secondary 
+                                                * selection claim */
+                                               tmpev         = *event;
+                                               tmpev.x_root -= tmpev.x;
+                                               tmpev.y_root -= tmpev.y;
+                                               tmpev.x       = 0;
+                                               tmpev.y       = 0;
+                                               tmpev.time    = GDK_CURRENT_TIME;
+                                               gtk_widget_event(widget, (GdkEvent *)&tmpev);
+
+                                               tmpev.type    = GDK_BUTTON_RELEASE;
+                                               tmpev.time    = GDK_CURRENT_TIME;
+                                               gtk_widget_event(widget, (GdkEvent *)&tmpev);
+
                                                g_free(fromaddress);
                                                g_free(fromname);
                                        } else {
@@ -1485,6 +1502,7 @@ static void textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                        }
                }
        }
+       return TRUE;
 }
 
 static void textview_uri_list_remove_all(GSList *uri_list)