gtk2/gtk/gtkwidgetpaintableprivate.h
Benjamin Otte 12fedca726 widgetpaintable: Protect against too many signals
This is actually not just a mechnaism to protect against too many
signals, but it's also a method to getting those signals at the wrong
time.

For every size/content change, a widget needs to invalidate twice:
Once when it queues a resize/redraw (going valid => invalid) and once
when the new size/content is actually assigned (going invalid => valid).

However, one of those invalidations might be inconvenient for the
listener. GtkImage for example does not like receiving
invalidate-contents signals when new contents are assigned, but is fine
with them when the old ones go invalid. And it will not try to draw the
paintable in between anyway.

So by bypassing the 2nd emission if nothing was changed, we can make
GtkImage happy.
2018-04-05 14:56:39 +02:00

31 lines
1.1 KiB
C

/*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#ifndef __GTK_WIDGET_PAINTABLE_PRIVATE_H__
#define __GTK_WIDGET_PAINTABLE_PRIVATE_H__
#include "gtkwidgetpaintable.h"
void gtk_widget_paintable_invalidate_size (GtkWidgetPaintable *self);
void gtk_widget_paintable_invalidate_contents (GtkWidgetPaintable *self);
#endif /* __GTK_WIDGET_PAINTABLE_PRIVATE_H__ */