Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit d3d9e3c

Browse files
committed
Update bitflags and bump version
1 parent 5af38a5 commit d3d9e3c

File tree

3 files changed

+132
-132
lines changed

3 files changed

+132
-132
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "cocoa"
33
description = "Bindings to Cocoa for OS X"
44
homepage = "https://github.com/servo/cocoa-rs"
55
repository = "https://github.com/servo/cocoa-rs"
6-
version = "0.9.0"
6+
version = "0.9.1"
77
authors = ["The Servo Project Developers"]
88
license = "MIT / Apache-2.0"
99

@@ -13,7 +13,7 @@ crate-type = ["rlib"]
1313

1414
[dependencies]
1515
block = "0.1"
16-
bitflags = "0.7"
16+
bitflags = "0.9"
1717
libc = "0.2"
1818
core-graphics = "0.8"
1919
objc = "0.2"

src/appkit.rs

Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,20 @@ pub enum NSApplicationTerminateReply {
141141
}
142142

143143
bitflags! {
144-
pub flags NSWindowStyleMask: NSUInteger {
145-
const NSBorderlessWindowMask = 0,
146-
const NSTitledWindowMask = 1 << 0,
147-
const NSClosableWindowMask = 1 << 1,
148-
const NSMiniaturizableWindowMask = 1 << 2,
149-
const NSResizableWindowMask = 1 << 3,
144+
pub struct NSWindowStyleMask: NSUInteger {
145+
const NSBorderlessWindowMask = 0;
146+
const NSTitledWindowMask = 1 << 0;
147+
const NSClosableWindowMask = 1 << 1;
148+
const NSMiniaturizableWindowMask = 1 << 2;
149+
const NSResizableWindowMask = 1 << 3;
150150

151-
const NSTexturedBackgroundWindowMask = 1 << 8,
151+
const NSTexturedBackgroundWindowMask = 1 << 8;
152152

153-
const NSUnifiedTitleAndToolbarWindowMask = 1 << 12,
153+
const NSUnifiedTitleAndToolbarWindowMask = 1 << 12;
154154

155-
const NSFullScreenWindowMask = 1 << 14,
155+
const NSFullScreenWindowMask = 1 << 14;
156156

157-
const NSFullSizeContentViewWindowMask = 1 << 15
157+
const NSFullSizeContentViewWindowMask = 1 << 15;
158158
}
159159
}
160160

@@ -174,46 +174,46 @@ pub enum NSBackingStoreType {
174174
}
175175

176176
bitflags! {
177-
pub flags NSWindowOrderingMode: NSInteger {
178-
const NSWindowAbove = 1,
179-
const NSWindowBelow = -1,
180-
const NSWindowOut = 0,
177+
pub struct NSWindowOrderingMode: NSInteger {
178+
const NSWindowAbove = 1;
179+
const NSWindowBelow = -1;
180+
const NSWindowOut = 0;
181181
}
182182
}
183183

184184
bitflags! {
185-
pub flags NSAlignmentOptions: libc::c_ulonglong {
186-
const NSAlignMinXInward = 1 << 0,
187-
const NSAlignMinYInward = 1 << 1,
188-
const NSAlignMaxXInward = 1 << 2,
189-
const NSAlignMaxYInward = 1 << 3,
190-
const NSAlignWidthInward = 1 << 4,
191-
const NSAlignHeightInward = 1 << 5,
192-
const NSAlignMinXOutward = 1 << 8,
193-
const NSAlignMinYOutward = 1 << 9,
194-
const NSAlignMaxXOutward = 1 << 10,
195-
const NSAlignMaxYOutward = 1 << 11,
196-
const NSAlignWidthOutward = 1 << 12,
197-
const NSAlignHeightOutward = 1 << 13,
198-
const NSAlignMinXNearest = 1 << 16,
199-
const NSAlignMinYNearest = 1 << 17,
200-
const NSAlignMaxXNearest = 1 << 18,
201-
const NSAlignMaxYNearest = 1 << 19,
202-
const NSAlignWidthNearest = 1 << 20,
203-
const NSAlignHeightNearest = 1 << 21,
204-
const NSAlignRectFlipped = 1 << 63,
185+
pub struct NSAlignmentOptions: libc::c_ulonglong {
186+
const NSAlignMinXInward = 1 << 0;
187+
const NSAlignMinYInward = 1 << 1;
188+
const NSAlignMaxXInward = 1 << 2;
189+
const NSAlignMaxYInward = 1 << 3;
190+
const NSAlignWidthInward = 1 << 4;
191+
const NSAlignHeightInward = 1 << 5;
192+
const NSAlignMinXOutward = 1 << 8;
193+
const NSAlignMinYOutward = 1 << 9;
194+
const NSAlignMaxXOutward = 1 << 10;
195+
const NSAlignMaxYOutward = 1 << 11;
196+
const NSAlignWidthOutward = 1 << 12;
197+
const NSAlignHeightOutward = 1 << 13;
198+
const NSAlignMinXNearest = 1 << 16;
199+
const NSAlignMinYNearest = 1 << 17;
200+
const NSAlignMaxXNearest = 1 << 18;
201+
const NSAlignMaxYNearest = 1 << 19;
202+
const NSAlignWidthNearest = 1 << 20;
203+
const NSAlignHeightNearest = 1 << 21;
204+
const NSAlignRectFlipped = 1 << 63;
205205
const NSAlignAllEdgesInward = NSAlignMinXInward.bits
206206
| NSAlignMaxXInward.bits
207207
| NSAlignMinYInward.bits
208-
| NSAlignMaxYInward.bits,
208+
| NSAlignMaxYInward.bits;
209209
const NSAlignAllEdgesOutward = NSAlignMinXOutward.bits
210210
| NSAlignMaxXOutward.bits
211211
| NSAlignMinYOutward.bits
212-
| NSAlignMaxYOutward.bits,
212+
| NSAlignMaxYOutward.bits;
213213
const NSAlignAllEdgesNearest = NSAlignMinXNearest.bits
214214
| NSAlignMaxXNearest.bits
215215
| NSAlignMinYNearest.bits
216-
| NSAlignMaxYNearest.bits,
216+
| NSAlignMaxYNearest.bits;
217217
}
218218
}
219219

@@ -767,26 +767,26 @@ impl NSMenuItem for id {
767767
pub type NSWindowDepth = libc::c_int;
768768

769769
bitflags! {
770-
pub flags NSWindowCollectionBehavior: NSUInteger {
771-
const NSWindowCollectionBehaviorDefault = 0,
772-
const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0,
773-
const NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1,
770+
pub struct NSWindowCollectionBehavior: NSUInteger {
771+
const NSWindowCollectionBehaviorDefault = 0;
772+
const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0;
773+
const NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1;
774774

775-
const NSWindowCollectionBehaviorManaged = 1 << 2,
776-
const NSWindowCollectionBehaviorTransient = 1 << 3,
777-
const NSWindowCollectionBehaviorStationary = 1 << 4,
775+
const NSWindowCollectionBehaviorManaged = 1 << 2;
776+
const NSWindowCollectionBehaviorTransient = 1 << 3;
777+
const NSWindowCollectionBehaviorStationary = 1 << 4;
778778

779-
const NSWindowCollectionBehaviorParticipatesInCycle = 1 << 5,
780-
const NSWindowCollectionBehaviorIgnoresCycle = 1 << 6,
779+
const NSWindowCollectionBehaviorParticipatesInCycle = 1 << 5;
780+
const NSWindowCollectionBehaviorIgnoresCycle = 1 << 6;
781781

782-
const NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
783-
const NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
782+
const NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7;
783+
const NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8;
784784
}
785785
}
786786

787787
bitflags! {
788-
pub flags NSWindowOcclusionState: NSUInteger {
789-
const NSWindowOcclusionStateVisible = 1 << 1
788+
pub struct NSWindowOcclusionState: NSUInteger {
789+
const NSWindowOcclusionStateVisible = 1 << 1;
790790
}
791791
}
792792

@@ -1919,9 +1919,9 @@ impl NSOpenGLContext for id {
19191919
}
19201920

19211921
bitflags! {
1922-
pub flags NSEventSwipeTrackingOptions: NSUInteger {
1923-
const NSEventSwipeTrackingLockDirection = 0x1 << 0,
1924-
const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
1922+
pub struct NSEventSwipeTrackingOptions: NSUInteger {
1923+
const NSEventSwipeTrackingLockDirection = 0x1 << 0;
1924+
const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1;
19251925
}
19261926
}
19271927

@@ -1933,28 +1933,28 @@ pub enum NSEventGestureAxis {
19331933
}
19341934

19351935
bitflags! {
1936-
pub flags NSEventPhase: NSUInteger {
1937-
const NSEventPhaseNone = 0,
1938-
const NSEventPhaseBegan = 0x1 << 0,
1939-
const NSEventPhaseStationary = 0x1 << 1,
1940-
const NSEventPhaseChanged = 0x1 << 2,
1941-
const NSEventPhaseEnded = 0x1 << 3,
1942-
const NSEventPhaseCancelled = 0x1 << 4,
1943-
const NSEventPhaseMayBegin = 0x1 << 5,
1936+
pub struct NSEventPhase: NSUInteger {
1937+
const NSEventPhaseNone = 0;
1938+
const NSEventPhaseBegan = 0x1 << 0;
1939+
const NSEventPhaseStationary = 0x1 << 1;
1940+
const NSEventPhaseChanged = 0x1 << 2;
1941+
const NSEventPhaseEnded = 0x1 << 3;
1942+
const NSEventPhaseCancelled = 0x1 << 4;
1943+
const NSEventPhaseMayBegin = 0x1 << 5;
19441944
}
19451945
}
19461946

19471947
bitflags! {
1948-
pub flags NSTouchPhase: NSUInteger {
1949-
const NSTouchPhaseBegan = 1 << 0,
1950-
const NSTouchPhaseMoved = 1 << 1,
1951-
const NSTouchPhaseStationary = 1 << 2,
1952-
const NSTouchPhaseEnded = 1 << 3,
1953-
const NSTouchPhaseCancelled = 1 << 4,
1948+
pub struct NSTouchPhase: NSUInteger {
1949+
const NSTouchPhaseBegan = 1 << 0;
1950+
const NSTouchPhaseMoved = 1 << 1;
1951+
const NSTouchPhaseStationary = 1 << 2;
1952+
const NSTouchPhaseEnded = 1 << 3;
1953+
const NSTouchPhaseCancelled = 1 << 4;
19541954
const NSTouchPhaseTouching = NSTouchPhaseBegan.bits
19551955
| NSTouchPhaseMoved.bits
1956-
| NSTouchPhaseStationary.bits,
1957-
const NSTouchPhaseAny = !0, // NSUIntegerMax
1956+
| NSTouchPhaseStationary.bits;
1957+
const NSTouchPhaseAny = !0; // NSUIntegerMax
19581958
}
19591959
}
19601960

@@ -1994,37 +1994,37 @@ pub enum NSEventType {
19941994
}
19951995

19961996
bitflags! {
1997-
pub flags NSEventMask: libc::c_ulonglong {
1998-
const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong,
1999-
const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong,
2000-
const NSRightMouseDownMask = 1 << NSRightMouseDown as libc::c_ulonglong,
2001-
const NSRightMouseUpMask = 1 << NSRightMouseUp as libc::c_ulonglong,
2002-
const NSMouseMovedMask = 1 << NSMouseMoved as libc::c_ulonglong,
2003-
const NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged as libc::c_ulonglong,
2004-
const NSRightMouseDraggedMask = 1 << NSRightMouseDragged as libc::c_ulonglong,
2005-
const NSMouseEnteredMask = 1 << NSMouseEntered as libc::c_ulonglong,
2006-
const NSMouseExitedMask = 1 << NSMouseExited as libc::c_ulonglong,
2007-
const NSKeyDownMask = 1 << NSKeyDown as libc::c_ulonglong,
2008-
const NSKeyUpMask = 1 << NSKeyUp as libc::c_ulonglong,
2009-
const NSFlagsChangedMask = 1 << NSFlagsChanged as libc::c_ulonglong,
2010-
const NSAppKitDefinedMask = 1 << NSAppKitDefined as libc::c_ulonglong,
2011-
const NSSystemDefinedMask = 1 << NSSystemDefined as libc::c_ulonglong,
2012-
const NSApplicationDefinedMask = 1 << NSApplicationDefined as libc::c_ulonglong,
2013-
const NSPeriodicMask = 1 << NSPeriodic as libc::c_ulonglong,
2014-
const NSCursorUpdateMask = 1 << NSCursorUpdate as libc::c_ulonglong,
2015-
const NSScrollWheelMask = 1 << NSScrollWheel as libc::c_ulonglong,
2016-
const NSTabletPointMask = 1 << NSTabletPoint as libc::c_ulonglong,
2017-
const NSTabletProximityMask = 1 << NSTabletProximity as libc::c_ulonglong,
2018-
const NSOtherMouseDownMask = 1 << NSOtherMouseDown as libc::c_ulonglong,
2019-
const NSOtherMouseUpMask = 1 << NSOtherMouseUp as libc::c_ulonglong,
2020-
const NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged as libc::c_ulonglong,
2021-
const NSEventMaskGesture = 1 << NSEventTypeGesture as libc::c_ulonglong,
2022-
const NSEventMaskSwipe = 1 << NSEventTypeSwipe as libc::c_ulonglong,
2023-
const NSEventMaskRotate = 1 << NSEventTypeRotate as libc::c_ulonglong,
2024-
const NSEventMaskBeginGesture = 1 << NSEventTypeBeginGesture as libc::c_ulonglong,
2025-
const NSEventMaskEndGesture = 1 << NSEventTypeEndGesture as libc::c_ulonglong,
2026-
const NSEventMaskPressure = 1 << NSEventTypePressure as libc::c_ulonglong,
2027-
const NSAnyEventMask = 0xffffffffffffffff,
1997+
pub struct NSEventMask: libc::c_ulonglong {
1998+
const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong;
1999+
const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong;
2000+
const NSRightMouseDownMask = 1 << NSRightMouseDown as libc::c_ulonglong;
2001+
const NSRightMouseUpMask = 1 << NSRightMouseUp as libc::c_ulonglong;
2002+
const NSMouseMovedMask = 1 << NSMouseMoved as libc::c_ulonglong;
2003+
const NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged as libc::c_ulonglong;
2004+
const NSRightMouseDraggedMask = 1 << NSRightMouseDragged as libc::c_ulonglong;
2005+
const NSMouseEnteredMask = 1 << NSMouseEntered as libc::c_ulonglong;
2006+
const NSMouseExitedMask = 1 << NSMouseExited as libc::c_ulonglong;
2007+
const NSKeyDownMask = 1 << NSKeyDown as libc::c_ulonglong;
2008+
const NSKeyUpMask = 1 << NSKeyUp as libc::c_ulonglong;
2009+
const NSFlagsChangedMask = 1 << NSFlagsChanged as libc::c_ulonglong;
2010+
const NSAppKitDefinedMask = 1 << NSAppKitDefined as libc::c_ulonglong;
2011+
const NSSystemDefinedMask = 1 << NSSystemDefined as libc::c_ulonglong;
2012+
const NSApplicationDefinedMask = 1 << NSApplicationDefined as libc::c_ulonglong;
2013+
const NSPeriodicMask = 1 << NSPeriodic as libc::c_ulonglong;
2014+
const NSCursorUpdateMask = 1 << NSCursorUpdate as libc::c_ulonglong;
2015+
const NSScrollWheelMask = 1 << NSScrollWheel as libc::c_ulonglong;
2016+
const NSTabletPointMask = 1 << NSTabletPoint as libc::c_ulonglong;
2017+
const NSTabletProximityMask = 1 << NSTabletProximity as libc::c_ulonglong;
2018+
const NSOtherMouseDownMask = 1 << NSOtherMouseDown as libc::c_ulonglong;
2019+
const NSOtherMouseUpMask = 1 << NSOtherMouseUp as libc::c_ulonglong;
2020+
const NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged as libc::c_ulonglong;
2021+
const NSEventMaskGesture = 1 << NSEventTypeGesture as libc::c_ulonglong;
2022+
const NSEventMaskSwipe = 1 << NSEventTypeSwipe as libc::c_ulonglong;
2023+
const NSEventMaskRotate = 1 << NSEventTypeRotate as libc::c_ulonglong;
2024+
const NSEventMaskBeginGesture = 1 << NSEventTypeBeginGesture as libc::c_ulonglong;
2025+
const NSEventMaskEndGesture = 1 << NSEventTypeEndGesture as libc::c_ulonglong;
2026+
const NSEventMaskPressure = 1 << NSEventTypePressure as libc::c_ulonglong;
2027+
const NSAnyEventMask = 0xffffffffffffffff;
20282028
}
20292029
}
20302030

@@ -2035,16 +2035,16 @@ impl NSEventMask {
20352035
}
20362036

20372037
bitflags! {
2038-
pub flags NSEventModifierFlags: NSUInteger {
2039-
const NSAlphaShiftKeyMask = 1 << 16,
2040-
const NSShiftKeyMask = 1 << 17,
2041-
const NSControlKeyMask = 1 << 18,
2042-
const NSAlternateKeyMask = 1 << 19,
2043-
const NSCommandKeyMask = 1 << 20,
2044-
const NSNumericPadKeyMask = 1 << 21,
2045-
const NSHelpKeyMask = 1 << 22,
2046-
const NSFunctionKeyMask = 1 << 23,
2047-
const NSDeviceIndependentModifierFlagsMask = 0xffff0000,
2038+
pub struct NSEventModifierFlags: NSUInteger {
2039+
const NSAlphaShiftKeyMask = 1 << 16;
2040+
const NSShiftKeyMask = 1 << 17;
2041+
const NSControlKeyMask = 1 << 18;
2042+
const NSAlternateKeyMask = 1 << 19;
2043+
const NSCommandKeyMask = 1 << 20;
2044+
const NSNumericPadKeyMask = 1 << 21;
2045+
const NSHelpKeyMask = 1 << 22;
2046+
const NSFunctionKeyMask = 1 << 23;
2047+
const NSDeviceIndependentModifierFlagsMask = 0xffff0000;
20482048
}
20492049
}
20502050

src/foundation.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ impl NSDictionary for id {
514514
}
515515

516516
bitflags! {
517-
pub flags NSEnumerationOptions: libc::c_ulonglong {
518-
const NSEnumerationConcurrent = 1 << 0,
519-
const NSEnumerationReverse = 1 << 1
517+
pub struct NSEnumerationOptions: libc::c_ulonglong {
518+
const NSEnumerationConcurrent = 1 << 0;
519+
const NSEnumerationReverse = 1 << 1;
520520
}
521521
}
522522

@@ -886,38 +886,38 @@ impl NSData for id {
886886
}
887887

888888
bitflags! {
889-
pub flags NSDataReadingOptions: libc::c_ulonglong {
890-
const NSDataReadingMappedIfSafe = 1 << 0,
891-
const NSDataReadingUncached = 1 << 1,
892-
const NSDataReadingMappedAlways = 1 << 3
889+
pub struct NSDataReadingOptions: libc::c_ulonglong {
890+
const NSDataReadingMappedIfSafe = 1 << 0;
891+
const NSDataReadingUncached = 1 << 1;
892+
const NSDataReadingMappedAlways = 1 << 3;
893893
}
894894
}
895895

896896
bitflags! {
897-
pub flags NSDataBase64EncodingOptions: libc::c_ulonglong {
898-
const NSDataBase64Encoding64CharacterLineLength = 1 << 0,
899-
const NSDataBase64Encoding76CharacterLineLength = 1 << 1,
900-
const NSDataBase64EncodingEndLineWithCarriageReturn = 1 << 4,
901-
const NSDataBase64EncodingEndLineWithLineFeed = 1 << 5
897+
pub struct NSDataBase64EncodingOptions: libc::c_ulonglong {
898+
const NSDataBase64Encoding64CharacterLineLength = 1 << 0;
899+
const NSDataBase64Encoding76CharacterLineLength = 1 << 1;
900+
const NSDataBase64EncodingEndLineWithCarriageReturn = 1 << 4;
901+
const NSDataBase64EncodingEndLineWithLineFeed = 1 << 5;
902902
}
903903
}
904904

905905
bitflags! {
906-
pub flags NSDataBase64DecodingOptions: libc::c_ulonglong {
907-
const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0
906+
pub struct NSDataBase64DecodingOptions: libc::c_ulonglong {
907+
const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0;
908908
}
909909
}
910910

911911
bitflags! {
912-
pub flags NSDataWritingOptions: libc::c_ulonglong {
913-
const NSDataWritingAtomic = 1 << 0,
914-
const NSDataWritingWithoutOverwriting = 1 << 1
912+
pub struct NSDataWritingOptions: libc::c_ulonglong {
913+
const NSDataWritingAtomic = 1 << 0;
914+
const NSDataWritingWithoutOverwriting = 1 << 1;
915915
}
916916
}
917917

918918
bitflags! {
919-
pub flags NSDataSearchOptions: libc::c_ulonglong {
920-
const NSDataSearchBackwards = 1 << 0,
921-
const NSDataSearchAnchored = 1 << 1
919+
pub struct NSDataSearchOptions: libc::c_ulonglong {
920+
const NSDataSearchBackwards = 1 << 0;
921+
const NSDataSearchAnchored = 1 << 1;
922922
}
923923
}

0 commit comments

Comments
 (0)