From 3d22e4fe4057b8136ec23122c31aaa61c4cf5f23 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 2 Aug 2024 17:16:40 +0200 Subject: [PATCH] clutter: Rename CallyStage to StageAccessible Moving it to the correct namespace and marking it a final private type Part-of: --- clutter/clutter/cally-stage.c | 108 ------------------ clutter/clutter/clutter-accessibility.c | 1 - ...e.h => clutter-stage-accessible-private.h} | 28 ++--- clutter/clutter/clutter-stage-accessible.c | 106 +++++++++++++++++ clutter/clutter/clutter-stage.c | 4 +- clutter/clutter/clutter.h | 1 - clutter/clutter/meson.build | 4 +- 7 files changed, 117 insertions(+), 135 deletions(-) delete mode 100644 clutter/clutter/cally-stage.c rename clutter/clutter/{cally-stage.h => clutter-stage-accessible-private.h} (58%) create mode 100644 clutter/clutter/clutter-stage-accessible.c diff --git a/clutter/clutter/cally-stage.c b/clutter/clutter/cally-stage.c deleted file mode 100644 index 0bc1bd2e4..000000000 --- a/clutter/clutter/cally-stage.c +++ /dev/null @@ -1,108 +0,0 @@ -/* CALLY - The Clutter Accessibility Implementation Library - * - * Copyright (C) 2008 Igalia, S.L. - * - * Author: Alejandro Piñeiro Iglesias - * - * 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 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 . - */ - -/** - * CallyStage: - * - * Implementation of the ATK interfaces for a #ClutterStage - * - * #CallyStage implements the required ATK interfaces for [class@Clutter.Stage] - * - * Some implementation details: at this moment #CallyStage is used as - * the most similar Window object in this toolkit (ie: emitting window - * related signals), although the real purpose of [class@Clutter.Stage] is - * being a canvas. Anyway, this is required for applications using - * just clutter, or directly [class@Clutter.Stage] - */ -#include "config.h" - -#include "clutter/clutter-actor-private.h" -#include "clutter/cally-stage.h" -#include "clutter/clutter-stage.h" - -/* AtkObject.h */ -static void cally_stage_real_initialize (AtkObject *obj, - gpointer data); -static AtkStateSet* cally_stage_ref_state_set (AtkObject *obj); - -/* AtkWindow */ -static void cally_stage_window_interface_init (AtkWindowIface *iface); - - -G_DEFINE_TYPE_WITH_CODE (CallyStage, - cally_stage, - CLUTTER_TYPE_ACTOR_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW, - cally_stage_window_interface_init)); - -static void -cally_stage_class_init (CallyStageClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - /* AtkObject */ - class->initialize = cally_stage_real_initialize; - class->ref_state_set = cally_stage_ref_state_set; -} - -static void -cally_stage_init (CallyStage *cally_stage) -{ -} - -static void -cally_stage_real_initialize (AtkObject *obj, - gpointer data) -{ - g_return_if_fail (CALLY_IS_STAGE (obj)); - - ATK_OBJECT_CLASS (cally_stage_parent_class)->initialize (obj, data); - - atk_object_set_role (obj, ATK_ROLE_WINDOW); -} - -static AtkStateSet* -cally_stage_ref_state_set (AtkObject *obj) -{ - CallyStage *cally_stage = NULL; - AtkStateSet *state_set = NULL; - ClutterStage *stage = NULL; - - g_return_val_if_fail (CALLY_IS_STAGE (obj), NULL); - cally_stage = CALLY_STAGE (obj); - - state_set = ATK_OBJECT_CLASS (cally_stage_parent_class)->ref_state_set (obj); - stage = CLUTTER_STAGE (CLUTTER_ACTOR_FROM_ACCESSIBLE (cally_stage)); - - if (stage == NULL) - return state_set; - - if (clutter_stage_is_active (stage)) - atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); - - return state_set; -} - -/* AtkWindow */ -static void -cally_stage_window_interface_init (AtkWindowIface *iface) -{ - /* At this moment AtkWindow is just about signals */ -} diff --git a/clutter/clutter/clutter-accessibility.c b/clutter/clutter/clutter-accessibility.c index 0e8ea08b5..5dc17a455 100644 --- a/clutter/clutter/clutter-accessibility.c +++ b/clutter/clutter/clutter-accessibility.c @@ -39,7 +39,6 @@ #include "clutter/clutter-accessibility-private.h" #include "clutter/cally-root.h" -#include "clutter/cally-stage.h" #include "clutter/clutter.h" #define DEFAULT_PASSWORD_CHAR '*' diff --git a/clutter/clutter/cally-stage.h b/clutter/clutter/clutter-stage-accessible-private.h similarity index 58% rename from clutter/clutter/cally-stage.h rename to clutter/clutter/clutter-stage-accessible-private.h index cbd67d51c..dbcc35054 100644 --- a/clutter/clutter/cally-stage.h +++ b/clutter/clutter/clutter-stage-accessible-private.h @@ -1,4 +1,4 @@ -/* CALLY - The Clutter Accessibility Implementation Library +/* Clutter. * * Copyright (C) 2008 Igalia, S.L. * @@ -20,31 +20,17 @@ #pragma once -#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - #include "clutter/clutter-actor-accessible.h" #include "clutter/clutter-macros.h" G_BEGIN_DECLS -#define CALLY_TYPE_STAGE (cally_stage_get_type ()) +#define CLUTTER_TYPE_STAGE_ACCESSIBLE (clutter_stage_accessible_get_type ()) -CLUTTER_EXPORT -G_DECLARE_DERIVABLE_TYPE (CallyStage, - cally_stage, - CALLY, - STAGE, - ClutterActorAccessible) - -typedef struct _CallyStage CallyStage; -typedef struct _CallyStageClass CallyStageClass; - -struct _CallyStageClass -{ - /*< private >*/ - ClutterActorAccessibleClass parent_class; -}; +G_DECLARE_FINAL_TYPE (ClutterStageAccessible, + clutter_stage_accessible, + CLUTTER, + STAGE_ACCESSIBLE, + ClutterActorAccessible) G_END_DECLS diff --git a/clutter/clutter/clutter-stage-accessible.c b/clutter/clutter/clutter-stage-accessible.c new file mode 100644 index 000000000..daa5dae33 --- /dev/null +++ b/clutter/clutter/clutter-stage-accessible.c @@ -0,0 +1,106 @@ +/* Clutter. + * + * Copyright (C) 2008 Igalia, S.L. + * + * Author: Alejandro Piñeiro Iglesias + * + * 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 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 . + */ + +/** + * ClutterStageAccessible: + * + * Implementation of the ATK interfaces for a #ClutterStage + * + * #ClutterStageAccessible implements the required ATK interfaces for [class@Clutter.Stage] + * + * Some implementation details: at this moment #ClutterStageAccessible is used as + * the most similar Window object in this toolkit (ie: emitting window + * related signals), although the real purpose of [class@Clutter.Stage] is + * being a canvas. Anyway, this is required for applications using + * just clutter, or directly [class@Clutter.Stage] + */ +#include "config.h" + +#include "clutter/clutter-actor-private.h" +#include "clutter/clutter-stage-accessible-private.h" +#include "clutter/clutter-stage.h" + +/* AtkWindow */ +static void clutter_stage_accessible_window_interface_init (AtkWindowIface *iface); + +struct _ClutterStageAccessible +{ + ClutterActorAccessible parent; +}; +G_DEFINE_FINAL_TYPE_WITH_CODE (ClutterStageAccessible, + clutter_stage_accessible, + CLUTTER_TYPE_ACTOR_ACCESSIBLE, + G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW, + clutter_stage_accessible_window_interface_init)); + +static void +clutter_stage_accessible_init (ClutterStageAccessible *stage_accessible) +{ +} + +static void +clutter_stage_accessible_real_initialize (AtkObject *obj, + gpointer data) +{ + g_return_if_fail (CLUTTER_IS_STAGE_ACCESSIBLE (obj)); + + ATK_OBJECT_CLASS (clutter_stage_accessible_parent_class)->initialize (obj, data); + + atk_object_set_role (obj, ATK_ROLE_WINDOW); +} + +static AtkStateSet* +clutter_stage_accessible_ref_state_set (AtkObject *obj) +{ + ClutterStageAccessible *stage_accessible; + AtkStateSet *state_set; + ClutterStage *stage; + + g_return_val_if_fail (CLUTTER_IS_STAGE_ACCESSIBLE (obj), NULL); + stage_accessible = CLUTTER_STAGE_ACCESSIBLE (obj); + + state_set = ATK_OBJECT_CLASS (clutter_stage_accessible_parent_class)->ref_state_set (obj); + stage = CLUTTER_STAGE (CLUTTER_ACTOR_FROM_ACCESSIBLE (stage_accessible)); + + if (stage == NULL) + return state_set; + + if (clutter_stage_is_active (stage)) + atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); + + return state_set; +} + +/* AtkWindow */ +static void +clutter_stage_accessible_window_interface_init (AtkWindowIface *iface) +{ + /* At this moment AtkWindow is just about signals */ +} + +static void +clutter_stage_accessible_class_init (ClutterStageAccessibleClass *klass) +{ + AtkObjectClass *class = ATK_OBJECT_CLASS (klass); + + /* AtkObject */ + class->initialize = clutter_stage_accessible_real_initialize; + class->ref_state_set = clutter_stage_accessible_ref_state_set; +} diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index c209ee37b..5ca451531 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -41,7 +41,7 @@ #include "clutter/clutter-stage.h" -#include "clutter/cally-stage.h" +#include "clutter/clutter-stage-accessible-private.h" #include "clutter/clutter-action-private.h" #include "clutter/clutter-actor-private.h" #include "clutter/clutter-backend-private.h" @@ -1343,7 +1343,7 @@ clutter_stage_class_init (ClutterStageClass *klass) gobject_class->finalize = clutter_stage_finalize; actor_class->allocate = clutter_stage_allocate; - actor_class->get_accessible_type = cally_stage_get_type; + actor_class->get_accessible_type = clutter_stage_accessible_get_type; actor_class->get_preferred_width = clutter_stage_get_preferred_width; actor_class->get_preferred_height = clutter_stage_get_preferred_height; actor_class->get_paint_volume = clutter_stage_get_paint_volume; diff --git a/clutter/clutter/clutter.h b/clutter/clutter/clutter.h index 5a8b18fff..f0bd9064f 100644 --- a/clutter/clutter/clutter.h +++ b/clutter/clutter/clutter.h @@ -31,7 +31,6 @@ #include "clutter/clutter-actor-accessible.h" #include "clutter/cally-root.h" -#include "clutter/cally-stage.h" #include "clutter/cally-text.h" #include "clutter/cally-root.h" diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index aaa95c8fb..0c81ce245 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -161,6 +161,7 @@ clutter_sources = [ 'clutter-shader-types.c', 'clutter-swipe-action.c', 'clutter-snap-constraint.c', + 'clutter-stage-accessible.c', 'clutter-stage.c', 'clutter-stage-manager.c', 'clutter-stage-view.c', @@ -206,6 +207,7 @@ clutter_private_headers = [ 'clutter-paint-volume-private.h', 'clutter-private.h', 'clutter-settings-private.h', + 'clutter-stage-accessible-private.h', 'clutter-stage-manager-private.h', 'clutter-stage-private.h', 'clutter-stage-view-private.h', @@ -221,13 +223,11 @@ clutter_backend_private_headers = [] clutter_headers += [ 'cally-root.h', - 'cally-stage.h', 'cally-text.h', ] clutter_sources += [ 'cally-root.c', - 'cally-stage.c', 'cally-text.c', ]