// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GdkX11DeviceType")]
pub enum X11DeviceType {
    #[doc(alias = "GDK_X11_DEVICE_TYPE_LOGICAL")]
    Logical,
    #[doc(alias = "GDK_X11_DEVICE_TYPE_PHYSICAL")]
    Physical,
    #[doc(alias = "GDK_X11_DEVICE_TYPE_FLOATING")]
    Floating,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for X11DeviceType {
    type GlibType = ffi::GdkX11DeviceType;

    #[inline]
    fn into_glib(self) -> ffi::GdkX11DeviceType {
        match self {
            Self::Logical => ffi::GDK_X11_DEVICE_TYPE_LOGICAL,
            Self::Physical => ffi::GDK_X11_DEVICE_TYPE_PHYSICAL,
            Self::Floating => ffi::GDK_X11_DEVICE_TYPE_FLOATING,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkX11DeviceType> for X11DeviceType {
    #[inline]
    unsafe fn from_glib(value: ffi::GdkX11DeviceType) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GDK_X11_DEVICE_TYPE_LOGICAL => Self::Logical,
            ffi::GDK_X11_DEVICE_TYPE_PHYSICAL => Self::Physical,
            ffi::GDK_X11_DEVICE_TYPE_FLOATING => Self::Floating,
            value => Self::__Unknown(value),
        }
    }
}
