diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | generic/tkBind.c | 6 | ||||
-rw-r--r-- | generic/tkFocus.c | 14 | ||||
-rw-r--r-- | generic/tkGrab.c | 8 | ||||
-rw-r--r-- | generic/tkInt.h | 10 | ||||
-rw-r--r-- | tests/bind.test | 8 |
6 files changed, 29 insertions, 21 deletions
@@ -1,5 +1,9 @@ 2008-11-23 Pat Thoyts <patthoyts@users.sourceforge.net> + * generic/tkBind.c: [Bug 1389270] event generate silently ignored + * generic/tkFocus.c: focus events. These can now be generated. + * generic/tkGrab.c: + * generic/tkInt.h: * tests/bind.test: Fixed some locale dependencies in various tests to reduce the noise on non-English windows systems. diff --git a/generic/tkBind.c b/generic/tkBind.c index 42186c0..ed2a6ae 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.48 2008/11/08 19:04:05 dkf Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.49 2008/11/23 21:58:24 patthoyts Exp $ */ #include "tkInt.h" @@ -3388,6 +3388,10 @@ HandleEventGenerate( event.xkey.y_root = -1; } + if (event.xany.type == FocusIn || event.xany.type == FocusOut) { + event.xany.send_event = GENERATED_FOCUS_EVENT_MAGIC; + } + /* * Process the remaining arguments to fill in additional fields of the * event. diff --git a/generic/tkFocus.c b/generic/tkFocus.c index bce8191..cbe8cda 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFocus.c,v 1.19 2008/11/08 18:44:39 dkf Exp $ + * RCS: @(#) $Id: tkFocus.c,v 1.20 2008/11/23 21:58:24 patthoyts Exp $ */ #include "tkInt.h" @@ -70,14 +70,6 @@ typedef struct TkDisplayFocusInfo { } DisplayFocusInfo; /* - * The following magic value is stored in the "send_event" field of FocusIn - * and FocusOut events that are generated in this file. This allows us to - * separate "real" events coming from the server from those that we generated. - */ - -#define GENERATED_EVENT_MAGIC ((Bool) 0x547321ac) - -/* * Debugging support... */ @@ -290,7 +282,7 @@ TkFocusFilterEvent( * pass the event through to Tk bindings. */ - if (eventPtr->xfocus.send_event == GENERATED_EVENT_MAGIC) { + if (eventPtr->xfocus.send_event == GENERATED_FOCUS_EVENT_MAGIC) { eventPtr->xfocus.send_event = 0; return 1; } @@ -908,7 +900,7 @@ GenerateFocusEvents( } event.xfocus.serial = LastKnownRequestProcessed(winPtr->display); - event.xfocus.send_event = GENERATED_EVENT_MAGIC; + event.xfocus.send_event = GENERATED_FOCUS_EVENT_MAGIC; event.xfocus.display = winPtr->display; event.xfocus.mode = NotifyNormal; TkInOutEvents(&event, sourcePtr, destPtr, FocusOut, FocusIn, diff --git a/generic/tkGrab.c b/generic/tkGrab.c index d07c197..8bf0e89 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkGrab.c,v 1.16 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkGrab.c,v 1.17 2008/11/23 21:58:24 patthoyts Exp $ */ #include "tkInt.h" @@ -132,7 +132,7 @@ typedef struct NewGrabWinEvent { * we generated. */ -#define GENERATED_EVENT_MAGIC ((Bool) 0x147321ac) +#define GENERATED_GRAB_EVENT_MAGIC ((Bool) 0x147321ac) /* * Mask that selects any of the state bits corresponding to buttons, plus @@ -722,7 +722,7 @@ TkPointerEvent( * serverWinPtr. */ - if (eventPtr->xcrossing.send_event != GENERATED_EVENT_MAGIC) { + if (eventPtr->xcrossing.send_event != GENERATED_GRAB_EVENT_MAGIC) { if ((eventPtr->type == LeaveNotify) && (winPtr->flags & TK_TOP_HIERARCHY)) { dispPtr->serverWinPtr = NULL; @@ -1151,7 +1151,7 @@ MovePointer2( } event.xcrossing.serial = LastKnownRequestProcessed(winPtr->display); - event.xcrossing.send_event = GENERATED_EVENT_MAGIC; + event.xcrossing.send_event = GENERATED_GRAB_EVENT_MAGIC; event.xcrossing.display = winPtr->display; event.xcrossing.root = RootWindow(winPtr->display, winPtr->screenNum); event.xcrossing.time = TkCurrentTime(winPtr->dispPtr); diff --git a/generic/tkInt.h b/generic/tkInt.h index 3a1094f..2b4705c 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.94 2008/11/22 22:28:52 das Exp $ + * RCS: $Id: tkInt.h,v 1.95 2008/11/23 21:58:24 patthoyts Exp $ */ #ifndef _TKINT @@ -970,6 +970,14 @@ MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; #endif /* + * The following magic value is stored in the "send_event" field of FocusIn + * and FocusOut events. This allows us to separate "real" events coming from + * the server from those that we generated. + */ + +#define GENERATED_FOCUS_EVENT_MAGIC ((Bool) 0x547321ac) + +/* * Exported internals. */ diff --git a/tests/bind.test b/tests/bind.test index d568026..23438fc 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: bind.test,v 1.25 2008/11/23 21:40:43 patthoyts Exp $ +# RCS: @(#) $Id: bind.test,v 1.26 2008/11/23 21:58:24 patthoyts Exp $ package require tcltest 2.2 namespace import ::tcltest::* @@ -3403,7 +3403,7 @@ test bind-22.35 {HandleEventGenerate: options <FocusIn> -detail NotifyVirtual} - return $x } -cleanup { destroy .t.f -} -result {} +} -result {FocusIn NotifyVirtual} test bind-22.35.1 {HandleEventGenerate: options <FocusOut> -detail NotifyVirtual} -setup { frame .t.f -class Test -width 150 -height 100 @@ -3417,7 +3417,7 @@ test bind-22.35.1 {HandleEventGenerate: options <FocusOut> -detail NotifyVirtual return $x } -cleanup { destroy .t.f -} -result {} +} -result {FocusOut NotifyVirtual} test bind-22.36 {HandleEventGenerate: options <Enter> -detail NotifyVirtual} -setup { frame .t.f -class Test -width 150 -height 100 @@ -3659,7 +3659,7 @@ test bind-22.53 {HandleEventGenerate: options <FocusIn> -mode NotifyNormal} -set return $x } -cleanup { destroy .t.f -} -result {} +} -result {NotifyNormal} test bind-22.54 {HandleEventGenerate: options <Key> -mode NotifyNormal} -setup { frame .t.f -class Test -width 150 -height 100 |