From 976e6dbc70f2131f19d34abf66b0abb4e46f81ba Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Thu, 28 Apr 2016 19:15:23 -0400 Subject: [PATCH] Derive common traits for AppKit integer repr enums. --- Cargo.toml | 2 +- src/appkit.rs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1a48196..06fd47e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "cocoa" description = "Bindings to Cocoa for OS X" homepage = "https://github.com/servo/cocoa-rs" repository = "https://github.com/servo/cocoa-rs" -version = "0.3.1" +version = "0.3.2" authors = ["The Servo Project Developers"] license = "MIT / Apache-2.0" diff --git a/src/appkit.rs b/src/appkit.rs index fcdbd41..bc98506 100644 --- a/src/appkit.rs +++ b/src/appkit.rs @@ -65,6 +65,7 @@ pub unsafe fn NSApp() -> id { } #[repr(i64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSApplicationActivationPolicy { NSApplicationActivationPolicyRegular = 0, NSApplicationActivationPolicyAccessory = 1, @@ -73,12 +74,14 @@ pub enum NSApplicationActivationPolicy { } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSApplicationActivationOptions { NSApplicationActivateAllWindows = 1 << 0, NSApplicationActivateIgnoringOtherApps = 1 << 1 } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSApplicationTerminateReply { NSTerminateCancel = 0, NSTerminateNow = 1, @@ -86,6 +89,7 @@ pub enum NSApplicationTerminateReply { } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSWindowMask { NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 << 0, @@ -103,12 +107,14 @@ pub enum NSWindowMask { } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSWindowTitleVisibility { NSWindowTitleVisible = 0, NSWindowTitleHidden = 1 } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSBackingStoreType { NSBackingStoreRetained = 0, NSBackingStoreNonretained = 1, @@ -160,6 +166,7 @@ bitflags! { } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSOpenGLPixelFormatAttribute { NSOpenGLPFAAllRenderers = 1, NSOpenGLPFATripleBuffer = 3, @@ -204,6 +211,7 @@ pub enum NSOpenGLPixelFormatAttribute { #[repr(u64)] #[allow(non_camel_case_types)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSOpenGLPFAOpenGLProfiles { NSOpenGLProfileVersionLegacy = 0x1000, NSOpenGLProfileVersion3_2Core = 0x3200, @@ -211,6 +219,7 @@ pub enum NSOpenGLPFAOpenGLProfiles { } #[repr(u64)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSOpenGLContextParameter { NSOpenGLCPSwapInterval = 222, NSOpenGLCPSurfaceOrder = 235, @@ -225,7 +234,7 @@ pub enum NSOpenGLContextParameter { } #[repr(u64)] -#[derive(Copy, Clone, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum NSWindowButton { NSWindowCloseButton = 0, NSWindowMiniaturizeButton = 1, @@ -1545,7 +1554,7 @@ bitflags! { } } -#[derive(Debug)] +#[derive(Clone, Copy, Debug, PartialEq)] #[repr(u64)] // NSUInteger pub enum NSEventType { NSLeftMouseDown = 1,