Tk
view release on metacpan or search on metacpan
pTk/mTk/generic/tkBind.c view on Meta::CPAN
* screen is no longer current. Change the current display
* back again.
*/
screenPtr->curDispPtr = oldDispPtr;
screenPtr->curScreenIndex = oldScreen;
Tk_ChangeScreen(interp, oldDispPtr->name, oldScreen);
}
Tcl_SetObjResult(interp, savedResult);
Tcl_DStringFree(&scripts);
if (matchCount > 0) {
if (!bindInfoPtr->deleted) {
/*
* Delete the pending list from the list of pending scripts
* for this window.
*/
PendingBinding **curPtrPtr;
for (curPtrPtr = &bindInfoPtr->pendingList; ; ) {
if (*curPtrPtr == pendingPtr) {
*curPtrPtr = pendingPtr->nextPtr;
break;
}
curPtrPtr = &(*curPtrPtr)->nextPtr;
}
}
if (pendingPtr != &staticPending) {
ckfree((char *) pendingPtr);
}
}
Tcl_Release((ClientData) bindInfoPtr);
}
/*
*---------------------------------------------------------------------------
*
* TkBindDeadWindow --
*
* This procedure is invoked when it is determined that a window is
* dead. It cleans up bind-related information about the window
*
* Results:
* None.
*
* Side effects:
* Any pending C bindings for this window are cancelled.
*
*---------------------------------------------------------------------------
*/
void
TkBindDeadWindow(winPtr)
TkWindow *winPtr; /* The window that is being deleted. */
{
BindInfo *bindInfoPtr;
PendingBinding *curPtr;
/*
* Certain special windows like those used for send and clipboard
* have no mainPtr.
*/
if (winPtr->mainPtr == NULL)
return;
bindInfoPtr = (BindInfo *) winPtr->mainPtr->bindInfo;
curPtr = bindInfoPtr->pendingList;
while (curPtr != NULL) {
if (curPtr->tkwin == (Tk_Window) winPtr) {
curPtr->deleted = 1;
}
curPtr = curPtr->nextPtr;
}
}
/*
*----------------------------------------------------------------------
*
* MatchPatterns --
*
* Given a list of pattern sequences and a list of recent events,
* return the pattern sequence that best matches the event list,
* if there is one.
*
* This procedure is used in two different ways. In the simplest
* use, "object" is NULL and psPtr is a list of pattern sequences,
* each of which corresponds to a binding. In this case, the
* procedure finds the pattern sequences that match the event list
* and returns the most specific of those, if there is more than one.
*
* In the second case, psPtr is a list of pattern sequences, each
* of which corresponds to a definition for a virtual binding.
* In order for one of these sequences to "match", it must match
* the events (as above) but in addition there must be a binding
* for its associated virtual event on the current object. The
* "object" argument indicates which object the binding must be for.
*
* Results:
* The return value is NULL if bestPtr is NULL and no pattern matches
* the recent events from bindPtr. Otherwise the return value is
* the most specific pattern sequence among bestPtr and all those
* at psPtr that match the event list and object. If a pattern
* sequence other than bestPtr is returned, then *bestCommandPtr
* is filled in with a pointer to the command from the best sequence.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static PatSeq *
MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
TkDisplay *dispPtr; /* Display from which the event came. */
BindingTable *bindPtr; /* Information about binding table, such as
* ring of recent events. */
PatSeq *psPtr; /* List of pattern sequences. */
PatSeq *bestPtr; /* The best match seen so far, from a
* previous call to this procedure. NULL
* means no prior best match. */
ClientData *objectPtr; /* If NULL, the sequences at psPtr
( run in 0.715 second using v1.01-cache-2.11-cpan-84e82930d8c )