From f7aaba9fc9f15b39de1f436c86b5b8486d681b71 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 31 Aug 2024 00:45:15 +0200 Subject: [PATCH] =?UTF-8?q?app,=20libgimpbase,=20libgimpconfig:=20make=20o?= =?UTF-8?q?ur=20custom=20GParamFlags=20definitions=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … more robust. GIMP_PARAM_NO_VALIDATE and GIMP_CONFIG_PARAM_DONT_COMPARE were the same value, most likely because when GIMP_CONFIG_PARAM_DONT_COMPARE got added (commit c5c807d1913), the comment to keep in sync libgimpbase/gimpparamspecs.h and libgimpconfig/gimpconfig-params.h was missed. Instead, since libgimpconfig can include libgimpbase, do the other way around: first non-GLib param flags are in libgimpbase, then we add a GIMP_PARAM_FLAG_SHIFT, then we increment from it in libgimpconfig, and finally we increment from GIMP_CONFIG_PARAM_FLAG_SHIFT if ever we add more flags in app/ (right now GIMP_SYMMETRY_PARAM_GUI is apparently the only one, but this may change). --- app/core/gimpsymmetry.h | 4 ++-- app/widgets/gimpsymmetryeditor.c | 1 + libgimpbase/gimpparamspecs.h | 11 ++++++++--- libgimpconfig/gimpconfig-params.h | 22 +++++++++++++++------- libgimpconfig/gimpconfig.h | 2 ++ 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/core/gimpsymmetry.h b/app/core/gimpsymmetry.h index d695c768ae..bd1dcee615 100644 --- a/app/core/gimpsymmetry.h +++ b/app/core/gimpsymmetry.h @@ -25,8 +25,8 @@ #include "gimpobject.h" -/* shift one more than GIMP_CONFIG_PARAM_DONT_COMPARE */ -#define GIMP_SYMMETRY_PARAM_GUI (1 << (7 + G_PARAM_USER_SHIFT)) +/* shift one more than latest GIMP_CONFIG_PARAM_* */ +#define GIMP_SYMMETRY_PARAM_GUI (1 << (0 + GIMP_CONFIG_PARAM_FLAG_SHIFT)) #define GIMP_TYPE_SYMMETRY (gimp_symmetry_get_type ()) diff --git a/app/widgets/gimpsymmetryeditor.c b/app/widgets/gimpsymmetryeditor.c index 4897667e0a..b6c05c172c 100644 --- a/app/widgets/gimpsymmetryeditor.c +++ b/app/widgets/gimpsymmetryeditor.c @@ -23,6 +23,7 @@ #include #include +#include "libgimpconfig/gimpconfig.h" #include "libgimpwidgets/gimpwidgets.h" #include "propgui/propgui-types.h" /* ugly, but what the heck */ diff --git a/libgimpbase/gimpparamspecs.h b/libgimpbase/gimpparamspecs.h index da6a357563..b00064fd15 100644 --- a/libgimpbase/gimpparamspecs.h +++ b/libgimpbase/gimpparamspecs.h @@ -35,10 +35,15 @@ G_BEGIN_DECLS * * Since 3.0 */ -/* - * Keep in sync with libgimpconfig/gimpconfig-params.h +#define GIMP_PARAM_NO_VALIDATE (1 << (0 + G_PARAM_USER_SHIFT)) + +/** + * GIMP_PARAM_FLAG_SHIFT: + * + * Minimum shift count to be used for libgimpconfig defined + * [flags@GObject.ParamFlags] (see libgimpconfig/gimpconfig-params.h). */ -#define GIMP_PARAM_NO_VALIDATE (1 << (6 + G_PARAM_USER_SHIFT)) +#define GIMP_PARAM_FLAG_SHIFT (1 + G_PARAM_USER_SHIFT) /** * GIMP_PARAM_STATIC_STRINGS: diff --git a/libgimpconfig/gimpconfig-params.h b/libgimpconfig/gimpconfig-params.h index 516baf8639..a11175d769 100644 --- a/libgimpconfig/gimpconfig-params.h +++ b/libgimpconfig/gimpconfig-params.h @@ -37,21 +37,21 @@ G_BEGIN_DECLS * * A property that can and should be serialized and deserialized. **/ -#define GIMP_CONFIG_PARAM_SERIALIZE (1 << (0 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_SERIALIZE (1 << (0 + GIMP_PARAM_FLAG_SHIFT)) /** * GIMP_CONFIG_PARAM_AGGREGATE: * * The object property is to be treated as part of the parent object. **/ -#define GIMP_CONFIG_PARAM_AGGREGATE (1 << (1 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_AGGREGATE (1 << (1 + GIMP_PARAM_FLAG_SHIFT)) /** * GIMP_CONFIG_PARAM_RESTART: * * Changes to this property take effect only after a restart. **/ -#define GIMP_CONFIG_PARAM_RESTART (1 << (2 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_RESTART (1 << (2 + GIMP_PARAM_FLAG_SHIFT)) /** * GIMP_CONFIG_PARAM_CONFIRM: @@ -59,14 +59,14 @@ G_BEGIN_DECLS * Changes to this property should be confirmed by the user before * being applied. **/ -#define GIMP_CONFIG_PARAM_CONFIRM (1 << (3 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_CONFIRM (1 << (3 + GIMP_PARAM_FLAG_SHIFT)) /** * GIMP_CONFIG_PARAM_DEFAULTS: * * Don't serialize this property if it has the default value. **/ -#define GIMP_CONFIG_PARAM_DEFAULTS (1 << (4 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_DEFAULTS (1 << (4 + GIMP_PARAM_FLAG_SHIFT)) /** * GIMP_CONFIG_PARAM_IGNORE: @@ -74,14 +74,22 @@ G_BEGIN_DECLS * This property exists for obscure reasons or is needed for backward * compatibility. Ignore the value read and don't serialize it. **/ -#define GIMP_CONFIG_PARAM_IGNORE (1 << (5 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_IGNORE (1 << (5 + GIMP_PARAM_FLAG_SHIFT)) /** * GIMP_CONFIG_PARAM_DONT_COMPARE: * * Ignore this property when comparing objects. **/ -#define GIMP_CONFIG_PARAM_DONT_COMPARE (1 << (6 + G_PARAM_USER_SHIFT)) +#define GIMP_CONFIG_PARAM_DONT_COMPARE (1 << (6 + GIMP_PARAM_FLAG_SHIFT)) + +/** + * GIMP_CONFIG_PARAM_FLAG_SHIFT: + * + * Minimum shift count to be used for core application defined + * [flags@GObject.ParamFlags]. + */ +#define GIMP_CONFIG_PARAM_FLAG_SHIFT (7 + GIMP_PARAM_FLAG_SHIFT) /** * GIMP_CONFIG_PARAM_FLAGS: diff --git a/libgimpconfig/gimpconfig.h b/libgimpconfig/gimpconfig.h index 829ab5b4b4..43cbf37ddb 100644 --- a/libgimpconfig/gimpconfig.h +++ b/libgimpconfig/gimpconfig.h @@ -21,6 +21,8 @@ #include +#include + #define __GIMP_CONFIG_H_INSIDE__ #include