Update bitflags to 2.2.1 (#549)

This commit is contained in:
George Burton
2024-04-09 09:47:41 +01:00
committed by GitHub
parent f9440bcddb
commit abbcc1eea5
9 changed files with 51 additions and 29 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ default-target = "x86_64-apple-darwin"
[dependencies] [dependencies]
block = "0.1" block = "0.1"
bitflags = "1.0" bitflags = "2"
libc = "0.2" libc = "0.2"
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" } core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" } core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" }
+8
View File
@@ -613,6 +613,7 @@ impl NSDictionary for id {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEnumerationOptions: libc::c_ulonglong { pub struct NSEnumerationOptions: libc::c_ulonglong {
const NSEnumerationConcurrent = 1 << 0; const NSEnumerationConcurrent = 1 << 0;
const NSEnumerationReverse = 1 << 1; const NSEnumerationReverse = 1 << 1;
@@ -792,6 +793,7 @@ impl NSRunLoop for id {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSURLBookmarkCreationOptions: NSUInteger { pub struct NSURLBookmarkCreationOptions: NSUInteger {
const NSURLBookmarkCreationPreferFileIDResolution = 1 << 8; const NSURLBookmarkCreationPreferFileIDResolution = 1 << 8;
const NSURLBookmarkCreationMinimalBookmark = 1 << 9; const NSURLBookmarkCreationMinimalBookmark = 1 << 9;
@@ -804,6 +806,7 @@ bitflags! {
pub type NSURLBookmarkFileCreationOptions = NSURLBookmarkCreationOptions; pub type NSURLBookmarkFileCreationOptions = NSURLBookmarkCreationOptions;
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSURLBookmarkResolutionOptions: NSUInteger { pub struct NSURLBookmarkResolutionOptions: NSUInteger {
const NSURLBookmarkResolutionWithoutUI = 1 << 8; const NSURLBookmarkResolutionWithoutUI = 1 << 8;
const NSURLBookmarkResolutionWithoutMounting = 1 << 9; const NSURLBookmarkResolutionWithoutMounting = 1 << 9;
@@ -1590,6 +1593,7 @@ impl NSData for id {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataReadingOptions: libc::c_ulonglong { pub struct NSDataReadingOptions: libc::c_ulonglong {
const NSDataReadingMappedIfSafe = 1 << 0; const NSDataReadingMappedIfSafe = 1 << 0;
const NSDataReadingUncached = 1 << 1; const NSDataReadingUncached = 1 << 1;
@@ -1598,6 +1602,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataBase64EncodingOptions: libc::c_ulonglong { pub struct NSDataBase64EncodingOptions: libc::c_ulonglong {
const NSDataBase64Encoding64CharacterLineLength = 1 << 0; const NSDataBase64Encoding64CharacterLineLength = 1 << 0;
const NSDataBase64Encoding76CharacterLineLength = 1 << 1; const NSDataBase64Encoding76CharacterLineLength = 1 << 1;
@@ -1607,12 +1612,14 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataBase64DecodingOptions: libc::c_ulonglong { pub struct NSDataBase64DecodingOptions: libc::c_ulonglong {
const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0; const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0;
} }
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataWritingOptions: libc::c_ulonglong { pub struct NSDataWritingOptions: libc::c_ulonglong {
const NSDataWritingAtomic = 1 << 0; const NSDataWritingAtomic = 1 << 0;
const NSDataWritingWithoutOverwriting = 1 << 1; const NSDataWritingWithoutOverwriting = 1 << 1;
@@ -1620,6 +1627,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataSearchOptions: libc::c_ulonglong { pub struct NSDataSearchOptions: libc::c_ulonglong {
const NSDataSearchBackwards = 1 << 0; const NSDataSearchBackwards = 1 << 0;
const NSDataSearchAnchored = 1 << 1; const NSDataSearchAnchored = 1 << 1;
+1 -1
View File
@@ -14,7 +14,7 @@ default-target = "x86_64-apple-darwin"
[dependencies] [dependencies]
block = "0.1" block = "0.1"
bitflags = "1.0" bitflags = "2"
libc = "0.2" libc = "0.2"
cocoa-foundation = { default-features = false, path = "../cocoa-foundation", version = "0.2" } cocoa-foundation = { default-features = false, path = "../cocoa-foundation", version = "0.2" }
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" } core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
+34 -25
View File
@@ -184,6 +184,7 @@ pub enum NSApplicationTerminateReply {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSApplicationPresentationOptions : NSUInteger { pub struct NSApplicationPresentationOptions : NSUInteger {
const NSApplicationPresentationDefault = 0; const NSApplicationPresentationDefault = 0;
const NSApplicationPresentationAutoHideDock = 1 << 0; const NSApplicationPresentationAutoHideDock = 1 << 0;
@@ -202,6 +203,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowStyleMask: NSUInteger { pub struct NSWindowStyleMask: NSUInteger {
const NSBorderlessWindowMask = 0; const NSBorderlessWindowMask = 0;
const NSTitledWindowMask = 1 << 0; const NSTitledWindowMask = 1 << 0;
@@ -251,6 +253,7 @@ pub enum NSWindowToolbarStyle {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowOrderingMode: NSInteger { pub struct NSWindowOrderingMode: NSInteger {
const NSWindowAbove = 1; const NSWindowAbove = 1;
const NSWindowBelow = -1; const NSWindowBelow = -1;
@@ -259,6 +262,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSAlignmentOptions: libc::c_ulonglong { pub struct NSAlignmentOptions: libc::c_ulonglong {
const NSAlignMinXInward = 1 << 0; const NSAlignMinXInward = 1 << 0;
const NSAlignMinYInward = 1 << 1; const NSAlignMinYInward = 1 << 1;
@@ -279,18 +283,18 @@ bitflags! {
const NSAlignWidthNearest = 1 << 20; const NSAlignWidthNearest = 1 << 20;
const NSAlignHeightNearest = 1 << 21; const NSAlignHeightNearest = 1 << 21;
const NSAlignRectFlipped = 1 << 63; const NSAlignRectFlipped = 1 << 63;
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits()
| NSAlignmentOptions::NSAlignMaxXInward.bits | NSAlignmentOptions::NSAlignMaxXInward.bits()
| NSAlignmentOptions::NSAlignMinYInward.bits | NSAlignmentOptions::NSAlignMinYInward.bits()
| NSAlignmentOptions::NSAlignMaxYInward.bits; | NSAlignmentOptions::NSAlignMaxYInward.bits();
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits()
| NSAlignmentOptions::NSAlignMaxXOutward.bits | NSAlignmentOptions::NSAlignMaxXOutward.bits()
| NSAlignmentOptions::NSAlignMinYOutward.bits | NSAlignmentOptions::NSAlignMinYOutward.bits()
| NSAlignmentOptions::NSAlignMaxYOutward.bits; | NSAlignmentOptions::NSAlignMaxYOutward.bits();
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits()
| NSAlignmentOptions::NSAlignMaxXNearest.bits | NSAlignmentOptions::NSAlignMaxXNearest.bits()
| NSAlignmentOptions::NSAlignMinYNearest.bits | NSAlignmentOptions::NSAlignMinYNearest.bits()
| NSAlignmentOptions::NSAlignMaxYNearest.bits; | NSAlignmentOptions::NSAlignMaxYNearest.bits();
} }
} }
@@ -578,7 +582,7 @@ impl NSApplication for id {
} }
unsafe fn setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL { unsafe fn setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL {
msg_send![self, setPresentationOptions:options.bits] msg_send![self, setPresentationOptions:options.bits()]
} }
unsafe fn presentationOptions_(self) -> NSApplicationPresentationOptions { unsafe fn presentationOptions_(self) -> NSApplicationPresentationOptions {
@@ -1041,6 +1045,7 @@ impl NSMenuItem for id {
pub type NSWindowDepth = libc::c_int; pub type NSWindowDepth = libc::c_int;
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowCollectionBehavior: NSUInteger { pub struct NSWindowCollectionBehavior: NSUInteger {
const NSWindowCollectionBehaviorDefault = 0; const NSWindowCollectionBehaviorDefault = 0;
const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0; const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0;
@@ -1059,6 +1064,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowOcclusionState: NSUInteger { pub struct NSWindowOcclusionState: NSUInteger {
const NSWindowOcclusionStateVisible = 1 << 1; const NSWindowOcclusionStateVisible = 1 << 1;
} }
@@ -1351,7 +1357,7 @@ impl NSWindow for id {
defer: BOOL, defer: BOOL,
) -> id { ) -> id {
msg_send![self, initWithContentRect:rect msg_send![self, initWithContentRect:rect
styleMask:style.bits styleMask:style.bits()
backing:backing as NSUInteger backing:backing as NSUInteger
defer:defer] defer:defer]
} }
@@ -1365,7 +1371,7 @@ impl NSWindow for id {
screen: id, screen: id,
) -> id { ) -> id {
msg_send![self, initWithContentRect:rect msg_send![self, initWithContentRect:rect
styleMask:style.bits styleMask:style.bits()
backing:backing as NSUInteger backing:backing as NSUInteger
defer:defer defer:defer
screen:screen] screen:screen]
@@ -1378,7 +1384,7 @@ impl NSWindow for id {
} }
unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask) { unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask) {
msg_send![self, setStyleMask:styleMask.bits] msg_send![self, setStyleMask:styleMask.bits()]
} }
unsafe fn toggleFullScreen_(self, sender: id) { unsafe fn toggleFullScreen_(self, sender: id) {
@@ -1507,7 +1513,7 @@ impl NSWindow for id {
windowFrame: NSRect, windowFrame: NSRect,
windowStyle: NSWindowStyleMask, windowStyle: NSWindowStyleMask,
) -> NSRect { ) -> NSRect {
msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits] msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits()]
} }
unsafe fn frameRectForContentRect_styleMask_( unsafe fn frameRectForContentRect_styleMask_(
@@ -1515,7 +1521,7 @@ impl NSWindow for id {
windowContentRect: NSRect, windowContentRect: NSRect,
windowStyle: NSWindowStyleMask, windowStyle: NSWindowStyleMask,
) -> NSRect { ) -> NSRect {
msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits] msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits()]
} }
unsafe fn minFrameWidthWithTitle_styleMask_( unsafe fn minFrameWidthWithTitle_styleMask_(
@@ -1523,7 +1529,7 @@ impl NSWindow for id {
windowTitle: id, windowTitle: id,
windowStyle: NSWindowStyleMask, windowStyle: NSWindowStyleMask,
) -> CGFloat { ) -> CGFloat {
msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits] msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits()]
} }
unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect { unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect {
@@ -2517,6 +2523,7 @@ impl NSOpenGLContext for id {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventSwipeTrackingOptions: NSUInteger { pub struct NSEventSwipeTrackingOptions: NSUInteger {
const NSEventSwipeTrackingLockDirection = 0x1 << 0; const NSEventSwipeTrackingLockDirection = 0x1 << 0;
const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1; const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1;
@@ -2531,6 +2538,7 @@ pub enum NSEventGestureAxis {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventPhase: NSUInteger { pub struct NSEventPhase: NSUInteger {
const NSEventPhaseNone = 0; const NSEventPhaseNone = 0;
const NSEventPhaseBegan = 0x1 << 0; const NSEventPhaseBegan = 0x1 << 0;
@@ -2543,15 +2551,16 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSTouchPhase: NSUInteger { pub struct NSTouchPhase: NSUInteger {
const NSTouchPhaseBegan = 1 << 0; const NSTouchPhaseBegan = 1 << 0;
const NSTouchPhaseMoved = 1 << 1; const NSTouchPhaseMoved = 1 << 1;
const NSTouchPhaseStationary = 1 << 2; const NSTouchPhaseStationary = 1 << 2;
const NSTouchPhaseEnded = 1 << 3; const NSTouchPhaseEnded = 1 << 3;
const NSTouchPhaseCancelled = 1 << 4; const NSTouchPhaseCancelled = 1 << 4;
const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits()
| NSTouchPhase::NSTouchPhaseMoved.bits | NSTouchPhase::NSTouchPhaseMoved.bits()
| NSTouchPhase::NSTouchPhaseStationary.bits; | NSTouchPhase::NSTouchPhaseStationary.bits();
const NSTouchPhaseAny = !0; // NSUIntegerMax const NSTouchPhaseAny = !0; // NSUIntegerMax
} }
} }
@@ -2592,6 +2601,7 @@ pub enum NSEventType {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventMask: libc::c_ulonglong { pub struct NSEventMask: libc::c_ulonglong {
const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong; const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong;
const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong; const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong;
@@ -2628,13 +2638,12 @@ bitflags! {
impl NSEventMask { impl NSEventMask {
pub fn from_type(ty: NSEventType) -> NSEventMask { pub fn from_type(ty: NSEventType) -> NSEventMask {
NSEventMask { NSEventMask::from_bits_truncate(1 << ty as libc::c_ulonglong)
bits: 1 << ty as libc::c_ulonglong,
}
} }
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventModifierFlags: NSUInteger { pub struct NSEventModifierFlags: NSUInteger {
const NSAlphaShiftKeyMask = 1 << 16; const NSAlphaShiftKeyMask = 1 << 16;
const NSShiftKeyMask = 1 << 17; const NSShiftKeyMask = 1 << 17;
+3
View File
@@ -1176,6 +1176,7 @@ impl Filter {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EdgeAntialiasingMask: u32 { pub struct EdgeAntialiasingMask: u32 {
const LEFT_EDGE = 1 << 0; // kCALayerLeftEdge const LEFT_EDGE = 1 << 0; // kCALayerLeftEdge
const RIGHT_EDGE = 1 << 1; // kCALayerRightEdge const RIGHT_EDGE = 1 << 1; // kCALayerRightEdge
@@ -1185,6 +1186,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CornerMask: NSUInteger { pub struct CornerMask: NSUInteger {
const MIN_X_MIN_Y_CORNER = 1 << 0; // kCALayerMinXMinYCorner const MIN_X_MIN_Y_CORNER = 1 << 0; // kCALayerMinXMinYCorner
const MAX_X_MIN_Y_CORNER = 1 << 1; // kCALayerMaxXMinYCorner const MAX_X_MIN_Y_CORNER = 1 << 1; // kCALayerMaxXMinYCorner
@@ -1194,6 +1196,7 @@ bitflags! {
} }
bitflags! { bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AutoresizingMask: u32 { pub struct AutoresizingMask: u32 {
const NOT_SIZABLE = 0; // kCALayerNotSizable const NOT_SIZABLE = 0; // kCALayerNotSizable
const MIN_X_MARGIN = 1 << 0; // kCALayerMinXMargin const MIN_X_MARGIN = 1 << 0; // kCALayerMinXMargin
+1 -1
View File
@@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
bitflags = "1.0" bitflags = "2"
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" } core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
libc = "0.2" libc = "0.2"
+1 -1
View File
@@ -16,7 +16,7 @@ highsierra = []
link = ["core-foundation/link", "core-graphics-types/link"] link = ["core-foundation/link", "core-graphics-types/link"]
[dependencies] [dependencies]
bitflags = "1.0" bitflags = "2"
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" } core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" } core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" }
foreign-types = "0.5.0" foreign-types = "0.5.0"
+1
View File
@@ -18,6 +18,7 @@ bitflags! {
/// ///
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h) /// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CGEventFlags: u64 { pub struct CGEventFlags: u64 {
const CGEventFlagNull = 0; const CGEventFlagNull = 0;
+1
View File
@@ -21,6 +21,7 @@ use libc::size_t;
bitflags! { bitflags! {
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CGGradientDrawingOptions: u32 { pub struct CGGradientDrawingOptions: u32 {
const CGGradientDrawsBeforeStartLocation = (1 << 0); const CGGradientDrawsBeforeStartLocation = (1 << 0);
const CGGradientDrawsAfterEndLocation = (1 << 1); const CGGradientDrawsAfterEndLocation = (1 << 1);