summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinWm.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 90503a6..146b82b 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2577,6 +2577,36 @@ TkpWmGetState(
*--------------------------------------------------------------
*/
+static void CheckForPointer(TkWindow *winPtr)
+{
+ Display *display = Tk_Display(winPtr);
+ POINT mouse;
+ unsigned int state = TkWinGetModifierState();
+ TkWindow **windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
+ TkWindow **w;
+ TkGetPointerCoords(NULL, &mouse.x, &mouse.y);
+ fprintf(stderr, "CheckForPointer: %s with mouse @(%d, %d)\n",
+ Tk_PathName(winPtr), mouse.x, mouse.y);
+ if (windows != NULL) {
+ for (w = windows; *w ; w++) {
+ RECT windowRect;
+ HWND hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) *w));
+ fprintf(stderr, " Checking %s\n", Tk_PathName(*w));
+ if (GetWindowRect(hwnd, &windowRect) == 0) {
+ continue;
+ }
+ if (winPtr != *w && PtInRect(&windowRect, mouse)) {
+ fprintf(stderr, "Pointer is in %s. Calling Tk_UpdatePointer\n",
+ Tk_PathName(*w));
+ Tk_UpdatePointer((Tk_Window) *w, mouse.x, mouse.y, state);
+ break;
+ }
+ }
+ ckfree(windows);
+ }
+ fflush(stderr);
+}
+
void
TkWmDeadWindow(
TkWindow *winPtr) /* Top-level window that's being deleted. */
@@ -2715,6 +2745,15 @@ TkWmDeadWindow(
DecrIconRefCount(wmPtr->iconPtr);
}
+ /*
+ * Check if the dead window is a toplevel containing the pointer. If so,
+ * find the window which will inherit the pointer and call
+ * TkUpdatePointer.
+ */
+
+ CheckForPointer(winPtr);
+ //TkPointerDeadWindow(winPtr);
+
ckfree(wmPtr);
winPtr->wmInfoPtr = NULL;
}