mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 05:20:48 +00:00
Add MacOSX 10.4 methods and constants to NSEvent. Resort event types to
be binary compatible to MacOSX. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25377 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9fc6122ab8
commit
8b5ef317f7
7 changed files with 627 additions and 353 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-08-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSDocumentController.h,
|
||||
* Source/NSDocumentController.m (-maximumRecentDocumentCount): Add
|
||||
missing method.
|
||||
* Headers/AppKit/NSEvent.h,
|
||||
* Source/NSEvent.m: Add MacOSX 10.4 methods and constants. Resort
|
||||
event types to be binary compatible to MacOSX.
|
||||
* Source/Functions.m (NSEventMaskFromType): Remove.
|
||||
* Source/NSWindow.m (-sendEvent:): Handle new event types.
|
||||
|
||||
2007-08-03 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m: ([-launchedApplications]) complete and tidy
|
||||
|
|
|
@ -109,6 +109,9 @@
|
|||
- (IBAction)openDocument:(id)sender;
|
||||
- (IBAction)newDocument:(id)sender;
|
||||
- (IBAction)clearRecentDocuments:(id)sender;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (unsigned int) maximumRecentDocumentCount;
|
||||
#endif
|
||||
|
||||
/*" Recent Documents "*/
|
||||
- (void)noteNewRecentDocument:(NSDocument *)aDocument;
|
||||
|
|
|
@ -73,15 +73,12 @@
|
|||
typedef enum _NSEventType {
|
||||
// Note - order IS significant as ranges of values
|
||||
// are used for testing for valid event types.
|
||||
NSLeftMouseDown,
|
||||
NSLeftMouseDown = 1,
|
||||
NSLeftMouseUp,
|
||||
NSOtherMouseDown,
|
||||
NSOtherMouseUp,
|
||||
NSRightMouseDown,
|
||||
NSRightMouseUp,
|
||||
NSMouseMoved,
|
||||
NSLeftMouseDragged,
|
||||
NSOtherMouseDragged,
|
||||
NSRightMouseDragged,
|
||||
NSMouseEntered,
|
||||
NSMouseExited,
|
||||
|
@ -93,19 +90,23 @@ typedef enum _NSEventType {
|
|||
NSApplicationDefined,
|
||||
NSPeriodic,
|
||||
NSCursorUpdate,
|
||||
NSScrollWheel
|
||||
NSScrollWheel = 22,
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
NSTabletPoint,
|
||||
NSTabletProximity,
|
||||
#endif
|
||||
NSOtherMouseDown = 25,
|
||||
NSOtherMouseUp,
|
||||
NSOtherMouseDragged
|
||||
} NSEventType;
|
||||
|
||||
enum {
|
||||
NSLeftMouseDownMask = (1 << NSLeftMouseDown),
|
||||
NSLeftMouseUpMask = (1 << NSLeftMouseUp),
|
||||
NSOtherMouseDownMask = (1 << NSOtherMouseDown),
|
||||
NSOtherMouseUpMask = (1 << NSOtherMouseUp),
|
||||
NSRightMouseDownMask = (1 << NSRightMouseDown),
|
||||
NSRightMouseUpMask = (1 << NSRightMouseUp),
|
||||
NSMouseMovedMask = (1 << NSMouseMoved),
|
||||
NSLeftMouseDraggedMask = (1 << NSLeftMouseDragged),
|
||||
NSOtherMouseDraggedMask = (1 << NSOtherMouseDragged),
|
||||
NSRightMouseDraggedMask = (1 << NSRightMouseDragged),
|
||||
NSMouseEnteredMask = (1 << NSMouseEntered),
|
||||
NSMouseExitedMask = (1 << NSMouseExited),
|
||||
|
@ -118,20 +119,107 @@ enum {
|
|||
NSPeriodicMask = (1 << NSPeriodic),
|
||||
NSCursorUpdateMask = (1 << NSCursorUpdate),
|
||||
NSScrollWheelMask = (1 << NSScrollWheel),
|
||||
NSAnyEventMask = 0xffffffff
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
NSTabletPointMask = (1 << NSTabletPoint),
|
||||
NSTabletProximityMask = (1 << NSTabletProximity),
|
||||
#endif
|
||||
NSOtherMouseDownMask = (1 << NSOtherMouseDown),
|
||||
NSOtherMouseUpMask = (1 << NSOtherMouseUp),
|
||||
NSOtherMouseDraggedMask = (1 << NSOtherMouseDragged),
|
||||
|
||||
NSAnyEventMask = 0xffffffffU,
|
||||
|
||||
// key events
|
||||
GSKeyEventMask = (NSKeyDownMask | NSKeyUpMask | NSFlagsChangedMask),
|
||||
// mouse events
|
||||
GSMouseEventMask = (NSLeftMouseDownMask | NSLeftMouseUpMask | NSLeftMouseDraggedMask
|
||||
| NSRightMouseDownMask | NSRightMouseUpMask | NSRightMouseDraggedMask
|
||||
| NSOtherMouseDownMask | NSOtherMouseUpMask | NSOtherMouseDraggedMask
|
||||
| NSMouseMovedMask | NSScrollWheelMask
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
| NSTabletPointMask | NSTabletProximityMask
|
||||
#endif
|
||||
),
|
||||
// mouse move events
|
||||
GSMouseMovedEventMask = (NSMouseMovedMask | NSScrollWheelMask
|
||||
| NSLeftMouseDraggedMask | NSRightMouseDraggedMask
|
||||
| NSOtherMouseDraggedMask),
|
||||
// enter/exit event
|
||||
GSEnterExitEventMask = (NSMouseEnteredMask | NSMouseExitedMask | NSCursorUpdateMask),
|
||||
// other events
|
||||
GSOtherEventMask = (NSAppKitDefinedMask | NSSystemDefinedMask
|
||||
| NSApplicationDefinedMask | NSPeriodicMask),
|
||||
|
||||
// tracking loops may need to add NSPeriodicMask
|
||||
GSTrackingLoopMask = (NSLeftMouseDownMask | NSLeftMouseUpMask
|
||||
| NSLeftMouseDraggedMask | NSMouseMovedMask
|
||||
| NSRightMouseUpMask | NSOtherMouseUpMask)
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert an NSEvent Type to it's respective Event Mask
|
||||
*/
|
||||
// FIXME: Should we use the inline trick from NSGeometry.h here?
|
||||
static inline
|
||||
unsigned int
|
||||
NSEventMaskFromType(NSEventType type)
|
||||
{
|
||||
return (1 << type);
|
||||
}
|
||||
|
||||
enum {
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
NSDeviceIndependentModifierFlagsMask = 0xffff0000U,
|
||||
#endif
|
||||
NSAlphaShiftKeyMask = 1 << 16,
|
||||
NSShiftKeyMask = 2 << 16,
|
||||
NSControlKeyMask = 4 << 16,
|
||||
NSAlternateKeyMask = 8 << 16,
|
||||
NSCommandKeyMask = 16 << 16,
|
||||
NSNumericPadKeyMask = 32 << 16,
|
||||
NSHelpKeyMask = 64 << 16,
|
||||
NSFunctionKeyMask = 128 << 16
|
||||
};
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
typedef enum
|
||||
{
|
||||
NSUnknownPointingDevice,
|
||||
NSPenPointingDevice,
|
||||
NSCursorPointingDevice,
|
||||
NSEraserPointingDevice
|
||||
} NSPointingDeviceType;
|
||||
|
||||
enum
|
||||
{
|
||||
NSPenTipMask = 1,
|
||||
NSPenLowerSideMask = 2,
|
||||
NSPenUpperSideMask = 4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NSMouseEventSubtype,
|
||||
NSTabletPointEventSubtype,
|
||||
NSTabletProximityEventSubtype
|
||||
};
|
||||
|
||||
enum {
|
||||
NSAlphaShiftKeyMask = 1,
|
||||
NSShiftKeyMask = 2,
|
||||
NSControlKeyMask = 4,
|
||||
NSAlternateKeyMask = 8,
|
||||
NSCommandKeyMask = 16,
|
||||
NSNumericPadKeyMask = 32,
|
||||
NSHelpKeyMask = 64,
|
||||
NSFunctionKeyMask = 128
|
||||
NSWindowExposedEventType = 0,
|
||||
NSApplicationActivatedEventType = 1,
|
||||
NSApplicationDeactivatedEventType = 2,
|
||||
NSWindowMovedEventType = 4,
|
||||
NSScreenChangedEventType = 8,
|
||||
NSAWTEventType = 16
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NSPowerOffEventType = 1
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@interface NSEvent : NSObject <NSCoding, NSCopying>
|
||||
{
|
||||
NSEventType event_type;
|
||||
|
@ -266,6 +354,27 @@ enum {
|
|||
- (NSWindow *) window;
|
||||
- (int) windowNumber;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
||||
- (int) absoluteX;
|
||||
- (int) absoluteY;
|
||||
- (int) absoluteZ;
|
||||
- (unsigned int) buttonMask;
|
||||
- (unsigned int) capabilityMask;
|
||||
- (unsigned int) deviceID;
|
||||
- (BOOL) isEnteringProximity;
|
||||
- (unsigned int) pointingDeviceID;
|
||||
- (unsigned int) pointingDeviceSerialNumber;
|
||||
- (NSPointingDeviceType) pointingDeviceType;
|
||||
- (float) rotation;
|
||||
- (unsigned int) systemTabletID;
|
||||
- (unsigned int) tabletID;
|
||||
- (float) tangentialPressure;
|
||||
- (NSPoint) tilt;
|
||||
- (unsigned long long) uniqueID;
|
||||
- (id) vendorDefined;
|
||||
- (unsigned int) vendorID;
|
||||
- (unsigned int) vendorPointingDeviceType;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -78,39 +78,6 @@ NSApplicationMain(int argc, const char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an NSEvent Type to it's respective Event Mask
|
||||
*/
|
||||
unsigned
|
||||
NSEventMaskFromType(NSEventType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case NSLeftMouseDown: return NSLeftMouseDownMask;
|
||||
case NSLeftMouseUp: return NSLeftMouseUpMask;
|
||||
case NSOtherMouseDown: return NSOtherMouseDownMask;
|
||||
case NSOtherMouseUp: return NSOtherMouseUpMask;
|
||||
case NSRightMouseDown: return NSRightMouseDownMask;
|
||||
case NSRightMouseUp: return NSRightMouseUpMask;
|
||||
case NSMouseMoved: return NSMouseMovedMask;
|
||||
case NSMouseEntered: return NSMouseEnteredMask;
|
||||
case NSMouseExited: return NSMouseExitedMask;
|
||||
case NSLeftMouseDragged: return NSLeftMouseDraggedMask;
|
||||
case NSOtherMouseDragged: return NSOtherMouseDraggedMask;
|
||||
case NSRightMouseDragged: return NSRightMouseDraggedMask;
|
||||
case NSKeyDown: return NSKeyDownMask;
|
||||
case NSKeyUp: return NSKeyUpMask;
|
||||
case NSFlagsChanged: return NSFlagsChangedMask;
|
||||
case NSPeriodic: return NSPeriodicMask;
|
||||
case NSCursorUpdate: return NSCursorUpdateMask;
|
||||
case NSScrollWheel: return NSScrollWheelMask;
|
||||
case NSAppKitDefined: return NSAppKitDefinedMask;
|
||||
case NSSystemDefined: return NSSystemDefinedMask;
|
||||
case NSApplicationDefined: return NSApplicationDefinedMask;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Color Functions
|
||||
*/
|
||||
|
|
|
@ -990,7 +990,10 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
}
|
||||
|
||||
// The number of remembered recent documents
|
||||
#define MAX_DOCS 5
|
||||
- (unsigned int) maximumRecentDocumentCount
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
- (void) noteNewRecentDocument: (NSDocument *)aDocument
|
||||
{
|
||||
|
@ -1011,7 +1014,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
// Always keep the current object at the end of the list
|
||||
[_recent_documents removeObjectAtIndex: index];
|
||||
}
|
||||
else if ([_recent_documents count] > MAX_DOCS)
|
||||
else if ([_recent_documents count] > [self maximumRecentDocumentCount])
|
||||
{
|
||||
[_recent_documents removeObjectAtIndex: 0];
|
||||
}
|
||||
|
|
222
Source/NSEvent.m
222
Source/NSEvent.m
|
@ -72,7 +72,7 @@ static Class eventClass;
|
|||
{
|
||||
if (self == [NSEvent class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
[self setVersion: 2];
|
||||
eventClass = [NSEvent class];
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static Class eventClass;
|
|||
{
|
||||
NSEvent *e;
|
||||
|
||||
if (type < NSKeyDown || type > NSFlagsChanged)
|
||||
if (!(NSEventMaskFromType(type) & GSKeyEventMask))
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"keyEvent with wrong type"];
|
||||
|
||||
|
@ -167,7 +167,7 @@ static Class eventClass;
|
|||
{
|
||||
NSEvent *e;
|
||||
|
||||
if (type < NSLeftMouseDown || type > NSRightMouseDragged)
|
||||
if (!(NSEventMaskFromType(type) & GSMouseEventMask))
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"mouseEvent with wrong type"];
|
||||
|
||||
|
@ -205,8 +205,7 @@ static Class eventClass;
|
|||
{
|
||||
NSEvent *e;
|
||||
|
||||
if ((type < NSLeftMouseDown || type > NSRightMouseDragged)
|
||||
&& (type != NSScrollWheel))
|
||||
if (!(NSEventMaskFromType(type) & GSMouseEventMask))
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"mouseEvent with wrong type"];
|
||||
|
||||
|
@ -252,7 +251,7 @@ static Class eventClass;
|
|||
{
|
||||
NSEvent *e;
|
||||
|
||||
if (type < NSAppKitDefined || type > NSPeriodic)
|
||||
if (!(NSEventMaskFromType(type) & GSOtherEventMask))
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"otherEvent with wrong type"];
|
||||
|
||||
|
@ -382,7 +381,7 @@ static Class eventClass;
|
|||
*/
|
||||
- (int) buttonNumber
|
||||
{
|
||||
if (event_type < NSLeftMouseDown || event_type > NSMouseExited)
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"buttonNumber requested for non-mouse event"];
|
||||
|
@ -432,7 +431,7 @@ static Class eventClass;
|
|||
- (int) clickCount
|
||||
{
|
||||
/* Make sure it is one of the right event types */
|
||||
if (event_type < NSLeftMouseDown || event_type > NSRightMouseUp)
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"clickCount requested for non-mouse event"];
|
||||
|
@ -525,8 +524,7 @@ static Class eventClass;
|
|||
*/
|
||||
- (float)deltaX
|
||||
{
|
||||
if (event_type != NSScrollWheel
|
||||
&& (event_type < NSMouseMoved || event_type > NSRightMouseDragged))
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseMovedEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"deltaX requested for invalid event type"];
|
||||
|
@ -546,8 +544,7 @@ static Class eventClass;
|
|||
*/
|
||||
- (float)deltaY
|
||||
{
|
||||
if (event_type != NSScrollWheel
|
||||
&& (event_type < NSMouseMoved || event_type > NSRightMouseDragged))
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseMovedEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"deltaY requested for invalid event type"];
|
||||
|
@ -570,8 +567,7 @@ static Class eventClass;
|
|||
*/
|
||||
- (float)deltaZ
|
||||
{
|
||||
if (event_type != NSScrollWheel
|
||||
&& (event_type < NSMouseMoved || event_type > NSRightMouseDragged))
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseMovedEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"deltaZ requested for invalid event type"];
|
||||
|
@ -582,15 +578,13 @@ static Class eventClass;
|
|||
- (NSString*) description
|
||||
{
|
||||
static const char *eventTypes[] = {
|
||||
"nullEvent",
|
||||
"leftMouseDown",
|
||||
"leftMouseUp",
|
||||
"otherMouseDown",
|
||||
"otherMouseUp",
|
||||
"rightMouseDown",
|
||||
"rightMouseUp",
|
||||
"mouseMoved",
|
||||
"leftMouseDragged",
|
||||
"otherMouseDragged",
|
||||
"rightMouseDragged",
|
||||
"mouseEntered",
|
||||
"mouseExited",
|
||||
|
@ -602,7 +596,12 @@ static const char *eventTypes[] = {
|
|||
"applicationDefined",
|
||||
"periodic",
|
||||
"cursorUpdate",
|
||||
"scrollWheel"
|
||||
"scrollWheel",
|
||||
"tabletPoint",
|
||||
"tabletProximity",
|
||||
"otherMouseDown",
|
||||
"otherMouseUp",
|
||||
"otherMouseDragged"
|
||||
};
|
||||
|
||||
switch (event_type)
|
||||
|
@ -683,6 +682,11 @@ static const char *eventTypes[] = {
|
|||
event_data.mouse.deltaY,
|
||||
event_data.mouse.deltaZ];
|
||||
break;
|
||||
|
||||
case NSTabletPoint:
|
||||
case NSTabletProximity:
|
||||
// FIXME: Tablet events
|
||||
break;
|
||||
}
|
||||
|
||||
return [super description];
|
||||
|
@ -740,6 +744,11 @@ static const char *eventTypes[] = {
|
|||
[aCoder encodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type,
|
||||
&event_data.misc.data1, &event_data.misc.data2];
|
||||
break;
|
||||
|
||||
case NSTabletPoint:
|
||||
case NSTabletProximity:
|
||||
// FIXME: Tablet events
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -753,7 +762,8 @@ static const char *eventTypes[] = {
|
|||
- (int) eventNumber
|
||||
{
|
||||
/* Make sure it is one of the right event types */
|
||||
if (event_type < NSLeftMouseDown || event_type > NSMouseExited)
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseEventMask) &&
|
||||
!(NSEventMaskFromType(event_type) & GSEnterExitEventMask))
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"eventNumber requested for non-mouse event"];
|
||||
|
||||
|
@ -765,12 +775,44 @@ static const char *eventTypes[] = {
|
|||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
int version = [aDecoder versionForClassName: @"NSEvent"];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSEventType) at: &event_type];
|
||||
location_point = [aDecoder decodePoint];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned) at: &modifier_flags];
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time];
|
||||
[aDecoder decodeValueOfObjCType: @encode(unsigned) at: &window_num];
|
||||
|
||||
if (version == 1)
|
||||
{
|
||||
// For the unlikely case that old events have been stored, convert them.
|
||||
switch (event_type)
|
||||
{
|
||||
case 0: event_type = NSLeftMouseDown; break;
|
||||
case 1: event_type = NSLeftMouseUp; break;
|
||||
case 2: event_type = NSOtherMouseDown; break;
|
||||
case 3: event_type = NSOtherMouseUp; break;
|
||||
case 4: event_type = NSRightMouseDown; break;
|
||||
case 5: event_type = NSRightMouseUp; break;
|
||||
case 6: event_type = NSMouseMoved; break;
|
||||
case 7: event_type = NSLeftMouseDragged; break;
|
||||
case 8: event_type = NSOtherMouseDragged; break;
|
||||
case 9: event_type = NSRightMouseDragged; break;
|
||||
case 10: event_type = NSMouseEntered; break;
|
||||
case 11: event_type = NSMouseExited; break;
|
||||
case 12: event_type = NSKeyDown; break;
|
||||
case 13: event_type = NSKeyUp; break;
|
||||
case 14: event_type = NSFlagsChanged; break;
|
||||
case 15: event_type = NSAppKitDefined; break;
|
||||
case 16: event_type = NSSystemDefined; break;
|
||||
case 17: event_type = NSApplicationDefined; break;
|
||||
case 18: event_type = NSPeriodic; break;
|
||||
case 19: event_type = NSCursorUpdate; break;
|
||||
case 20: event_type = NSScrollWheel; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
// Decode the event date based upon the event type
|
||||
switch (event_type)
|
||||
{
|
||||
|
@ -817,6 +859,11 @@ static const char *eventTypes[] = {
|
|||
[aDecoder decodeValuesOfObjCTypes: "sii", &event_data.misc.sub_type,
|
||||
&event_data.misc.data1, &event_data.misc.data2];
|
||||
break;
|
||||
|
||||
case NSTabletPoint:
|
||||
case NSTabletProximity:
|
||||
// FIXME: Tablet events
|
||||
break;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -879,7 +926,7 @@ static const char *eventTypes[] = {
|
|||
- (float) pressure
|
||||
{
|
||||
/* Make sure it is one of the right event types */
|
||||
if (event_type < NSLeftMouseDown || event_type > NSRightMouseDragged)
|
||||
if (!(NSEventMaskFromType(event_type) & GSMouseEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"pressure requested for non-mouse event"];
|
||||
|
@ -891,16 +938,28 @@ static const char *eventTypes[] = {
|
|||
* Returns the 'subtype' item associated with the event.
|
||||
* <br />Raises NSInternalInconsistencyException if the event is not
|
||||
* of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined,
|
||||
* or NSPeriodic
|
||||
* NSPeriodic or a mouve event.
|
||||
*/
|
||||
- (short) subtype
|
||||
{
|
||||
if (event_type < NSAppKitDefined || event_type > NSPeriodic)
|
||||
if (!(NSEventMaskFromType(event_type) & GSOtherEventMask) &&
|
||||
!(NSEventMaskFromType(event_type) & GSMouseEventMask))
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"subtype requested for invalid event type"];
|
||||
}
|
||||
return event_data.misc.sub_type;;
|
||||
|
||||
if (NSEventMaskFromType(event_type) & GSOtherEventMask)
|
||||
return event_data.misc.sub_type;
|
||||
else
|
||||
{
|
||||
if (event_type == NSTabletPoint)
|
||||
return NSTabletPointEventSubtype;
|
||||
else if (event_type == NSTabletProximity)
|
||||
return NSTabletProximityEventSubtype;
|
||||
else
|
||||
return NSMouseEventSubtype;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -973,4 +1032,121 @@ static const char *eventTypes[] = {
|
|||
return window_num;
|
||||
}
|
||||
|
||||
/*
|
||||
* Methods for tablet events
|
||||
*/
|
||||
- (int) absoluteX
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (int) absoluteY
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (int) absoluteZ
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (unsigned int) buttonMask
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (unsigned int) capabilityMask
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (unsigned int) deviceID
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (BOOL) isEnteringProximity
|
||||
{
|
||||
// FIXME
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (unsigned int) pointingDeviceID
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (unsigned int) pointingDeviceSerialNumber
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSPointingDeviceType) pointingDeviceType
|
||||
{
|
||||
// FIXME
|
||||
return NSUnknownPointingDevice;
|
||||
}
|
||||
|
||||
- (float) rotation
|
||||
{
|
||||
// FIXME
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (unsigned int) systemTabletID
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (unsigned int) tabletID
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (float) tangentialPressure
|
||||
{
|
||||
// FIXME
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (NSPoint) tilt
|
||||
{
|
||||
// FIXME
|
||||
return NSMakePoint(0.0, 0.0);
|
||||
}
|
||||
|
||||
- (unsigned long long) uniqueID
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (id) vendorDefined
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (unsigned int) vendorID
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (unsigned int) vendorPointingDeviceType
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -3759,6 +3759,11 @@ resetCursorRectsForView(NSView *theView)
|
|||
case NSSystemDefined:
|
||||
case NSApplicationDefined:
|
||||
break;
|
||||
|
||||
case NSTabletPoint:
|
||||
case NSTabletProximity:
|
||||
// FIXME: Tablet events
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue