diff options
author | Alexander Larsson <alexl@redhat.com> | 2001-03-09 13:28:26 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2001-03-09 13:28:26 +0000 |
commit | e7d4a7f90d58e7e45bf690107b3615135ced357e (patch) | |
tree | bab1f3860394d2c5f4ca39a4710cd078baaa37fc | |
parent | 8f35f03045bd7d9e6a75ad07ac2dae32e5aa8ae1 (diff) | |
download | gdk-pixbuf-e7d4a7f90d58e7e45bf690107b3615135ced357e.tar.gz |
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.
45 files changed, 719 insertions, 501 deletions
@@ -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. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 18e7a7797..ad59f5913 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -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. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 18e7a7797..ad59f5913 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -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. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 18e7a7797..ad59f5913 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -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. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 18e7a7797..ad59f5913 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -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. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 18e7a7797..ad59f5913 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -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. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 18e7a7797..ad59f5913 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -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. diff --git a/docs/Changes-2.0.txt b/docs/Changes-2.0.txt index 66cd49892..29ac9ea71 100644 --- a/docs/Changes-2.0.txt +++ b/docs/Changes-2.0.txt @@ -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. diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 203f7f4e2..92972578c 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -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); diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index ea2c25b3a..14232fd93 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -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. */ }; diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index acead1b23..a9fd49c8b 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -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); } diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 87ed39295..2c015535f 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -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; diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c index 83d45f94e..315819835 100644 --- a/gtk/gtkbin.c +++ b/gtk/gtkbin.c @@ -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) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index e61d7a8a8..574eda52f 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -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) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index ecdd7b5a0..6b8d1f6a1 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -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; } diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index fb8d052d1..257cafefa 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -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; diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index f5cd66157..a3e5e8bfd 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -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); diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 8a6295781..760e15296 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -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); + } +} diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h index 0da0c1184..9b725b89f 100644 --- a/gtk/gtkcontainer.h +++ b/gtk/gtkcontainer.h @@ -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 */ diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c index 186f1cc75..024b1276c 100644 --- a/gtk/gtkeventbox.c +++ b/gtk/gtkeventbox.c @@ -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; diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index bf1af5285..938039943 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -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) diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index be0ea1713..76c35bf22 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -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; diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index 00ca124d7..1f748d826 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -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); } } diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index 2130759fd..228e8c111 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -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) { diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index a80ceac43..6e1d163c5 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -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; } diff --git a/gtk/gtklist.c b/gtk/gtklist.c index 7d0ee82b8..4746277e8 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -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) diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 00a819687..7f1f6ece0 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -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)) { diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index f8801cc1b..6ca74c210 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -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); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 0f49d0949..0a6d22fa7 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -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; diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index e6e7baf2d..73602d848 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -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; diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index f44fc816f..4ad4c9802 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -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; diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index ff3b62f6f..997f9cb2f 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -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); } } } diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index 2a5115a05..ea749fb01 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -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 */ } diff --git a/gtk/gtkpacker.c b/gtk/gtkpacker.c index 243ef092e..b7cc2603e 100644 --- a/gtk/gtkpacker.c +++ b/gtk/gtkpacker.c @@ -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) diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index dba1ebf58..f07379195 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -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; diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 8ffd505e8..ab859edf8 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -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; diff --git a/gtk/gtktable.c b/gtk/gtktable.c index e6644d92f..7b573182b 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -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) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index c54cd6930..eba3960fc 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -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); diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index e51ee8400..773f4fe5f 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -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; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index d23eba5a6..7b6aeeb39 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -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); } } diff --git a/gtk/gtktree.c b/gtk/gtktree.c index ff25b2542..114e6ea32 100644 --- a/gtk/gtktree.c +++ b/gtk/gtktree.c @@ -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, diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 9a8894d39..162161ac1 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -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; diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index c79af9af3..d9cbbd4cf 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -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); } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index d2d1e5609..a5e11f8cf 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -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,11 +2246,60 @@ 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; @@ -2577,6 +2628,40 @@ gtk_widget_intersect (GtkWidget *widget, } /** + * 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 * diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 949854d94..61c2c2f1b 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -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); |