summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXKeyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXKeyboard.c')
-rw-r--r--macosx/tkMacOSXKeyboard.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index db5d679..aff807e 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.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: tkMacOSXKeyboard.c,v 1.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.3 2002/09/09 23:52:02 hobbs Exp $
*/
#include "tkInt.h"
@@ -148,6 +148,14 @@ XKeycodeToKeysym(
if (!initialized) {
InitKeyMaps();
}
+ if (keycode == 0) {
+ /*
+ * This means we had a pure modifier keypress or
+ * something similar which is a TO DO.
+ */
+ return NoSymbol;
+ }
+
virtualKey = (char) (keycode >> 16);
c = (keycode) & 0xffff;
if (c > 255) {
@@ -240,7 +248,7 @@ TkpGetString(
* Just return NULL if the character is a function key or another
* non-printing key.
*/
- if (c == 0x10) {
+ if (c == 0x10 || (eventPtr->xany.send_event == -1)) {
len = 0;
} else {
hPtr = Tcl_FindHashEntry(&keycodeTable, (char *) virtualKey);
@@ -487,6 +495,30 @@ TkpGetKeySym(dispPtr, eventPtr)
&& (eventPtr->xkey.state & LockMask))) {
index += 1;
}
+ if (eventPtr->xany.send_event == -1) {
+ /* We use -1 as a special signal for a pure modifier */
+ int modifier = eventPtr->xkey.keycode;
+ if (modifier == cmdKey) {
+ return XK_Alt_L;
+ } else if (modifier == shiftKey) {
+ return XK_Shift_L;
+ } else if (modifier == alphaLock) {
+ return XK_Caps_Lock;
+ } else if (modifier == optionKey) {
+ return XK_Meta_L;
+ } else if (modifier == controlKey) {
+ return XK_Control_L;
+ } else if (modifier == rightShiftKey) {
+ return XK_Shift_R;
+ } else if (modifier == rightOptionKey) {
+ return XK_Meta_R;
+ } else if (modifier == rightControlKey) {
+ return XK_Control_R;
+ } else {
+ /* If we get here, we probably need to implement something new */
+ return NoSymbol;
+ }
+ }
sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
/*