summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authormdejong <mdejong>2003-04-14 23:34:38 (GMT)
committermdejong <mdejong>2003-04-14 23:34:38 (GMT)
commitc0eda27e6633bfc5790cbb82bb8684a4a3d13abf (patch)
tree0843c40903b1ad5380b2e08c2ebf09cd5bbb4315 /generic
parent7da91f4ded6684e544186183922f03297ff2eeb1 (diff)
downloadtk-c0eda27e6633bfc5790cbb82bb8684a4a3d13abf.zip
tk-c0eda27e6633bfc5790cbb82bb8684a4a3d13abf.tar.gz
tk-c0eda27e6633bfc5790cbb82bb8684a4a3d13abf.tar.bz2
* generic/tkBind.c (TkpGetBindingXEvent): Add helper method
that can be used to query the XEvent* for the currently executing binding. * generic/tkInt.h: Declare TkpGetBindingXEvent. * win/tkWinMenu.c (MenuKeyBindProc, TkWinMenuKeyObjCmd, TkpInitializeMenuBindings): Rename MenuKeyBindProc to TkWinMenuKeyObjCmd and convert it into a Tcl command named tk::tkWinMenuKey. Bind keyboard accelerator actions to this Tcl command instead of using a native C binding. This makes it possible to extend the existing binding with Tcl code and makes the Windows version work just like the unix version.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c30
-rw-r--r--generic/tkInt.h4
2 files changed, 31 insertions, 3 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index d77718a..7f6fc04 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.28 2003/02/28 15:55:33 dkf Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.29 2003/04/14 23:34:41 mdejong Exp $
*/
#include "tkPort.h"
@@ -4675,5 +4675,31 @@ TkCopyAndGlobalEval(interp, script)
Tcl_DStringFree(&buffer);
return code;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetBindingXEvent --
+ *
+ * This procedure returns the XEvent associated with the
+ * currently executing binding. This procedure can only
+ * be invoked while a binding is executing.
+ *
+ * Results:
+ * Returns a pointer to the XEvent that caused the
+ * current binding code to be run.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
-
+XEvent *
+TkpGetBindingXEvent(interp)
+ Tcl_Interp *interp; /* Interpreter. */
+{
+ TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
+ BindingTable *bindPtr = (BindingTable *) winPtr->mainPtr->bindingTable;
+ return &(bindPtr->eventRing[bindPtr->curEvent]);
+}
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 2723d41..6bd0f12 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.56 2003/02/18 06:22:44 mdejong Exp $
+ * RCS: $Id: tkInt.h,v 1.57 2003/04/14 23:34:41 mdejong Exp $
*/
#ifndef _TKINT
@@ -1166,6 +1166,8 @@ EXTERN char * TkTilePrintProc _ANSI_ARGS_((
ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr));
+EXTERN XEvent * TkpGetBindingXEvent _ANSI_ARGS_((
+ Tcl_Interp *interp));
/*
* Unsupported commands.