Document expose event->region change and that gtk_widget_event doesn't

2001-03-09  Alexander Larsson  <alexl@redhat.com>

	* docs/Changes-2.0.txt:
	Document expose event->region change and that gtk_widget_event
	doesn't allow passing expose events.

	* gdk/gdkevents.h:
	Add region to expose event.

	* gdk/gdkevents.c:
	Handle event->region in gdk_event_copy() and gdk_event_free().

	* gdk/gdkwindow.c (gdk_window_process_updates_internal):
	Generate expose_event->region when creating expose events.

	* gdk/x11/gdkevents-x11.c:
	Generate expose events with regions when translating X events.

	* gtk/gtkcontainer.[ch]:
	Default expose handler that propagates expose events to NO_WINDOW
	children. New function gtk_container_propagate_expose()

	* gtk/gtkwidget.[ch]:
	Moved gtk_widget_event implementation to gtk_widget_event_internal.
	gtk_widget_event calls gtk_widget_event_internal but doesn't allow
	expose events. New function gtk_widget_send_expose() to send expose
	events. New function gtk_widget_region_intersect() to calculate
	window/region intersections.

	* gtk/gtkmain.c (gtk_main_do_event):
	Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
	Use gtk_widget_send_expose() to send expose events.

	* gtk/gtkbin.c:
	* gtk/gtkbox.c:
	* gtk/gtkfixed.c:
	* gtk/gtkimagemenuitem.c:
	* gtk/gtklist.c:
	* gtk/gtkpacker.c:
	* gtk/gtktable.c:
	* gtk/gtktree.c:
	Remove expose handler, using the default container implementation
	instead.

	* gtk/gtkbutton.c:
	* gtk/gtkcheckbutton.c:
	* gtk/gtkeventbox.c:
	* gtk/gtkfixed.c:
	* gtk/gtkhandlebox.c:
	* gtk/gtklayout.c:
	* gtk/gtklistitem.c:
	* gtk/gtkmenu.c:
	* gtk/gtkmenubar.c:
	* gtk/gtkmenuitem.c:
	* gtk/gtknotebook.c:
	* gtk/gtkoptionmenu.c:
	* gtk/gtkpaned.c:
	* gtk/gtkscrolledwindow.c:
	* gtk/gtktogglebutton.c:
	* gtk/gtktoolbar.c:
	* gtk/gtktreeitem.c:
	* gtk/gtkviewport.c:
	Chain expose handler to parent class handler. Use
	gtk_container_propagate_expose() to propagate exposes.

	* gtk/gtkclist.c (check_exposures):
	* gtk/gtktext.c (process_exposes):
	Use gtk_widget_send_expose instead of gtk_widget_event.
This commit is contained in:
Alexander Larsson 2001-03-09 13:28:26 +00:00 committed by Alexander Larsson
parent 8f35f03045
commit e7d4a7f90d
45 changed files with 720 additions and 502 deletions

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -1,3 +1,64 @@
2001-03-09 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt:
Document expose event->region change and that gtk_widget_event
doesn't allow passing expose events.
* gdk/gdkevents.h:
Add region to expose event.
* gdk/gdkevents.c:
Handle event->region in gdk_event_copy() and gdk_event_free().
* gdk/gdkwindow.c (gdk_window_process_updates_internal):
Generate expose_event->region when creating expose events.
* gdk/x11/gdkevents-x11.c:
Generate expose events with regions when translating X events.
* gtk/gtkcontainer.[ch]:
Default expose handler that propagates expose events to NO_WINDOW
children. New function gtk_container_propagate_expose()
* gtk/gtkmain.c (gtk_main_do_event):
Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect().
Use gtk_widget_send_expose() to send expose events.
* gtk/gtkbin.c:
* gtk/gtkbox.c:
* gtk/gtkfixed.c:
* gtk/gtkimagemenuitem.c:
* gtk/gtklist.c:
* gtk/gtkpacker.c:
* gtk/gtktable.c:
* gtk/gtktree.c:
Remove expose handler, using the default container implementation
instead.
* gtk/gtkbutton.c:
* gtk/gtkcheckbutton.c:
* gtk/gtkeventbox.c:
* gtk/gtkfixed.c:
* gtk/gtkhandlebox.c:
* gtk/gtklayout.c:
* gtk/gtklistitem.c:
* gtk/gtkmenu.c:
* gtk/gtkmenubar.c:
* gtk/gtkmenuitem.c:
* gtk/gtknotebook.c:
* gtk/gtkoptionmenu.c:
* gtk/gtkpaned.c:
* gtk/gtkscrolledwindow.c:
* gtk/gtktogglebutton.c:
* gtk/gtktoolbar.c:
* gtk/gtktreeitem.c:
Chain expose handler to parent class handler. Use
gtk_container_propagate_expose() to propagate exposes.
* gtk/gtkclist.c (check_exposures):
* gtk/gtktext.c (process_exposes):
Use gtk_widget_send_expose instead of gtk_widget_event.
Thu Mar 8 19:40:28 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_destroy): Add destroy function.

View File

@ -279,6 +279,17 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
implementation, since they will already have working expose_event
implementations. The draw method was rarely called in practice
anyway.
* The GdkExposeEvent has a new region field. This can be used instead
of the area field if you want a more exact representation of the
area to update.
* Sending synthetic exposes using gtk_widget_event is no longer allowed.
If you just need an expose call you should use gdk_window_invalidate_rect()
or gdk_window_invalidate_region() instead. For the case of container
widgets that need to propagate expose events to NO_WINDOW children
you can either use gtk_container_propagate_expose(), or chain to the
default container expose handler.
* The draw_default and draw_focus methods/signals on GtkWidget are
gone; simply draw things in your expose handler.

View File

@ -322,7 +322,11 @@ gdk_event_copy (GdkEvent *event)
gdk_drag_context_ref (event->dnd.context);
break;
default:
case GDK_EXPOSE:
if (event->expose.region)
new_event->expose.region = gdk_region_copy (event->expose.region);
break;
default:
break;
}
@ -384,7 +388,12 @@ gdk_event_free (GdkEvent *event)
if (event->button.axes)
g_free (event->button.axes);
break;
case GDK_EXPOSE:
if (event->expose.region)
gdk_region_destroy (event->expose.region);
break;
case GDK_MOTION_NOTIFY:
if (event->motion.axes)
g_free (event->motion.axes);

View File

@ -215,6 +215,7 @@ struct _GdkEventExpose
GdkWindow *window;
gint8 send_event;
GdkRectangle area;
GdkRegion *region;
gint count; /* If non-zero, how many more events follow. */
};

View File

@ -1748,6 +1748,8 @@ gdk_window_process_updates_internal (GdkWindow *window)
{
GdkEvent event;
GdkRectangle window_rect;
GdkRegion *expose_region;
GdkRegion *window_region;
gint width, height;
if (debug_updates)
@ -1769,16 +1771,28 @@ gdk_window_process_updates_internal (GdkWindow *window)
event.expose.type = GDK_EXPOSE;
event.expose.window = gdk_window_ref (window);
event.expose.count = 0;
gdk_region_get_clipbox (update_area, &event.expose.area);
if (gdk_rectangle_intersect (&event.expose.area, &window_rect, &event.expose.area))
if (save_region)
expose_region = gdk_region_copy (update_area);
else
expose_region = update_area;
window_region = gdk_region_rectangle (&window_rect);
gdk_region_intersect (expose_region,
window_region);
gdk_region_destroy (window_region);
event.expose.region = expose_region;
gdk_region_get_clipbox (expose_region, &event.expose.area);
if (!gdk_region_empty (expose_region))
{
(*gdk_event_func) (&event, gdk_event_data);
}
if (expose_region != update_area)
gdk_region_destroy (expose_region);
gdk_window_unref (window);
}
if (!save_region)
gdk_region_destroy (update_area);
}

View File

@ -973,6 +973,7 @@ gdk_event_translate (GdkEvent *event,
{
event->expose.type = GDK_EXPOSE;
event->expose.area = expose_rect;
event->expose.region = gdk_region_rectangle (&expose_rect);
event->expose.window = window;
event->expose.count = xevent->xexpose.count;
@ -1007,6 +1008,7 @@ gdk_event_translate (GdkEvent *event,
{
event->expose.type = GDK_EXPOSE;
event->expose.area = expose_rect;
event->expose.region = gdk_region_rectangle (&expose_rect);
event->expose.window = window;
event->expose.count = xevent->xgraphicsexpose.count;

View File

@ -31,8 +31,6 @@ static void gtk_bin_class_init (GtkBinClass *klass);
static void gtk_bin_init (GtkBin *bin);
static void gtk_bin_map (GtkWidget *widget);
static void gtk_bin_unmap (GtkWidget *widget);
static gint gtk_bin_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_bin_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_bin_remove (GtkContainer *container,
@ -87,7 +85,6 @@ gtk_bin_class_init (GtkBinClass *class)
widget_class->map = gtk_bin_map;
widget_class->unmap = gtk_bin_unmap;
widget_class->expose_event = gtk_bin_expose;
container_class->add = gtk_bin_add;
container_class->remove = gtk_bin_remove;
@ -151,32 +148,6 @@ gtk_bin_unmap (GtkWidget *widget)
gtk_widget_unmap (bin->child);
}
static gint
gtk_bin_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_BIN (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
bin = GTK_BIN (widget);
child_event = *event;
if (bin->child && GTK_WIDGET_DRAWABLE (bin->child) &&
GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
return FALSE;
}
static void
gtk_bin_add (GtkContainer *container,
GtkWidget *child)

View File

@ -51,8 +51,6 @@ static void gtk_box_set_arg (GtkObject *object,
guint arg_id);
static void gtk_box_map (GtkWidget *widget);
static void gtk_box_unmap (GtkWidget *widget);
static gint gtk_box_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_box_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_box_remove (GtkContainer *container,
@ -126,7 +124,6 @@ gtk_box_class_init (GtkBoxClass *class)
widget_class->map = gtk_box_map;
widget_class->unmap = gtk_box_unmap;
widget_class->expose_event = gtk_box_expose;
container_class->add = gtk_box_add;
container_class->remove = gtk_box_remove;
@ -645,41 +642,6 @@ gtk_box_unmap (GtkWidget *widget)
}
}
static gint
gtk_box_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBox *box;
GtkBoxChild *child;
GdkEventExpose child_event;
GList *children;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_BOX (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
box = GTK_BOX (widget);
child_event = *event;
children = box->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_DRAWABLE (child->widget) &&
GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_box_add (GtkContainer *container,
GtkWidget *widget)

View File

@ -142,9 +142,8 @@ gtk_button_class_init (GtkButtonClass *klass)
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass;
parent_class = gtk_type_class (GTK_TYPE_BIN);
parent_class = g_type_class_peek_parent (klass);
object_class->set_arg = gtk_button_set_arg;
object_class->get_arg = gtk_button_get_arg;
@ -715,7 +714,6 @@ gtk_button_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
@ -726,13 +724,10 @@ gtk_button_expose (GtkWidget *widget,
bin = GTK_BIN (widget);
gtk_button_paint (widget, &event->area);
child_event = *event;
if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;
}

View File

@ -243,7 +243,6 @@ gtk_check_button_expose (GtkWidget *widget,
GtkCheckButton *check_button;
GtkToggleButton *toggle_button;
GtkBin *bin;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CHECK_BUTTON (widget), FALSE);
@ -259,16 +258,13 @@ gtk_check_button_expose (GtkWidget *widget,
{
gtk_check_button_paint (widget, &event->area);
child_event = *event;
if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
else
{
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
if (bin->child)
gtk_container_propagate_expose (GTK_CONTAINER (widget),
bin->child,
event);
}
else if (GTK_WIDGET_CLASS (parent_class)->expose_event)
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -6350,7 +6350,7 @@ check_exposures (GtkCList *clist)
* again */
while ((event = gdk_event_get_graphics_expose (clist->clist_window)) != NULL)
{
gtk_widget_event (GTK_WIDGET (clist), event);
gtk_widget_send_expose (GTK_WIDGET (clist), event);
if (event->expose.count == 0)
{
gdk_event_free (event);

View File

@ -96,6 +96,8 @@ static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget);
static gint gtk_container_expose (GtkWidget *widget,
GdkEventExpose *event);
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
@ -172,6 +174,7 @@ gtk_container_class_init (GtkContainerClass *class)
widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_all;
widget_class->expose_event = gtk_container_expose;
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
@ -1963,3 +1966,95 @@ gtk_container_hide_all (GtkWidget *widget)
(GtkCallback) gtk_widget_hide_all,
NULL);
}
static void
gtk_container_expose_child (GtkWidget *child,
gpointer client_data)
{
struct {
GtkWidget *container;
GdkEventExpose *event;
} *data = client_data;
gtk_container_propagate_expose (GTK_CONTAINER (data->container),
child,
data->event);
}
static gint
gtk_container_expose (GtkWidget *widget,
GdkEventExpose *event)
{
struct {
GtkWidget *container;
GdkEventExpose *event;
} data;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
data.container = widget;
data.event = event;
gtk_container_foreach (GTK_CONTAINER (widget),
gtk_container_expose_child,
&data);
}
return TRUE;
}
/**
* gtk_container_propagate_expose:
* @container: a #GtkContainer
* @child: a child of @container
* @event: a expose event sent to container
*
* When a container receives an expose event, it must send synthetic
* expose events to all children that don't have their own GdkWindows.
* This function provides a convenient way of doing this. A container,
* when it receives an expose event, gtk_container_propagate_expose()
* once for each child, passing in the event the container received.
*
* gtk_container_propagate expose() takes care of deciding whether
* an expose event needs to be sent to the child, intersecting
* the event's area with the child area, and sending the event.
*
* In most cases, a container can simply either simply inherit the
* ::expose implementation from GtkContainer, or, do some drawing
* and then chain to the ::expose implementation from GtkContainer.
**/
void
gtk_container_propagate_expose (GtkContainer *container,
GtkWidget *child,
GdkEventExpose *event)
{
GdkEventExpose child_event;
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (event != NULL);
g_assert (child->parent == GTK_WIDGET (container));
if (GTK_WIDGET_DRAWABLE (child) &&
GTK_WIDGET_NO_WINDOW (child) &&
(child->window == event->window))
{
child_event = *event;
child_event.region = gtk_widget_region_intersect (child, event->region);
if (!gdk_region_empty (child_event.region))
{
gdk_region_get_clipbox (child_event.region, &child_event.area);
gtk_widget_send_expose (child, (GdkEvent *)&child_event);
}
gdk_region_destroy (child_event.region);
}
}

View File

@ -130,6 +130,9 @@ void gtk_container_foreach_full (GtkContainer *container,
GList* gtk_container_children (GtkContainer *container);
gboolean gtk_container_focus (GtkContainer *container,
GtkDirectionType direction);
void gtk_container_propagate_expose (GtkContainer *container,
GtkWidget *child,
GdkEventExpose *event);
/* Widget-level methods */

View File

@ -41,6 +41,8 @@ static gint gtk_event_box_expose (GtkWidget *widget,
GdkEventExpose *event);
static GtkBinClass *parent_class = NULL;
GtkType
gtk_event_box_get_type (void)
{
@ -71,6 +73,8 @@ gtk_event_box_class_init (GtkEventBoxClass *class)
{
GtkWidgetClass *widget_class;
parent_class = g_type_class_peek_parent (class);
widget_class = (GtkWidgetClass*) class;
widget_class->realize = gtk_event_box_realize;
@ -204,24 +208,15 @@ static gint
gtk_event_box_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
bin = GTK_BIN (widget);
gtk_event_box_paint (widget, &event->area);
child_event = *event;
if (bin->child &&
GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -37,8 +37,6 @@ static void gtk_fixed_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_fixed_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_fixed_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_fixed_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_fixed_remove (GtkContainer *container,
@ -95,7 +93,6 @@ gtk_fixed_class_init (GtkFixedClass *class)
widget_class->realize = gtk_fixed_realize;
widget_class->size_request = gtk_fixed_size_request;
widget_class->size_allocate = gtk_fixed_size_allocate;
widget_class->expose_event = gtk_fixed_expose;
container_class->add = gtk_fixed_add;
container_class->remove = gtk_fixed_remove;
@ -349,41 +346,6 @@ gtk_fixed_paint (GtkWidget *widget,
area->width, area->height);
}
static gint
gtk_fixed_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkFixed *fixed;
GtkFixedChild *child;
GdkEventExpose child_event;
GList *children;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_FIXED (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
fixed = GTK_FIXED (widget);
child_event = *event;
children = fixed->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area,
&child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_fixed_add (GtkContainer *container,
GtkWidget *widget)

View File

@ -399,6 +399,7 @@ gtk_frame_paint (GtkWidget *widget,
x2 = widget->style->xthickness + (frame->child_allocation.width - child_requisition.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_SIDE_PAD;
gtk_paint_shadow_gap (widget->style, widget->window,
GTK_STATE_NORMAL, frame->shadow_type,
area, widget, "frame",
@ -418,27 +419,11 @@ static gboolean
gtk_frame_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin = GTK_BIN (widget);
GtkFrame *frame = GTK_FRAME (widget);
GdkEventExpose child_event;
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_frame_paint (widget, &event->area);
if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child))
{
child_event = *event;
if (gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
if (frame->label_widget && GTK_WIDGET_NO_WINDOW (frame->label_widget))
{
child_event = *event;
if (gtk_widget_intersect (frame->label_widget, &event->area, &child_event.area))
gtk_widget_event (frame->label_widget, (GdkEvent*) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -813,7 +813,6 @@ gtk_handle_box_paint (GtkWidget *widget,
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
GdkRectangle child_area;
GdkEventExpose child_event;
if (!event) /* we were called from draw() */
{
@ -821,13 +820,7 @@ gtk_handle_box_paint (GtkWidget *widget,
gtk_widget_draw (bin->child, &child_area);
}
else /* we were called from expose() */
{
child_event = *event;
if (GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent *) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
}

View File

@ -35,8 +35,6 @@ static void gtk_image_menu_item_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_image_menu_item_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gint gtk_image_menu_item_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_image_menu_item_remove (GtkContainer *container,
GtkWidget *child);
static void gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
@ -108,7 +106,6 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM);
widget_class->expose_event = gtk_image_menu_item_expose;
widget_class->size_request = gtk_image_menu_item_size_request;
widget_class->size_allocate = gtk_image_menu_item_size_allocate;
widget_class->map = gtk_image_menu_item_map;
@ -279,31 +276,6 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
}
}
static gint
gtk_image_menu_item_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GdkEventExpose child_event;
GtkImageMenuItem *image_menu_item;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_IMAGE_MENU_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
image_menu_item = GTK_IMAGE_MENU_ITEM (widget);
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
child_event = *event;
if (image_menu_item->image && GTK_WIDGET_DRAWABLE (image_menu_item->image) &&
GTK_WIDGET_NO_WINDOW (image_menu_item->image) &&
gtk_widget_intersect (image_menu_item->image, &event->area, &child_event.area))
gtk_widget_event (image_menu_item->image, (GdkEvent*) &child_event);
return FALSE;
}
static void
gtk_image_menu_item_map (GtkWidget *widget)
{

View File

@ -606,9 +606,7 @@ gtk_layout_size_allocate (GtkWidget *widget,
static gint
gtk_layout_expose (GtkWidget *widget, GdkEventExpose *event)
{
GList *tmp_list;
GtkLayout *layout;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_LAYOUT (widget), FALSE);
@ -618,18 +616,7 @@ gtk_layout_expose (GtkWidget *widget, GdkEventExpose *event)
if (event->window != layout->bin_window)
return FALSE;
tmp_list = layout->children;
while (tmp_list)
{
GtkLayoutChild *child = tmp_list->data;
tmp_list = tmp_list->next;
child_event = *event;
if (GTK_WIDGET_DRAWABLE (child->widget) &&
GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
return FALSE;
}

View File

@ -68,8 +68,6 @@ static void gtk_list_map (GtkWidget *widget);
static void gtk_list_unmap (GtkWidget *widget);
static void gtk_list_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static gint gtk_list_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_list_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_list_button_press (GtkWidget *widget,
@ -224,7 +222,6 @@ gtk_list_class_init (GtkListClass *class)
widget_class->unmap = gtk_list_unmap;
widget_class->style_set = gtk_list_style_set;
widget_class->realize = gtk_list_realize;
widget_class->expose_event = gtk_list_expose;
widget_class->button_press_event = gtk_list_button_press;
widget_class->button_release_event = gtk_list_button_release;
widget_class->motion_notify_event = gtk_list_motion_notify;
@ -836,40 +833,6 @@ gtk_list_button_release (GtkWidget *widget,
return FALSE;
}
static gint
gtk_list_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkList *list;
GtkWidget *child;
GdkEventExpose child_event;
GList *children;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
list = GTK_LIST (widget);
child_event = *event;
children = list->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_list_style_set (GtkWidget *widget,
GtkStyle *previous_style)

View File

@ -483,16 +483,7 @@ gtk_list_item_expose (GtkWidget *widget,
0, 0, -1, -1);
}
if (bin->child)
{
GdkEventExpose child_event;
child_event = *event;
if (GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
if (GTK_WIDGET_HAS_FOCUS (widget))
{

View File

@ -869,9 +869,9 @@ gtk_main_do_event (GdkEvent *event)
case GDK_EXPOSE:
if (event->any.window && GTK_WIDGET_DOUBLE_BUFFERED (event_widget))
gdk_window_begin_paint_rect (event->any.window, &event->expose.area);
gdk_window_begin_paint_region (event->any.window, event->expose.region);
gtk_widget_event (event_widget, event);
gtk_widget_send_expose (event_widget, event);
if (event->any.window && GTK_WIDGET_DOUBLE_BUFFERED (event_widget))
gdk_window_end_paint (event->any.window);

View File

@ -1369,34 +1369,15 @@ static gboolean
gtk_menu_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkMenuShell *menu_shell;
GtkWidget *child;
GList *children;
GtkMenu *menu;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
menu_shell = GTK_MENU_SHELL (widget);
menu = GTK_MENU (widget);
if (GTK_WIDGET_DRAWABLE (widget))
{
GdkEventExpose child_event = *event;
gtk_menu_paint (widget);
children = menu_shell->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -58,6 +58,8 @@ static gint gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static GtkMenuShellClass *parent_class = NULL;
GtkType
gtk_menu_bar_get_type (void)
{
@ -92,6 +94,8 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GtkBindingSet *binding_set;
parent_class = g_type_class_peek_parent (class);
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
menu_shell_class = (GtkMenuShellClass*) class;
@ -384,11 +388,6 @@ static gint
gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkMenuShell *menu_shell;
GdkEventExpose child_event;
GList *children;
GtkWidget *child;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU_BAR (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -397,19 +396,7 @@ gtk_menu_bar_expose (GtkWidget *widget,
{
gtk_menu_bar_paint (widget, &event->area);
menu_shell = GTK_MENU_SHELL (widget);
child_event = *event;
children = menu_shell->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -523,9 +523,6 @@ static gint
gtk_menu_item_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -534,16 +531,7 @@ gtk_menu_item_expose (GtkWidget *widget,
{
gtk_menu_item_paint (widget, &event->area);
bin = GTK_BIN (widget);
if (bin->child)
{
child_event = *event;
if (GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -958,7 +958,6 @@ gtk_notebook_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkNotebook *notebook;
GdkEventExpose child_event;
GdkRectangle child_area;
g_return_val_if_fail (widget != NULL, FALSE);
@ -978,12 +977,11 @@ gtk_notebook_expose (GtkWidget *widget,
gtk_notebook_draw_focus (widget);
}
child_event = *event;
if (notebook->cur_page &&
GTK_WIDGET_NO_WINDOW (notebook->cur_page->child) &&
gtk_widget_intersect (notebook->cur_page->child, &event->area,
&child_event.area))
gtk_widget_event (notebook->cur_page->child, (GdkEvent*) &child_event);
if (notebook->cur_page)
gtk_container_propagate_expose (GTK_CONTAINER (notebook),
notebook->cur_page->child,
event);
}
return FALSE;
@ -2350,12 +2348,14 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
expose_event.window = page->tab_label->window;
expose_event.area = child_area;
expose_event.region = gdk_region_rectangle (&child_area);
expose_event.send_event = TRUE;
expose_event.type = GDK_EXPOSE;
expose_event.count = 0;
gtk_widget_event (page->tab_label,
(GdkEvent*)&expose_event);
gtk_container_propagate_expose (GTK_CONTAINER (notebook), page->tab_label, &expose_event);
gdk_region_destroy (expose_event.region);
}
}
}

View File

@ -430,10 +430,6 @@ static gint
gtk_option_menu_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkWidget *child;
GdkEventExpose child_event;
gint remove_child;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -477,13 +473,10 @@ gtk_option_menu_expose (GtkWidget *widget,
if (remove_child)
gtk_option_menu_remove_contents (GTK_OPTION_MENU (widget));
#else
remove_child = FALSE;
child = GTK_BIN (widget)->child;
child_event = *event;
if (child && GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event);
if (GTK_BIN (widget)->child)
gtk_container_propagate_expose (GTK_CONTAINER (widget),
GTK_BIN (widget)->child,
event);
#endif /* 0 */
}

View File

@ -127,8 +127,6 @@ static void gtk_packer_class_init (GtkPackerClass *klass);
static void gtk_packer_init (GtkPacker *packer);
static void gtk_packer_map (GtkWidget *widget);
static void gtk_packer_unmap (GtkWidget *widget);
static gint gtk_packer_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_packer_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_packer_size_allocate (GtkWidget *widget,
@ -222,7 +220,6 @@ gtk_packer_class_init (GtkPackerClass *klass)
widget_class->map = gtk_packer_map;
widget_class->unmap = gtk_packer_unmap;
widget_class->expose_event = gtk_packer_expose;
widget_class->size_request = gtk_packer_size_request;
widget_class->size_allocate = gtk_packer_size_allocate;
@ -893,40 +890,6 @@ gtk_packer_unmap (GtkWidget *widget)
}
}
static gint
gtk_packer_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkPacker *packer;
GtkPackerChild *child;
GdkEventExpose child_event;
GList *children;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PACKER (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
packer = GTK_PACKER (widget);
child_event = *event;
children = g_list_first(packer->children);
while (children)
{
child = children->data;
children = g_list_next(children);
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_packer_size_request (GtkWidget *widget,
GtkRequisition *requisition)

View File

@ -302,7 +302,6 @@ gtk_paned_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkPaned *paned;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
@ -313,19 +312,7 @@ gtk_paned_expose (GtkWidget *widget,
paned = GTK_PANED (widget);
if (event->window != paned->handle)
{
child_event = *event;
if (paned->child1 &&
GTK_WIDGET_NO_WINDOW (paned->child1) &&
gtk_widget_intersect (paned->child1, &event->area, &child_event.area))
gtk_widget_event (paned->child1, (GdkEvent *) &child_event);
if (paned->child2 &&
GTK_WIDGET_NO_WINDOW (paned->child2) &&
gtk_widget_intersect (paned->child2, &event->area, &child_event.area))
gtk_widget_event (paned->child2, (GdkEvent *) &child_event);
}
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -598,21 +598,11 @@ static gint
gtk_scrolled_window_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin = GTK_BIN (widget);
GdkEventExpose child_event;
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_scrolled_window_paint (widget, &event->area);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child) && GTK_WIDGET_NO_WINDOW (bin->child))
{
child_event = *event;
if (gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
}
/* We rely on our knowledge that scrollbars are !NO_WINDOW widgets */
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -55,8 +55,6 @@ static void gtk_table_init (GtkTable *table);
static void gtk_table_finalize (GObject *object);
static void gtk_table_map (GtkWidget *widget);
static void gtk_table_unmap (GtkWidget *widget);
static gint gtk_table_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_table_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_table_size_allocate (GtkWidget *widget,
@ -145,7 +143,6 @@ gtk_table_class_init (GtkTableClass *class)
widget_class->map = gtk_table_map;
widget_class->unmap = gtk_table_unmap;
widget_class->expose_event = gtk_table_expose;
widget_class->size_request = gtk_table_size_request;
widget_class->size_allocate = gtk_table_size_allocate;
@ -715,39 +712,6 @@ gtk_table_unmap (GtkWidget *widget)
}
}
static gint
gtk_table_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkTable *table;
GtkTableChild *child;
GList *children;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TABLE (widget), FALSE);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
{
table = GTK_TABLE (widget);
child_event = *event;
children = table->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area, &child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_table_size_request (GtkWidget *widget,
GtkRequisition *requisition)

View File

@ -4478,7 +4478,7 @@ process_exposes (GtkText *text)
while ((event = gdk_event_get_graphics_expose (text->text_area)) != NULL)
{
gtk_widget_event (GTK_WIDGET (text), event);
gtk_widget_send_expose (GTK_WIDGET (text), event);
if (event->expose.count == 0)
{
gdk_event_free (event);

View File

@ -415,7 +415,7 @@ gtk_toggle_button_paint (GtkWidget *widget,
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
if (button->relief != GTK_RELIEF_NONE ||
(GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL &&
GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE))
@ -451,19 +451,13 @@ static gint
gtk_toggle_button_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin;
GdkEventExpose child_event;
if (GTK_WIDGET_DRAWABLE (widget))
{
bin = GTK_BIN (widget);
gtk_toggle_button_paint (widget, &event->area);
child_event = *event;
if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
gtk_container_propagate_expose (GTK_CONTAINER (widget),
GTK_BIN (widget)->child,
event);
}
return TRUE;

View File

@ -407,8 +407,7 @@ gtk_toolbar_expose (GtkWidget *widget,
GtkToolbar *toolbar;
GList *children;
GtkToolbarChild *child;
GdkEventExpose child_event;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TOOLBAR (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -417,8 +416,6 @@ gtk_toolbar_expose (GtkWidget *widget,
{
toolbar = GTK_TOOLBAR (widget);
child_event = *event;
for (children = toolbar->children; children; children = children->next)
{
child = children->data;
@ -428,9 +425,10 @@ gtk_toolbar_expose (GtkWidget *widget,
if (toolbar->space_style == GTK_TOOLBAR_SPACE_LINE)
gtk_toolbar_paint_space_line (widget, &event->area, child);
}
else if (GTK_WIDGET_NO_WINDOW (child->widget)
&& gtk_widget_intersect (child->widget, &event->area, &child_event.area))
gtk_widget_event (child->widget, (GdkEvent *) &child_event);
else
gtk_container_propagate_expose (GTK_CONTAINER (widget),
child->widget,
event);
}
}

View File

@ -47,8 +47,6 @@ static void gtk_tree_parent_set (GtkWidget *widget,
GtkWidget *previous_parent);
static void gtk_tree_unmap (GtkWidget *widget);
static void gtk_tree_realize (GtkWidget *widget);
static gint gtk_tree_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_tree_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_tree_button_press (GtkWidget *widget,
@ -121,7 +119,6 @@ gtk_tree_class_init (GtkTreeClass *class)
widget_class->unmap = gtk_tree_unmap;
widget_class->parent_set = gtk_tree_parent_set;
widget_class->realize = gtk_tree_realize;
widget_class->expose_event = gtk_tree_expose;
widget_class->motion_notify_event = gtk_tree_motion_notify;
widget_class->button_press_event = gtk_tree_button_press;
widget_class->button_release_event = gtk_tree_button_release;
@ -442,42 +439,6 @@ gtk_tree_destroy (GtkObject *object)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static gint
gtk_tree_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkTree *tree;
GtkWidget *child;
GdkEventExpose child_event;
GList *children;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
tree = GTK_TREE (widget);
child_event = *event;
children = tree->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_tree_forall (GtkContainer *container,
gboolean include_internals,

View File

@ -718,23 +718,15 @@ static gint
gtk_tree_item_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GdkEventExpose child_event;
GtkBin *bin;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
bin = GTK_BIN (widget);
gtk_tree_item_paint (widget, &event->area);
child_event = *event;
if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
return FALSE;

View File

@ -562,10 +562,7 @@ gtk_viewport_expose (GtkWidget *widget,
&event->area, widget, "viewportbin",
0, 0, -1, -1);
if ((bin->child != NULL) &&
GTK_WIDGET_NO_WINDOW (bin->child) &&
gtk_widget_intersect (bin->child, &event->area, &child_event.area))
gtk_widget_event (bin->child, (GdkEvent*) &child_event);
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}

View File

@ -182,6 +182,8 @@ static void gtk_widget_set_style_internal (GtkWidget *widget,
gboolean initial_emission);
static void gtk_widget_set_style_recurse (GtkWidget *widget,
gpointer client_data);
static gint gtk_widget_event_internal (GtkWidget *widget,
GdkEvent *event);
static void gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
gpointer client_data);
@ -2244,12 +2246,61 @@ gint
gtk_widget_event (GtkWidget *widget,
GdkEvent *event)
{
gboolean return_val;
gint signal_num;
g_return_val_if_fail (widget != NULL, TRUE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
if (event->type == GDK_EXPOSE)
{
g_warning ("Events of type GDK_EXPOSE cannot be synthesized. To get "
"the same effect, call gdk_window_invalidate_rect/region(), "
"followed by gdk_window_process_updates().");
return TRUE;
}
return gtk_widget_event_internal (widget, event);
}
/**
* gtk_widget_send_expose:
* @widget: a #GtkWidget
* @event: a expose #GdkEvent
*
* Very rarely-used function. This function is used to emit
* an expose event signals on a widget. This function is not
* normally used directly. The only time it is used is when
* propagating an expose event to a child NO_WINDOW widget, and
* that is normally done using gtk_container_propagate_expose.
*
* If you want to force an area of a window to be redrawn,
* use gdk_window_invalidate_rect() or gdk_window_invalidate_region().
* To cause the redraw to be done immediately, follow that call
* with a call to gdk_window_procss_updates().
*
* Return value: return from the event signal emission (%TRUE if the event was handled)
**/
gint
gtk_widget_send_expose (GtkWidget *widget,
GdkEvent *event)
{
g_return_val_if_fail (widget != NULL, TRUE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
g_return_val_if_fail (event != NULL, TRUE);
g_return_val_if_fail (event->type == GDK_EXPOSE, TRUE);
if (event->type != GDK_EXPOSE)
return TRUE;
return gtk_widget_event_internal (widget, event);
}
static gint
gtk_widget_event_internal (GtkWidget *widget,
GdkEvent *event)
{
gboolean return_val;
gint signal_num;
gtk_widget_ref (widget);
return_val = FALSE;
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT], event,
@ -2576,6 +2627,40 @@ gtk_widget_intersect (GtkWidget *widget,
return return_val;
}
/**
* gtk_widget_region_intersect:
* @widget: a #GtkWidget
* @region: a #GdkRegion, in the same coordinate system as
* widget->allocation. That is, relative to widget->window
* for NO_WINDOW widgets; relative to the parent window
* of widget->window for widgets with their own window.
* @returns: A newly allocated region holding the intersection of @widget
* and @region. The coordinates of the return value are
* relative to widget->window for NO_WINDOW widgets, and
* relative to the parent window of widget->window for
* widgets with their own window.
*
* Computes the intersection of a @widget's area and @region, returning
* the intersection. The result may be empty, use #gdk_region_empty to
* check.
**/
GdkRegion *
gtk_widget_region_intersect (GtkWidget *widget,
GdkRegion *region)
{
GdkRegion *dest;
g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (region != NULL, NULL);
dest = gdk_region_rectangle (&widget->allocation);
gdk_region_intersect (dest, region);
return dest;
}
/**
* gtk_widget_grab_focus:
* @widget: a #GtkWidget

View File

@ -466,6 +466,8 @@ void gtk_widget_unlock_accelerators (GtkWidget *widget);
gboolean gtk_widget_accelerators_locked (GtkWidget *widget);
gint gtk_widget_event (GtkWidget *widget,
GdkEvent *event);
gint gtk_widget_send_expose (GtkWidget *widget,
GdkEvent *event);
gboolean gtk_widget_activate (GtkWidget *widget);
gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget,
@ -480,6 +482,8 @@ void gtk_widget_popup (GtkWidget *widget,
gboolean gtk_widget_intersect (GtkWidget *widget,
GdkRectangle *area,
GdkRectangle *intersection);
GdkRegion *gtk_widget_region_intersect (GtkWidget *widget,
GdkRegion *region);
gboolean gtk_widget_is_focus (GtkWidget *widget);
void gtk_widget_grab_focus (GtkWidget *widget);