diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkGrab.c | 16 | ||||
-rw-r--r-- | generic/tkPointer.c | 5 | ||||
-rw-r--r-- | generic/tkWindow.c | 51 |
3 files changed, 71 insertions, 1 deletions
diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 2232ba5..c5f2a3b 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -998,6 +998,10 @@ TkInOutEvents( { TkWindow *winPtr; int upLevels, downLevels, i, j, focus; + //fprintf(stderr, "TkInOutEvents: source is %s, destination is %s, leaveType is %d, enterType is %d\n", + // sourcePtr ? Tk_PathName(sourcePtr) : "NULL", + // destPtr ? Tk_PathName(destPtr) : "NULL", + // leaveType, enterType); /* * There are four possible cases to deal with: @@ -1025,6 +1029,7 @@ TkInOutEvents( focus = 0; } FindCommonAncestor(sourcePtr, destPtr, &upLevels, &downLevels); + //fprintf(stderr, "upLevels = %d, downLevels = %d\n", upLevels, downLevels); /* * Generate enter/leave events and add them to the grab event queue. @@ -1083,10 +1088,15 @@ TkInOutEvents( * Non-linear: neither window is an inferior of the other. */ + //fprintf(stderr, " Nonlinear path\n"); if (leaveType != 0) { + //fprintf(stderr, " Queueing leave event for %s\n", + // Tk_PathName(sourcePtr)); QUEUE(sourcePtr, leaveType, NotifyNonlinear); for (winPtr = sourcePtr->parentPtr, i = upLevels-1; i > 0; winPtr = winPtr->parentPtr, i--) { + //fprintf(stderr, " Queueing Virtual leave event for %s\n", + // Tk_PathName(winPtr)); QUEUE(winPtr, leaveType, NotifyNonlinearVirtual); } } @@ -1095,13 +1105,18 @@ TkInOutEvents( for (winPtr = destPtr->parentPtr, j = 1; j < i; winPtr = winPtr->parentPtr, j++) { } + //fprintf(stderr, " Queueing Virtual enter event for %s\n", + // Tk_PathName(winPtr)); QUEUE(winPtr, enterType, NotifyNonlinearVirtual); } if (destPtr != NULL) { + //fprintf(stderr, " Queueing enter event for %s\n", + // Tk_PathName(destPtr)); QUEUE(destPtr, enterType, NotifyNonlinear); } } } + fflush(stderr); } /* @@ -1167,6 +1182,7 @@ MovePointer2( TkInOutEvents(&event, sourcePtr, destPtr, (leaveEvents) ? LeaveNotify : 0, (enterEvents) ? EnterNotify : 0, TCL_QUEUE_MARK); } + /* *---------------------------------------------------------------------- diff --git a/generic/tkPointer.c b/generic/tkPointer.c index 905489a..2b5b40e 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -183,7 +183,6 @@ GenerateEnterLeave( InitializeEvent(&event, targetPtr, LeaveNotify, x, y, state, NotifyNormal); - TkInOutEvents(&event, lastWinPtr, winPtr, LeaveNotify, EnterNotify, TCL_QUEUE_TAIL); crossed = 1; @@ -228,6 +227,10 @@ Tk_UpdatePointer( unsigned changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS; int type, b; unsigned mask; + //fprintf(stderr, " Tk_UpdatePointer: %s %d %d %x --> %s %d %d %x\n", + // tsdPtr->lastWinPtr ? Tk_PathName(tsdPtr->lastWinPtr): "NULL", + // tsdPtr->lastPos.x, tsdPtr->lastPos.y, tsdPtr->lastState, + // tkwin ? Tk_PathName(tkwin) : "NULL", x, y, state); pos.x = x; pos.y = y; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 5d664b9..5c3700b 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1322,6 +1322,33 @@ Tk_CreateWindowFromPath( *-------------------------------------------------------------- */ + +static void SendEnterLeaveForDestroy( + Tk_Window tkwin) +{ + int x, y; + unsigned int state; + Tk_Window pointerWin; + TkWindow *containerPtr; + + XQueryPointer(NULL, None, NULL, NULL, &x, &y, NULL, NULL, &state); + pointerWin = Tk_CoordsToWindow(x, y, tkwin); + if (pointerWin == tkwin) { + //fprintf(stderr, " Pointer window is being destroyed\n"); + if (!Tk_IsTopLevel(tkwin)) { + containerPtr = TkGetContainer((TkWindow *)pointerWin); + //fprintf(stderr, " Moving pointer from topmost %s to container %s\n", + // pointerWin ? Tk_PathName(pointerWin) : "NULL", + // containerPtr ? Tk_PathName(containerPtr) : "NULL"); + Tk_UpdatePointer((Tk_Window) containerPtr, x, y, state); + } + // else { + //fprintf(stderr, " Pointer window is a toplevel\n"); + // } + } + // fflush(stderr); +} + void Tk_DestroyWindow( Tk_Window tkwin) /* Window to destroy. */ @@ -1341,6 +1368,10 @@ Tk_DestroyWindow( return; } + //fprintf(stderr, "Tk_DestroyWindow: destroying %s\n", Tk_PathName(tkwin)); + //fflush(stderr); + SendEnterLeaveForDestroy(tkwin); + winPtr->flags |= TK_ALREADY_DEAD; /* @@ -1711,6 +1742,22 @@ Tk_DestroyWindow( *-------------------------------------------------------------- */ +static void SendEnterLeaveForMap( + Tk_Window tkwin) +{ + int x, y; + unsigned int state; + Tk_Window pointerWin; + + XQueryPointer(NULL, None, NULL, NULL, &x, &y, NULL, NULL, &state); + pointerWin = Tk_CoordsToWindow(x, y, tkwin); + if (pointerWin == tkwin) { + //fprintf(stderr, " New window contains pointer.\n"); + //fflush(stderr); + Tk_UpdatePointer(tkwin, x, y, state); + } +} + void Tk_MapWindow( Tk_Window tkwin) /* Token for window to map. */ @@ -1740,6 +1787,7 @@ Tk_MapWindow( TkWmMapWindow(winPtr); return; } + winPtr->flags |= TK_MAPPED; XMapWindow(winPtr->display, winPtr->window); event.type = MapNotify; @@ -1750,6 +1798,9 @@ Tk_MapWindow( event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; Tk_HandleEvent(&event); + //fprintf(stderr, "Tk_MapWindow: mapped %s\n", Tk_PathName(tkwin)); + //fflush(stderr); + SendEnterLeaveForMap(tkwin); } /* |