17 #include <Cocoa/Cocoa.h> 29 @interface FakeCrossingEvent : NSEvent {
30 NSWindow *fQuartzWindow;
31 NSPoint fLocationInWindow;
36 @implementation FakeCrossingEvent
39 - (
id) initWithWindow : (NSWindow *) window location : (NSPoint) location
42 assert(window &&
"initWithWindow:location:, parameter 'window' is nil");
44 if (
self = [super
init]) {
45 fQuartzWindow = window;
46 fLocationInWindow = location;
55 assert(fQuartzWindow &&
"window, fQuartzWindow is nil");
60 - (NSPoint) locationInWindow
62 assert(fQuartzWindow != nil &&
"locationInWindow, fQuartzWindow is nil");
63 return fLocationInWindow;
67 - (NSTimeInterval) timestamp
84 template<
typename T1,
typename T2>
91 return fFirst < rhs.fFirst;
100 assert(buf != 0 &&
"MapUnicharToKeySym, parameter 'buf' is null");
105 static const KeySymPair<unichar, EKeySym> keyMap[] = {
113 {NSUpArrowFunctionKey,
kKey_Up},
125 {NSF9FunctionKey, kKey_F8},
163 const unsigned nEntries =
sizeof keyMap /
sizeof keyMap[0];
167 KeySymPair<unichar, EKeySym> valueToFind = {};
168 valueToFind.fFirst = key;
169 const KeySymPair<unichar, EKeySym> *iter = std::lower_bound(keyMap, keyMap + nEntries, valueToFind);
171 if (iter != keyMap + nEntries && iter->fFirst == key) {
172 buf[0] = key <= 0x7e ? key : 0;
173 rootKeySym = iter->fSecond;
184 if (keySym >= 0x20 && keySym <= 0x7e)
187 static const KeySymPair<EKeySym, unichar> keyMap[] = {
202 {
kKey_Up, NSUpArrowFunctionKey},
252 const unsigned nEntries =
sizeof keyMap /
sizeof keyMap[0];
254 KeySymPair<EKeySym, unichar> valueToFind = {};
255 valueToFind.fFirst =
static_cast<EKeySym>(keySym);
256 const KeySymPair<EKeySym, unichar> *iter = std::lower_bound(keyMap, keyMap + nEntries, valueToFind);
257 if (iter != keyMap + nEntries && iter->fFirst == keySym)
258 return iter->fSecond;
266 NSUInteger cocoaModifiers = 0;
279 return cocoaModifiers;
285 const NSUInteger modifiers = [NSEvent modifierFlags];
299 return rootModifiers;
306 const NSUInteger buttons = [NSEvent pressedMouseButtons];
311 if (buttons & (1 << 2))
314 return rootModifiers;
319 #pragma mark - Several aux. functions to extract parameters from Cocoa events. 325 assert(theEvent != nil &&
"TimeForCocoaEvent, parameter 'theEvent' is nil");
327 return [theEvent timestamp] * 1000;
335 assert(theEvent != nil &&
"NewX11EventFromCocoaEvent, parameter 'theEvent' is nil");
349 assert(cocoaEvent != nil &&
"ConvertEventLocationToROOTXY, parameter 'cocoaEvent' is nil");
350 assert(eventView != nil &&
"ConvertEventLocationToROOTXY, parameter 'eventView' is nil");
351 assert(rootEvent != 0 &&
"ConvertEventLocationToROOTXY, parameter 'rootEvent' is null");
354 if (![cocoaEvent window])
355 NSLog(
@"Error in ConvertEventLocationToROOTXY, window property" 356 " of event is nil, can not convert coordinates correctly");
363 const NSPoint viewPoint = [eventView convertPoint : winPoint fromView : nil];
365 rootEvent->
fX = viewPoint.x;
366 rootEvent->
fY = viewPoint.y;
375 assert(theEvent != nil &&
"GetKeyboardModifiersFromCocoaEvent, parameter 'event' is nil");
377 const NSUInteger modifiers = [theEvent modifierFlags];
378 unsigned rootModifiers = 0;
390 return rootModifiers;
396 assert(theEvent != nil &&
"GetModifiersFromCocoaEvent, parameter 'event' is nil");
399 const NSUInteger buttons = [NSEvent pressedMouseButtons];
404 if (buttons & (1 << 2))
407 return rootModifiers;
410 #pragma mark - Misc. aux. functions. 413 bool IsParent(NSView<X11Window> *testParent, NSView<X11Window> *testChild)
415 assert(testParent != nil &&
"IsParent, parameter 'testParent' is nil");
416 assert(testChild != nil &&
"IsParent, parameter 'testChild' is nil");
418 if (testChild.fParentView) {
419 NSView<X11Window> *parent = testChild.fParentView;
421 if(parent == testParent)
423 parent = parent.fParentView;
431 bool IsInBranch(NSView<X11Window> *parent, NSView<X11Window> *child, NSView<X11Window> *testView)
433 assert(child != nil &&
"IsInBranch, parameter 'child' is nil");
434 assert(testView != nil &&
"IsInBranch, parameter 'testView' is nil");
436 if (testView == child || testView == parent)
439 for (NSView<X11Window> *current = child.fParentView; current != parent; current = current.fParentView) {
440 if (current == testView)
457 NSView<X11Window> **lca)
463 assert(view1 != nil &&
"FindLowestCommonAncestor, parameter 'view1' is nil");
464 assert(view2 != nil &&
"findLowestCommonAncestor, parameter 'view2' is nil");
465 assert(lca != 0 &&
"FindLowestCommonAncestor, parameter 'lca' is null");
467 if (!view1.fParentView)
470 if (!view2.fParentView)
473 NSView<X11Window> *
const ancestor = (NSView<X11Window> *)[view1 ancestorSharedWithView : view2];
486 assert(view1 != nil &&
"FindRelation, view1 parameter is nil");
487 assert(view2 != nil &&
"FindRelation, view2 parameter is nil");
488 assert(lca != 0 &&
"FindRelation, lca parameter is nil");
503 assert(viewFrom != nil &&
"FindViewToPropagateEvent, parameter 'view' is nil");
505 if (viewFrom.fEventMask & checkMask)
508 for (viewFrom = viewFrom.fParentView; viewFrom; viewFrom = viewFrom.fParentView) {
509 if (viewFrom.fEventMask & checkMask)
518 NSView<X11Window> *grabView,
Mask_t grabMask)
525 assert(viewFrom != nil &&
"FindViewToPropagateEvent, parameter 'view' is nil");
527 if (viewFrom.fEventMask & checkMask)
530 for (viewFrom = viewFrom.fParentView; viewFrom; viewFrom = viewFrom.fParentView) {
531 if (viewFrom.fEventMask & checkMask)
535 if (grabView && (grabMask & checkMask))
541 #pragma mark - Aux. 'low-level' functions to generate events and call HandleEvent for a root window. 552 assert(view != nil &&
"SendEnterEvent, parameter 'view' is nil");
553 assert(theEvent != nil &&
"SendEnterEvent, parameter 'event' is nil");
554 assert(view.fID != 0 &&
"SendEnterEvent, view.fID is 0");
558 #ifdef DEBUG_ROOT_COCOA 559 NSLog(
@"SendEnterEvent, ROOT's widget %u was not found", view.fID);
566 enterEvent.
fCode = detail;
575 queue.push_back(enterEvent);
587 assert(view != nil &&
"SendLeaveEvent, parameter 'view' is nil");
588 assert(theEvent != nil &&
"SendLeaveEvent, parameter 'event' is nil");
589 assert(view.fID != 0 &&
"SendLeaveEvent, view.fID is 0");
593 #ifdef DEBUG_ROOT_COCOA 594 NSLog(
@"SendLeaveEvent, ROOT's widget %u was not found", view.fID);
601 leaveEvent.
fCode = detail;
607 queue.push_back(leaveEvent);
618 assert(view != nil &&
"SendPointerMotionEvent, parameter 'view' is nil");
619 assert(theEvent != nil &&
"SendPointerMotionEvent, parameter 'event' is nil");
620 assert(view.fID != 0 &&
"SendPointerMotionEvent, view.fID is 0");
624 #ifdef DEBUG_ROOT_COCOA 625 NSLog(
@"SendPointerMotionEvent, ROOT's widget %u was not found", view.fID);
636 queue.push_back(motionEvent);
649 assert(view != nil &&
"SendButtonPressEvent, parameter 'view' is nil");
650 assert(theEvent != nil &&
"SendButtonPressEvent, parameter 'event' is nil");
651 assert(view.fID != 0 &&
"SendButtonPressEvent, view.fID is 0");
655 #ifdef DEBUG_ROOT_COCOA 656 NSLog(
@"SendButtonpressEvent, ROOT's widget %u was not found", view.fID);
663 pressEvent.
fCode = btn;
675 NSPoint viewPoint = {};
676 viewPoint.x = pressEvent.
fX;
677 viewPoint.y = pressEvent.
fY;
678 for (NSView<X11Window> *child in [view subviews]) {
679 if (!child.fIsOverlapped && [child hitTest : viewPoint]) {
680 pressEvent.
fUser[0] = child.fID;
686 queue.push_back(pressEvent);
698 assert(view != nil &&
"SendButtonReleaseEvent, parameter 'view' is nil");
699 assert(theEvent != nil &&
"SendButtonReleaseEvent, parameter 'event' is nil");
700 assert(view.fID != 0 &&
"SendButtonReleaseEvent, view.fID is 0");
704 #ifdef DEBUG_ROOT_COCOA 705 NSLog(
@"SendButtonReleaseEvent, ROOT's widget %u was not found", view.fID);
712 releaseEvent.
fCode = btn;
717 queue.push_back(releaseEvent);
722 NSEvent *theEvent, NSPoint windowPoint)
724 assert(view != nil &&
"SendKeyPressEvent, parameter 'view' is nil");
725 assert(theEvent != nil &&
"SendKeyPressEvent, parameter 'event' is nil");
726 assert(view.fID != 0 &&
"SendKeyPressEvent, view.fID is 0");
730 #ifdef DEBUG_ROOT_COCOA 731 NSLog(
@"SendKeyPressEvent, ROOT's widget %u was not found", view.fID);
740 NSString *
const characters = [theEvent charactersIgnoringModifiers];
741 assert(characters != nil &&
"SendKeyPressEvent, [theEvent characters] returned nil");
742 assert([characters length] > 0 &&
"SendKeyPressEvent, characters is an empty string");
744 keyPressEvent.
fCode = [characters characterAtIndex : 0];
748 const NSPoint viewPoint = [view convertPoint : windowPoint fromView : nil];
751 keyPressEvent.
fX = viewPoint.x;
752 keyPressEvent.
fY = viewPoint.y;
754 keyPressEvent.
fXRoot = screenPoint.x;
755 keyPressEvent.
fYRoot = screenPoint.y;
758 keyPressEvent.
fUser[0] = childView.fID;
761 queue.push_back(keyPressEvent);
766 NSEvent *theEvent, NSPoint windowPoint)
768 assert(view != nil &&
"SendKeyReleaseEvent, parameter 'view' is nil");
769 assert(theEvent != nil &&
"SendKeyReleaseEvent, parameter 'event' is nil");
770 assert(view.fID != 0 &&
"SendKeyReleaseEvent, view.fID is 0");
774 #ifdef DEBUG_ROOT_COCOA 775 NSLog(
@"SendKeyPressEvent, ROOT's widget %u was not found", view.fID);
785 NSString *
const characters = [theEvent charactersIgnoringModifiers];
786 assert(characters != nil &&
"SendKeyReleaseEvent, [theEvent characters] returned nil");
787 assert([characters length] > 0 &&
"SendKeyReleaseEvent, characters is an empty string");
788 keyReleaseEvent.
fCode = [characters characterAtIndex : 0];
791 const NSPoint viewPoint = [view convertPoint : windowPoint fromView : nil];
792 keyReleaseEvent.
fX = viewPoint.x;
793 keyReleaseEvent.
fY = viewPoint.y;
796 keyReleaseEvent.
fXRoot = screenPoint.x;
797 keyReleaseEvent.
fYRoot = screenPoint.y;
801 keyReleaseEvent.
fUser[0] = childView.fID;
804 queue.push_back(keyReleaseEvent);
811 assert(view != nil &&
"SendFocusInEvent, parameter 'view' is nil");
815 #ifdef DEBUG_ROOT_COCOA 816 NSLog(
@"SendFocusInEvent, ROOT's widget %u was not found", view.fID);
822 focusInEvent.
fWindow = view.fID;
824 focusInEvent.
fCode = mode;
826 queue.push_back(focusInEvent);
832 assert(view != nil &&
"SendFocusOutEvent, parameter 'view' is nil");
836 #ifdef DEBUG_ROOT_COCOA 837 NSLog(
@"SendFocusOutEvent, ROOT's widget %u was not found", view.fID);
843 focusOutEvent.
fWindow = view.fID;
845 focusOutEvent.
fCode = mode;
847 queue.push_back(focusOutEvent);
850 #pragma mark - Aux. functions to send events to view's branch. 854 NSEvent *theEvent,
EXMagic mode)
857 assert(from != nil &&
"SendEnterEventRange, 'from' parameter is nil");
858 assert(to != nil &&
"SendEnterEventRange, 'to' parameter is nil");
859 assert(theEvent != nil &&
"SendEnterEventRange, event parameter is nil");
864 from = from.fParentView;
870 NSEvent *theEvent,
EXMagic mode)
873 assert(from != nil &&
"SendEnterEventClosedRange, 'from' parameter is nil");
874 assert(to != nil &&
"SendEnterEventClosedRange, 'to' parameter is nil");
875 assert(theEvent != nil &&
"SendEnterEventClosedRange, event parameter is nil");
884 NSEvent *theEvent,
EXMagic mode)
887 assert(from != nil &&
"SendLeaveEventRange, 'from' parameter is nil");
888 assert(to != nil &&
"SendLeaveEventRange, 'to' parameter is nil");
889 assert(theEvent != nil &&
"SendLeaveEventRange, event parameter is nil");
894 from = from.fParentView;
900 NSEvent *theEvent,
EXMagic mode)
903 assert(from != nil &&
"SendLeaveEventClosedRange, 'from' parameter is nil");
904 assert(to != nil &&
"SendLeaveEventClosedRange, 'to' parameter is nil");
905 assert(theEvent != nil &&
"SendLeaveEventClosedRange, event parameter is nil");
912 #pragma mark - Top-level crossing event generators. 919 NSEvent *theEvent,
EXMagic detail)
928 assert(parent != nil &&
"GenerateCrossingEventChildToParent, parameter 'parent' is nil");
929 assert(child != nil &&
"GenerateCrossingEventChildToParent, parameter 'child' is nil");
930 assert(theEvent != nil &&
"GenerateCrossingEventChildToParent, parameter 'event' is nil");
931 assert(child.fParentView != nil &&
932 "GenerateCrossingEventChildToParent, parameter 'child' must have QuartzView* parent");
949 NSEvent *theEvent,
EXMagic detail)
959 assert(parent != nil &&
"GenerateCrossingEventParentToChild, parameter 'parent' is nil");
960 assert(child != nil &&
"GenerateCrossingEventParentToChild, parameter 'child' is nil");
961 assert(theEvent != nil &&
"GenerateCrossingEventParentToChild, parameter 'event' is nil");
962 assert(child.fParentView != nil &&
963 "GenerateCrossingEventParentToChild, parameter 'child' must have QuartzView* parent");
980 NSView<X11Window> *ancestor, NSEvent *theEvent,
EXMagic detail)
988 assert(child1 != nil &&
"GenerateCrossingEventFromChild1ToChild2, parameter 'child1' is nil");
989 assert(child2 != nil &&
"GenerateCrossingEventFromChild1ToChild2, child2 parameter is nil");
990 assert(theEvent != nil &&
"GenerateCrossingEventFromChild1ToChild2, theEvent parameter is nil");
1000 if (child1.fParentView)
1002 (NSView<X11Window> *)[[child1 window] contentView], theEvent, detail);
1003 if (child2.fParentView)
1005 (NSView<X11Window> *)[[child2 window] contentView], theEvent, detail);
1007 if (child1.fParentView)
1009 if (child2.fParentView)
1020 NSEvent *theEvent,
EXMagic detail)
1025 assert(theEvent != nil &&
"GenerateCrossingEvent, event parameter is nil");
1027 if (fromView == toView) {
1044 }
else if (!toView) {
1049 NSView<X11Window> *ancestor = 0;
1091 NSView<X11Window> *grabView,
Mask_t grabEventMask, NSEvent *theEvent)
1096 assert(theEvent != nil &&
"GenerateCrossingEventForGrabView, parameter 'event' is nil");
1097 assert(grabView != nil &&
"GenerateCrossingEventForGrabView, parameter 'grabView' is nil");
1098 assert((fromView != nil || toView != nil) &&
1099 "GenerateCrossingEventForGrabView, both 'toView' and 'fromView' parameters are nil");
1101 if (fromView == toView)
1107 if (fromView == grabView && wantsLeave)
1110 if (toView == grabView && wantsEnter)
1116 if (wantsEnter &&
IsParent(grabView, toView))
1118 }
else if (!toView) {
1120 if (wantsLeave &&
IsParent(grabView, fromView))
1123 NSView<X11Window> *ancestor = 0;
1129 }
else if (
IsInBranch(nil, toView, grabView)) {
1139 EventTranslator::EventTranslator()
1140 : fViewUnderPointer(nil),
1144 fButtonGrabView(nil),
1155 assert(view != nil &&
"GenerateConfigureNotifyEvent, parameter 'view' is nil");
1161 newEvent.
fX = newFrame.origin.x;
1162 newEvent.
fY = newFrame.origin.y;
1165 newEvent.
fWidth = newFrame.size.width;
1166 newEvent.
fHeight = newFrame.size.height;
1169 assert(window != 0 &&
"GenerateConfigureNotifyEvent, window was not found");
1182 assert(view != nil &&
"GenerateExposeEvent, parameter 'view' is nil");
1185 exposeEvent.
fWindow = view.fID;
1187 exposeEvent.
fX = exposedRect.origin.x;
1188 exposeEvent.
fY = exposedRect.origin.y;
1189 exposeEvent.
fWidth = exposedRect.size.width;
1190 exposeEvent.
fHeight = exposedRect.size.height;
1193 assert(window != 0 &&
"GenerateExposeEvent, window was not found");
1202 assert(theEvent != nil &&
"GenerateCrossingEvent, parameter 'event' is nil");
1211 assert(theEvent &&
"GenerateCrossingEventNoGrab, parameter 'theEvent' is nil");
1222 assert(theEvent != nil &&
"GenerateCrossingEventActiveGrab, parameter 'theEvent' is nil");
1253 assert(theEvent != nil &&
"GeneratePointerMotionEvent, parameter 'theEvent' is nil");
1267 assert(eventView != nil &&
"GenerateButtonPressEvent, parameter 'eventView' is nil");
1268 assert(theEvent != nil &&
"GenerateButtonpressEvent, parameter 'theEvent' is nil");
1280 assert(eventView != nil &&
"GenerateButtonReleaseEvent, parameter 'eventView' is nil");
1281 assert(theEvent != nil &&
"GenerateButtonReleaseEvent, parameter 'theEvent' is nil");
1294 assert(eventView != nil &&
"GenerateKeyPressEvent, parameter 'eventView' is nil");
1295 assert(theEvent != nil &&
"GenerateKeyPressEvent, parameter 'theEvent' is nil");
1297 if (![[theEvent charactersIgnoringModifiers] length])
1310 assert(eventView != nil &&
"GenerateKeyReleaseEvent, parameter 'eventView' is nil");
1311 assert(theEvent != nil &&
"GenerateKeyReleaseEvent, parameter 'theEvent' is nil");
1313 if (![[theEvent charactersIgnoringModifiers] length])
1348 assert(grabView != nil &&
"SetPointerGrab, parameter 'grabView' is nil");
1371 const NSPoint location = [[grabView window] mouseLocationOutsideOfEventStream];
1373 location : location]);
1376 NSLog(
@"EventTranslator::SetPointerGrab, crossing event initialization failed");
1384 [
fButtonGrabView activateGrab : eventMask ownerEvents : fOwnerEvents];
1397 const NSPoint location = [[candidateView window] mouseLocationOutsideOfEventStream];
1399 location : location ]);
1403 NSLog(
@"EventTranslator::CancelPointerGrab, crossing event initialization failed");
1416 location : location ]);
1420 NSLog(
@"EventTranslator::CancelPointerGrab, crossing event initialization failed");
1466 void ClearPointerIfViewIsRelated(NSView<X11Window> *&view,
Window_t winID)
1468 NSView<X11Window> *
v = view;
1470 for (;
v; v = v.fParentView) {
1471 if (v.fID == winID) {
1491 for (NSView<X11Window> *view =
fButtonGrabView; view; view = view.fParentView) {
1492 if (view.fID == winID) {
1500 for (NSView<X11Window> *view =
fViewUnderPointer; view; view = view.fParentView) {
1501 if (view.fID == winID) {
1502 NSPoint location = {};
1509 location : location]);
1512 NSLog(
@"EventTranslator::CheckUnmappedView, crossing event initialization failed");
1524 ClearPointerIfViewIsRelated(
fFocusView, winID);
1532 assert(theEvent != nil &&
"GeneratePointerMotionEventNoGrab, parameter 'theEvent' is nil");
1534 const Mask_t maskToTest = [NSEvent pressedMouseButtons] ?
1561 assert(theEvent != nil &&
"GeneratePointerMotionEventActiveGrab, parameter 'theEvent' is nil");
1563 const Mask_t maskToTest = [NSEvent pressedMouseButtons] ?
1595 assert(view != nil &&
"GenerateButtonPressEventNoGrab, parameter 'view' is nil");
1596 assert(theEvent != nil &&
"GenerateButtonPressEventNoGrab, parameter 'theEvent' is nil");
1630 assert(theEvent != nil &&
"GenerateButtonPressEventActiveGrab, parameter 'theEvent' is nil");
1662 assert(eventView != nil &&
"GenerateButtonReleaseEventNoGrab, parameter 'eventView' is nil");
1663 assert(theEvent != nil &&
"GenerateButtonReleaseEventNoGrabm parameter 'theEvent' is nil");
1675 assert(eventView != nil &&
"GenerateButtonReleaseEventActiveGrab, parameter 'eventView' is nil");
1676 assert(theEvent != nil &&
"GenerateButtonReleaseEventActiveGrab, parameter 'theEvent' is nil");
1716 assert(eventView != nil &&
"GenerateKeyPressEventNoGrab, parameter 'eventView' is nil");
1717 assert(theEvent != nil &&
"GenerateKeyPressEventNoGrab, parameter 'theEvent' is nil");
1718 assert(
fFocusView != nil &&
"GenerateKeyPressEventNoGrab, fFocusView is nil");
1723 NSView<X11Window> *candidateView =
fFocusView;
1729 candidateView = testView;
1741 assert(eventView != nil &&
"GenerateKeyEventActiveGrab, parameter 'eventView' is nil");
1742 assert(theEvent != nil &&
"GenerateKeyEventActiveGrab, parameter 'theEvent' is nil");
1743 assert(
fFocusView != nil &&
"GenerateKeyEventActiveGrab, fFocusView is nil");
1775 assert(eventView != nil &&
"GenerateKeyReleaseEventNoGrab, parameter 'eventView' is nil");
1776 assert(theEvent != nil &&
"GenerateKeyReleaseEventNoGrab, parameter 'theEvent' is nil");
1778 NSView<X11Window> *candidateView =
fFocusView;
1783 candidateView = testView;
1794 assert(view != nil &&
"GenerateKeyEventForView, parameter 'view' is nil");
1795 assert(theEvent != nil &&
"GenerateKeyEventForView, parameter 'theEvent' is nil");
1797 "GenerateKeyEvenForView, event's type must be keydown or keyup");
1802 NSView<X11Window> *childView = nil;
1804 NSPoint mousePosition = {};
1806 mousePosition = [topLevel mouseLocationOutsideOfEventStream];
1819 assert(fromView != nil &&
"FindButtonGrabView, parameter 'fromView' is nil");
1820 assert(theEvent != nil &&
"FindButtonGrabView, parameter 'theEvent' is nil");
1826 NSView<X11Window> *grabView = 0;
1827 NSView<X11Window> *buttonPressView = 0;
1829 for (NSView<X11Window> *view = fromView; view != nil; view = view.fParentView) {
1832 buttonPressView = view;
1835 if (view.fPassiveGrabButton ==
kAnyButton || view.fPassiveGrabButton == btn) {
1837 if (view.fPassiveGrabKeyModifiers ==
kAnyModifier || (view.fPassiveGrabKeyModifiers & keyModifiers))
1847 }
else if (buttonPressView) {
1865 assert(eventView != nil &&
"FindKeyGrabView, parameter 'eventView' is nil");
1866 assert(theEvent != nil &&
"FindKeyGrabView, parameter 'theEvent' is nil");
1868 NSString *
const characters = [theEvent charactersIgnoringModifiers];
1869 assert(characters != nil &&
"FindKeyGrabView, [theEvent characters] returned nil");
1870 assert([characters length] > 0 &&
"FindKeyGrabView, characters is an empty string");
1872 const unichar keyCode = [characters characterAtIndex : 0];
1877 currentView = eventView;
1879 for (; currentView; currentView = currentView.fParentView) {
1880 if ([currentView findPassiveKeyGrab : keyCode modifiers : modifiers])
NSUInteger GetCocoaKeyModifiersFromROOTKeyModifiers(UInt_t rootKeyModifiers)
void GenerateCrossingEventForGrabView(EventQueue_t &queue, NSView< X11Window > *fromView, NSView< X11Window > *toView, NSView< X11Window > *grabView, Mask_t grabEventMask, NSEvent *theEvent)
const Mask_t kKeyReleaseMask
int GlobalXCocoaToROOT(CGFloat xCocoa)
void SendLeaveEvent(EventQueue_t &queue, NSView< X11Window > *view, NSEvent *theEvent, EXMagic detail)
void GenerateCrossingEventParentToChild(EventQueue_t &queue, NSView< X11Window > *parent, NSView< X11Window > *child, NSEvent *theEvent, EXMagic detail)
void GenerateConfigureNotifyEvent(NSView< X11Window > *view, const NSRect &newFrame)
void GeneratePointerMotionEventActiveGrab(NSEvent *theEvent)
Bool_t operator<(const TDatime &d1, const TDatime &d2)
NSView< X11Window > * FindViewForPointerEvent(NSEvent *pointerEvent)
void SendFocusOutEvent(EventQueue_t &queue, NSView< X11Window > *view, EXMagic mode)
void GeneratePointerMotionEvent(NSEvent *theEvent)
const Mask_t kButton2Mask
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Int_t MapKeySymToKeyCode(Int_t keySym)
const Mask_t kKeyMod2Mask
const Mask_t kKeyShiftMask
Ancestry FindRelation(NSView< X11Window > *view1, NSView< X11Window > *view2, NSView< X11Window > **lca)
const NSUInteger kDeviceIndependentModifierFlagsMask
const Mask_t kKeyMod1Mask
void GenerateKeyReleaseEvent(NSView< X11Window > *eventView, NSEvent *theEvent)
const Mask_t kButtonMotionMask
const Mask_t kLeaveWindowMask
void SendLeaveEventClosedRange(EventQueue_t &queue, NSView< X11Window > *from, NSView< X11Window > *to, NSEvent *theEvent, EXMagic mode)
void MapUnicharToKeySym(unichar key, char *buf, Int_t len, UInt_t &rootKeySym)
NSView< X11Window > * FindViewToPropagateEvent(NSView< X11Window > *viewFrom, Mask_t checkMask)
unsigned GetKeyboardModifiersFromCocoaEvent(NSEvent *theEvent)
void GenerateButtonReleaseEventActiveGrab(NSView< X11Window > *eventView, NSEvent *theEvent, EMouseButton btn)
std::deque< Event_t > EventQueue_t
const NSUInteger kAlternateKeyMask
void GenerateKeyPressEventNoGrab(NSView< X11Window > *eventView, NSEvent *theEvent)
void FindKeyGrabView(NSView< X11Window > *eventView, NSEvent *theEvent)
DerivedType * Get() const
NSView< X11Window > * fButtonGrabView
void GenerateButtonPressEvent(NSView< X11Window > *eventView, NSEvent *theEvent, EMouseButton btn)
void SendButtonPressEvent(EventQueue_t &queue, NSView< X11Window > *view, NSEvent *theEvent, EMouseButton btn)
void GenerateCrossingEventFromChild1ToChild2(EventQueue_t &queue, NSView< X11Window > *child1, NSView< X11Window > *child2, NSView< X11Window > *ancestor, NSEvent *theEvent, EXMagic detail)
const NSEventType kKeyDown
const Mask_t kPointerMotionMask
NSView< X11Window > * fFocusView
NSView< X11Window > * FindViewToPropagateEvent(NSView< X11Window > *viewFrom, Mask_t checkMask, NSView< X11Window > *grabView, Mask_t grabMask)
void GenerateButtonReleaseEventNoGrab(NSView< X11Window > *eventView, NSEvent *theEvent, EMouseButton btn)
void GenerateCrossingEventChildToParent(EventQueue_t &queue, NSView< X11Window > *parent, NSView< X11Window > *child, NSEvent *theEvent, EXMagic detail)
void SendPointerMotionEvent(EventQueue_t &queue, NSView< X11Window > *view, NSEvent *theEvent)
NSPoint ConvertPointFromBaseToScreen(NSWindow *window, NSPoint windowPoint)
PointerGrab fPointerGrabType
void SendKeyPressEvent(EventQueue_t &queue, NSView< X11Window > *view, NSView< X11Window > *childView, NSEvent *theEvent, NSPoint windowPoint)
const Mask_t kKeyLockMask
void SetInputFocus(NSView< X11Window > *focusView)
NSPoint ConvertPointFromScreenToBase(NSPoint screenPoint, NSWindow *window)
EMouseButton fImplicitGrabButton
Time_t TimeForCocoaEvent(NSEvent *theEvent)
void GenerateCrossingEvents(EventQueue_t &queue, NSView< X11Window > *fromView, NSView< X11Window > *toView, NSEvent *theEvent, EXMagic detail)
void FindButtonGrab(NSView< X11Window > *fromView, NSEvent *theEvent, EMouseButton btn)
const Mask_t kButtonPressMask
NSView< X11Window > * FindViewUnderPointer()
NSPoint TranslateToScreen(NSView< X11Window > *from, NSPoint point)
const Mask_t kKeyPressMask
const Mask_t kButton3Mask
int GlobalYCocoaToROOT(CGFloat yCocoa)
void GenerateExposeEvent(NSView< X11Window > *view, const NSRect &exposedRect)
unsigned GetModifiersFromCocoaEvent(NSEvent *theEvent)
QuartzWindow * FindWindowUnderPointer()
void GenerateButtonPressEventActiveGrab(NSView< X11Window > *view, NSEvent *theEvent, EMouseButton btn)
const NSUInteger kCommandKeyMask
void SendEnterEvent(EventQueue_t &queue, NSView< X11Window > *view, NSEvent *theEvent, EXMagic detail)
void GenerateDestroyNotify(unsigned winID)
bool HasPointerGrab() const
Ancestry FindLowestCommonAncestor(NSView< X11Window > *view1, NSView< X11Window > *view2, NSView< X11Window > **lca)
const NSUInteger kShiftKeyMask
void SendLeaveEventRange(EventQueue_t &queue, NSView< X11Window > *from, NSView< X11Window > *to, NSEvent *theEvent, EXMagic mode)
void SendEnterEventRange(EventQueue_t &queue, NSView< X11Window > *from, NSView< X11Window > *to, NSEvent *theEvent, EXMagic mode)
void GenerateKeyEventActiveGrab(NSView< X11Window > *eventView, NSEvent *theEvent)
NSView< X11Window > * fKeyGrabView
bool IsInBranch(NSView< X11Window > *parent, NSView< X11Window > *child, NSView< X11Window > *testView)
const Mask_t kEnterWindowMask
void GenerateButtonPressEventNoGrab(NSView< X11Window > *view, NSEvent *theEvent, EMouseButton btn)
void ConvertEventLocationToROOTXY(NSEvent *cocoaEvent, NSView< X11Window > *eventView, Event_t *rootEvent)
void SendFocusInEvent(EventQueue_t &queue, NSView< X11Window > *view, EXMagic mode)
unsigned GetInputFocus() const
void GenerateCrossingEventActiveGrab(NSEvent *theEvent)
virtual Bool_t HandleEvent(Event_t *)
const Mask_t kButtonReleaseMask
NSView< X11Window > * fViewUnderPointer
void GenerateCrossingEvent(NSEvent *theEvent)
const NSUInteger kControlKeyMask
UInt_t GetKeyboardModifiers()
void SendEnterEventClosedRange(EventQueue_t &queue, NSView< X11Window > *from, NSView< X11Window > *to, NSEvent *theEvent, EXMagic mode)
void GenerateKeyReleaseEventNoGrab(NSView< X11Window > *eventView, NSEvent *theEvent)
void GeneratePointerMotionEventNoGrab(NSEvent *theEvent)
const Mask_t kFocusChangeMask
void CheckUnmappedView(Window_t winID)
void GenerateCrossingEventNoGrab(NSEvent *theEvent)
void GenerateKeyPressEvent(NSView< X11Window > *eventView, NSEvent *theEvent)
Event_t NewX11EventFromCocoaEvent(unsigned windowID, NSEvent *theEvent)
void SendButtonReleaseEvent(EventQueue_t &queue, NSView< X11Window > *view, NSEvent *theEvent, EMouseButton btn)
const Mask_t kKeyControlMask
void GenerateKeyEventForView(NSView< X11Window > *view, NSEvent *theEvent)
bool IsParent(NSView< X11Window > *testParent, NSView< X11Window > *testChild)
const Mask_t kAnyModifier
const NSUInteger kAlphaShiftKeyMask
const Mask_t kButton1Mask
void SetPointerGrab(NSView< X11Window > *grabView, unsigned eventMask, bool ownerEvents)
void GenerateFocusChangeEvent(NSView< X11Window > *eventView)
void SendKeyReleaseEvent(EventQueue_t &queue, NSView< X11Window > *view, NSView< X11Window > *childView, NSEvent *theEvent, NSPoint windowPoint)
void GenerateButtonReleaseEvent(NSView< X11Window > *eventView, NSEvent *theEvent, EMouseButton btn)