barrier/native: Fix warning about implicit enum conversion

Also add static asserts to make sure the values match so casting can be
done.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
This commit is contained in:
Jonas Ådahl 2022-03-04 20:56:47 +01:00 committed by Marge Bot
parent ab21bedcfc
commit 79319a3a91
2 changed files with 13 additions and 1 deletions

View File

@ -26,6 +26,15 @@
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrier, meta_barrier, G_TYPE_OBJECT)
G_DEFINE_TYPE (MetaBarrierImpl, meta_barrier_impl, G_TYPE_OBJECT)
G_STATIC_ASSERT ((int) META_BARRIER_DIRECTION_POSITIVE_X ==
(int) META_BORDER_MOTION_DIRECTION_POSITIVE_X);
G_STATIC_ASSERT ((int) META_BARRIER_DIRECTION_POSITIVE_Y ==
(int) META_BORDER_MOTION_DIRECTION_POSITIVE_Y);
G_STATIC_ASSERT ((int) META_BARRIER_DIRECTION_NEGATIVE_X ==
(int) META_BORDER_MOTION_DIRECTION_NEGATIVE_X);
G_STATIC_ASSERT ((int) META_BARRIER_DIRECTION_NEGATIVE_Y ==
(int) META_BORDER_MOTION_DIRECTION_NEGATIVE_Y);
enum
{
PROP_0,

View File

@ -109,8 +109,11 @@ static gboolean
is_barrier_blocking_directions (MetaBarrier *barrier,
MetaBarrierDirection directions)
{
MetaBorderMotionDirection border_motion_directions =
(MetaBorderMotionDirection) directions;
return meta_border_is_blocking_directions (&barrier->priv->border,
directions);
border_motion_directions);
}
static void