reworked the redrawing heuristics somewhat, this fixed a bunch of existing

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.
This commit is contained in:
Tim Janik 1999-01-12 15:12:14 +00:00 committed by Tim Janik
parent 8b0955954c
commit d7bd87f2ea
23 changed files with 1007 additions and 355 deletions

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

View 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> Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin) * gtk/gtklist.c (gtk_list_signal_drag_begin)

21
gtk/check-n.xpm Normal file
View File

@ -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.....",
"..........",
"..........",
};

21
gtk/check-y.xpm Normal file
View File

@ -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.....",
"..........",
"..........",
};

View File

@ -365,12 +365,18 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
height = CHECK_BUTTON_CLASS (widget)->indicator_size; height = CHECK_BUTTON_CLASS (widget)->indicator_size;
if (GTK_TOGGLE_BUTTON (widget)->active) if (GTK_TOGGLE_BUTTON (widget)->active)
{
state_type = GTK_STATE_ACTIVE;
shadow_type = GTK_SHADOW_IN; shadow_type = GTK_SHADOW_IN;
}
else else
{
shadow_type = GTK_SHADOW_OUT; shadow_type = GTK_SHADOW_OUT;
state_type = GTK_WIDGET_STATE (widget);
}
gtk_paint_check (widget->style, window, gtk_paint_check (widget->style, window,
GTK_WIDGET_STATE (widget), shadow_type, state_type, shadow_type,
area, widget, "checkbutton", area, widget, "checkbutton",
x + 1, y + 1, width, height); x + 1, y + 1, width, height);
} }

View File

@ -936,11 +936,8 @@ gtk_container_real_check_resize (GtkContainer *container)
widget->requisition.height > widget->allocation.height) widget->requisition.height > widget->allocation.height)
{ {
if (GTK_IS_RESIZE_CONTAINER (container)) if (GTK_IS_RESIZE_CONTAINER (container))
{
gtk_widget_size_allocate (GTK_WIDGET (container), gtk_widget_size_allocate (GTK_WIDGET (container),
&GTK_WIDGET (container)->allocation); &GTK_WIDGET (container)->allocation);
gtk_widget_queue_draw (GTK_WIDGET (container));
}
else else
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
} }
@ -1009,11 +1006,8 @@ gtk_container_resize_children (GtkContainer *container)
if (resize_container->parent) if (resize_container->parent)
gtk_container_queue_resize (container); gtk_container_queue_resize (container);
else else
{
gtk_widget_size_allocate (GTK_WIDGET (container), gtk_widget_size_allocate (GTK_WIDGET (container),
&GTK_WIDGET (container)->allocation); &GTK_WIDGET (container)->allocation);
gtk_widget_queue_draw (GTK_WIDGET (container));
}
return; return;
} }
@ -1084,8 +1078,9 @@ gtk_container_resize_children (GtkContainer *container)
widget = node->data; widget = node->data;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
gtk_widget_size_allocate (widget, &widget->allocation); gtk_widget_size_allocate (widget, &widget->allocation);
gtk_widget_queue_draw (widget);
gtk_widget_unref (widget); gtk_widget_unref (widget);
} }
g_slist_free (resize_containers); g_slist_free (resize_containers);

View File

@ -865,6 +865,7 @@ gtk_label_size_request (GtkWidget *widget,
if (requisition != &widget->requisition) if (requisition != &widget->requisition)
*requisition = widget->requisition; *requisition = widget->requisition;
} }
static void static void
gtk_label_paint_word (GtkLabel *label, gtk_label_paint_word (GtkLabel *label,
gint x, gint x,
@ -892,6 +893,7 @@ gtk_label_paint_word (GtkLabel *label,
} }
static gint static gint
gtk_label_expose (GtkWidget *widget, gtk_label_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
@ -937,8 +939,10 @@ gtk_label_expose (GtkWidget *widget,
gdk_gc_set_clip_mask (widget->style->white_gc, NULL); gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL); gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
} }
return TRUE; return TRUE;
} }
guint guint
gtk_label_parse_uline (GtkLabel *label, gtk_label_parse_uline (GtkLabel *label,
const gchar *string) const gchar *string)

View File

@ -328,6 +328,7 @@ gtk_notebook_init (GtkNotebook *notebook)
notebook->button = 0; notebook->button = 0;
notebook->need_timer = 0; notebook->need_timer = 0;
notebook->child_has_focus = FALSE; notebook->child_has_focus = FALSE;
notebook->have_visible_child = FALSE;
} }
GtkWidget* GtkWidget*
@ -882,17 +883,36 @@ gtk_notebook_draw (GtkWidget *widget,
g_return_if_fail (GTK_IS_NOTEBOOK (widget)); g_return_if_fail (GTK_IS_NOTEBOOK (widget));
g_return_if_fail (area != NULL); g_return_if_fail (area != NULL);
if (GTK_WIDGET_DRAWABLE (widget))
{
notebook = GTK_NOTEBOOK (widget); notebook = GTK_NOTEBOOK (widget);
if (GTK_WIDGET_DRAWABLE (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); 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_intersect (notebook->cur_page->child, area, &child_area))
gtk_widget_draw (notebook->cur_page->child, &child_area); gtk_widget_draw (notebook->cur_page->child, &child_area);
} }
else
notebook->have_visible_child = FALSE;
} }
static gint static gint
@ -2110,7 +2130,6 @@ gtk_notebook_paint (GtkWidget *widget,
if (notebook->show_border && (!notebook->show_tabs || !notebook->children)) if (notebook->show_border && (!notebook->show_tabs || !notebook->children))
{ {
gtk_paint_box (widget->style, widget->window, gtk_paint_box (widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
area, widget, "notebook", area, widget, "notebook",

View File

@ -69,6 +69,7 @@ struct _GtkNotebook
guint button : 2; guint button : 2;
guint need_timer : 1; guint need_timer : 1;
guint child_has_focus : 1; guint child_has_focus : 1;
guint have_visible_child : 1;
}; };
struct _GtkNotebookClass struct _GtkNotebookClass

View File

@ -343,8 +343,10 @@ gtk_radio_button_clicked (GtkButton *button)
if (GTK_WIDGET_STATE (button) != new_state) if (GTK_WIDGET_STATE (button) != new_state)
gtk_widget_set_state (GTK_WIDGET (button), new_state); gtk_widget_set_state (GTK_WIDGET (button), new_state);
if (toggled) if (toggled)
gtk_toggle_button_toggled (toggle_button); gtk_toggle_button_toggled (toggle_button);
gtk_widget_queue_draw (GTK_WIDGET (button)); gtk_widget_queue_draw (GTK_WIDGET (button));
} }

View File

@ -687,43 +687,6 @@ gtk_style_destroy (GtkStyle *style)
g_free (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 void
gtk_draw_hline (GtkStyle *style, gtk_draw_hline (GtkStyle *style,
GdkWindow *window, GdkWindow *window,
@ -1088,10 +1051,48 @@ gtk_draw_handle (GtkStyle *style,
(*style->klass->draw_handle) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation); (*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 */ /* Default functions */
void void
gtk_style_apply_default_pixmap (GtkStyle *style, gtk_style_apply_default_background (GtkStyle *style,
GdkWindow *window, GdkWindow *window,
gboolean copy_area,
GtkStateType state_type, GtkStateType state_type,
GdkRectangle *area, GdkRectangle *area,
gint x, gint x,
@ -1122,12 +1123,15 @@ gtk_style_apply_default_pixmap (GtkStyle *style,
gdk_draw_rectangle (window, gc, TRUE, gdk_draw_rectangle (window, gc, TRUE,
x, y, width, height); x, y, width, height);
} }
else else if (!copy_area || style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
{
if (!copy_area)
{ {
if (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); gdk_window_set_back_pixmap (window, NULL, TRUE);
else else
gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE); gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
}
old_rect.x = x; old_rect.x = x;
old_rect.y = y; old_rect.y = y;
@ -1139,6 +1143,23 @@ gtk_style_apply_default_pixmap (GtkStyle *style,
else else
gdk_window_clear_area (window, x, y, width, height); 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 static void
@ -2126,7 +2147,9 @@ gtk_default_draw_box (GtkStyle *style,
} }
} }
else 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, gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
x, y, width, height); x, y, width, height);
@ -2184,7 +2207,9 @@ gtk_default_draw_flat_box (GtkStyle *style,
} }
} }
else 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 static void
@ -2519,8 +2544,9 @@ gtk_default_draw_box_gap (GtkStyle *style,
g_return_if_fail (style != NULL); g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL); g_return_if_fail (window != NULL);
gtk_style_apply_default_pixmap(style, window, state_type, area, gtk_style_apply_default_background (style, window,
x, y, width, height); widget && GTK_WIDGET_NO_WINDOW (widget),
state_type, area, x, y, width, height);
if ((width == -1) && (height == -1)) if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height); 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 (style != NULL);
g_return_if_fail (window != NULL); g_return_if_fail (window != NULL);
gtk_style_apply_default_pixmap(style, window, GTK_STATE_NORMAL, area, gtk_style_apply_default_background (style, window,
x, y, width, height); widget && GTK_WIDGET_NO_WINDOW (widget),
GTK_STATE_NORMAL, area, x, y, width, height);
if ((width == -1) && (height == -1)) if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height); gdk_window_get_size (window, &width, &height);
@ -2796,7 +2823,9 @@ gtk_default_draw_extension (GtkStyle *style,
switch (gap_side) switch (gap_side)
{ {
case GTK_POS_TOP: case GTK_POS_TOP:
gtk_style_apply_default_pixmap(style, window, state_type, area, gtk_style_apply_default_background (style, window,
widget && GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
x + style->klass->xthickness, x + style->klass->xthickness,
y, y,
width - (2 * style->klass->xthickness), width - (2 * style->klass->xthickness),
@ -2816,7 +2845,9 @@ gtk_default_draw_extension (GtkStyle *style,
x + width - 1, y, x + width - 1, y + height - 2); x + width - 1, y, x + width - 1, y + height - 2);
break; break;
case GTK_POS_BOTTOM: case GTK_POS_BOTTOM:
gtk_style_apply_default_pixmap(style, window, state_type, area, gtk_style_apply_default_background (style, window,
widget && GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
x + style->klass->xthickness, x + style->klass->xthickness,
y + style->klass->ythickness, y + style->klass->ythickness,
width - (2 * style->klass->xthickness), width - (2 * style->klass->xthickness),
@ -2836,7 +2867,9 @@ gtk_default_draw_extension (GtkStyle *style,
x + width - 1, y + 1, x + width - 1, y + height - 1); x + width - 1, y + 1, x + width - 1, y + height - 1);
break; break;
case GTK_POS_LEFT: case GTK_POS_LEFT:
gtk_style_apply_default_pixmap(style, window, state_type, area, gtk_style_apply_default_background (style, window,
widget && GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
x, x,
y + style->klass->ythickness, y + style->klass->ythickness,
width - (style->klass->xthickness), width - (style->klass->xthickness),
@ -2856,7 +2889,9 @@ gtk_default_draw_extension (GtkStyle *style,
x + width - 1, y + 1, x + width - 1, y + height - 2); x + width - 1, y + 1, x + width - 1, y + height - 2);
break; break;
case GTK_POS_RIGHT: case GTK_POS_RIGHT:
gtk_style_apply_default_pixmap(style, window, state_type, area, gtk_style_apply_default_background (style, window,
widget && GTK_WIDGET_NO_WINDOW (widget),
state_type, area,
x + style->klass->xthickness, x + style->klass->xthickness,
y + style->klass->ythickness, y + style->klass->ythickness,
width - (style->klass->xthickness), width - (style->klass->xthickness),

View File

@ -342,8 +342,9 @@ void gtk_style_unref (GtkStyle *style);
void gtk_style_set_background (GtkStyle *style, void gtk_style_set_background (GtkStyle *style,
GdkWindow *window, GdkWindow *window,
GtkStateType state_type); GtkStateType state_type);
void gtk_style_apply_default_pixmap(GtkStyle *style, void gtk_style_apply_default_background (GtkStyle *style,
GdkWindow *window, GdkWindow *window,
gboolean copy_area,
GtkStateType state_type, GtkStateType state_type,
GdkRectangle *area, GdkRectangle *area,
gint x, gint x,

View 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_init (GtkToggleButton *toggle_button);
static void gtk_toggle_button_paint (GtkWidget *widget, static void gtk_toggle_button_paint (GtkWidget *widget,
GdkRectangle *area); GdkRectangle *area);
static void gtk_toggle_button_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_toggle_button_draw (GtkWidget *widget, static void gtk_toggle_button_draw (GtkWidget *widget,
GdkRectangle *area); 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_pressed (GtkButton *button);
static void gtk_toggle_button_released (GtkButton *button); static void gtk_toggle_button_released (GtkButton *button);
static void gtk_toggle_button_clicked (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->set_arg = gtk_toggle_button_set_arg;
object_class->get_arg = gtk_toggle_button_get_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->draw = gtk_toggle_button_draw;
widget_class->expose_event = gtk_toggle_button_expose;
widget_class->realize = gtk_toggle_button_realize; widget_class->realize = gtk_toggle_button_realize;
widget_class->unrealize = gtk_toggle_button_unrealize; widget_class->unrealize = gtk_toggle_button_unrealize;
widget_class->map = gtk_toggle_button_map; widget_class->map = gtk_toggle_button_map;
@ -140,6 +146,7 @@ gtk_toggle_button_init (GtkToggleButton *toggle_button)
{ {
toggle_button->active = FALSE; toggle_button->active = FALSE;
toggle_button->draw_indicator = FALSE; toggle_button->draw_indicator = FALSE;
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
} }
@ -234,14 +241,27 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
gtk_widget_unrealize (widget); gtk_widget_unrealize (widget);
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);
gtk_widget_realize (widget); gtk_widget_realize (widget);
if (visible) if (visible)
gtk_widget_show (widget); gtk_widget_show (widget);
} }
else 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)) if (GTK_WIDGET_VISIBLE (toggle_button))
gtk_widget_queue_resize (GTK_WIDGET (toggle_button)); gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
} }
@ -280,11 +300,11 @@ gtk_toggle_button_paint (GtkWidget *widget,
gint width, height; gint width, height;
gint x, y; gint x, y;
if (GTK_WIDGET_DRAWABLE (widget))
{
button = GTK_BUTTON (widget); button = GTK_BUTTON (widget);
toggle_button = GTK_TOGGLE_BUTTON (widget); toggle_button = GTK_TOGGLE_BUTTON (widget);
if (GTK_WIDGET_DRAWABLE (widget))
{
x = 0; x = 0;
y = 0; y = 0;
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2; 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 static void
gtk_toggle_button_draw (GtkWidget *widget, gtk_toggle_button_draw (GtkWidget *widget,
GdkRectangle *area) GdkRectangle *area)
@ -362,7 +402,7 @@ gtk_toggle_button_draw (GtkWidget *widget,
bin = GTK_BIN (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 = *area;
tmp_area.x -= GTK_CONTAINER (widget)->border_width; tmp_area.x -= GTK_CONTAINER (widget)->border_width;
@ -519,9 +559,8 @@ gtk_toggle_button_realize (GtkWidget *widget)
GDK_ENTER_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_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.wclass = GDK_INPUT_ONLY;
attributes_mask = GDK_WA_X | GDK_WA_Y; attributes_mask = GDK_WA_X | GDK_WA_Y;
@ -534,7 +573,6 @@ gtk_toggle_button_realize (GtkWidget *widget)
} }
else else
{ {
GTK_WIDGET_UNSET_FLAGS (toggle_button, GTK_NO_WINDOW);
attributes.wclass = GDK_INPUT_OUTPUT; attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.visual = gtk_widget_get_visual (widget); 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); 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); 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); 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_set_user_data (toggle_button->event_window, NULL);
gdk_window_destroy (toggle_button->event_window); 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 (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget)); 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); gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
GTK_WIDGET_CLASS (parent_class)->map (widget); 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 (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget)); 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); gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
GTK_WIDGET_CLASS (parent_class)->unmap (widget); GTK_WIDGET_CLASS (parent_class)->unmap (widget);

View File

@ -1206,15 +1206,19 @@ gtk_widget_setv (GtkWidget *widget,
gtk_object_setv (GTK_OBJECT (widget), nargs, args); gtk_object_setv (GTK_OBJECT (widget), nargs, args);
} }
/***************************************** static inline void
* gtk_widget_unparent: gtk_widget_queue_clear_child (GtkWidget *widget)
* do any cleanup necessary necessary {
* for setting parent = NULL. GtkWidget *parent;
*
* arguments: parent = widget->parent;
* if (parent && GTK_WIDGET_DRAWABLE (parent))
* results: gtk_widget_queue_clear_area (parent,
*****************************************/ widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
widget->allocation.height);
}
void void
gtk_widget_unparent (GtkWidget *widget) gtk_widget_unparent (GtkWidget *widget)
@ -1336,10 +1340,8 @@ gtk_widget_unparent (GtkWidget *widget)
toplevel = toplevel->parent; toplevel = toplevel->parent;
} }
if (widget->window &&
GTK_WIDGET_NO_WINDOW (widget) && gtk_widget_queue_clear_child (widget);
GTK_WIDGET_DRAWABLE (widget))
gtk_widget_queue_clear (widget);
/* Reset the width and height here, to force reallocation if we /* 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 * 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)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_VISIBLE (widget)) if (!GTK_WIDGET_VISIBLE (widget))
{
gtk_widget_queue_resize (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]); 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: * gtk_widget_show_now:
@ -1478,7 +1497,25 @@ gtk_widget_hide (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_VISIBLE (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 gint
@ -1540,6 +1577,8 @@ gtk_widget_map (GtkWidget *widget)
gtk_widget_realize (widget); gtk_widget_realize (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]); gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]);
gtk_widget_queue_draw (widget);
} }
} }
@ -1558,8 +1597,11 @@ gtk_widget_unmap (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (GTK_WIDGET_MAPPED (widget)) if (GTK_WIDGET_MAPPED (widget))
{
gtk_widget_queue_clear_child (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]); gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]);
} }
}
/***************************************** /*****************************************
* gtk_widget_realize: * gtk_widget_realize:
@ -1848,6 +1890,8 @@ gtk_widget_queue_clear (GtkWidget *widget)
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (widget->allocation.width || widget->allocation.height)
{
if (GTK_WIDGET_NO_WINDOW (widget)) if (GTK_WIDGET_NO_WINDOW (widget))
gtk_widget_queue_clear_area (widget, widget->allocation.x, gtk_widget_queue_clear_area (widget, widget->allocation.x,
widget->allocation.y, widget->allocation.y,
@ -1858,6 +1902,7 @@ gtk_widget_queue_clear (GtkWidget *widget)
widget->allocation.width, widget->allocation.width,
widget->allocation.height); widget->allocation.height);
} }
}
static gint static gint
gtk_widget_draw_data_combine (GtkDrawData *parent, GtkDrawData *child) gtk_widget_draw_data_combine (GtkDrawData *parent, GtkDrawData *child)
@ -2175,6 +2220,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
if (GTK_IS_RESIZE_CONTAINER (widget)) if (GTK_IS_RESIZE_CONTAINER (widget))
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget)); gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
if (GTK_WIDGET_DRAWABLE (widget))
gtk_widget_queue_clear (widget);
if (widget->parent) if (widget->parent)
gtk_container_queue_resize (GTK_CONTAINER (widget->parent)); gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
else if (GTK_WIDGET_TOPLEVEL (widget)) else if (GTK_WIDGET_TOPLEVEL (widget))
@ -2302,6 +2350,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
{ {
GtkWidgetAuxInfo *aux_info; GtkWidgetAuxInfo *aux_info;
GtkAllocation real_allocation; GtkAllocation real_allocation;
gboolean needs_draw = FALSE;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
@ -2317,7 +2366,46 @@ gtk_widget_size_allocate (GtkWidget *widget,
real_allocation.y = aux_info->y; 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); 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 static void
@ -4189,60 +4277,6 @@ gtk_widget_finalize (GtkObject *object)
parent_class->finalize (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: * gtk_widget_real_map:
* *
@ -4263,8 +4297,6 @@ gtk_widget_real_map (GtkWidget *widget)
if (!GTK_WIDGET_NO_WINDOW (widget)) if (!GTK_WIDGET_NO_WINDOW (widget))
gdk_window_show (widget->window); gdk_window_show (widget->window);
else
gtk_widget_queue_draw (widget);
} }
} }
@ -4286,9 +4318,7 @@ gtk_widget_real_unmap (GtkWidget *widget)
{ {
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
if (GTK_WIDGET_NO_WINDOW (widget)) if (!GTK_WIDGET_NO_WINDOW (widget))
gtk_widget_queue_clear (widget);
else
gdk_window_hide (widget->window); gdk_window_hide (widget->window);
} }
} }
@ -4366,14 +4396,6 @@ gtk_widget_real_unrealize (GtkWidget *widget)
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
} }
/*****************************************
* gtk_widget_real_draw:
*
* arguments:
*
* results:
*****************************************/
static void static void
gtk_widget_real_draw (GtkWidget *widget, gtk_widget_real_draw (GtkWidget *widget,
GdkRectangle *area) GdkRectangle *area)
@ -4409,34 +4431,6 @@ gtk_widget_real_size_request (GtkWidget *widget,
requisition->height = widget->requisition.height; 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: * gtk_widget_peek_colormap:
* *

View File

@ -29,12 +29,6 @@ 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" style "scale"
{ {
fg[NORMAL] = { 1.0, 0, 0 } fg[NORMAL] = { 1.0, 0, 0 }
@ -52,7 +46,8 @@ style "toggle_button" = "button"
{ {
fg[NORMAL] = { 1.0, 0, 0 } fg[NORMAL] = { 1.0, 0, 0 }
fg[ACTIVE] = { 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" style "text"

21
tests/check-n.xpm Normal file
View File

@ -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.....",
"..........",
"..........",
};

21
tests/check-y.xpm Normal file
View File

@ -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.....",
"..........",
"..........",
};

View File

@ -29,12 +29,6 @@ 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" style "scale"
{ {
fg[NORMAL] = { 1.0, 0, 0 } fg[NORMAL] = { 1.0, 0, 0 }
@ -52,7 +46,8 @@ style "toggle_button" = "button"
{ {
fg[NORMAL] = { 1.0, 0, 0 } fg[NORMAL] = { 1.0, 0, 0 }
fg[ACTIVE] = { 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" style "text"