[gimp] app: add GimpTileHandlerValidate::invalidated signal



commit 3ea391602e340edd5dd3448b7f5a5fdcf0c96783
Author: Ell <ell_se yahoo com>
Date:   Wed Jan 15 21:38:59 2020 +0200

    app: add GimpTileHandlerValidate::invalidated signal
    
    Add a new GimpTileHandlerValidate::invalidated signal, which is
    emitted when a region of the buffer is invalidated.  This would
    allow us to properly invalidate the graph in response; this
    normally happens in response to GeglBuffer::changed, but this
    signal is not emitted when a region is merely invalidated.

 app/gegl/gimptilehandlervalidate.c | 23 +++++++++++++++++++++++
 app/gegl/gimptilehandlervalidate.h |  5 +++++
 2 files changed, 28 insertions(+)
---
diff --git a/app/gegl/gimptilehandlervalidate.c b/app/gegl/gimptilehandlervalidate.c
index 4dde27091d..ebac465c02 100644
--- a/app/gegl/gimptilehandlervalidate.c
+++ b/app/gegl/gimptilehandlervalidate.c
@@ -25,11 +25,19 @@
 
 #include "gimp-gegl-types.h"
 
+#include "core/gimpmarshal.h"
+
 #include "gimp-gegl-loops.h"
 #include "gimp-gegl-utils.h"
 #include "gimptilehandlervalidate.h"
 
 
+enum
+{
+  INVALIDATED,
+  LAST_SIGNAL
+};
+
 enum
 {
   PROP_0,
@@ -74,12 +82,24 @@ G_DEFINE_TYPE (GimpTileHandlerValidate, gimp_tile_handler_validate,
 
 #define parent_class gimp_tile_handler_validate_parent_class
 
+static guint gimp_tile_handler_validate_signals[LAST_SIGNAL];
+
 
 static void
 gimp_tile_handler_validate_class_init (GimpTileHandlerValidateClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  gimp_tile_handler_validate_signals[INVALIDATED] =
+    g_signal_new ("invalidated",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GimpTileHandlerValidateClass, invalidated),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__BOXED,
+                  G_TYPE_NONE, 1,
+                  GEGL_TYPE_RECTANGLE);
+
   object_class->finalize     = gimp_tile_handler_validate_finalize;
   object_class->set_property = gimp_tile_handler_validate_set_property;
   object_class->get_property = gimp_tile_handler_validate_get_property;
@@ -465,6 +485,9 @@ gimp_tile_handler_validate_invalidate (GimpTileHandlerValidate *validate,
                                 (cairo_rectangle_int_t *) rect);
 
   gegl_tile_handler_damage_rect (GEGL_TILE_HANDLER (validate), rect);
+
+  g_signal_emit (validate, gimp_tile_handler_validate_signals[INVALIDATED],
+                 0, rect, NULL);
 }
 
 void
diff --git a/app/gegl/gimptilehandlervalidate.h b/app/gegl/gimptilehandlervalidate.h
index ae1e125eb6..86973be33b 100644
--- a/app/gegl/gimptilehandlervalidate.h
+++ b/app/gegl/gimptilehandlervalidate.h
@@ -56,6 +56,11 @@ struct _GimpTileHandlerValidateClass
 {
   GeglTileHandlerClass  parent_class;
 
+  /*  signals  */
+  void (* invalidated)     (GimpTileHandlerValidate *validate,
+                            const GeglRectangle     *rect);
+
+  /*  virtual functions  */
   void (* begin_validate)  (GimpTileHandlerValidate *validate);
   void (* end_validate)    (GimpTileHandlerValidate *validate);
   void (* validate)        (GimpTileHandlerValidate *validate,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]