]> Pileus Git - ~andy/gtk/commitdiff
reworked the redrawing heuristics somewhat, this fixed a bunch of existing
authorTim Janik <timj@gtk.org>
Tue, 12 Jan 1999 15:12:14 +0000 (15:12 +0000)
committerTim Janik <timj@src.gnome.org>
Tue, 12 Jan 1999 15:12:14 +0000 (15:12 +0000)
Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>

        * reworked the redrawing heuristics somewhat, this fixed a bunch of
        existing redrawing problems and majorly reduces overall redrawing needs
        during normal operation. basically we now only queue redraws when
        neccessary and much rely on the draw_area coalescing code in gtkwidget.c
        to optimize the queued portions. widgets will now upon reallocation only
        get redrawed if their allocation has changed. upon hide/show only the
        area allocated by the child will be queued for the parent, this has the
        side effect that parents which change their appearance in dependance on
        the numer of visible children have to keep track of their children's
        visiblity and eventually fully redraw themselves. this is a minor
        constrain with great benefits in terms of redraw reduction, and only got
        triggered by the notebook widget.

        * gtk/gtkwidget.c:
        (gtk_widget_queue_clear): don't bother if width and height == 0.
        (gtk_widget_queue_clear_child): new static function to queue a redraw of
        the area obscured by a child on a parent.
        (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
        (gtk_widget_show): queue resize on the widget before showing.
        (gtk_widget_hide): queue resize on the widget after hiding.
        (gtk_widget_map): queue_draw the widget after mapping.
        (gtk_widget_unmap): queue_clear_child the widget.
        (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
        widget's allocation changed.
        (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
        portions.
        (gtk_widget_real_show):
        (gtk_widget_real_hide):
        (gtk_widget_real_map):
        (gtk_widget_real_unmap):
        (gtk_widget_real_size_allocate): don't bother with redraw queueing,
        descendants that override these functions don't do either and we handle
        all redrawing/resizing related stuff before or after the signal emission
        now.

        * gtk/gtkcontainer.c:
        (gtk_container_resize_children): don't bother about redrawing anymore
        since gtk_widget_size_allocate handles that for us now.

        * gtk/gtknotebook.h:
        * gtk/gtknotebook.c:
        added a flag have_visible_child to indicate whether we need to draw
        non child related portions at all, e.g. shadows etc.
        (gtk_notebook_draw): if have_visible_child changed, do a full paint
        instead of updating a small area only.

Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
        gtk_style_apply_default_background which takes an extra argument
        copy_area to determine NO_WINDOW widget pixmap copying.
        changed callers accordingly.

        * gtk/gtktogglebutton.c:
        (gtk_toggle_size_allocate):
        (gtk_toggle_button_expose):
        (gtk_toggle_button_paint): avoid messing with our parent's window if
        toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.

        * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
        the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.

        * gtk/check-n.xpm:
        * gtk/check-y.xpm:
        * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
        bg_pixmaps.

23 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/check-n.xpm [new file with mode: 0644]
gtk/check-y.xpm [new file with mode: 0644]
gtk/gtkcheckbutton.c
gtk/gtkcontainer.c
gtk/gtklabel.c
gtk/gtknotebook.c
gtk/gtknotebook.h
gtk/gtkradiobutton.c
gtk/gtkstyle.c
gtk/gtkstyle.h
gtk/gtktogglebutton.c
gtk/gtkwidget.c
gtk/testgtkrc
tests/check-n.xpm [new file with mode: 0644]
tests/check-y.xpm [new file with mode: 0644]
tests/testgtkrc

index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
index 85024053036df34f2f313b673c49e76be9178c1e..e2132b8d39f8850529d7ac604c7550b9ff0c5bd0 100644 (file)
@@ -1,3 +1,72 @@
+Tue Jan 12 13:47:07 1999  Tim Janik  <timj@gtk.org>
+
+       * reworked the redrawing heuristics somewhat, this fixed a bunch of
+       existing redrawing problems and majorly reduces overall redrawing needs
+       during normal operation. basically we now only queue redraws when
+       neccessary and much rely on the draw_area coalescing code in gtkwidget.c
+       to optimize the queued portions. widgets will now upon reallocation only
+       get redrawed if their allocation has changed. upon hide/show only the
+       area allocated by the child will be queued for the parent, this has the
+       side effect that parents which change their appearance in dependance on
+       the numer of visible children have to keep track of their children's
+       visiblity and eventually fully redraw themselves. this is a minor
+       constrain with great benefits in terms of redraw reduction, and only got
+       triggered by the notebook widget.
+
+       * gtk/gtkwidget.c:
+       (gtk_widget_queue_clear): don't bother if width and height == 0.
+       (gtk_widget_queue_clear_child): new static function to queue a redraw of
+       the area obscured by a child on a parent.
+       (gtk_widget_queue_resize): queue_clear the widget if it is drawable.
+       (gtk_widget_show): queue resize on the widget before showing.
+       (gtk_widget_hide): queue resize on the widget after hiding.
+       (gtk_widget_map): queue_draw the widget after mapping.
+       (gtk_widget_unmap): queue_clear_child the widget.
+       (gtk_widget_size_allocate): queue_clear_child and queue_draw if the
+       widget's allocation changed.
+       (gtk_widget_unparent): queue_clear_child so the parent redraws obscured
+       portions.
+       (gtk_widget_real_show):
+       (gtk_widget_real_hide):
+       (gtk_widget_real_map):
+       (gtk_widget_real_unmap):
+       (gtk_widget_real_size_allocate): don't bother with redraw queueing,
+       descendants that override these functions don't do either and we handle
+       all redrawing/resizing related stuff before or after the signal emission
+       now.
+
+       * gtk/gtkcontainer.c:
+       (gtk_container_resize_children): don't bother about redrawing anymore
+       since gtk_widget_size_allocate handles that for us now.
+
+       * gtk/gtknotebook.h:
+       * gtk/gtknotebook.c:
+       added a flag have_visible_child to indicate whether we need to draw
+       non child related portions at all, e.g. shadows etc.
+       (gtk_notebook_draw): if have_visible_child changed, do a full paint
+       instead of updating a small area only.
+
+Mon Jan 11 20:44:35 1999  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkstyle.c: changed gtk_style_apply_default_pixmap to
+       gtk_style_apply_default_background which takes an extra argument
+       copy_area to determine NO_WINDOW widget pixmap copying.
+       changed callers accordingly.
+
+       * gtk/gtktogglebutton.c:
+       (gtk_toggle_size_allocate): 
+       (gtk_toggle_button_expose): 
+       (gtk_toggle_button_paint): avoid messing with our parent's window if
+       toggle_button->draw_indicator == TRUE and we are a NO_WINDOW widget.
+
+       * gtk/gtkcheckbutton.c (gtk_real_check_button_draw_indicator): draw
+       the draw_indicator with GTK_STATE_ACTIVE if the toggle button is active.
+
+       * gtk/check-n.xpm:
+       * gtk/check-y.xpm:
+       * gtk/testgtkrc: set pixmaps for ACTIVE and NORMAL check button
+       bg_pixmaps.
+
 Mon Jan 11 23:52:58 1999  Lars Hamann  <lars@gtk.org>
 
        * gtk/gtklist.c (gtk_list_signal_drag_begin)
diff --git a/gtk/check-n.xpm b/gtk/check-n.xpm
new file mode 100644 (file)
index 0000000..417ae20
--- /dev/null
@@ -0,0 +1,21 @@
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+"    10    9       5            1",
+/* colors */
+". c None",
+"# c #000000",
+"y c #666666",
+"i c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
diff --git a/gtk/check-y.xpm b/gtk/check-y.xpm
new file mode 100644 (file)
index 0000000..d82b485
--- /dev/null
@@ -0,0 +1,21 @@
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+"    10    9       5            1",
+/* colors */
+". c None",
+"# c #000000",
+"i c #ff0fff",
+"y c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
index 2fd81aa7999846b8df918822f5d0ecb6c16e497a..b77a373b9d1dfd9993746fb42ae1c33db929b5b4 100644 (file)
@@ -365,12 +365,18 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
       height = CHECK_BUTTON_CLASS (widget)->indicator_size;
       
       if (GTK_TOGGLE_BUTTON (widget)->active)
-       shadow_type = GTK_SHADOW_IN;
+       {
+         state_type = GTK_STATE_ACTIVE;
+         shadow_type = GTK_SHADOW_IN;
+       }
       else
-       shadow_type = GTK_SHADOW_OUT;
-      
+       {
+         shadow_type = GTK_SHADOW_OUT;
+         state_type = GTK_WIDGET_STATE (widget);
+       }
+
       gtk_paint_check (widget->style, window,
-                      GTK_WIDGET_STATE (widget), shadow_type,
+                      state_type, shadow_type,
                       area, widget, "checkbutton",
                       x + 1, y + 1, width, height);
     }
index ce8cc9ba2f9bb8354f2cc09044d7076e5a3d6f62..e1b3e02aa4d3d83b815bd32859e3f8a19ca54070 100644 (file)
@@ -936,11 +936,8 @@ gtk_container_real_check_resize (GtkContainer *container)
       widget->requisition.height > widget->allocation.height)
     {
       if (GTK_IS_RESIZE_CONTAINER (container))
-       {
-         gtk_widget_size_allocate (GTK_WIDGET (container),
-                                   &GTK_WIDGET (container)->allocation);
-         gtk_widget_queue_draw (GTK_WIDGET (container));
-       }
+       gtk_widget_size_allocate (GTK_WIDGET (container),
+                                 &GTK_WIDGET (container)->allocation);
       else
        gtk_widget_queue_resize (widget);
     }
@@ -1009,11 +1006,8 @@ gtk_container_resize_children (GtkContainer *container)
       if (resize_container->parent)
        gtk_container_queue_resize (container);
       else
-       {
-         gtk_widget_size_allocate (GTK_WIDGET (container),
-                                   &GTK_WIDGET (container)->allocation);
-         gtk_widget_queue_draw (GTK_WIDGET (container));
-       }
+       gtk_widget_size_allocate (GTK_WIDGET (container),
+                                 &GTK_WIDGET (container)->allocation);
       return;
     }
 
@@ -1084,8 +1078,9 @@ gtk_container_resize_children (GtkContainer *container)
       widget = node->data;
       
       GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
+
       gtk_widget_size_allocate (widget, &widget->allocation);
-      gtk_widget_queue_draw (widget);
+
       gtk_widget_unref (widget);
     }
   g_slist_free (resize_containers);
index def945546b5d1e5b45c44f70d7005e90e363fa77..84ac17b30f786171fffad48edc6682c6d728f063 100644 (file)
@@ -1,4 +1,4 @@
- /* GTK - The GIMP Toolkit
+/* GTK - The GIMP Toolkit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@ struct _GtkLabelWord
 {
   GdkWChar *beginning;
   gint length;
-
+  
   /* FIXME:
    * We need (space,width) only before we've set (x,y), so to save
    * memory, these pairs should really be wrapped in a union.
@@ -126,7 +126,7 @@ gtk_label_class_init (GtkLabelClass *class)
   gtk_object_add_arg_type ("GtkLabel::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
   gtk_object_add_arg_type ("GtkLabel::pattern", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_PATTERN);
   gtk_object_add_arg_type ("GtkLabel::justify", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY);
-
+  
   object_class->set_arg = gtk_label_set_arg;
   object_class->get_arg = gtk_label_get_arg;
   object_class->finalize = gtk_label_finalize;
@@ -141,9 +141,9 @@ gtk_label_set_arg (GtkObject          *object,
                   guint           arg_id)
 {
   GtkLabel *label;
-
+  
   label = GTK_LABEL (object);
-
+  
   switch (arg_id)
     {
     case ARG_LABEL:
@@ -166,9 +166,9 @@ gtk_label_get_arg (GtkObject          *object,
                   guint           arg_id)
 {
   GtkLabel *label;
-
+  
   label = GTK_LABEL (object);
-
+  
   switch (arg_id)
     {
     case ARG_LABEL:
@@ -197,7 +197,7 @@ gtk_label_init (GtkLabel *label)
   label->jtype = GTK_JUSTIFY_CENTER;
   label->pattern = NULL;
   label->wrap = FALSE;
-
+  
   gtk_label_set_text (label, "");
 }
 
@@ -205,13 +205,13 @@ GtkWidget*
 gtk_label_new (const char *str)
 {
   GtkLabel *label;
-
+  
   g_return_val_if_fail (str != NULL, NULL);
-
+  
   label = gtk_type_new (gtk_label_get_type ());
-
+  
   gtk_label_set_text (label, str);
-
+  
   return GTK_WIDGET (label);
 }
 
@@ -224,17 +224,17 @@ gtk_label_set_text_internal (GtkLabel *label,
     g_free (label->label);
   if (label->label_wc)
     g_free (label->label_wc);
-
+  
   label->label = str;
   label->label_wc = str_wc;
-
+  
   gtk_label_free_words (label);
-
+  
   if (GTK_WIDGET_VISIBLE (label))
     {
       if (GTK_WIDGET_MAPPED (label))
        gtk_widget_queue_clear (GTK_WIDGET (label));
-
+      
       gtk_widget_queue_resize (GTK_WIDGET (label));
     }
 }
@@ -250,13 +250,13 @@ gtk_label_set_text (GtkLabel *label,
   g_return_if_fail (label != NULL);
   g_return_if_fail (GTK_IS_LABEL (label));
   g_return_if_fail (str != NULL);
-
+  
   /* Convert text to wide characters */
   len = strlen (str);
   str_wc = g_new (GdkWChar, len + 1);
   wc_len = gdk_mbstowcs (str_wc, str, len + 1);
   str_wc[wc_len] = '\0';
-
+  
   gtk_label_set_text_internal (label, g_strdup (str), str_wc);
 }
 
@@ -285,14 +285,14 @@ gtk_label_set_justify (GtkLabel *label, GtkJustification jtype)
 {
   g_return_if_fail (label != NULL);
   g_return_if_fail (GTK_IS_LABEL (label));
-
+  
   if ((GtkJustification) label->jtype != jtype)
     {
       if ((label->jtype == GTK_JUSTIFY_FILL) || 
          (jtype == GTK_JUSTIFY_FILL))
        /* FIXME: think about this a little */
-         gtk_label_free_words (label);
-         
+       gtk_label_free_words (label);
+      
       label->jtype = jtype;
       
       if (GTK_WIDGET_VISIBLE (label))
@@ -310,7 +310,7 @@ gtk_label_set_line_wrap (GtkLabel *label, gboolean wrap)
 {
   g_return_if_fail (label != NULL);
   g_return_if_fail (GTK_IS_LABEL (label));
-
+  
   if (label->wrap != wrap) {
     if (GTK_WIDGET_VISIBLE (label))
       {
@@ -330,7 +330,7 @@ gtk_label_get (GtkLabel  *label,
   g_return_if_fail (label != NULL);
   g_return_if_fail (GTK_IS_LABEL (label));
   g_return_if_fail (str != NULL);
-
+  
   *str = label->label;
 }
 
@@ -355,7 +355,7 @@ static GtkLabelWord*
 gtk_label_word_alloc ()
 {
   GtkLabelWord * word;
-
+  
   if (!word_chunk)
     {
       word_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
@@ -373,7 +373,7 @@ gtk_label_word_alloc ()
     {
       word = g_mem_chunk_alloc (word_chunk);
     }
-    
+  
   word->next = 0;
   word->uline = 0;
   return word;
@@ -383,7 +383,7 @@ static void
 gtk_label_free_words (GtkLabel *label)
 {
   GtkLabelWord * last;
-
+  
   if (label->words)
     {
       for (last = label->words; last->next != 0; last = last->next)
@@ -397,7 +397,7 @@ static GtkLabelULine*
 gtk_label_uline_alloc (void)
 {
   GtkLabelULine * uline;
-
+  
   if (!uline_chunk)
     {
       uline_chunk = g_mem_chunk_new ("GtkLabelWord chunk",
@@ -415,9 +415,9 @@ gtk_label_uline_alloc (void)
     {
       uline = g_mem_chunk_alloc (uline_chunk);
     }
-    
+  
   uline->next = NULL;
-
+  
   return uline;
 }
 
@@ -428,7 +428,7 @@ gtk_label_free_ulines (GtkLabelWord *word)
   if (word->uline)
     {
       for (last = word->uline; last->next != 0; last = last->next)
-         ;
+       ;
       last->next = free_ulines;
       free_ulines = word->uline;
       word->uline = 0;
@@ -455,7 +455,7 @@ gtk_label_split_text (GtkLabel *label)
   max_line_width = 0;
   tailp = &label->words;
   str = label->label_wc;
-
+  
   while (*str)
     {
       word = gtk_label_word_alloc ();
@@ -503,13 +503,13 @@ gtk_label_split_text (GtkLabel *label)
       *tailp = word;
       tailp = &word->next;
     }
-
+  
   /* Add an empty word to represent an empty line
    */
   if ((str == label->label_wc) || (str[-1] == '\n'))
     {
       word = gtk_label_word_alloc ();
-
+      
       word->space = 0;
       word->beginning = str;
       word->length = 0;
@@ -654,19 +654,19 @@ gtk_label_finalize_lines (GtkLabel *label,
   
   g_return_if_fail (!label->wrap);
   ptrn = label->pattern;
-
+  
   y = 0;
   baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 2;
   
   for (line = label->words; line; line = line->next)
     {
       if (label->jtype == GTK_JUSTIFY_CENTER)
-         line->x = (line_width - line->width) / 2;
+       line->x = (line_width - line->width) / 2;
       else if (label->jtype == GTK_JUSTIFY_RIGHT)
-         line->x = line_width - line->width;
+       line->x = line_width - line->width;
       else
-         line->x = 0;
-
+       line->x = 0;
+      
       line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
       y_max = 0;
       
@@ -693,7 +693,7 @@ gtk_label_finalize_lines (GtkLabel *label,
                      else if (ptrn[j] == ' ')
                        break;
                    }
-
+                 
                  /* good.  Now we have an underlined segment.
                   * let's measure it and record it.
                   */
@@ -740,7 +740,7 @@ gtk_label_finalize_lines_wrap (GtkLabel *label,
   gint x, y, space, extra_width, add_space, baseline_skip;
   
   g_return_if_fail (label->wrap);
-
+  
   ptrn = label->pattern;
   y = 0;
   baseline_skip = GTK_WIDGET (label)->style->font->ascent + GTK_WIDGET (label)->style->font->descent + 1;
@@ -753,18 +753,18 @@ gtk_label_finalize_lines_wrap (GtkLabel *label,
       for (next_line = line->next; next_line; next_line = next_line->next)
        {
          if (next_line->space == 0)
-             break;            /* New paragraph */
+           break;              /* New paragraph */
          if (next_line->space + next_line->width > extra_width)
-             break;
+           break;
          extra_width -= next_line->space + next_line->width;
          space += next_line->space;
        }
-
+      
       line->x = 0;
       line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
       x = line->width;
       add_space = 0;
-
+      
       for (word = line->next; word != next_line; word = word->next)
        {
          if (next_line && next_line->space)
@@ -781,16 +781,16 @@ gtk_label_finalize_lines_wrap (GtkLabel *label,
          word->y = line->y;
          x = word->x + word->width;
        }
-
+      
       y += (baseline_skip);
     }
-
+  
   label->max_width = line_width;
   widget = GTK_WIDGET (label);
   widget->requisition.width = line_width + 2 * label->misc.xpad;
   widget->requisition.height = y + 2 * label->misc.ypad + 1;
 }
-      
+
 static void
 gtk_label_size_request (GtkWidget      *widget,
                        GtkRequisition *requisition)
@@ -800,9 +800,9 @@ gtk_label_size_request (GtkWidget      *widget,
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_LABEL (widget));
   g_return_if_fail (requisition != NULL);
-
+  
   label = GTK_LABEL (widget);
-
+  
   /*
    * There are a number of conditions which will necessitate re-filling
    * our text:
@@ -823,7 +823,7 @@ gtk_label_size_request (GtkWidget      *widget,
    * Too much of a pain to detect all these case, so always re-fill.  I
    * don't think it's really that slow.
    */
-
+  
   if (label->wrap)
     {
       GtkWidgetAuxInfo *aux_info;
@@ -840,7 +840,7 @@ gtk_label_size_request (GtkWidget      *widget,
       else
        {
          label->max_width = gdk_string_width (GTK_WIDGET (label)->style->font,
-                                       "This is a good enough length for any line to have.");
+                                              "This is a good enough length for any line to have.");
          label->max_width = MIN (label->max_width, (gdk_screen_width () + 1) / 2);
          label->max_width = MIN (label->max_width, longest_paragraph);
          if (longest_paragraph > 0)
@@ -850,8 +850,8 @@ gtk_label_size_request (GtkWidget      *widget,
              nlines = (longest_paragraph + label->max_width - 1) / label->max_width;
              perfect_width = (longest_paragraph + nlines - 1) / nlines;
              label->max_width = gtk_label_pick_width (label,
-                                                perfect_width,
-                                                label->max_width);
+                                                      perfect_width,
+                                                      label->max_width);
            }
        }
       gtk_label_finalize_lines_wrap (label, label->max_width);
@@ -861,21 +861,22 @@ gtk_label_size_request (GtkWidget      *widget,
       label->max_width = gtk_label_split_text (label);
       gtk_label_finalize_lines (label, label->max_width);
     }
-
+  
   if (requisition != &widget->requisition)
     *requisition = widget->requisition;
 }
+
 static void
-gtk_label_paint_word (GtkLabel *label,
-                     gint x,
-                     gint y,
+gtk_label_paint_word (GtkLabel     *label,
+                     gint          x,
+                     gint          y,
                      GtkLabelWord *word,
                      GdkRectangle *area)
 {
   GtkWidget *widget = GTK_WIDGET (label);
   GtkLabelULine *uline;
   gchar *tmp_str;
-
+  
   tmp_str = gdk_wcstombs (word->beginning);
   gtk_paint_string (widget->style, widget->window, widget->state,
                    area, widget, "label", 
@@ -884,14 +885,15 @@ gtk_label_paint_word (GtkLabel *label,
                    tmp_str);
   g_free (tmp_str);
   
-  for (uline = word->uline;uline;uline = uline->next)
+  for (uline = word->uline; uline; uline = uline->next)
     gtk_paint_hline (widget->style, widget->window, 
                     widget->state, area,
                     widget, "label", 
-                    x + uline->x1, x +uline->x2, y + uline->y);
-
-
+                    x + uline->x1, x + uline->x2, y + uline->y);
+  
+  
 }
+
 static gint
 gtk_label_expose (GtkWidget      *widget,
                  GdkEventExpose *event)
@@ -900,28 +902,28 @@ gtk_label_expose (GtkWidget      *widget,
   GtkMisc *misc;
   GtkLabelWord *word;
   gint x, y;
-
+  
   g_return_val_if_fail (widget != NULL, FALSE);
   g_return_val_if_fail (GTK_IS_LABEL (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
-
+  
   label = GTK_LABEL (widget);
   
   if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
       label->label && (*label->label != '\0'))
     {
       misc = GTK_MISC (widget);
-
+      
       /*
        * GC Clipping
        */
       gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area);
       gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], &event->area);
-
+      
       x = widget->allocation.x + misc->xpad +
        (widget->allocation.width - label->max_width) 
        * misc->xalign + 0.5;
-
+      
       y = (widget->allocation.y
           + (widget->allocation.height
              - widget->requisition.height) * misc->yalign
@@ -933,15 +935,17 @@ gtk_label_expose (GtkWidget      *widget,
          gtk_label_paint_word (label, x, y, word, &event->area);
          word->beginning[word->length] = save;
        }
-
+      
       gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
       gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
     }
+
   return TRUE;
 }
+
 guint      
-gtk_label_parse_uline (GtkLabel         *label,
-                      const gchar      *string)
+gtk_label_parse_uline (GtkLabel    *label,
+                      const gchar *string)
 {
   guint accel_key = GDK_VoidSymbol;
   GdkWChar *p, *q, *string_wc;
@@ -949,7 +953,7 @@ gtk_label_parse_uline (GtkLabel         *label,
   gchar *pattern;
   gint length, wc_length;
   gboolean underscore;
-
+  
   /* Convert text to wide characters */
   length = strlen (string);
   string_wc = g_new (GdkWChar, length + 1);
@@ -957,12 +961,12 @@ gtk_label_parse_uline (GtkLabel         *label,
   string_wc[wc_length] = '\0';
   
   pattern = g_new (gchar, length+1);
-
+  
   underscore = FALSE;
-
+  
   p = q = string_wc;
   r = pattern;
-
+  
   while (*p)
     {
       if (underscore)
@@ -975,7 +979,7 @@ gtk_label_parse_uline (GtkLabel         *label,
              if (accel_key == GDK_VoidSymbol)
                accel_key = gdk_keyval_to_lower (*p);
            }
-
+         
          *q++ = *p;
          underscore = FALSE;
        }
@@ -993,11 +997,11 @@ gtk_label_parse_uline (GtkLabel         *label,
     }
   *q = 0;
   *r = 0;
-
+  
   gtk_label_set_text_internal (label, gdk_wcstombs (string_wc), string_wc);
   gtk_label_set_pattern (label, pattern);
   
   g_free (pattern);
-
+  
   return accel_key;
 }
index 7181e957a74c566c18a0585eb9329751202cffc9..1432ea976dc832dd2ee4dda4e2d2d6a264766279 100644 (file)
@@ -328,6 +328,7 @@ gtk_notebook_init (GtkNotebook *notebook)
   notebook->button = 0;
   notebook->need_timer = 0;
   notebook->child_has_focus = FALSE;
+  notebook->have_visible_child = FALSE;
 }
 
 GtkWidget*
@@ -882,17 +883,36 @@ gtk_notebook_draw (GtkWidget    *widget,
   g_return_if_fail (GTK_IS_NOTEBOOK (widget));
   g_return_if_fail (area != NULL);
 
+  notebook = GTK_NOTEBOOK (widget);
+
   if (GTK_WIDGET_DRAWABLE (widget))
     {
-      notebook = GTK_NOTEBOOK (widget);
+      gboolean have_visible_child;
+
+      have_visible_child = notebook->cur_page && GTK_WIDGET_VISIBLE (notebook->cur_page->child);
+
+      if (have_visible_child != notebook->have_visible_child)
+       {
+         GdkRectangle full_area;
+
+         notebook->have_visible_child = have_visible_child;
+         full_area.x = 0;
+         full_area.y = 0;
+         full_area.width = widget->allocation.width;
+         full_area.height = widget->allocation.height;
+         gtk_notebook_paint (widget, &full_area);
+       }
+      else
+       gtk_notebook_paint (widget, area);
 
-      gtk_notebook_paint (widget, area);
       gtk_widget_draw_focus (widget);
 
-      if (notebook->cur_page &&
+      if (notebook->cur_page && GTK_WIDGET_VISIBLE (notebook->cur_page->child) &&
          gtk_widget_intersect (notebook->cur_page->child, area, &child_area))
        gtk_widget_draw (notebook->cur_page->child, &child_area);
     }
+  else
+    notebook->have_visible_child = FALSE;
 }
 
 static gint
@@ -2110,11 +2130,10 @@ gtk_notebook_paint (GtkWidget    *widget,
 
   if (notebook->show_border && (!notebook->show_tabs || !notebook->children))
     {
-      
-      gtk_paint_box(widget->style, widget->window,
-                   GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                   area, widget, "notebook",
-                   x, y, width, height);
+      gtk_paint_box (widget->style, widget->window,
+                    GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+                    area, widget, "notebook",
+                    x, y, width, height);
       return;
     }
 
index c502a50e6acf71aa40da161094ac7908408149ff..6401109149f9836ecfb200dcf3c41c5ede179c6e 100644 (file)
@@ -59,16 +59,17 @@ struct _GtkNotebook
   guint16 tab_hborder;
   guint16 tab_vborder;
   
-  guint show_tabs       : 1;
-  guint homogeneous     : 1;
-  guint show_border     : 1;
-  guint tab_pos         : 2;
-  guint scrollable      : 1;
-  guint in_child        : 2;
-  guint click_child     : 2;
-  guint button          : 2;
-  guint need_timer      : 1;
-  guint child_has_focus : 1;
+  guint show_tabs          : 1;
+  guint homogeneous        : 1;
+  guint show_border        : 1;
+  guint tab_pos            : 2;
+  guint scrollable         : 1;
+  guint in_child           : 2;
+  guint click_child        : 2;
+  guint button             : 2;
+  guint need_timer         : 1;
+  guint child_has_focus    : 1;
+  guint have_visible_child : 1;
 };
 
 struct _GtkNotebookClass
index 9ec83c4a6b1aec0c5ff37ef791efb6002249d40f..b83814a5ddbb09e835e8063740a04aa7f222fb8f 100644 (file)
@@ -343,8 +343,10 @@ gtk_radio_button_clicked (GtkButton *button)
 
   if (GTK_WIDGET_STATE (button) != new_state)
     gtk_widget_set_state (GTK_WIDGET (button), new_state);
+
   if (toggled)
     gtk_toggle_button_toggled (toggle_button);
+
   gtk_widget_queue_draw (GTK_WIDGET (button));
 }
 
index 97df6898d2754d65fa240f54fabf8f8a1b5b45c2..4ebc9103979506c23c46a44f6dca08e6410fb631 100644 (file)
@@ -687,43 +687,6 @@ gtk_style_destroy (GtkStyle *style)
   g_free (style);
 }
 
-void
-gtk_style_set_background (GtkStyle     *style,
-                         GdkWindow    *window,
-                         GtkStateType  state_type)
-{
-  GdkPixmap *pixmap;
-  gint parent_relative;
-  
-  if (style->engine && style->engine->set_background)
-    {
-      (*style->engine->set_background) (style, window, state_type);
-      return;
-    }
-  
-  g_return_if_fail (style != NULL);
-  g_return_if_fail (window != NULL);
-  
-  if (style->bg_pixmap[state_type])
-    {
-      if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
-       {
-         pixmap = NULL;
-         parent_relative = TRUE;
-       }
-      else
-       {
-         pixmap = style->bg_pixmap[state_type];
-         parent_relative = FALSE;
-       }
-      
-      gdk_window_set_back_pixmap (window, pixmap, parent_relative);
-    }
-  else
-    gdk_window_set_background (window, &style->bg[state_type]);
-}
-
-
 void
 gtk_draw_hline (GtkStyle     *style,
                GdkWindow    *window,
@@ -1088,16 +1051,54 @@ gtk_draw_handle  (GtkStyle      *style,
   (*style->klass->draw_handle) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
 }
 
+void
+gtk_style_set_background (GtkStyle     *style,
+                         GdkWindow    *window,
+                         GtkStateType  state_type)
+{
+  GdkPixmap *pixmap;
+  gint parent_relative;
+  
+  if (style->engine && style->engine->set_background)
+    {
+      (*style->engine->set_background) (style, window, state_type);
+      return;
+    }
+  
+  g_return_if_fail (style != NULL);
+  g_return_if_fail (window != NULL);
+  
+  if (style->bg_pixmap[state_type])
+    {
+      if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
+       {
+         pixmap = NULL;
+         parent_relative = TRUE;
+       }
+      else
+       {
+         pixmap = style->bg_pixmap[state_type];
+         parent_relative = FALSE;
+       }
+      
+      gdk_window_set_back_pixmap (window, pixmap, parent_relative);
+    }
+  else
+    gdk_window_set_background (window, &style->bg[state_type]);
+}
+
+
 /* Default functions */
 void
-gtk_style_apply_default_pixmap (GtkStyle     *style,
-                               GdkWindow    *window, 
-                               GtkStateType  state_type, 
-                               GdkRectangle *area, 
-                               gint x, 
-                               gint y, 
-                               gint width, 
-                               gint height)
+gtk_style_apply_default_background (GtkStyle     *style,
+                                   GdkWindow    *window,
+                                   gboolean      copy_area,
+                                   GtkStateType  state_type, 
+                                   GdkRectangle *area, 
+                                   gint          x, 
+                                   gint          y, 
+                                   gint          width, 
+                                   gint          height)
 {
   GdkRectangle new_rect, old_rect;
   GdkGC       *gc;
@@ -1122,12 +1123,15 @@ gtk_style_apply_default_pixmap (GtkStyle     *style,
        gdk_draw_rectangle (window, gc, TRUE, 
                            x, y, width, height);
     }
-  else
+  else if (!copy_area || style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
     {
-      if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
-       gdk_window_set_back_pixmap (window, NULL, TRUE);
-      else
-       gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
+      if (!copy_area)
+       {
+         if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
+           gdk_window_set_back_pixmap (window, NULL, TRUE);
+         else
+           gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
+       }
       
       old_rect.x = x;
       old_rect.y = y;
@@ -1139,6 +1143,23 @@ gtk_style_apply_default_pixmap (GtkStyle     *style,
       else
        gdk_window_clear_area (window, x, y, width, height);
     }
+  else
+    {
+      old_rect.x = x;
+      old_rect.y = y;
+      old_rect.width = width;
+      old_rect.height = height;
+
+      if (area && gdk_rectangle_intersect (area, &old_rect, &new_rect))
+       gdk_window_copy_area (window, style->bg_gc[state_type], new_rect.x, new_rect.y,
+                             style->bg_pixmap[state_type], 0, 0, new_rect.width, new_rect.height);
+      else
+       {
+         gdk_window_clear_area (window, x, y, width, height);
+         gdk_window_copy_area (window, style->bg_gc[state_type], x, y,
+                               style->bg_pixmap[state_type], 0, 0, width, height);
+       }
+    }
 }
 
 static void
@@ -2126,7 +2147,9 @@ gtk_default_draw_box     (GtkStyle      *style,
        }
     }
   else
-    gtk_style_apply_default_pixmap (style, window, state_type, area, x, y, width, height);
+    gtk_style_apply_default_background (style, window,
+                                       widget && GTK_WIDGET_NO_WINDOW (widget),
+                                       state_type, area, x, y, width, height);
   
   gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
                    x, y, width, height);
@@ -2184,7 +2207,9 @@ gtk_default_draw_flat_box (GtkStyle      *style,
        }
     }
   else
-    gtk_style_apply_default_pixmap(style, window, state_type, area, x, y, width, height);
+    gtk_style_apply_default_background (style, window,
+                                       widget && GTK_WIDGET_NO_WINDOW (widget),
+                                       state_type, area, x, y, width, height);
 }
 
 static void 
@@ -2519,8 +2544,9 @@ gtk_default_draw_box_gap (GtkStyle       *style,
   g_return_if_fail (style != NULL);
   g_return_if_fail (window != NULL);
   
-  gtk_style_apply_default_pixmap(style, window, state_type, area,
-                                x, y, width, height);
+  gtk_style_apply_default_background (style, window,
+                                     widget && GTK_WIDGET_NO_WINDOW (widget),
+                                     state_type, area, x, y, width, height);
   
   if ((width == -1) && (height == -1))
     gdk_window_get_size (window, &width, &height);
@@ -2740,8 +2766,9 @@ gtk_default_draw_extension (GtkStyle       *style,
   g_return_if_fail (style != NULL);
   g_return_if_fail (window != NULL);
   
-  gtk_style_apply_default_pixmap(style, window, GTK_STATE_NORMAL, area,
-                                x, y, width, height);
+  gtk_style_apply_default_background (style, window,
+                                     widget && GTK_WIDGET_NO_WINDOW (widget),
+                                     GTK_STATE_NORMAL, area, x, y, width, height);
   
   if ((width == -1) && (height == -1))
     gdk_window_get_size (window, &width, &height);
@@ -2796,11 +2823,13 @@ gtk_default_draw_extension (GtkStyle       *style,
       switch (gap_side)
        {
        case GTK_POS_TOP:
-         gtk_style_apply_default_pixmap(style, window, state_type, area,
-                                        x + style->klass->xthickness, 
-                                        y, 
-                                        width - (2 * style->klass->xthickness), 
-                                        height - (style->klass->ythickness));
+         gtk_style_apply_default_background (style, window,
+                                             widget && GTK_WIDGET_NO_WINDOW (widget),
+                                             state_type, area,
+                                             x + style->klass->xthickness, 
+                                             y, 
+                                             width - (2 * style->klass->xthickness), 
+                                             height - (style->klass->ythickness));
          gdk_draw_line (window, gc1,
                         x, y, x, y + height - 2);
          gdk_draw_line (window, gc2,
@@ -2816,11 +2845,13 @@ gtk_default_draw_extension (GtkStyle       *style,
                         x + width - 1, y, x + width - 1, y + height - 2);
          break;
        case GTK_POS_BOTTOM:
-         gtk_style_apply_default_pixmap(style, window, state_type, area,
-                                        x + style->klass->xthickness, 
-                                        y + style->klass->ythickness, 
-                                        width - (2 * style->klass->xthickness), 
-                                        height - (style->klass->ythickness));
+         gtk_style_apply_default_background (style, window,
+                                             widget && GTK_WIDGET_NO_WINDOW (widget),
+                                             state_type, area,
+                                             x + style->klass->xthickness, 
+                                             y + style->klass->ythickness, 
+                                             width - (2 * style->klass->xthickness), 
+                                             height - (style->klass->ythickness));
          gdk_draw_line (window, gc1,
                         x + 1, y, x + width - 2, y);
          gdk_draw_line (window, gc1,
@@ -2836,11 +2867,13 @@ gtk_default_draw_extension (GtkStyle       *style,
                         x + width - 1, y + 1, x + width - 1, y + height - 1);
          break;
        case GTK_POS_LEFT:
-         gtk_style_apply_default_pixmap(style, window, state_type, area,
-                                        x, 
-                                        y + style->klass->ythickness, 
-                                        width - (style->klass->xthickness), 
-                                        height - (2 * style->klass->ythickness));
+         gtk_style_apply_default_background (style, window,
+                                             widget && GTK_WIDGET_NO_WINDOW (widget),
+                                             state_type, area,
+                                             x, 
+                                             y + style->klass->ythickness, 
+                                             width - (style->klass->xthickness), 
+                                             height - (2 * style->klass->ythickness));
          gdk_draw_line (window, gc1,
                         x, y, x + width - 2, y);
          gdk_draw_line (window, gc2,
@@ -2856,11 +2889,13 @@ gtk_default_draw_extension (GtkStyle       *style,
                         x + width - 1, y + 1, x + width - 1, y + height - 2);
          break;
        case GTK_POS_RIGHT:
-         gtk_style_apply_default_pixmap(style, window, state_type, area,
-                                        x + style->klass->xthickness, 
-                                        y + style->klass->ythickness, 
-                                        width - (style->klass->xthickness), 
-                                        height - (2 * style->klass->ythickness));
+         gtk_style_apply_default_background (style, window,
+                                             widget && GTK_WIDGET_NO_WINDOW (widget),
+                                             state_type, area,
+                                             x + style->klass->xthickness, 
+                                             y + style->klass->ythickness, 
+                                             width - (style->klass->xthickness), 
+                                             height - (2 * style->klass->ythickness));
          gdk_draw_line (window, gc1,
                         x + 1, y, x + width - 1, y);
          gdk_draw_line (window, gc1,
index 0a53beb2a1deca6ca4339ce217d1fd133479ddf1..e1a23f2d1e3fbcee93b6ee76cc10ba8d2d4eecdf 100644 (file)
@@ -332,24 +332,25 @@ struct _GtkStyleClass
                         GtkOrientation orientation);
 };
 
-GtkStyle* gtk_style_new                   (void);
-GtkStyle* gtk_style_copy          (GtkStyle     *style);
-GtkStyle* gtk_style_attach        (GtkStyle     *style,
-                                   GdkWindow    *window);
-void     gtk_style_detach         (GtkStyle     *style);
-GtkStyle* gtk_style_ref                   (GtkStyle     *style);
-void     gtk_style_unref          (GtkStyle     *style);
-void     gtk_style_set_background (GtkStyle     *style,
-                                   GdkWindow    *window,
-                                   GtkStateType  state_type);
-void      gtk_style_apply_default_pixmap(GtkStyle     *style,
-                                        GdkWindow    *window, 
-                                        GtkStateType  state_type, 
-                                        GdkRectangle *area, 
-                                        gint x, 
-                                        gint y, 
-                                        gint width, 
-                                        gint height);
+GtkStyle* gtk_style_new                            (void);
+GtkStyle* gtk_style_copy                   (GtkStyle      *style);
+GtkStyle* gtk_style_attach                 (GtkStyle      *style,
+                                            GdkWindow     *window);
+void     gtk_style_detach                   (GtkStyle     *style);
+GtkStyle* gtk_style_ref                             (GtkStyle     *style);
+void     gtk_style_unref                    (GtkStyle     *style);
+void     gtk_style_set_background           (GtkStyle     *style,
+                                             GdkWindow    *window,
+                                             GtkStateType  state_type);
+void      gtk_style_apply_default_background (GtkStyle     *style,
+                                             GdkWindow    *window,
+                                             gboolean      copy_area,
+                                             GtkStateType  state_type, 
+                                             GdkRectangle *area, 
+                                             gint          x, 
+                                             gint          y, 
+                                             gint          width, 
+                                             gint          height);
       
 void gtk_draw_hline   (GtkStyle             *style,
                       GdkWindow     *window,
index 57c951b0e02411b384102ba88f6e3ac647668fcc..732526cce218f15b1d9a1df9a6eaf623b10f4921 100644 (file)
@@ -42,8 +42,12 @@ static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass);
 static void gtk_toggle_button_init       (GtkToggleButton      *toggle_button);
 static void gtk_toggle_button_paint      (GtkWidget            *widget,
                                          GdkRectangle         *area);
+static void gtk_toggle_button_size_allocate (GtkWidget         *widget,
+                                            GtkAllocation     *allocation);
 static void gtk_toggle_button_draw       (GtkWidget            *widget,
                                          GdkRectangle         *area);
+static gint gtk_toggle_button_expose     (GtkWidget            *widget,
+                                         GdkEventExpose       *event);
 static void gtk_toggle_button_pressed    (GtkButton            *button);
 static void gtk_toggle_button_released   (GtkButton            *button);
 static void gtk_toggle_button_clicked    (GtkButton            *button);
@@ -120,7 +124,9 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
   object_class->set_arg = gtk_toggle_button_set_arg;
   object_class->get_arg = gtk_toggle_button_get_arg;
 
+  widget_class->size_allocate = gtk_toggle_button_size_allocate;
   widget_class->draw = gtk_toggle_button_draw;
+  widget_class->expose_event = gtk_toggle_button_expose;
   widget_class->realize = gtk_toggle_button_realize;
   widget_class->unrealize = gtk_toggle_button_unrealize;
   widget_class->map = gtk_toggle_button_map;
@@ -140,6 +146,7 @@ gtk_toggle_button_init (GtkToggleButton *toggle_button)
 {
   toggle_button->active = FALSE;
   toggle_button->draw_indicator = FALSE;
+  GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
 }
 
 
@@ -234,13 +241,26 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
 
          gtk_widget_unrealize (widget);
          toggle_button->draw_indicator = draw_indicator;
+
+         if (toggle_button->draw_indicator)
+           GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
+         else
+           GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
+         
          gtk_widget_realize (widget);
 
          if (visible)
            gtk_widget_show (widget);
        }
       else
-       toggle_button->draw_indicator = draw_indicator;
+       {
+         toggle_button->draw_indicator = draw_indicator;
+
+         if (toggle_button->draw_indicator)
+           GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
+         else
+           GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
+       }
 
       if (GTK_WIDGET_VISIBLE (toggle_button))
        gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
@@ -280,11 +300,11 @@ gtk_toggle_button_paint (GtkWidget    *widget,
   gint width, height;
   gint x, y;
 
+  button = GTK_BUTTON (widget);
+  toggle_button = GTK_TOGGLE_BUTTON (widget);
+
   if (GTK_WIDGET_DRAWABLE (widget))
     {
-      button = GTK_BUTTON (widget);
-      toggle_button = GTK_TOGGLE_BUTTON (widget);
-
       x = 0;
       y = 0;
       width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
@@ -348,6 +368,26 @@ gtk_toggle_button_paint (GtkWidget    *widget,
     }
 }
 
+static void
+gtk_toggle_button_size_allocate (GtkWidget     *widget,
+                                GtkAllocation *allocation)
+{
+  if (!GTK_WIDGET_NO_WINDOW (widget) &&
+      GTK_WIDGET_CLASS (parent_class)->size_allocate)
+    GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+}
+
+static gint
+gtk_toggle_button_expose (GtkWidget      *widget,
+                         GdkEventExpose *event)
+{
+  if (!GTK_WIDGET_NO_WINDOW (widget) &&
+      GTK_WIDGET_CLASS (parent_class)->expose_event)
+    return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+  else
+    return FALSE;
+}
+
 static void
 gtk_toggle_button_draw (GtkWidget    *widget,
                        GdkRectangle *area)
@@ -362,7 +402,7 @@ gtk_toggle_button_draw (GtkWidget    *widget,
 
   bin = GTK_BIN (widget);
 
-  if (GTK_WIDGET_DRAWABLE (widget))
+  if (GTK_WIDGET_DRAWABLE (widget) && !GTK_WIDGET_NO_WINDOW (widget))
     {
       tmp_area = *area;
       tmp_area.x -= GTK_CONTAINER (widget)->border_width;
@@ -519,9 +559,8 @@ gtk_toggle_button_realize (GtkWidget *widget)
                            GDK_ENTER_NOTIFY_MASK |
                            GDK_LEAVE_NOTIFY_MASK);
 
-  if (toggle_button->draw_indicator)
+  if (GTK_WIDGET_NO_WINDOW (widget))
     {
-      GTK_WIDGET_SET_FLAGS (toggle_button, GTK_NO_WINDOW);
       attributes.wclass = GDK_INPUT_ONLY;
       attributes_mask = GDK_WA_X | GDK_WA_Y;
 
@@ -534,7 +573,6 @@ gtk_toggle_button_realize (GtkWidget *widget)
     }
   else
     {
-      GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
       attributes.wclass = GDK_INPUT_OUTPUT;
       attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
       attributes.visual = gtk_widget_get_visual (widget);
@@ -546,7 +584,7 @@ gtk_toggle_button_realize (GtkWidget *widget)
 
   widget->style = gtk_style_attach (widget->style, widget->window);
 
-  if (!toggle_button->draw_indicator)
+  if (!GTK_WIDGET_NO_WINDOW (widget))
     gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
 }
   
@@ -560,7 +598,7 @@ gtk_toggle_button_unrealize (GtkWidget *widget)
 
   toggle_button = GTK_TOGGLE_BUTTON (widget);
   
-  if (toggle_button->draw_indicator)
+  if (GTK_WIDGET_NO_WINDOW (widget))
     {
       gdk_window_set_user_data (toggle_button->event_window, NULL);
       gdk_window_destroy (toggle_button->event_window);
@@ -577,7 +615,7 @@ gtk_toggle_button_map (GtkWidget *widget)
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
 
-  if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
+  if (GTK_WIDGET_NO_WINDOW (widget))
     gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
 
   GTK_WIDGET_CLASS (parent_class)->map (widget);
@@ -589,7 +627,7 @@ gtk_toggle_button_unmap (GtkWidget *widget)
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
 
-  if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
+  if (GTK_WIDGET_NO_WINDOW (widget))
     gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
 
   GTK_WIDGET_CLASS (parent_class)->unmap (widget);
index 00ebb9039bf4aa97191c6fdb5f18e6d558783671..715d3bb60cf17f06fb6db351ecbc82a56a266365 100644 (file)
@@ -1206,15 +1206,19 @@ gtk_widget_setv (GtkWidget *widget,
   gtk_object_setv (GTK_OBJECT (widget), nargs, args);
 }
 
-/*****************************************
- * gtk_widget_unparent:
- *   do any cleanup necessary necessary
- *   for setting parent = NULL.
- *
- *   arguments:
- *
- *   results:
- *****************************************/
+static inline void        
+gtk_widget_queue_clear_child (GtkWidget *widget)
+{
+  GtkWidget *parent;
+
+  parent = widget->parent;
+  if (parent && GTK_WIDGET_DRAWABLE (parent))
+    gtk_widget_queue_clear_area (parent,
+                                widget->allocation.x,
+                                widget->allocation.y,
+                                widget->allocation.width,
+                                widget->allocation.height);
+}
 
 void
 gtk_widget_unparent (GtkWidget *widget)
@@ -1336,10 +1340,8 @@ gtk_widget_unparent (GtkWidget *widget)
 
       toplevel = toplevel->parent;
     }
-  if (widget->window &&
-      GTK_WIDGET_NO_WINDOW (widget) &&
-      GTK_WIDGET_DRAWABLE (widget))
-    gtk_widget_queue_clear (widget);
+
+  gtk_widget_queue_clear_child (widget);
 
   /* Reset the width and height here, to force reallocation if we
    * get added back to a new parent. This won't work if our new
@@ -1415,9 +1417,26 @@ gtk_widget_show (GtkWidget *widget)
   g_return_if_fail (GTK_IS_WIDGET (widget));
   
   if (!GTK_WIDGET_VISIBLE (widget))
-    gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
+    {
+      gtk_widget_queue_resize (widget);
+      gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
+    }
 }
 
+static void
+gtk_widget_real_show (GtkWidget *widget)
+{
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  
+  if (!GTK_WIDGET_VISIBLE (widget))
+    {
+      GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
+
+      if (widget->parent && GTK_WIDGET_MAPPED (widget->parent))
+       gtk_widget_map (widget);
+    }
+}
 
 /*************************************************************
  * gtk_widget_show_now:
@@ -1478,7 +1497,25 @@ gtk_widget_hide (GtkWidget *widget)
   g_return_if_fail (GTK_IS_WIDGET (widget));
   
   if (GTK_WIDGET_VISIBLE (widget))
-    gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
+    {
+      gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
+      gtk_widget_queue_resize (widget);
+    }
+}
+
+static void
+gtk_widget_real_hide (GtkWidget *widget)
+{
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  
+  if (GTK_WIDGET_VISIBLE (widget))
+    {
+      GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
+      
+      if (GTK_WIDGET_MAPPED (widget))
+       gtk_widget_unmap (widget);
+    }
 }
 
 gint
@@ -1538,8 +1575,10 @@ gtk_widget_map (GtkWidget *widget)
     {
       if (!GTK_WIDGET_REALIZED (widget))
        gtk_widget_realize (widget);
-      
+
       gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]);
+
+      gtk_widget_queue_draw (widget);
     }
 }
 
@@ -1558,7 +1597,10 @@ gtk_widget_unmap (GtkWidget *widget)
   g_return_if_fail (GTK_IS_WIDGET (widget));
   
   if (GTK_WIDGET_MAPPED (widget))
-    gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]);
+    {
+      gtk_widget_queue_clear_child (widget);
+      gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]);
+    }
 }
 
 /*****************************************
@@ -1843,20 +1885,23 @@ gtk_widget_redraw_queue_remove (GtkWidget *widget)
 }
 
 void      
-gtk_widget_queue_clear   (GtkWidget *widget)
+gtk_widget_queue_clear (GtkWidget *widget)
 {
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (GTK_WIDGET_NO_WINDOW (widget))
-    gtk_widget_queue_clear_area (widget, widget->allocation.x,
-                                widget->allocation.y,
-                                widget->allocation.width, 
-                                widget->allocation.height);
-  else
-    gtk_widget_queue_clear_area (widget, 0, 0, 
-                                widget->allocation.width, 
-                                widget->allocation.height);
+  if (widget->allocation.width || widget->allocation.height)
+    {
+      if (GTK_WIDGET_NO_WINDOW (widget))
+       gtk_widget_queue_clear_area (widget, widget->allocation.x,
+                                    widget->allocation.y,
+                                    widget->allocation.width, 
+                                    widget->allocation.height);
+      else
+       gtk_widget_queue_clear_area (widget, 0, 0, 
+                                    widget->allocation.width, 
+                                    widget->allocation.height);
+    }
 }
 
 static gint
@@ -2175,6 +2220,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
   if (GTK_IS_RESIZE_CONTAINER (widget))
     gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
 
+  if (GTK_WIDGET_DRAWABLE (widget))
+    gtk_widget_queue_clear (widget);
+
   if (widget->parent)
     gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
   else if (GTK_WIDGET_TOPLEVEL (widget))
@@ -2302,6 +2350,7 @@ gtk_widget_size_allocate (GtkWidget       *widget,
 {
   GtkWidgetAuxInfo *aux_info;
   GtkAllocation real_allocation;
+  gboolean needs_draw = FALSE;
   
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -2317,7 +2366,46 @@ gtk_widget_size_allocate (GtkWidget      *widget,
        real_allocation.y = aux_info->y;
     }
   
+  if (GTK_WIDGET_NO_WINDOW (widget))
+    {
+      if (widget->allocation.x != real_allocation.x ||
+         widget->allocation.y != real_allocation.y ||
+         widget->allocation.width != real_allocation.width ||
+         widget->allocation.height != real_allocation.height)
+       {
+         gtk_widget_queue_clear_child (widget);
+         needs_draw = TRUE;
+       }
+    }
+  else if (widget->allocation.width != real_allocation.width ||
+          widget->allocation.height != real_allocation.height)
+    {
+      gtk_widget_queue_clear_child (widget);
+      needs_draw = TRUE;
+    }
+
   gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_ALLOCATE], &real_allocation);
+
+  if (needs_draw)
+    gtk_widget_queue_draw (widget);
+}
+
+static void
+gtk_widget_real_size_allocate (GtkWidget     *widget,
+                              GtkAllocation *allocation)
+{
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+
+  widget->allocation = *allocation;
+  
+  if (GTK_WIDGET_REALIZED (widget) &&
+      !GTK_WIDGET_NO_WINDOW (widget))
+     {
+       gdk_window_move_resize (widget->window,
+                               allocation->x, allocation->y,
+                               allocation->width, allocation->height);
+     }
 }
 
 static void
@@ -4189,60 +4277,6 @@ gtk_widget_finalize (GtkObject *object)
   parent_class->finalize (object);
 }
 
-/*****************************************
- * gtk_widget_real_show:
- *
- *   arguments:
- *
- *   results:
- *****************************************/
-
-static void
-gtk_widget_real_show (GtkWidget *widget)
-{
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  
-  if (!GTK_WIDGET_VISIBLE (widget))
-    {
-      GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
-      
-      if (widget->parent)
-       {
-         gtk_widget_queue_resize (widget->parent);
-         
-         if (GTK_WIDGET_MAPPED (widget->parent))
-           gtk_widget_map (widget);
-       }
-    }
-}
-
-/*****************************************
- * gtk_widget_real_hide:
- *
- *   arguments:
- *
- *   results:
- *****************************************/
-
-static void
-gtk_widget_real_hide (GtkWidget *widget)
-{
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-  
-  if (GTK_WIDGET_VISIBLE (widget))
-    {
-      GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
-      
-      if (GTK_WIDGET_MAPPED (widget))
-       gtk_widget_unmap (widget);
-      
-      if (widget->parent)
-       gtk_widget_queue_resize (widget->parent);
-    }
-}
-
 /*****************************************
  * gtk_widget_real_map:
  *
@@ -4263,8 +4297,6 @@ gtk_widget_real_map (GtkWidget *widget)
       
       if (!GTK_WIDGET_NO_WINDOW (widget))
        gdk_window_show (widget->window);
-      else
-       gtk_widget_queue_draw (widget);
     }
 }
 
@@ -4285,10 +4317,8 @@ gtk_widget_real_unmap (GtkWidget *widget)
   if (GTK_WIDGET_MAPPED (widget))
     {
       GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-      
-      if (GTK_WIDGET_NO_WINDOW (widget))
-       gtk_widget_queue_clear (widget);
-      else
+
+      if (!GTK_WIDGET_NO_WINDOW (widget))
        gdk_window_hide (widget->window);
     }
 }
@@ -4366,14 +4396,6 @@ gtk_widget_real_unrealize (GtkWidget *widget)
   GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
 }
 
-/*****************************************
- * gtk_widget_real_draw:
- *
- *   arguments:
- *
- *   results:
- *****************************************/
-
 static void
 gtk_widget_real_draw (GtkWidget           *widget,
                      GdkRectangle *area)
@@ -4409,34 +4431,6 @@ gtk_widget_real_size_request (GtkWidget         *widget,
   requisition->height = widget->requisition.height;
 }
 
-static void
-gtk_widget_real_size_allocate (GtkWidget     *widget,
-                              GtkAllocation *allocation)
-{
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  if (GTK_WIDGET_NO_WINDOW (widget) &&
-      GTK_WIDGET_MAPPED (widget) &&
-      ((widget->allocation.x != allocation->x) ||
-       (widget->allocation.y != allocation->y) ||
-       (widget->allocation.width != allocation->width) ||
-       (widget->allocation.height != allocation->height)) &&
-      (widget->allocation.width != 0) &&
-      (widget->allocation.height != 0))
-    gtk_widget_queue_clear (widget);
-  
-  widget->allocation = *allocation;
-  
-  if (GTK_WIDGET_REALIZED (widget) &&
-      !GTK_WIDGET_NO_WINDOW (widget))
-     {
-       gdk_window_move_resize (widget->window,
-                               allocation->x, allocation->y,
-                               allocation->width, allocation->height);
-     }
-}
-
 /*****************************************
  * gtk_widget_peek_colormap:
  *
index 4e097bc35a5784ef7cde629d8ab568f3610de4a7..5d43b97b46df5a1ddea75121f09817dabc6a37e4 100644 (file)
@@ -26,15 +26,9 @@ class "GtkWidget" style "defaultfont"
 
 style "window"
 {
- bg_pixmap[NORMAL] = "marble.xpm"
+ # bg_pixmap[NORMAL] = "marble.xpm"
 }
 
-style "pix"
-{
-#  bg_pixmap[NORMAL] = "<parent>" # "marble.xpm" # "test.xpm"
-}
-widget_class "*Button*" style "pix"
-
 style "scale"
 {
   fg[NORMAL] = { 1.0, 0, 0 }
@@ -52,7 +46,8 @@ style "toggle_button" = "button"
 {
   fg[NORMAL] = { 1.0, 0, 0 }
   fg[ACTIVE] = { 1.0, 0, 0 }
-  bg_pixmap[NORMAL] = "<parent>"
+  bg_pixmap[ACTIVE] = "check-y.xpm"
+  bg_pixmap[NORMAL] = "check-n.xpm"
 }
 
 style "text"
diff --git a/tests/check-n.xpm b/tests/check-n.xpm
new file mode 100644 (file)
index 0000000..417ae20
--- /dev/null
@@ -0,0 +1,21 @@
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+"    10    9       5            1",
+/* colors */
+". c None",
+"# c #000000",
+"y c #666666",
+"i c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
diff --git a/tests/check-y.xpm b/tests/check-y.xpm
new file mode 100644 (file)
index 0000000..d82b485
--- /dev/null
@@ -0,0 +1,21 @@
+/* XPM */
+static char *openfile[] = {
+/* width height num_colors chars_per_pixel */
+"    10    9       5            1",
+/* colors */
+". c None",
+"# c #000000",
+"i c #ff0fff",
+"y c #ff1f00",
+"# c #9f9f9f",
+/* pixels */
+"..........",
+"........yy",
+".......yy.",
+"......yy..",
+".yyy.yy...",
+"..yyyy....",
+"...yy.....",
+"..........",
+"..........",
+};
index 4e097bc35a5784ef7cde629d8ab568f3610de4a7..5d43b97b46df5a1ddea75121f09817dabc6a37e4 100644 (file)
@@ -26,15 +26,9 @@ class "GtkWidget" style "defaultfont"
 
 style "window"
 {
- bg_pixmap[NORMAL] = "marble.xpm"
+ # bg_pixmap[NORMAL] = "marble.xpm"
 }
 
-style "pix"
-{
-#  bg_pixmap[NORMAL] = "<parent>" # "marble.xpm" # "test.xpm"
-}
-widget_class "*Button*" style "pix"
-
 style "scale"
 {
   fg[NORMAL] = { 1.0, 0, 0 }
@@ -52,7 +46,8 @@ style "toggle_button" = "button"
 {
   fg[NORMAL] = { 1.0, 0, 0 }
   fg[ACTIVE] = { 1.0, 0, 0 }
-  bg_pixmap[NORMAL] = "<parent>"
+  bg_pixmap[ACTIVE] = "check-y.xpm"
+  bg_pixmap[NORMAL] = "check-n.xpm"
 }
 
 style "text"