diff options
author | wolfsuit <wolfsuit> | 2003-02-19 22:20:54 (GMT) |
---|---|---|
committer | wolfsuit <wolfsuit> | 2003-02-19 22:20:54 (GMT) |
commit | e58c4121633f54dd00b872d11a8e40cc777c5ab5 (patch) | |
tree | 9dd562b3ccffb0436bf5b125695d5d8ac6c6291b /macosx/tkMacOSXMouseEvent.c | |
parent | e891595e16225fe441b40805b6bc3f1e9ff7cc75 (diff) | |
download | tk-e58c4121633f54dd00b872d11a8e40cc777c5ab5.zip tk-e58c4121633f54dd00b872d11a8e40cc777c5ab5.tar.gz tk-e58c4121633f54dd00b872d11a8e40cc777c5ab5.tar.bz2 |
2003-02-19 Jim Ingham <jingham@apple.com>
* tkMacOSXMouseEvents.c (GeneratePollingEvents): In the case
where there was a capture window, we were sending the events to
the capture window. But the capture window (return value or
TkMacOSXGetCapture) is always a toplevel. So this is wrong in
the case that the Event's toplevel IS the capture window - in
which case the event should go to the subwindow most closely
containing the event.
Fixes bug #688188
Diffstat (limited to 'macosx/tkMacOSXMouseEvent.c')
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index e771edb..2516ef8 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -470,28 +470,38 @@ HandleInCollapse(WindowRef win) static int GeneratePollingEvents(MouseEventData * medPtr) { - Tk_Window tkwin, rootwin, grabWin; + Tk_Window tkwin, rootwin, grabWin, topPtr; Window window; int local_x, local_y; TkDisplay *dispPtr; - /* - * I really do not understand this complicated logic. Surely the event - * should be to either: (1) medPtr->whichWin, the window under the mouse - * (from which we then obviously extract the correct Tk subwindow), or - * (2) the current grab window. I really don't see why anything else is - * relevant. - */ -#if 0 + + grabWin = TkMacOSXGetCapture(); + if ((!TkpIsWindowFloating(medPtr->whichWin) && (medPtr->activeNonFloating != medPtr->whichWin))) { - tkwin = NULL; + /* + * If the window for this event is not floating, and is not the + * active non-floating window, don't generate polling events. + * We don't send events to backgrounded windows. So either send + * it to the grabWin, or NULL if there is no grabWin. + */ + + tkwin = grabWin; } else { + /* + * First check whether the toplevel containing this mouse + * event is the grab window. If not, then send the event + * to the grab window. Otherwise, set tkWin to the subwindow + * which most closely contains the mouse event. + */ + window = TkMacOSXGetXWindow(medPtr->whichWin); dispPtr = TkGetDisplayList(); rootwin = Tk_IdToWindow(dispPtr->display, window); - if (rootwin == NULL) { - tkwin = NULL; + if ((rootwin == NULL) + || ((grabWin != NULL) && (rootwin != grabWin))) { + tkwin = grabWin; } else { tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h, medPtr->local.v, @@ -504,28 +514,6 @@ GeneratePollingEvents(MouseEventData * medPtr) * adjust any state that Tk must remember. */ - grabWin = TkMacOSXGetCapture(); - - if ((tkwin == NULL) && (grabWin != NULL)) { - tkwin = grabWin; - } -#else - grabWin = TkMacOSXGetCapture(); - if (grabWin != NULL) { - tkwin = grabWin; - } else { - window = TkMacOSXGetXWindow(medPtr->whichWin); - dispPtr = TkGetDisplayList(); - rootwin = Tk_IdToWindow(dispPtr->display, window); - if (rootwin == NULL) { - tkwin = NULL; - } else { - tkwin = Tk_TopCoordsToWindow(rootwin, - medPtr->local.h, medPtr->local.v, - &local_x, &local_y); - } - } -#endif Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v, medPtr->state); |