Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Created August 30, 2015 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noitidart/9470ec02bd252e2ae7eb to your computer and use it in GitHub Desktop.
Save Noitidart/9470ec02bd252e2ae7eb to your computer and use it in GitHub Desktop.
// For APIs introduced in Mac OS X 10.6 and later, this type is used with NS*Mask constants to indicate the events of interest.
typedef NS_OPTIONS(unsigned long long, NSEventMask) { /* masks for the types of events */
NSLeftMouseDownMask = 1 << NSLeftMouseDown,
NSLeftMouseUpMask = 1 << NSLeftMouseUp,
NSRightMouseDownMask = 1 << NSRightMouseDown,
NSRightMouseUpMask = 1 << NSRightMouseUp,
NSMouseMovedMask = 1 << NSMouseMoved,
NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged,
NSRightMouseDraggedMask = 1 << NSRightMouseDragged,
NSMouseEnteredMask = 1 << NSMouseEntered,
NSMouseExitedMask = 1 << NSMouseExited,
NSKeyDownMask = 1 << NSKeyDown,
NSKeyUpMask = 1 << NSKeyUp,
NSFlagsChangedMask = 1 << NSFlagsChanged,
NSAppKitDefinedMask = 1 << NSAppKitDefined,
NSSystemDefinedMask = 1 << NSSystemDefined,
NSApplicationDefinedMask = 1 << NSApplicationDefined,
NSPeriodicMask = 1 << NSPeriodic,
NSCursorUpdateMask = 1 << NSCursorUpdate,
NSScrollWheelMask = 1 << NSScrollWheel,
NSTabletPointMask = 1 << NSTabletPoint,
NSTabletProximityMask = 1 << NSTabletProximity,
NSOtherMouseDownMask = 1 << NSOtherMouseDown,
NSOtherMouseUpMask = 1 << NSOtherMouseUp,
NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged,
/* The following event masks are available on some hardware on 10.5.2 and later */
NSEventMaskGesture NS_ENUM_AVAILABLE_MAC(10_5) = 1 << NSEventTypeGesture,
NSEventMaskMagnify NS_ENUM_AVAILABLE_MAC(10_5) = 1 << NSEventTypeMagnify,
NSEventMaskSwipe NS_ENUM_AVAILABLE_MAC(10_5) = 1U << NSEventTypeSwipe,
NSEventMaskRotate NS_ENUM_AVAILABLE_MAC(10_5) = 1 << NSEventTypeRotate,
NSEventMaskBeginGesture NS_ENUM_AVAILABLE_MAC(10_5) = 1 << NSEventTypeBeginGesture,
NSEventMaskEndGesture NS_ENUM_AVAILABLE_MAC(10_5) = 1 << NSEventTypeEndGesture,
#if __LP64__
/* Note: You can only use these event masks on 64 bit. In other words, you cannot setup a local, nor global, event monitor for these event types on 32 bit. Also, you cannot search the event que for them (nextEventMatchingMask:...) on 32 bit.
*/
NSEventMaskSmartMagnify NS_ENUM_AVAILABLE_MAC(10_8) = 1ULL << NSEventTypeSmartMagnify,
NSEventMaskPressure NS_ENUM_AVAILABLE_MAC(10_10_3) = 1ULL << NSEventTypePressure,
#endif
NSAnyEventMask = NSUIntegerMax
};
#if __LP64__
NS_INLINE NSEventMask NSEventMaskFromType(NSEventType type) { return (1UL << type); }
#else
NS_INLINE NSEventMask NSEventMaskFromType(NSEventType type) { return (1 << type); }
#endif
@Noitidart
Copy link
Author

dont delete. this is for objc mouse block stuff, i reference this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment