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 | |
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')
-rw-r--r-- | generic/tkBind.c | 22 | ||||
-rw-r--r-- | generic/tkInt.h | 7 | ||||
-rw-r--r-- | generic/tkWindow.c | 4 |
3 files changed, 19 insertions, 14 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; } diff --git a/generic/tkInt.h b/generic/tkInt.h index 73297d8..83ccbae 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -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: tkInt.h,v 1.117 2010/01/02 11:07:56 dkf Exp $ + * RCS: $Id: tkInt.h,v 1.118 2010/01/06 14:58:30 dkf Exp $ */ #ifndef _TKINT @@ -506,7 +506,9 @@ typedef struct TkDisplay { * display. */ Window mouseButtonWindow; /* Window the button state was set in, added * in Tk 8.4. */ - Window warpWindow; + Tk_Window warpWindow; + Tk_Window warpMainwin; /* For finding the root window for warping + * purposes. */ int warpX; int warpY; @@ -1242,6 +1244,7 @@ MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, ClientData clientData); +MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); /* * Unsupported commands. diff --git a/generic/tkWindow.c b/generic/tkWindow.c index c023507..5080cc0 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.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: tkWindow.c,v 1.106 2009/12/12 00:10:45 nijtmans Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.107 2010/01/06 14:58:30 dkf Exp $ */ #include "tkInt.h" @@ -508,7 +508,7 @@ GetScreen( dispPtr->lastEventTime = CurrentTime; dispPtr->bindInfoStale = 1; dispPtr->cursorFont = None; - dispPtr->warpWindow = None; + dispPtr->warpWindow = NULL; dispPtr->multipleAtom = None; /* |