fixed bug #490076 (hunted down by Alfons who implemented a workaround
authorMelvin Hadasht <melvin.hadasht@free.fr>
Sun, 9 Dec 2001 20:44:24 +0000 (20:44 +0000)
committerMelvin Hadasht <melvin.hadasht@free.fr>
Sun, 9 Dec 2001 20:44:24 +0000 (20:44 +0000)
in 0.6.5claws65)

ChangeLog.claws
configure.in
src/textview.c
src/textview.h

index 0cc3b92fea7308a7f513d798d469cffacdce332e..bbb4aaad75dbfe5496148aa9b75635be627f6ca8 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-09 [melvin]    0.6.5claws70
+       
+       * src/textview.[ch]
+               fixed bug #490076 (hunted down by Alfons who implemented
+               a workaround in 0.6.5claws65)
+
 2001-12-09 [christoph] 0.6.5claws69
 
        * src/summaryview.c
index fdea532dc6b5d2d186aa5c4a56b37af6bce19e69..ccc76c38451bd2837070387813b89daf4d2edb0f 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws69
+EXTRA_VERSION=claws70
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 3af5cc4e3493ed25c295b30d45f678aacf16bf1f..53d8e0f3787a73a584908c704de848bcd526effd 100644 (file)
@@ -119,7 +119,10 @@ static void textview_show_header   (TextView       *textview,
 static void textview_key_pressed       (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         TextView       *textview);
-static void textview_button_pressed    (GtkWidget      *widget,
+static gint textview_button_pressed    (GtkWidget      *widget,
+                                        GdkEventButton *event,
+                                        TextView       *textview);
+static gint textview_button_released   (GtkWidget      *widget,
                                         GdkEventButton *event,
                                         TextView       *textview);
 
@@ -194,12 +197,18 @@ TextView *textview_create(void)
        gtk_signal_connect_after(GTK_OBJECT(text_sb), "button_press_event",
                                 GTK_SIGNAL_FUNC(textview_button_pressed),
                                 textview);
+       gtk_signal_connect_after(GTK_OBJECT(text_sb), "button_release_event",
+                                GTK_SIGNAL_FUNC(textview_button_released),
+                                textview);
        gtk_signal_connect(GTK_OBJECT(text_mb), "key_press_event",
                           GTK_SIGNAL_FUNC(textview_key_pressed),
                           textview);
        gtk_signal_connect_after(GTK_OBJECT(text_mb), "button_press_event",
                                 GTK_SIGNAL_FUNC(textview_button_pressed),
                                 textview);
+       gtk_signal_connect_after(GTK_OBJECT(text_mb), "button_release_event",
+                                GTK_SIGNAL_FUNC(textview_button_released),
+                                textview);
 
        gtk_widget_show(scrolledwin_sb);
        gtk_widget_show(scrolledwin_mb);
@@ -218,6 +227,7 @@ TextView *textview_create(void)
        textview->uri_list       = NULL;
        textview->body_pos       = 0;
        textview->cur_pos        = 0;
+       textview->last_buttonpress = GDK_NOTHING;
 
        return textview;
 }
@@ -1438,21 +1448,29 @@ static void textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
        }
 }
 
-static void textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
+static gint textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
+                                   TextView *textview)
+{
+       if (event)
+               textview->last_buttonpress = event->type;
+       return FALSE;
+}
+
+static gint textview_button_released(GtkWidget *widget, GdkEventButton *event,
                                    TextView *textview)
 {
        textview->cur_pos = 
                gtk_editable_get_position(GTK_EDITABLE(textview->text));
 
-       if (event &&
-           ((event->button == 1 && event->type == GDK_2BUTTON_PRESS)
+       if (event && 
+           ((event->button == 1 && textview->last_buttonpress == GDK_2BUTTON_PRESS)
             || event->button == 2 || event->button == 3)) {
                GSList *cur;
 
                /* double click seems to set the cursor after the current
                 * word. The cursor position needs fixing, otherwise the
                 * last word of a clickable zone will not work */
-               if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
+               if (event->button == 1 && textview->last_buttonpress == GDK_2BUTTON_PRESS) {
                        textview->cur_pos--;
                }
 
@@ -1475,20 +1493,6 @@ static void textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                                                /* 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 {
@@ -1502,7 +1506,9 @@ static void textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                        }
                }
        }
-       return TRUE;
+       if (event)
+               textview->last_buttonpress = event->type;
+       return FALSE;
 }
 
 static void textview_uri_list_remove_all(GSList *uri_list)
index e3eccdf48951aaaa6a39193f7967bb5f1f221080..dca4d858758a69e28b2086012354336af948440e 100644 (file)
@@ -54,6 +54,8 @@ struct _TextView
        gint prev_descent;
 
        MessageView *messageview;
+
+       gint last_buttonpress;
 };
 
 TextView *textview_create      (void);