(bindingTable, eventPtr, tkwin, numObjects, objectPtr)
| 965 | * Results: |
| 966 | * None. |
| 967 | * |
| 968 | * Side effects: |
| 969 | * Depends on the command associated with the matching |
| 970 | * binding. |
| 971 | * |
| 972 | *-------------------------------------------------------------- |
| 973 | */ |
| 974 | |
| 975 | void |
| 976 | Tk_BindEvent(bindingTable, eventPtr, tkwin, numObjects, objectPtr) |
| 977 | Tk_BindingTable bindingTable; /* Table in which to look for |
| 978 | * bindings. */ |
| 979 | XEvent *eventPtr; /* What actually happened. */ |
| 980 | Tk_Window tkwin; /* Window on display where event |
| 981 | * occurred (needed in order to |
| 982 | * locate display information). */ |
| 983 | int numObjects; /* Number of objects at *objectPtr. */ |
| 984 | ClientData *objectPtr; /* Array of one or more objects |
| 985 | * to check for a matching binding. */ |
| 986 | { |
| 987 | BindingTable *bindPtr = (BindingTable *) bindingTable; |
| 988 | TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; |
| 989 | XEvent *ringPtr; |
| 990 | PatSeq *matchPtr; |
| 991 | PatternTableKey key; |
| 992 | Tcl_HashEntry *hPtr; |
| 993 | int detail; |
| 994 | |
| 995 | /* |
| 996 | * Add the new event to the ring of saved events for the |
| 997 | * binding table. Consecutive MotionNotify events get combined: |
| 998 | * if both the new event and the previous event are MotionNotify, |
| 999 | * then put the new event *on top* of the previous event. |
| 1000 | */ |
| 1001 | |
| 1002 | if ((eventPtr->type != MotionNotify) |
| 1003 | || (bindPtr->eventRing[bindPtr->curEvent].type != MotionNotify)) { |
| 1004 | bindPtr->curEvent++; |
| 1005 | if (bindPtr->curEvent >= EVENT_BUFFER_SIZE) { |
| 1006 | bindPtr->curEvent = 0; |
| 1007 | } |
| 1008 | } |
| 1009 | ringPtr = &bindPtr->eventRing[bindPtr->curEvent]; |
| 1010 | memcpy((VOID *) ringPtr, (VOID *) eventPtr, sizeof(XEvent)); |
| 1011 | detail = 0; |
| 1012 | bindPtr->detailRing[bindPtr->curEvent] = 0; |
| 1013 | if ((ringPtr->type == KeyPress) || (ringPtr->type == KeyRelease)) { |
| 1014 | detail = (int) GetKeySym(dispPtr, ringPtr); |
| 1015 | if (detail == NoSymbol) { |
| 1016 | detail = 0; |
| 1017 | } |
| 1018 | } else if ((ringPtr->type == ButtonPress) |
| 1019 | || (ringPtr->type == ButtonRelease)) { |
| 1020 | detail = ringPtr->xbutton.button; |
| 1021 | } |
| 1022 | bindPtr->detailRing[bindPtr->curEvent] = detail; |
| 1023 | |
| 1024 | /* |
no test coverage detected