diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-01-06 14:58:29 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-01-06 14:58:29 (GMT) |
commit | 1a6ac30b077e52ba1da9ac22a8d38356ece00cec (patch) | |
tree | 26bd34fc1fc835f2a79bdefdc48e6aff6bbd207f /generic/tkBind.c | |
parent | ef7b2a248d85365c8bfc78d1ef62475638b1a6bc (diff) | |
download | tk-1a6ac30b077e52ba1da9ac22a8d38356ece00cec.zip tk-1a6ac30b077e52ba1da9ac22a8d38356ece00cec.tar.gz tk-1a6ac30b077e52ba1da9ac22a8d38356ece00cec.tar.bz2 |
[Bug 2926819]: Factor out the pointer warping code a bit better and extend it
to work on OSX too.
Diffstat (limited to 'generic/tkBind.c')
-rw-r--r-- | generic/tkBind.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index 1dafaa2..4821513 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.59 2010/01/02 22:52:38 dkf Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.60 2010/01/06 14:58:30 dkf Exp $ */ #include "tkInt.h" @@ -3360,7 +3360,8 @@ HandleEventGenerate( event.general.xkey.y_root = -1; } - if (event.general.xany.type == FocusIn || event.general.xany.type == FocusOut) { + if (event.general.xany.type == FocusIn + || event.general.xany.type == FocusOut) { event.general.xany.send_event = GENERATED_FOCUS_EVENT_MAGIC; } @@ -3544,7 +3545,8 @@ HandleEventGenerate( "\"", NULL); return TCL_ERROR; } - if (!(flags & KEY) || (event.general.xkey.type == MouseWheelEvent)) { + if (!(flags & KEY) + || (event.general.xkey.type == MouseWheelEvent)) { goto badopt; } break; @@ -3817,12 +3819,14 @@ HandleEventGenerate( Tcl_DoWhenIdle(DoWarp, dispPtr); dispPtr->flags |= TK_DISPLAY_IN_WARP; } - dispPtr->warpWindow = event.general.xany.window; - dispPtr->warpX = event.general.xkey.x; - dispPtr->warpY = event.general.xkey.y; + dispPtr->warpWindow = Tk_IdToWindow(Tk_Display(mainWin), + event.general.xmotion.window); + dispPtr->warpMainwin = mainWin; + dispPtr->warpX = event.general.xmotion.x; + dispPtr->warpY = event.general.xmotion.y; } -done: + done: Tcl_ResetResult(interp); return TCL_OK; } @@ -3888,9 +3892,7 @@ DoWarp( { TkDisplay *dispPtr = clientData; - XWarpPointer(dispPtr->display, (Window) None, - (Window) dispPtr->warpWindow, 0, 0, 0, 0, - (int) dispPtr->warpX, (int) dispPtr->warpY); + TkpWarpPointer(dispPtr); XForceScreenSaver(dispPtr->display, ScreenSaverReset); dispPtr->flags &= ~TK_DISPLAY_IN_WARP; } |