Avoid deprecation warnings cased by GTK_ALIGN_BASELINE_FILL

We have to be careful to only use GDK_ALIGN_BASELINE_FILL when permitted
by GDK_VERSION_MAX_ALLOWED because gtkenums.h is a public header. If
it's not allowed, then just fall back to the previous definition of
GtkAlign since they are both compatible.

I don't think we can avoid conditional compilation here, because the old
definition is going to cause deprecated declaration warnings unless you
define an old GDK_VERSION_MIN_REQUIRED.

Fixes #5875
This commit is contained in:
Michael Catanzaro
2023-06-08 16:02:58 -05:00
parent 28fb91e85e
commit f1f2e3e237

View File

@@ -69,8 +69,13 @@ typedef enum
GTK_ALIGN_START,
GTK_ALIGN_END,
GTK_ALIGN_CENTER,
#if defined(GDK_VERSION_MAX_ALLOWED) && GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_12
GTK_ALIGN_BASELINE GDK_DEPRECATED_ENUMERATOR_IN_4_12_FOR(GTK_ALIGN_BASELINE_FILL),
GTK_ALIGN_BASELINE_FILL GDK_AVAILABLE_ENUMERATOR_IN_4_12 = GTK_ALIGN_BASELINE,
#else
GTK_ALIGN_BASELINE_FILL GDK_AVAILABLE_ENUMERATOR_IN_4_12,
GTK_ALIGN_BASELINE GDK_DEPRECATED_ENUMERATOR_IN_4_12_FOR(GTK_ALIGN_BASELINE_FILL) = GTK_ALIGN_BASELINE_FILL,
#endif
GTK_ALIGN_BASELINE_CENTER GDK_AVAILABLE_ENUMERATOR_IN_4_12,
} GtkAlign;