Skip to content

Commit

Permalink
Update bitflags to 2.2.1 (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
burtonageo committed Apr 9, 2024
1 parent f9440bc commit abbcc1e
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cocoa-foundation/Cargo.toml
Expand Up @@ -14,7 +14,7 @@ default-target = "x86_64-apple-darwin"

[dependencies]
block = "0.1"
bitflags = "1.0"
bitflags = "2"
libc = "0.2"
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" }
Expand Down
8 changes: 8 additions & 0 deletions cocoa-foundation/src/foundation.rs
Expand Up @@ -613,6 +613,7 @@ impl NSDictionary for id {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEnumerationOptions: libc::c_ulonglong {
const NSEnumerationConcurrent = 1 << 0;
const NSEnumerationReverse = 1 << 1;
Expand Down Expand Up @@ -792,6 +793,7 @@ impl NSRunLoop for id {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSURLBookmarkCreationOptions: NSUInteger {
const NSURLBookmarkCreationPreferFileIDResolution = 1 << 8;
const NSURLBookmarkCreationMinimalBookmark = 1 << 9;
Expand All @@ -804,6 +806,7 @@ bitflags! {
pub type NSURLBookmarkFileCreationOptions = NSURLBookmarkCreationOptions;

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSURLBookmarkResolutionOptions: NSUInteger {
const NSURLBookmarkResolutionWithoutUI = 1 << 8;
const NSURLBookmarkResolutionWithoutMounting = 1 << 9;
Expand Down Expand Up @@ -1590,6 +1593,7 @@ impl NSData for id {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataReadingOptions: libc::c_ulonglong {
const NSDataReadingMappedIfSafe = 1 << 0;
const NSDataReadingUncached = 1 << 1;
Expand All @@ -1598,6 +1602,7 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataBase64EncodingOptions: libc::c_ulonglong {
const NSDataBase64Encoding64CharacterLineLength = 1 << 0;
const NSDataBase64Encoding76CharacterLineLength = 1 << 1;
Expand All @@ -1607,19 +1612,22 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataBase64DecodingOptions: libc::c_ulonglong {
const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0;
}
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataWritingOptions: libc::c_ulonglong {
const NSDataWritingAtomic = 1 << 0;
const NSDataWritingWithoutOverwriting = 1 << 1;
}
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSDataSearchOptions: libc::c_ulonglong {
const NSDataSearchBackwards = 1 << 0;
const NSDataSearchAnchored = 1 << 1;
Expand Down
2 changes: 1 addition & 1 deletion cocoa/Cargo.toml
Expand Up @@ -14,7 +14,7 @@ default-target = "x86_64-apple-darwin"

[dependencies]
block = "0.1"
bitflags = "1.0"
bitflags = "2"
libc = "0.2"
cocoa-foundation = { default-features = false, path = "../cocoa-foundation", version = "0.2" }
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
Expand Down
59 changes: 34 additions & 25 deletions cocoa/src/appkit.rs
Expand Up @@ -184,6 +184,7 @@ pub enum NSApplicationTerminateReply {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSApplicationPresentationOptions : NSUInteger {
const NSApplicationPresentationDefault = 0;
const NSApplicationPresentationAutoHideDock = 1 << 0;
Expand All @@ -202,6 +203,7 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowStyleMask: NSUInteger {
const NSBorderlessWindowMask = 0;
const NSTitledWindowMask = 1 << 0;
Expand Down Expand Up @@ -251,6 +253,7 @@ pub enum NSWindowToolbarStyle {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowOrderingMode: NSInteger {
const NSWindowAbove = 1;
const NSWindowBelow = -1;
Expand All @@ -259,6 +262,7 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSAlignmentOptions: libc::c_ulonglong {
const NSAlignMinXInward = 1 << 0;
const NSAlignMinYInward = 1 << 1;
Expand All @@ -279,18 +283,18 @@ bitflags! {
const NSAlignWidthNearest = 1 << 20;
const NSAlignHeightNearest = 1 << 21;
const NSAlignRectFlipped = 1 << 63;
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits
| NSAlignmentOptions::NSAlignMaxXInward.bits
| NSAlignmentOptions::NSAlignMinYInward.bits
| NSAlignmentOptions::NSAlignMaxYInward.bits;
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits
| NSAlignmentOptions::NSAlignMaxXOutward.bits
| NSAlignmentOptions::NSAlignMinYOutward.bits
| NSAlignmentOptions::NSAlignMaxYOutward.bits;
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits
| NSAlignmentOptions::NSAlignMaxXNearest.bits
| NSAlignmentOptions::NSAlignMinYNearest.bits
| NSAlignmentOptions::NSAlignMaxYNearest.bits;
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits()
| NSAlignmentOptions::NSAlignMaxXInward.bits()
| NSAlignmentOptions::NSAlignMinYInward.bits()
| NSAlignmentOptions::NSAlignMaxYInward.bits();
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits()
| NSAlignmentOptions::NSAlignMaxXOutward.bits()
| NSAlignmentOptions::NSAlignMinYOutward.bits()
| NSAlignmentOptions::NSAlignMaxYOutward.bits();
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits()
| NSAlignmentOptions::NSAlignMaxXNearest.bits()
| NSAlignmentOptions::NSAlignMinYNearest.bits()
| NSAlignmentOptions::NSAlignMaxYNearest.bits();
}
}

Expand Down Expand Up @@ -578,7 +582,7 @@ impl NSApplication for id {
}

unsafe fn setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL {
msg_send![self, setPresentationOptions:options.bits]
msg_send![self, setPresentationOptions:options.bits()]
}

unsafe fn presentationOptions_(self) -> NSApplicationPresentationOptions {
Expand Down Expand Up @@ -1041,6 +1045,7 @@ impl NSMenuItem for id {
pub type NSWindowDepth = libc::c_int;

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowCollectionBehavior: NSUInteger {
const NSWindowCollectionBehaviorDefault = 0;
const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0;
Expand All @@ -1059,6 +1064,7 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSWindowOcclusionState: NSUInteger {
const NSWindowOcclusionStateVisible = 1 << 1;
}
Expand Down Expand Up @@ -1351,7 +1357,7 @@ impl NSWindow for id {
defer: BOOL,
) -> id {
msg_send![self, initWithContentRect:rect
styleMask:style.bits
styleMask:style.bits()
backing:backing as NSUInteger
defer:defer]
}
Expand All @@ -1365,7 +1371,7 @@ impl NSWindow for id {
screen: id,
) -> id {
msg_send![self, initWithContentRect:rect
styleMask:style.bits
styleMask:style.bits()
backing:backing as NSUInteger
defer:defer
screen:screen]
Expand All @@ -1378,7 +1384,7 @@ impl NSWindow for id {
}

unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask) {
msg_send![self, setStyleMask:styleMask.bits]
msg_send![self, setStyleMask:styleMask.bits()]
}

unsafe fn toggleFullScreen_(self, sender: id) {
Expand Down Expand Up @@ -1507,23 +1513,23 @@ impl NSWindow for id {
windowFrame: NSRect,
windowStyle: NSWindowStyleMask,
) -> NSRect {
msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits]
msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits()]
}

unsafe fn frameRectForContentRect_styleMask_(
self,
windowContentRect: NSRect,
windowStyle: NSWindowStyleMask,
) -> NSRect {
msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits]
msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits()]
}

unsafe fn minFrameWidthWithTitle_styleMask_(
self,
windowTitle: id,
windowStyle: NSWindowStyleMask,
) -> CGFloat {
msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits]
msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits()]
}

unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect {
Expand Down Expand Up @@ -2517,6 +2523,7 @@ impl NSOpenGLContext for id {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventSwipeTrackingOptions: NSUInteger {
const NSEventSwipeTrackingLockDirection = 0x1 << 0;
const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1;
Expand All @@ -2531,6 +2538,7 @@ pub enum NSEventGestureAxis {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventPhase: NSUInteger {
const NSEventPhaseNone = 0;
const NSEventPhaseBegan = 0x1 << 0;
Expand All @@ -2543,15 +2551,16 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSTouchPhase: NSUInteger {
const NSTouchPhaseBegan = 1 << 0;
const NSTouchPhaseMoved = 1 << 1;
const NSTouchPhaseStationary = 1 << 2;
const NSTouchPhaseEnded = 1 << 3;
const NSTouchPhaseCancelled = 1 << 4;
const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits
| NSTouchPhase::NSTouchPhaseMoved.bits
| NSTouchPhase::NSTouchPhaseStationary.bits;
const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits()
| NSTouchPhase::NSTouchPhaseMoved.bits()
| NSTouchPhase::NSTouchPhaseStationary.bits();
const NSTouchPhaseAny = !0; // NSUIntegerMax
}
}
Expand Down Expand Up @@ -2592,6 +2601,7 @@ pub enum NSEventType {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventMask: libc::c_ulonglong {
const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong;
const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong;
Expand Down Expand Up @@ -2628,13 +2638,12 @@ bitflags! {

impl NSEventMask {
pub fn from_type(ty: NSEventType) -> NSEventMask {
NSEventMask {
bits: 1 << ty as libc::c_ulonglong,
}
NSEventMask::from_bits_truncate(1 << ty as libc::c_ulonglong)
}
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NSEventModifierFlags: NSUInteger {
const NSAlphaShiftKeyMask = 1 << 16;
const NSShiftKeyMask = 1 << 17;
Expand Down
3 changes: 3 additions & 0 deletions cocoa/src/quartzcore.rs
Expand Up @@ -1176,6 +1176,7 @@ impl Filter {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EdgeAntialiasingMask: u32 {
const LEFT_EDGE = 1 << 0; // kCALayerLeftEdge
const RIGHT_EDGE = 1 << 1; // kCALayerRightEdge
Expand All @@ -1185,6 +1186,7 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CornerMask: NSUInteger {
const MIN_X_MIN_Y_CORNER = 1 << 0; // kCALayerMinXMinYCorner
const MAX_X_MIN_Y_CORNER = 1 << 1; // kCALayerMaxXMinYCorner
Expand All @@ -1194,6 +1196,7 @@ bitflags! {
}

bitflags! {
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AutoresizingMask: u32 {
const NOT_SIZABLE = 0; // kCALayerNotSizable
const MIN_X_MARGIN = 1 << 0; // kCALayerMinXMargin
Expand Down
2 changes: 1 addition & 1 deletion core-graphics-types/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
edition = "2018"

[dependencies]
bitflags = "1.0"
bitflags = "2"
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
libc = "0.2"

Expand Down
2 changes: 1 addition & 1 deletion core-graphics/Cargo.toml
Expand Up @@ -16,7 +16,7 @@ highsierra = []
link = ["core-foundation/link", "core-graphics-types/link"]

[dependencies]
bitflags = "1.0"
bitflags = "2"
core-foundation = { default-features = false, path = "../core-foundation", version = "0.10" }
core-graphics-types = { default-features = false, path = "../core-graphics-types", version = "0.2" }
foreign-types = "0.5.0"
Expand Down
1 change: 1 addition & 0 deletions core-graphics/src/event.rs
Expand Up @@ -18,6 +18,7 @@ bitflags! {
///
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CGEventFlags: u64 {
const CGEventFlagNull = 0;

Expand Down
1 change: 1 addition & 0 deletions core-graphics/src/gradient.rs
Expand Up @@ -21,6 +21,7 @@ use libc::size_t;

bitflags! {
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CGGradientDrawingOptions: u32 {
const CGGradientDrawsBeforeStartLocation = (1 << 0);
const CGGradientDrawsAfterEndLocation = (1 << 1);
Expand Down

0 comments on commit abbcc1e

Please sign in to comment.