// 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 glib::translate::*;
use std::fmt;

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

impl fmt::Display for X11DeviceType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "X11DeviceType::{}",
            match *self {
                X11DeviceType::Logical => "Logical",
                X11DeviceType::Physical => "Physical",
                X11DeviceType::Floating => "Floating",
                _ => "Unknown",
            }
        )
    }
}

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

    fn to_glib(&self) -> ffi::GdkX11DeviceType {
        match *self {
            X11DeviceType::Logical => ffi::GDK_X11_DEVICE_TYPE_LOGICAL,
            X11DeviceType::Physical => ffi::GDK_X11_DEVICE_TYPE_PHYSICAL,
            X11DeviceType::Floating => ffi::GDK_X11_DEVICE_TYPE_FLOATING,
            X11DeviceType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkX11DeviceType> for X11DeviceType {
    unsafe fn from_glib(value: ffi::GdkX11DeviceType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => X11DeviceType::Logical,
            1 => X11DeviceType::Physical,
            2 => X11DeviceType::Floating,
            value => X11DeviceType::__Unknown(value),
        }
    }
}
