summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Hamann <lars@src.gnome.org>1998-07-16 13:05:02 +0000
committerLars Hamann <lars@src.gnome.org>1998-07-16 13:05:02 +0000
commit8f733319d123f4fb42da17a361f5340137805ccd (patch)
tree554b480419e42b18f76d6ffa2f70e4e4b30deb6e
parentaf24aef782056e52eb4d39c2880da648578c2728 (diff)
downloadgtk+-8f733319d123f4fb42da17a361f5340137805ccd.tar.gz
fix for sigsegv in case of drag_target == NULL fix for
* gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in case of drag_target == NULL * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS. Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS. * gtk/gtkfilesel.c (gtk_file_selection_file_button, gtk_dir_selection_file_button): fix due to changes in clist's select_row signal.
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.pre-2-010
-rw-r--r--ChangeLog.pre-2-1010
-rw-r--r--ChangeLog.pre-2-210
-rw-r--r--ChangeLog.pre-2-410
-rw-r--r--ChangeLog.pre-2-610
-rw-r--r--ChangeLog.pre-2-810
-rw-r--r--gtk/gtkclist.c82
-rw-r--r--gtk/gtkctree.c3
-rw-r--r--gtk/gtkfilesel.c64
10 files changed, 159 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 9b88bb27d4..7189dc8bc4 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,13 @@
+Thu Jul 16 14:42:11 1998 Lars Hamann <lars@gtk.org>
+
+ * gtk/gtkctree.c (gtk_ctree_button_release): fix for sigsegv in
+ case of drag_target == NULL
+ * gtk/gtkclist.c (gtk_clist_button_press): fix for GTK_2/3BUTTON_PRESS.
+ Clist did not emit an select_row signal in case of GTK_2/3BUTTON_PRESS.
+ * gtk/gtkfilesel.c (gtk_file_selection_file_button,
+ gtk_dir_selection_file_button): fix due to changes in clist's
+ select_row signal.
+
Thu Jul 16 01:27:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index c17bacb72a..07bba37c40 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -2218,7 +2218,7 @@ real_undo_selection (GtkCList *clist)
return;
if (clist->anchor >= 0)
- resync_selection (clist, NULL);
+ GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
if (!(clist->undo_selection || clist->undo_unselection))
{
@@ -2704,13 +2704,20 @@ gtk_clist_button_press (GtkWidget * widget,
no_focus_row = TRUE;
}
- GTK_CLIST_SET_FLAG (clist, CLIST_DRAG_SELECTION);
- gdk_pointer_grab (clist->clist_window, FALSE,
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON1_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time);
-
+ if (event->type == GDK_BUTTON_PRESS)
+ {
+ GTK_CLIST_SET_FLAG (clist, CLIST_DRAG_SELECTION);
+ gdk_pointer_grab (clist->clist_window, FALSE,
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_BUTTON1_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL, NULL, event->time);
+ }
+ else if (gdk_pointer_is_grabbed ())
+ {
+ GTK_CLIST_UNSET_FLAG (clist, CLIST_DRAG_SELECTION);
+ gdk_pointer_ungrab (event->time);
+ }
if (GTK_CLIST_ADD_MODE (clist))
{
@@ -2749,15 +2756,29 @@ gtk_clist_button_press (GtkWidget * widget,
{
case GTK_SELECTION_SINGLE:
case GTK_SELECTION_MULTIPLE:
- clist->anchor = row;
+ if (event->type != GDK_BUTTON_PRESS)
+ select_row (clist, row, column, (GdkEvent *) event);
+ else
+ clist->anchor = row;
break;
case GTK_SELECTION_BROWSE:
- if (row != old_row || no_focus_row)
- select_row (clist, row, column, (GdkEvent *) event);
+ select_row (clist, row, column, (GdkEvent *) event);
break;
case GTK_SELECTION_EXTENDED:
+ if (event->type != GDK_BUTTON_PRESS)
+ {
+ if (clist->anchor != -1)
+ {
+ update_extended_selection (clist, clist->focus_row);
+ GTK_CLIST_CLASS_FW (clist)->resync_selection
+ (clist, (GdkEvent *) event);
+ }
+ select_row (clist, row, column, (GdkEvent *) event);
+ break;
+ }
+
if (event->state & GDK_CONTROL_MASK)
{
if (event->state & GDK_SHIFT_MASK)
@@ -2772,24 +2793,27 @@ gtk_clist_button_press (GtkWidget * widget,
else
update_extended_selection (clist, clist->focus_row);
}
- return TRUE;
+ break;
}
+
if (event->state & GDK_SHIFT_MASK)
{
set_anchor (clist, FALSE, old_row, old_row);
update_extended_selection (clist, clist->focus_row);
- return TRUE;
+ break;
}
+
if (clist->anchor == -1)
set_anchor (clist, FALSE, row, old_row);
else
update_extended_selection (clist, clist->focus_row);
- return TRUE;
+ break;
default:
break;
}
}
+
return FALSE;
}
@@ -3056,7 +3080,7 @@ gtk_clist_motion (GtkWidget * widget,
}
}
else
- return TRUE;
+ return FALSE;
}
row = ROW_FROM_YPIXEL (clist, y);
@@ -3064,7 +3088,7 @@ gtk_clist_motion (GtkWidget * widget,
/* don't scroll on last pixel row if it's a cell spacing */
if (y == clist->clist_window_height-1 &&
y == ROW_TOP_YPIXEL (clist, row-1) + clist->row_height)
- return TRUE;
+ return FALSE;
/* vertical autoscrolling */
if (LIST_HEIGHT (clist) > clist->clist_window_height &&
@@ -3079,7 +3103,7 @@ gtk_clist_motion (GtkWidget * widget,
if ((y < 0 && clist->focus_row == 0) ||
(y >= clist->clist_window_height &&
clist->focus_row == clist->rows-1))
- return TRUE;
+ return FALSE;
if (row < 0 && clist->focus_row > 0)
{
@@ -3101,7 +3125,7 @@ gtk_clist_motion (GtkWidget * widget,
gtk_clist_draw_focus (widget);
}
else
- return TRUE;
+ return FALSE;
switch (clist->selection_mode)
{
@@ -3123,11 +3147,11 @@ gtk_clist_motion (GtkWidget * widget,
move_vertical (clist, row, 1);
}
else
- return TRUE;
+ return FALSE;
}
if (row == clist->focus_row)
- return TRUE;
+ return FALSE;
/* dragging inside clist_window */
if (row < 0 && clist->focus_row > 0)
@@ -3149,13 +3173,13 @@ gtk_clist_motion (GtkWidget * widget,
gtk_clist_draw_focus (widget);
}
else
- return TRUE;
+ return FALSE;
switch (clist->selection_mode)
{
case GTK_SELECTION_EXTENDED:
update_extended_selection (clist, clist->focus_row);
- return TRUE;
+ return FALSE;
case GTK_SELECTION_BROWSE:
select_row (clist, clist->focus_row, -1, (GdkEvent *) event);
@@ -3176,7 +3200,7 @@ gtk_clist_motion (GtkWidget * widget,
clist->clist_window_height)
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
}
- return TRUE;
+ return FALSE;
}
static void
@@ -4984,16 +5008,19 @@ static gint
gtk_clist_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
+ GtkCList *clist;
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_draw_focus (widget);
+
+ clist = GTK_CLIST (widget);
- if (GTK_CLIST (widget)->anchor != -1)
- GTK_CLIST_CLASS_FW (widget)->resync_selection
- (GTK_CLIST (widget), (GdkEvent *) event);
+ if (clist->anchor != -1 && clist->selection_mode == GTK_SELECTION_EXTENDED)
+ GTK_CLIST_CLASS_FW (widget)->resync_selection (clist, (GdkEvent *) event);
return FALSE;
}
@@ -5398,6 +5425,9 @@ update_extended_selection (GtkCList *clist,
gint h2 = 0;
gint top;
+ if (clist->selection_mode != GTK_SELECTION_EXTENDED || clist->anchor == -1)
+ return;
+
if (row < 0)
row = 0;
if (row >= clist->rows)
diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c
index 6171c2820c..17f23e8967 100644
--- a/gtk/gtkctree.c
+++ b/gtk/gtkctree.c
@@ -865,7 +865,8 @@ gtk_ctree_button_release (GtkWidget *widget,
if (event->x < 0 || event->y < -3 ||
event->x > clist->clist_window_width ||
event->y > clist->clist_window_height + 3 ||
- ctree->drag_target == ctree->drag_source)
+ ctree->drag_target == ctree->drag_source ||
+ !ctree->drag_target)
return GTK_WIDGET_CLASS (parent_class)->button_release_event
(widget, event);
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index 36fc45f888..9ee6ea9f7c 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -1172,25 +1172,24 @@ gtk_file_selection_file_button (GtkWidget *widget,
gtk_clist_get_text (GTK_CLIST (fs->file_list), row, 0, &temp);
filename = g_strdup (temp);
- if (bevent && filename)
+ if (filename)
{
- switch (bevent->type)
- {
- case GDK_BUTTON_PRESS:
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- break;
-
- case GDK_2BUTTON_PRESS:
- gtk_button_clicked (GTK_BUTTON (fs->ok_button));
- break;
-
- default:
- break;
- }
- }
+ if (bevent)
+ switch (bevent->type)
+ {
+ case GDK_2BUTTON_PRESS:
+ gtk_button_clicked (GTK_BUTTON (fs->ok_button));
+ break;
+
+ default:
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+ break;
+ }
+ else
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- if (filename)
- g_free (filename);
+ g_free (filename);
+ }
}
static void
@@ -1212,25 +1211,24 @@ gtk_file_selection_dir_button (GtkWidget *widget,
gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &temp);
filename = g_strdup (temp);
- if (bevent && filename)
+ if (filename)
{
- switch (bevent->type)
- {
- case GDK_BUTTON_PRESS:
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- break;
+ if (bevent)
+ switch (bevent->type)
+ {
+ case GDK_2BUTTON_PRESS:
+ gtk_file_selection_populate (fs, filename, FALSE);
+ break;
- case GDK_2BUTTON_PRESS:
- gtk_file_selection_populate (fs, filename, FALSE);
- break;
-
- default:
- break;
- }
+ default:
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+ break;
+ }
+ else
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+
+ g_free (filename);
}
-
- if (filename)
- g_free (filename);
}
static void