Skip to content

Commit 612cd9c

Browse files
rcalixteFantu
andauthored
gir: Correct usage of the closure annotation (#704)
Whenever you’re describing a function that takes a callback, you should always annotate the callback argument with the argument that contains the user data using the (closure argument) annotation You should not annotate the data argument with a unary (closure). The unary (closure) is meant to be used when annotating the callback type Ref: https://gitlab.gnome.org/GNOME/mutter/-/commit/077eb80a8d9bb2968c2bfac959c2f2ca966ca7e7 Co-authored-by: Fabio Fantoni <[email protected]>
1 parent 7124201 commit 612cd9c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

clutter/clutter/clutter-actor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13069,8 +13069,8 @@ typedef enum
1306913069
* @self: a #ClutterActor
1307013070
* @child: a #ClutterActor
1307113071
* @flags: control flags for actions
13072-
* @add_func: delegate function
13073-
* @data: (closure): data to pass to @add_func
13072+
* @add_func (closure data): delegate function
13073+
* @data: data to pass to @add_func
1307413074
*
1307513075
* Adds @child to the list of children of @self.
1307613076
*

clutter/clutter/clutter-timeline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,8 +2184,8 @@ clutter_timeline_get_repeat_count (ClutterTimeline *timeline)
21842184
/**
21852185
* clutter_timeline_set_progress_func:
21862186
* @timeline: a #ClutterTimeline
2187-
* @func: (scope notified) (allow-none): a progress function, or %NULL
2188-
* @data: (closure): data to pass to @func
2187+
* @func: (scope notified) (allow-none) (closure data): a progress function, or %NULL
2188+
* @data: data to pass to @func
21892189
* @notify: a function to be called when the progress function is removed
21902190
* or the timeline is disposed
21912191
*

cogl/cogl/cogl-onscreen.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ GType cogl_frame_closure_get_gtype (void);
395395
/**
396396
* cogl_onscreen_add_frame_callback:
397397
* @onscreen: A #CoglOnscreen framebuffer
398-
* @callback: (scope notified): A callback function to call for frame events
399-
* @user_data: (closure): A private pointer to be passed to @callback
398+
* @callback: (scope notified) (closure user_data): A callback function to call for frame events
399+
* @user_data: A private pointer to be passed to @callback
400400
* @destroy: (allow-none): An optional callback to destroy @user_data
401401
* when the @callback is removed or @onscreen is freed.
402402
*
@@ -568,9 +568,9 @@ GType cogl_onscreen_resize_closure_get_gtype (void);
568568
/**
569569
* cogl_onscreen_add_resize_callback:
570570
* @onscreen: A #CoglOnscreen framebuffer
571-
* @callback: (scope notified): A #CoglOnscreenResizeCallback to call when
571+
* @callback: (scope notified) (closure user_data): A #CoglOnscreenResizeCallback to call when
572572
* the @onscreen changes size.
573-
* @user_data: (closure): Private data to be passed to @callback.
573+
* @user_data: Private data to be passed to @callback.
574574
* @destroy: (allow-none): An optional callback to destroy @user_data
575575
* when the @callback is removed or @onscreen is freed.
576576
*
@@ -683,8 +683,8 @@ GType cogl_onscreen_dirty_closure_get_gtype (void);
683683
/**
684684
* cogl_onscreen_add_dirty_callback:
685685
* @onscreen: A #CoglOnscreen framebuffer
686-
* @callback: (scope notified): A callback function to call for dirty events
687-
* @user_data: (closure): A private pointer to be passed to @callback
686+
* @callback: (scope notified) (closure user_data): A callback function to call for dirty events
687+
* @user_data: A private pointer to be passed to @callback
688688
* @destroy: (allow-none): An optional callback to destroy @user_data when the
689689
* @callback is removed or @onscreen is freed.
690690
*

cogl/cogl/cogl-pipeline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ typedef gboolean (*CoglPipelineLayerCallback) (CoglPipeline *pipeline,
142142
/**
143143
* cogl_pipeline_foreach_layer:
144144
* @pipeline: A #CoglPipeline object
145-
* @callback: (scope call): A #CoglPipelineLayerCallback to be
145+
* @callback: (scope call) (closure user_data): A #CoglPipelineLayerCallback to be
146146
* called for each layer index
147-
* @user_data: (closure): Private data that will be passed to the
147+
* @user_data: Private data that will be passed to the
148148
* callback
149149
*
150150
* Iterates all the layer indices of the given @pipeline.

src/tests/clutter-test-utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ clutter_test_add_data (const char *test_path,
199199
/**
200200
* clutter_test_add_data_full:
201201
* @test_path: unique path for identifying the test
202-
* @test_func: (scope notified): function containing the test
203-
* @test_data: (closure): data to pass to the test function
202+
* @test_func: (scope notified) (closure test_data): function containing the test
203+
* @test_data: data to pass to the test function
204204
* @test_notify: function called when the test function ends
205205
*
206206
* Adds a test unit to the Clutter test environment.

0 commit comments

Comments
 (0)