Offset invalidated range correctly. Fix scrolling of title window.

Fri Nov 23 18:36:42 2001  Owen Taylor  <otaylor@redhat.com>
	* gtk/gtkrange.c (gtk_range_button_press): Offset
	invalidated range correctly.
	* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
	of title window. (#65001, reported by Damon Chaplin)
	* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
	horrible hack with use of ::event_after.
This commit is contained in:
Owen Taylor 2001-11-23 23:42:30 +00:00 committed by Owen Taylor
parent 2936c8e942
commit 1123956779
10 changed files with 153 additions and 53 deletions

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -1,3 +1,14 @@
Fri Nov 23 18:36:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c (gtk_range_button_press): Offset
invalidated range correctly.
* gtk/gtkclist.c (hadjustment_value_changed): Fix scrolling
of title window. (#65001, reported by Damon Chaplin)
* gtk/gtkcombo.c (gtk_combo_button_event_after): Replace
horrible hack with use of ::event_after.
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com>
* Version 1.3.11 * Version 1.3.11

View File

@ -3789,9 +3789,6 @@ real_unselect_row (GtkCList *clist,
static void static void
real_select_all (GtkCList *clist) real_select_all (GtkCList *clist)
{ {
GList *list;
gint i;
g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
@ -6138,6 +6135,64 @@ vadjustment_value_changed (GtkAdjustment *adjustment,
return; return;
} }
typedef struct
{
GdkWindow *window;
gint dx;
} ScrollData;
/* The window to which widget->window is relative */
#define ALLOCATION_WINDOW(widget) \
(GTK_WIDGET_NO_WINDOW (widget) ? \
(widget)->window : \
gdk_window_get_parent ((widget)->window))
static void
adjust_allocation_recurse (GtkWidget *widget,
gpointer data)
{
ScrollData *scroll_data = data;
if (!GTK_WIDGET_REALIZED (widget))
{
if (GTK_WIDGET_VISIBLE (widget))
{
GdkRectangle tmp_rectangle = widget->allocation;
tmp_rectangle.x += scroll_data->dx;
gtk_widget_size_allocate (widget, &tmp_rectangle);
}
}
else
{
if (ALLOCATION_WINDOW (widget) == scroll_data->window)
{
widget->allocation.x += scroll_data->dx;
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget),
adjust_allocation_recurse,
data);
}
}
}
static void
adjust_allocation (GtkWidget *widget,
gint dx)
{
ScrollData scroll_data;
if (GTK_WIDGET_REALIZED (widget))
scroll_data.window = ALLOCATION_WINDOW (widget);
else
scroll_data.window = NULL;
scroll_data.dx = dx;
adjust_allocation_recurse (widget, &scroll_data);
}
static void static void
hadjustment_value_changed (GtkAdjustment *adjustment, hadjustment_value_changed (GtkAdjustment *adjustment,
gpointer data) gpointer data)
@ -6164,33 +6219,15 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
dx = -value - clist->hoffset; dx = -value - clist->hoffset;
if (GTK_WIDGET_REALIZED (clist)) if (GTK_WIDGET_REALIZED (clist))
{ gdk_window_scroll (clist->title_window, dx, 0);
/* move the column buttons and resize windows */
for (i = (dx<0)? 0 : clist->columns-1; i >= 0 && i < clist->columns; i += (dx<0)? 1 : -1) /* adjust the column button's allocations */
{ for (i = 0; i < clist->columns; i++)
if (clist->column[i].button) if (clist->column[i].button)
{ adjust_allocation (clist->column[i].button, dx);
clist->column[i].button->allocation.x -= value + clist->hoffset;
if (clist->column[i].button->window)
{
gdk_window_move (clist->column[i].button->window,
clist->column[i].button->allocation.x,
clist->column[i].button->allocation.y);
if (clist->column[i].window)
gdk_window_move (clist->column[i].window,
clist->column[i].button->allocation.x +
clist->column[i].button->allocation.width -
(DRAG_WIDTH / 2), 0);
}
}
}
}
clist->hoffset = -value; clist->hoffset = -value;
if (GTK_WIDGET_DRAWABLE (clist)) if (GTK_WIDGET_DRAWABLE (clist))
{ {
if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) && if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) &&

View File

@ -86,7 +86,7 @@ static void gtk_combo_update_list (GtkEntry *entry,
static gint gtk_combo_button_press (GtkWidget *widget, static gint gtk_combo_button_press (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GtkCombo *combo); GtkCombo *combo);
static gint gtk_combo_button_release (GtkWidget *widget, static void gtk_combo_button_event_after (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GtkCombo *combo); GtkCombo *combo);
static gint gtk_combo_list_enter (GtkWidget *widget, static gint gtk_combo_list_enter (GtkWidget *widget,
@ -616,23 +616,15 @@ gtk_combo_button_press (GtkWidget * widget, GdkEvent * event, GtkCombo * combo)
return TRUE; return TRUE;
} }
static gint static void
gtk_combo_button_release (GtkWidget *widget, gtk_combo_button_event_after (GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GtkCombo *combo) GtkCombo *combo)
{ {
GtkWidget *child; GtkWidget *child;
/* Horrible hack to get connect-after effect without regard to the return value of the default if (event->type != GDK_BUTTON_RELEASE)
* handler. return;
*/
gtk_signal_handler_block_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_combo_button_release),
combo);
gtk_widget_event (widget, event);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_combo_button_release),
combo);
if ((combo->current_button != 0) && (event->button.button == 1)) if ((combo->current_button != 0) && (event->button.button == 1))
{ {
@ -669,7 +661,7 @@ gtk_combo_button_release (GtkWidget *widget,
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK, GDK_POINTER_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME); NULL, NULL, GDK_CURRENT_TIME);
return TRUE; return;
} }
} }
else else
@ -684,8 +676,6 @@ gtk_combo_button_release (GtkWidget *widget,
} }
gtk_widget_hide (combo->popwin); gtk_widget_hide (combo->popwin);
return TRUE;
} }
static gint static gint
@ -789,12 +779,8 @@ gtk_combo_init (GtkCombo * combo)
(GtkSignalFunc) gtk_combo_activate, combo); (GtkSignalFunc) gtk_combo_activate, combo);
gtk_signal_connect (GTK_OBJECT (combo->button), "button_press_event", gtk_signal_connect (GTK_OBJECT (combo->button), "button_press_event",
(GtkSignalFunc) gtk_combo_popup_button_press, combo); (GtkSignalFunc) gtk_combo_popup_button_press, combo);
/*gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_release_event",
(GtkSignalFunc) gtk_combo_button_release, combo);*/
gtk_signal_connect (GTK_OBJECT (combo->button), "leave_notify_event", gtk_signal_connect (GTK_OBJECT (combo->button), "leave_notify_event",
(GtkSignalFunc) gtk_combo_popup_button_leave, combo); (GtkSignalFunc) gtk_combo_popup_button_leave, combo);
/*gtk_signal_connect (GTK_OBJECT (combo->button), "clicked",
(GtkSignalFunc)prelight_bug, combo); */
combo->popwin = gtk_window_new (GTK_WINDOW_POPUP); combo->popwin = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_ref (combo->popwin); gtk_widget_ref (combo->popwin);
@ -848,8 +834,8 @@ gtk_combo_init (GtkCombo * combo)
gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event", gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event",
GTK_SIGNAL_FUNC (gtk_combo_button_press), combo); GTK_SIGNAL_FUNC (gtk_combo_button_press), combo);
gtk_signal_connect (GTK_OBJECT (combo->list), "button_release_event", gtk_signal_connect (GTK_OBJECT (combo->list), "event_after",
GTK_SIGNAL_FUNC (gtk_combo_button_release), combo); (GtkSignalFunc) gtk_combo_button_event_after, combo);
/* We connect here on the button, because we'll have a grab on it /* We connect here on the button, because we'll have a grab on it
* when the event occurs. But we are actually interested in enters * when the event occurs. But we are actually interested in enters
* for the combo->list. * for the combo->list.

View File

@ -1161,8 +1161,8 @@ gtk_range_button_press (GtkWidget *widget,
stepper_area = get_area (range, range->layout->mouse_location); stepper_area = get_area (range, range->layout->mouse_location);
gtk_widget_queue_draw_area (widget, gtk_widget_queue_draw_area (widget,
stepper_area->x, widget->allocation.x + stepper_area->x,
stepper_area->y, widget->allocation.y + stepper_area->y,
stepper_area->width, stepper_area->width,
stepper_area->height); stepper_area->height);