summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXKeyboard.c
diff options
context:
space:
mode:
authordas <das>2007-04-23 21:24:32 (GMT)
committerdas <das>2007-04-23 21:24:32 (GMT)
commit11dbb8af58fd851913e5c781e3164e8211e93745 (patch)
tree1a0bc7c114e940c5e46d3704ac14fb34f4cc029e /macosx/tkMacOSXKeyboard.c
parent24b160e09ae3ca4b52502fe59ddcd5fc80e00713 (diff)
downloadtk-11dbb8af58fd851913e5c781e3164e8211e93745.zip
tk-11dbb8af58fd851913e5c781e3164e8211e93745.tar.gz
tk-11dbb8af58fd851913e5c781e3164e8211e93745.tar.bz2
* macosx/tkMacOSXCarbonEvents.c: add window event target carbon event
* macosx/tkMacOSXEvent.c: handler for all kEventClassWindow and * macosx/tkMacOSXEvent.h: kEventClassMouse events; * macosx/tkMacOSXNotify.c: move all remaining events except for * macosx/tkMacOSXWindowEvent.c: kEventClassKeyboard from dispatcher to application event handler; pass event handler callRef downstream; fix debug event tracing; process all tcl event types in carbon event timer; delay carbon event timer first fire; add TkMacOSXTrackingLoop() to mark enter/exit of event tracking loop during which all tcl events but only carbon update events should be processed by the timer (replaces various calls to Tcl_SetServiceMode()); rename TkMacOSXReceiveAndProcessEvent() to TkMacOSXReceiveAndDispatchEvent(), move it from tkMacOSXEvent.c to tkMacOSXCarbonEvents.c and modify it to dequeue only update events during a tracking loop; add TkMacOSXRunTclEventLoop() to standardize the various ways in use to run the tcl event loop; add handling of kEventClassAppearance events (for ScrollBarVariantChanged event). * macosx/tkMacOSXDialog.c: use new TkMacOSXTrackingLoop() around * macosx/tkMacOSXEvent.c: blocking API that puts up modal dialogs * macosx/tkMacOSXMenu.c: or when entering/exiting menu/control * macosx/tkMacOSXMouseEvent.c: tracking, window dragging and other * macosx/tkMacOSXScale.c: mouse tracking loops. * macosx/tkMacOSXScrlbr.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXDialog.c: use new TkMacOSXRunTclEventLoop() * macosx/tkMacOSXScale.c: instead of Tcl_DoOneEvent(), * macosx/tkMacOSXScrlbr.c: Tcl_ServiceAll(), TclServiceIdle() * macosx/tkMacOSXWindowEvent.c: and Tcl_GlobalEval("update idletasks"). * macosx/tkMacOSXColor.c: make available as Tk system colors all * macosx/tkMacOSXPort.h: appearance manager brushes, text colors and backgrounds with new and legacy names, as well as the fully transparent color "systemTransparent"; add TkMacOSXSetColorIn{Port,Context}() to directly set an X pixel color value in the current QD port resp. the given CG context without requiring passage through rgb representation (lossy for most system colors); modernize/remove Classic-era code; replace crufty strcmp() elseifs by Tcl_GetIndexFromObjStruct(). * macosx/tkMacOSXButton.c: use new TkMacOSXSetColorInPort() * macosx/tkMacOSXDraw.c: instead of setting rgb color directly * macosx/tkMacOSXMenubutton.c: to allow for non-rgb system colors. * macosx/tkMacOSXCursor.c: implement "none" cursor as on other platforms [Patch 1615427]; add all missing appearance manager cursors. * macosx/tkMacOSXDefault.h: set SELECT_FG_COLORs to None to match aqua L&F; use standard system color names; use new 'menu' system font; correct default scrollbar width. * macosx/tkMacOSXDraw.c: standardize initialization, use and * macosx/tkMacOSXInt.h: emptying of various static temp rgns * macosx/tkMacOSXRegion.c: onto two global RgnHandles; in debug * macosx/tkMacOSXSubwindows.c: builds, verify emptiness of these temp * macosx/tkMacOSXWindowEvent.c: rgns before use. * macosx/tkMacOSXDraw.c: add TkMacOSX{Setup,Restore}DrawingContext() to * macosx/tkMacOSXInt.h: abstract common setup & teardown of drawing environment (for both CG and QD); save/restore QD theme drawing state; handle GC clip region; add TkpClipDrawableToRect() to allow clipped drawing into drawable regardless of GC used; use new system color "systemWindowHeaderBackground" to setup background in themed toplevels; correct implementation of TkMacOSXMakeStippleMap(). * macosx/tkMacOSXEntry.c: use new TkMacOSXSetupDrawingContext() and * macosx/tkMacOSXFont.c: TkMacOSXRestoreDrawingContext() instead of * macosx/ttkMacOSXTheme.c: various setup/teardown procs like TkMacOSX{SetUp,Release}CGContext(), TkMacOSXQuarz{Start,End}Draw(), TkMacOSXSetUpGraphicsPort() etc. * macosx/tkMacOSXEmbed.c: add CG context and drawable clip rgn fields * macosx/tkMacOSXInt.h: to MacDrawable struct. * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXDialog.c: make -parent option of tk_getOpenFile et al. use the sheet version of NavServices dialogs; ensure native parent win exists before using StandardSheet API for tk_messageBox [Bug 1677611]; force sheets to behave like app-modal dialogs via WindowModality() API; use more modern ColorPicker API. * macosx/tkAboutDlg.r: use themed movable modal dialog, fix (c) year. * macosx/tkMacOSXEntry.c: take xOff/yOff of MacDrawable into account * macosx/ttkMacOSXTheme.c: when computing locations/bounds to ensure correct posititioning when not drawing into intermediate pixmap. * macosx/tkMacOSXFont.c: use appearance manager API to map system font * macosx/tkMacOSXFont.h: names to TkFonts; add "menu" system font for menu item text drawing from MDEF; always draw with CG; remove QD dependent stippling algorithm; move most header declarations into the source file (as they were not used anywhere else). * macosx/tkMacOSXMenu.c: large-scale rewrite of custom * macosx/tkMacOSXMenu.r (removed): MDEF and related code that * macosx/Wish.xcode/project.pbxproj: restores many longtime-MIA * macosx/Wish.xcodeproj/project.pbxproj: features to working order * unix/Makefile.in: (e.g. images, custom colors & fonts in menus etc); implement compound menu items; use Appearance Mgr and ThemeText APIs to mimic native MDEF as closely as possible when default "menu" system font is used; remove now obsolete SICN drawing code and resources. * macosx/tkMacOSXCarbonEvents.c: handle additional menu carbon events * macosx/tkMacOSXEvent.c: in order to support <<MenuSelect>> in * macosx/tkMacOSXMenu.c: the menubar and in menus that are not * macosx/tkMacOSXMenus.c: using the custom MDEF [Bug 1620826]; fix early and missing clearing of current Tk active menu entry; fix extraneous sending of <<MenuSelect>> during active menu entry clearing. * macosx/tkMacOSXMouseEvent.c: add support for async window dragging by the window server; set the corresponding window attribute by default. * macosx/tkMacOSXMouseEvent.c: rationalized handling order of non-mousedown events; add TkMacOSXModifierState() to retrieve the current key modifiers in carbon format. * macosx/tkMacOSXScrlbr.c: use appearance manager API to retrieve scrollbar component metrics; add awareness of multiple possibilites for scrollbar arrow position in aqua and handle user changes to arrow position pref; handle difference in metrics of small & large scrollbar variants; handle aqua "jump to here" scrollbar behaviour; correct computation of scroll view size and position; enforce min scrollbar height to avoid scrollbar component overlap; erase scrollbar area outside of standard width; remove broken auto-adjust code; account for window class when leaving space for grow box; remove code to manually draw grow box; use modern API for thumb scroll proc; replace HiliteControl() by modern API; replace control mgr constants with appearance mgr equivalents. * macosx/tkMacOSXSubwindows.c: use SetWindowBounds() API instead of SizeWindow(); invalidate clip regions after X{Map,Unmap}Window as fix for [Bug 940117] made them dependent on mapping state; remove unneeded calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD port; use native-endian pixmap on intel; remove obsolete pixmap pix locking. * macosx/tkMacOSXWindowEvent.c: handle only the first of a batch of kEventAppAvailableWindowBoundsChanged events sent per transaction; handle kEventWindowBoundsChanged event to support live window resizing and centralized sending of location/size changed ConfigureNotify events; ensure HIGrowBox is redrawn after bounds change; constrain window after dragging to ensure titlebar is not inacessible offscreen or under dock/menubar; handle kEventWindowGetRegion and kEventWindowDrawContent for transparent windows to mark resp. paint content region as transparent; handle kEventWindowConstrain for fullscreen windows to ensure bounds match new screen size; enter/exit fullscreen UIMode upon activation/deactivation of fullscreen window. * macosx/tkMacOSXWm.c: use live-resize and async-drag carbon window * macosx/tkMacOSXWm.h: attributes for toplevels by default; implement new [wm attributes] -topmost, -transparent and -fullscreen; refactor WmAttributesCmd() parallelling the tkUnixWm.c implementation, use thus factored proc to set proxy icon from [wm iconbitmap]; dynamically determine default values for toplevel min and max sizes (similar to tkWinWm.c impl): min sizes depend on window class & attributes to ensure visibility of all titlebar widgets and grow box, max sizes depend on maximal window bounds for all active displays; factor out code that puts into effect changes to master or override_redirect; use RepositionWindow() API to determine staggered initial window bounds; correct resize limit calculations, handle gridding and use modern resize API in TkMacOSXGrowToplevel(); remove sending of ConfigureNotify after resize or zoom (now handled by BoundsChanged handler); correct composite carbon window attribute handling, remove currently unusable attributes and add new attributes in [tk::unsupported::MacWindowStyle]; ensure validity of window class and attributes before use; apply changes to window class when handling carbon window attribute changes (if HIWindowChangeClass() API available); add debug build warning message when deprecated window style is used instead of window class; use transparent HIGrowBox for resizable windows; avoid unnecessary calls to window structure width API; use tcl time API in TkpGetMS(); add TkMacOSXEnterExitFullscreen() to enter/exit UIMode with dock and menubar hidden; restrict wmTracing output to debug builds; remove unneeded calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD port; workaround GetWindowStructureWidths() Carbon bug (bogus results for never-mapped floating windows). * macosx/tkMacOSXXStubs.c (TkMacOSXDisplayChanged): add maximal window bounds field to Screen record (in ext_data), computed as the union of available window positioning bounds of all graphics devices (displays). * macosx/tkMacOSXBitmap.c: fix macRoman encoding leak. * macosx/tkMacOSXCursor.c: * macosx/tkMacOSXDebug.c (TkMacOSXCarbonEventToAscii): use static * macosx/tkMacOSXDebug.h: buffer to simplify callers; const fixes. * macosx/tkMacOSXBitmap.c: use more efficient QDSwapPort() instead of * macosx/tkMacOSXButton.c: GetPort()/SetPort()/GetGWorld()/SetGWorld(). * macosx/tkMacOSXDraw.c: * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXScale.c: * macosx/tkMacOSXScrlbr.c: * macosx/tkMacOSXXStubs.c: * macosx/tkMacOSXColor.c: use kHIToolboxVersionNumber for runtime OS * macosx/tkMacOSXEntry.c: version check rather than Gestalt() etc. * macosx/tkMacOSXInt.h: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXDraw.c: remove obsolete and now incorrect * macosx/tkMacOSXInt.h: tkMenuCascadeRgn clipping code. * macosx/tkMacOSXMenu.c: * macosx/tkMacOSXHLEvents.c: replace Tcl_GlobalEval() resp. Tcl_Eval() * macosx/tkMacOSXScrlbr.c: by Tcl_EvalEx(). * macosx/tkMacOSXInit.c: * macosx/tkMacOSXInit.c (TkpInit): reorder initialization steps. * macosx/tkMacOSXKeyEvent.c: remove pre-10.2 support. * macosx/tkMacOSXMenus.c: remove now useless call to TkMacOSXHandleTearoffMenu(); use \x.. quoting for non-latin1 macroman literar chars to allow file to be edited as utf-8. * macosx/tkMacOSXScale.c: replace TrackControl() by modern * macosx/tkMacOSXScrlbr.c: HandleControlClick() API (using new TkMacOSXModifierState()). * macosx/tkMacOSXInt.h: move all constant #defines needed to * macosx/tkMacOSXColor.c: support building on older OS X releases * macosx/tkMacOSXEvent.h: to a central location in tkMacOSXInt.h. * macosx/tkMacOSXFont.c: * macosx/tkMacOSXMenu.c: * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXMenus.c: * macosx/tkMacOSXMouseEvent.c: * macosx/tkMacOSXWm.c: * macosx/ttkMacOSXTheme.c: * macosx/tkMacOSXInt.h: add ChkErr() macro to factor out * macosx/tkMacOSXButton.c: Carbon OSStatus return value checking * macosx/tkMacOSXCarbonEvents.c: and TkMacOSXDbgMsg() macro to factour * macosx/tkMacOSXClipboard.c: out debug message output; use these * macosx/tkMacOSXColor.c: macros to replace #ifdef TK_MAC_DEBUG * macosx/tkMacOSXCursor.c: blocks & direct printing to stderr, * macosx/tkMacOSXDebug.c: and to do additional OSStatus return * macosx/tkMacOSXDialog.c: checking, and to standardize OSStatus * macosx/tkMacOSXDraw.c: usage. * macosx/tkMacOSXEntry.c: * macosx/tkMacOSXEvent.c: * macosx/tkMacOSXFont.c: * macosx/tkMacOSXHLEvents.c: * macosx/tkMacOSXInit.c: * macosx/tkMacOSXKeyEvent.c: * macosx/tkMacOSXMenu.c: * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXMenus.c: * macosx/tkMacOSXMouseEvent.c: * macosx/tkMacOSXScrlbr.c: * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXXStubs.c: * macosx/tkMacOSXSend.c: remove duplicate/unused declarations * macosx/tkMacOSXXStubs.c: * macosx/tkMacOSXDebug.c: const fixes. * macosx/tkMacOSXInit.c: * macosx/tkMacOSXTest.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXXStubs.c: * macosx/Wish-Info.plist.in: add tcl document extensions/mime types and LSMinimumSystemVersion, LSRequiresCarbon & NSAppleScriptEnabled keys. * macosx/Wish-Common.xcconfig: add Wish's Info.plist as __info_plist section to tktest; enable more warnings. * macosx/Wish.xcodeproj/project.pbxproj: add 'DebugMemCompile' build configuration that calls configure with --enable-symbols=all; disable configure check for __attribute__((__visibility__("hidden"))) in Debug configuration to restore availability of ZeroLink. * macosx/Wish-Common.xcconfig: fix whitespace. * macosx/Wish-Debug.xcconfig: * macosx/Wish-Release.xcconfig: * macosx/tkMacOSXAETE.r: * macosx/tkMacOSXConfig.c: * macosx/tkMacOSXCursors.r: * macosx/tkMacOSXKeyboard.c: * macosx/tkMacOSXSend.c: * macosx/ttkMacOSXTheme.c: * macosx/tkMacOSXXCursors.r: * macosx/README: * macosx/GNUmakefile: fix/add copyright and license refs. * macosx/Tk-Info.plist.in: * macosx/Wish-Info.plist.in: * macosx/Wish.xcode/project.pbxproj: * macosx/Wish.xcodeproj/project.pbxproj: * macosx/tkMacOSX.h:
Diffstat (limited to 'macosx/tkMacOSXKeyboard.c')
-rw-r--r--macosx/tkMacOSXKeyboard.c691
1 files changed, 346 insertions, 345 deletions
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index e767dbf..ce16324 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -1,20 +1,21 @@
-/*
+/*
* tkMacOSXKeyboard.c --
*
- * Routines to support keyboard events on the Macintosh.
+ * Routines to support keyboard events on the Macintosh.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
*
* 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.20 2006/07/21 06:26:28 das Exp $
+ * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.21 2007/04/23 21:24:33 das Exp $
*/
#include "tkMacOSXInt.h"
-#include "tkMacOSXEvent.h" /* TkMacOSXKeycodeToUnicode() FIXME: That
- * function should probably move here. */
+#include "tkMacOSXEvent.h" /* TkMacOSXKeycodeToUnicode() FIXME: That
+ * function should probably move here. */
/*
* A couple of simple definitions to make code a bit more self-explaining.
@@ -23,22 +24,22 @@
* tkMacOSXMouseEvent.c.
*/
-#define LATIN1_MAX 255
-#define MAC_KEYCODE_MAX 0x7F
+#define LATIN1_MAX 255
+#define MAC_KEYCODE_MAX 0x7F
#define MAC_KEYCODE_MASK 0x7F
-#define COMMAND_MASK Mod1Mask
-#define OPTION_MASK Mod2Mask
+#define COMMAND_MASK Mod1Mask
+#define OPTION_MASK Mod2Mask
/*
- * Tables enumerating the special keys defined on Mac keyboards. These are
+ * Tables enumerating the special keys defined on Mac keyboards. These are
* necessary for correct keysym mappings for all keys where the keysyms are
* not identical with their ASCII or Latin-1 code points.
*/
typedef struct {
- int keycode; /* Macintosh keycode. */
- KeySym keysym; /* X windows keysym. */
+ int keycode; /* Macintosh keycode. */
+ KeySym keysym; /* X windows keysym. */
} KeyInfo;
/*
@@ -55,64 +56,64 @@ typedef struct {
*/
static KeyInfo keyArray[] = {
- {0x24, XK_Return},
- {0x30, XK_Tab},
- {0x33, XK_BackSpace},
- {0x34, XK_Return},
- {0x35, XK_Escape},
-
- {0x47, XK_Clear},
- {0x4C, XK_KP_Enter},
-
- {0x72, XK_Help},
- {0x73, XK_Home},
- {0x74, XK_Page_Up},
- {0x75, XK_Delete},
- {0x77, XK_End},
- {0x79, XK_Page_Down},
-
- {0x7B, XK_Left},
- {0x7C, XK_Right},
- {0x7D, XK_Down},
- {0x7E, XK_Up},
-
- {0, 0}
+ {0x24, XK_Return},
+ {0x30, XK_Tab},
+ {0x33, XK_BackSpace},
+ {0x34, XK_Return},
+ {0x35, XK_Escape},
+
+ {0x47, XK_Clear},
+ {0x4C, XK_KP_Enter},
+
+ {0x72, XK_Help},
+ {0x73, XK_Home},
+ {0x74, XK_Page_Up},
+ {0x75, XK_Delete},
+ {0x77, XK_End},
+ {0x79, XK_Page_Down},
+
+ {0x7B, XK_Left},
+ {0x7C, XK_Right},
+ {0x7D, XK_Down},
+ {0x7E, XK_Up},
+
+ {0, 0}
};
static KeyInfo virtualkeyArray[] = {
- {122, XK_F1},
- {120, XK_F2},
- {99, XK_F3},
- {118, XK_F4},
- {96, XK_F5},
- {97, XK_F6},
- {98, XK_F7},
- {100, XK_F8},
- {101, XK_F9},
- {109, XK_F10},
- {103, XK_F11},
- {111, XK_F12},
- {105, XK_F13},
- {107, XK_F14},
- {113, XK_F15},
- {0, 0}
+ {122, XK_F1},
+ {120, XK_F2},
+ {99, XK_F3},
+ {118, XK_F4},
+ {96, XK_F5},
+ {97, XK_F6},
+ {98, XK_F7},
+ {100, XK_F8},
+ {101, XK_F9},
+ {109, XK_F10},
+ {103, XK_F11},
+ {111, XK_F12},
+ {105, XK_F13},
+ {107, XK_F14},
+ {113, XK_F15},
+ {0, 0}
};
static int initialized = 0;
-static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */
-static Tcl_HashTable vkeyTable; /* virtualkeyArray hashed by virtual
- * keycode value. */
+static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */
+static Tcl_HashTable vkeyTable; /* virtualkeyArray hashed by virtual
+ * keycode value. */
-static int latin1Table[LATIN1_MAX+1]; /* Reverse mapping table for
- * controls, ASCII and Latin-1. */
+static int latin1Table[LATIN1_MAX+1]; /* Reverse mapping table for
+ * controls, ASCII and Latin-1. */
/*
* Prototypes for static functions used in this file.
*/
-static void InitKeyMaps (void);
-static void InitLatin1Table(Display *display);
-static int XKeysymToMacKeycode(Display *display, KeySym keysym);
+static void InitKeyMaps (void);
+static void InitLatin1Table(Display *display);
+static int XKeysymToMacKeycode(Display *display, KeySym keysym);
/*
@@ -120,39 +121,39 @@ static int XKeysymToMacKeycode(Display *display, KeySym keysym);
*
* InitKeyMaps --
*
- * Creates hash tables used by some of the functions in this file.
+ * Creates hash tables used by some of the functions in this file.
*
- * FIXME: As keycodes are defined to be in the limited range 0-127, it
- * would be easier and more efficient to use directly initialized plain
- * arrays and drop this function.
+ * FIXME: As keycodes are defined to be in the limited range 0-127, it
+ * would be easier and more efficient to use directly initialized plain
+ * arrays and drop this function.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Allocates memory & creates some hash tables.
+ * Allocates memory & creates some hash tables.
*
*----------------------------------------------------------------------
*/
static void
-InitKeyMaps()
+InitKeyMaps(void)
{
Tcl_HashEntry *hPtr;
KeyInfo *kPtr;
int dummy;
-
+
Tcl_InitHashTable(&keycodeTable, TCL_ONE_WORD_KEYS);
for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
- hPtr = Tcl_CreateHashEntry(&keycodeTable, (char *) kPtr->keycode,
- &dummy);
- Tcl_SetHashValue(hPtr, kPtr->keysym);
+ hPtr = Tcl_CreateHashEntry(&keycodeTable, (char *) kPtr->keycode,
+ &dummy);
+ Tcl_SetHashValue(hPtr, kPtr->keysym);
}
Tcl_InitHashTable(&vkeyTable, TCL_ONE_WORD_KEYS);
for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
- hPtr = Tcl_CreateHashEntry(&vkeyTable, (char *) kPtr->keycode,
- &dummy);
- Tcl_SetHashValue(hPtr, kPtr->keysym);
+ hPtr = Tcl_CreateHashEntry(&vkeyTable, (char *) kPtr->keycode,
+ &dummy);
+ Tcl_SetHashValue(hPtr, kPtr->keysym);
}
initialized = 1;
}
@@ -162,16 +163,16 @@ InitKeyMaps()
*
* InitLatin1Table --
*
- * Creates a simple table to be used for mapping from keysyms to
- * keycodes. Always needs to be called before using latin1Table,
- * because the keyboard layout may have changed, and than the table must
- * be re-computed.
+ * Creates a simple table to be used for mapping from keysyms to
+ * keycodes. Always needs to be called before using latin1Table,
+ * because the keyboard layout may have changed, and than the table must
+ * be re-computed.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Sets the global latin1Table.
+ * Sets the global latin1Table.
*
*----------------------------------------------------------------------
*/
@@ -190,46 +191,46 @@ InitLatin1Table(
keyLayoutID = GetScriptVariable(keyScript,smScriptKeys);
if (!latin1_initialized || (lastKeyLayoutID != keyLayoutID)) {
- int keycode;
- KeySym keysym;
- int state;
- int modifiers;
-
- latin1_initialized = true;
- lastKeyLayoutID = keyLayoutID;
-
- memset(latin1Table, 0, sizeof(latin1Table));
-
- /*
- * In the common X11 implementations, a keymap has four columns
- * "plain", "Shift", "Mode_switch" and "Mode_switch + Shift". We
- * don't use "Mode_switch", but we use "Option" instead. (This is
- * similar to Apple's X11 implementation, where "Mode_switch" is used
- * as an alias for "Option".)
- *
- * So here we go through all 4 columns of the keymap and find all
- * Latin-1 compatible keycodes. We go through the columns
- * back-to-front from the more exotic columns to the more simple, so
- * that simple keycode-modifier combinations are preferred in the
- * resulting table.
- */
-
- for (state = 3; state >= 0; state--) {
- modifiers = 0;
- if (state & 1) {
- modifiers |= shiftKey;
- }
- if (state & 2) {
- modifiers |= optionKey;
- }
-
- for (keycode = 0; keycode <= MAC_KEYCODE_MAX; keycode++) {
- keysym = XKeycodeToKeysym(display,keycode<<16,state);
- if (keysym <= LATIN1_MAX) {
- latin1Table[keysym] = keycode | modifiers;
- }
- }
- }
+ int keycode;
+ KeySym keysym;
+ int state;
+ int modifiers;
+
+ latin1_initialized = true;
+ lastKeyLayoutID = keyLayoutID;
+
+ memset(latin1Table, 0, sizeof(latin1Table));
+
+ /*
+ * In the common X11 implementations, a keymap has four columns
+ * "plain", "Shift", "Mode_switch" and "Mode_switch + Shift". We
+ * don't use "Mode_switch", but we use "Option" instead. (This is
+ * similar to Apple's X11 implementation, where "Mode_switch" is used
+ * as an alias for "Option".)
+ *
+ * So here we go through all 4 columns of the keymap and find all
+ * Latin-1 compatible keycodes. We go through the columns
+ * back-to-front from the more exotic columns to the more simple, so
+ * that simple keycode-modifier combinations are preferred in the
+ * resulting table.
+ */
+
+ for (state = 3; state >= 0; state--) {
+ modifiers = 0;
+ if (state & 1) {
+ modifiers |= shiftKey;
+ }
+ if (state & 2) {
+ modifiers |= optionKey;
+ }
+
+ for (keycode = 0; keycode <= MAC_KEYCODE_MAX; keycode++) {
+ keysym = XKeycodeToKeysym(display,keycode<<16,state);
+ if (keysym <= LATIN1_MAX) {
+ latin1Table[keysym] = keycode | modifiers;
+ }
+ }
+ }
}
}
@@ -238,19 +239,19 @@ InitLatin1Table(
*
* XKeycodeToKeysym --
*
- * Translate from a system-dependent keycode to a system-independent
- * keysym.
+ * Translate from a system-dependent keycode to a system-independent
+ * keysym.
*
* Results:
- * Returns the translated keysym, or NoSymbol on failure.
+ * Returns the translated keysym, or NoSymbol on failure.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
-KeySym
+KeySym
XKeycodeToKeysym(
Display* display,
KeyCode keycode,
@@ -263,55 +264,55 @@ XKeycodeToKeysym(
(void) display; /*unused*/
if (!initialized) {
- InitKeyMaps();
+ InitKeyMaps();
}
/*
* When determining what keysym to produce we first check to see if the
- * key is a function key. We then check to see if the character is
- * another non-printing key. Finally, we return the key syms for all
+ * key is a function key. We then check to see if the character is
+ * another non-printing key. Finally, we return the key syms for all
* ASCII and Latin-1 chars.
*/
newKeycode = keycode >> 16;
if ((keycode & 0xFFFF) == 0x10) {
- hPtr = Tcl_FindHashEntry(&vkeyTable, (char *) newKeycode);
- if (hPtr != NULL) {
- return (KeySym) Tcl_GetHashValue(hPtr);
- }
+ hPtr = Tcl_FindHashEntry(&vkeyTable, (char *) newKeycode);
+ if (hPtr != NULL) {
+ return (KeySym) Tcl_GetHashValue(hPtr);
+ }
}
hPtr = Tcl_FindHashEntry(&keycodeTable, (char *) newKeycode);
if (hPtr != NULL) {
- return (KeySym) Tcl_GetHashValue(hPtr);
+ return (KeySym) Tcl_GetHashValue(hPtr);
}
- /*
+ /*
* Add in the Mac modifier flags for shift and option.
*/
if (index & 1) {
- newKeycode |= shiftKey;
+ newKeycode |= shiftKey;
}
if (index & 2) {
- newKeycode |= optionKey;
+ newKeycode |= optionKey;
}
newChar = 0;
TkMacOSXKeycodeToUnicode(
- &newChar, 1, kEventRawKeyDown,
- newKeycode & 0x00FF, newKeycode & 0xFF00, NULL);
+ &newChar, 1, kEventRawKeyDown,
+ newKeycode & 0x00FF, newKeycode & 0xFF00, NULL);
/*
- * X11 keysyms are identical to Unicode for ASCII and Latin-1. Give up
+ * X11 keysyms are identical to Unicode for ASCII and Latin-1. Give up
* for other characters for now.
*/
if ((newChar >= XK_space) && (newChar <= LATIN1_MAX)) {
- return newChar;
+ return newChar;
}
- return NoSymbol;
+ return NoSymbol;
}
/*
@@ -319,24 +320,24 @@ XKeycodeToKeysym(
*
* TkpGetString --
*
- * Retrieve the string equivalent for the given keyboard event.
+ * Retrieve the string equivalent for the given keyboard event.
*
* Results:
- * Returns the UTF string.
+ * Returns the UTF string.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
char *
TkpGetString(
- TkWindow *winPtr, /* Window where event occurred: Needed to get
- * input context. */
- XEvent *eventPtr, /* X keyboard event. */
- Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
- * result. */
+ TkWindow *winPtr, /* Window where event occurred: Needed to get
+ * input context. */
+ XEvent *eventPtr, /* X keyboard event. */
+ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
+ * result. */
{
(void) winPtr; /*unused*/
Tcl_DStringInit(dsPtr);
@@ -348,28 +349,28 @@ TkpGetString(
*
* XGetModifierMapping --
*
- * Fetch the current keycodes used as modifiers.
+ * Fetch the current keycodes used as modifiers.
*
* Results:
- * Returns a new modifier map.
+ * Returns a new modifier map.
*
* Side effects:
- * Allocates a new modifier map data structure.
+ * Allocates a new modifier map data structure.
*
*----------------------------------------------------------------------
*/
-XModifierKeymap *
+XModifierKeymap *
XGetModifierMapping(
Display* display)
-{
+{
XModifierKeymap * modmap;
(void) display; /*unused*/
/*
* MacOSX doesn't use the key codes for the modifiers for anything, and
- * we don't generate them either. So there is no modifier map.
+ * we don't generate them either. So there is no modifier map.
*/
modmap = (XModifierKeymap *) ckalloc(sizeof(XModifierKeymap));
@@ -383,23 +384,23 @@ XGetModifierMapping(
*
* XFreeModifiermap --
*
- * Deallocate a modifier map that was created by XGetModifierMapping.
+ * Deallocate a modifier map that was created by XGetModifierMapping.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Frees the datastructure referenced by modmap.
+ * Frees the datastructure referenced by modmap.
*
*----------------------------------------------------------------------
*/
-void
+void
XFreeModifiermap(
XModifierKeymap *modmap)
{
if (modmap->modifiermap != NULL) {
- ckfree((char *) modmap->modifiermap);
+ ckfree((char *) modmap->modifiermap);
}
ckfree((char *) modmap);
}
@@ -409,31 +410,31 @@ XFreeModifiermap(
*
* XKeysymToString, XStringToKeysym --
*
- * These X window functions map keysyms to strings & strings to keysyms.
- * However, Tk already does this for the most common keysyms.
- * Therefore, these functions only need to support keysyms that will be
- * specific to the Macintosh. Currently, there are none.
+ * These X window functions map keysyms to strings & strings to keysyms.
+ * However, Tk already does this for the most common keysyms.
+ * Therefore, these functions only need to support keysyms that will be
+ * specific to the Macintosh. Currently, there are none.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
-char *
+char *
XKeysymToString(
KeySym keysym)
{
- return NULL;
+ return NULL;
}
-KeySym
+KeySym
XStringToKeysym(
const char* string)
-{
+{
return NoSymbol;
}
@@ -442,15 +443,15 @@ XStringToKeysym(
*
* XKeysymToMacKeycode --
*
- * An internal function like XKeysymToKeycode but only generating the
- * Mac specific keycode plus the modifiers Shift and Option.
+ * An internal function like XKeysymToKeycode but only generating the
+ * Mac specific keycode plus the modifiers Shift and Option.
*
* Results:
- * A Mac keycode with the actual keycode in the low byte and Mac-style
- * modifier bits in the high byte.
+ * A Mac keycode with the actual keycode in the low byte and Mac-style
+ * modifier bits in the high byte.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
@@ -462,42 +463,42 @@ XKeysymToMacKeycode(
{
if (keysym <= LATIN1_MAX) {
- /*
- * Handle keysyms in the Latin-1 range where keysym and Unicode
- * character code point are the same.
- */
+ /*
+ * Handle keysyms in the Latin-1 range where keysym and Unicode
+ * character code point are the same.
+ */
- InitLatin1Table(display);
- return latin1Table[keysym];
+ InitLatin1Table(display);
+ return latin1Table[keysym];
} else {
- /*
- * Handle special keys from our exception tables. Don't mind if this
- * is slow, neither the test suite nor [event generate] need to be
- * optimized (we hope).
- */
-
- KeyInfo *kPtr;
-
- for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
- if (kPtr->keysym == keysym) {
- return kPtr->keycode;
- }
- }
- for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
- if (kPtr->keysym == keysym) {
- return kPtr->keycode;
- }
- }
-
- /*
- * For other keysyms (not Latin-1 and not special keys), we'd need a
- * generic keysym-to-unicode table. We don't have that, so we give
- * up here.
- */
-
- return 0;
+ /*
+ * Handle special keys from our exception tables. Don't mind if this
+ * is slow, neither the test suite nor [event generate] need to be
+ * optimized (we hope).
+ */
+
+ KeyInfo *kPtr;
+
+ for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
+ if (kPtr->keysym == keysym) {
+ return kPtr->keycode;
+ }
+ }
+ for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
+ if (kPtr->keysym == keysym) {
+ return kPtr->keycode;
+ }
+ }
+
+ /*
+ * For other keysyms (not Latin-1 and not special keys), we'd need a
+ * generic keysym-to-unicode table. We don't have that, so we give
+ * up here.
+ */
+
+ return 0;
}
}
@@ -506,17 +507,17 @@ XKeysymToMacKeycode(
*
* XKeysymToKeycode --
*
- * The function XKeysymToKeycode takes an X11 keysym and converts it
- * into a Mac keycode. It is in the stubs table for compatibility but
- * not used anywhere in the core.
+ * The function XKeysymToKeycode takes an X11 keysym and converts it
+ * into a Mac keycode. It is in the stubs table for compatibility but
+ * not used anywhere in the core.
*
* Results:
- * A 32 bit keycode with the the mac keycode (without modifiers) in the
- * higher 16 bits of the keycode and the ASCII or Latin-1 code in the
- * lower 8 bits of the keycode.
+ * A 32 bit keycode with the the mac keycode (without modifiers) in the
+ * higher 16 bits of the keycode and the ASCII or Latin-1 code in the
+ * lower 8 bits of the keycode.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
@@ -528,17 +529,17 @@ XKeysymToKeycode(
{
int macKeycode = XKeysymToMacKeycode(display, keysym);
KeyCode result;
-
+
/*
- * See also TkpSetKeycodeAndState. The 0x0010 magic is used in
- * XKeycodeToKeysym. For special keys like XK_Return the lower 8 bits of
+ * See also TkpSetKeycodeAndState. The 0x0010 magic is used in
+ * XKeycodeToKeysym. For special keys like XK_Return the lower 8 bits of
* the keysym are usually a related ASCII control code.
*/
if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
- result = 0x0010;
+ result = 0x0010;
} else {
- result = 0x00FF & keysym;
+ result = 0x00FF & keysym;
}
result |= (macKeycode & MAC_KEYCODE_MASK) << 16;
@@ -549,23 +550,23 @@ XKeysymToKeycode(
NB: Keep this commented code for a moment for reference.
if ((keysym >= XK_space) && (XK_asciitilde)) {
- if (keysym == 'a') {
- virtualKeyCode = 0x00;
- } else if (keysym == 'b' || keysym == 'B') {
- virtualKeyCode = 0x0B;
- } else if (keysym == 'c') {
- virtualKeyCode = 0x08;
- } else if (keysym == 'x' || keysym == 'X') {
- virtualKeyCode = 0x07;
- } else if (keysym == 'z') {
- virtualKeyCode = 0x06;
- } else if (keysym == ' ') {
- virtualKeyCode = 0x31;
- } else if (keysym == XK_Return) {
- virtualKeyCode = 0x24;
- keysym = '\r';
- }
- keycode = keysym + (virtualKeyCode <<16);
+ if (keysym == 'a') {
+ virtualKeyCode = 0x00;
+ } else if (keysym == 'b' || keysym == 'B') {
+ virtualKeyCode = 0x0B;
+ } else if (keysym == 'c') {
+ virtualKeyCode = 0x08;
+ } else if (keysym == 'x' || keysym == 'X') {
+ virtualKeyCode = 0x07;
+ } else if (keysym == 'z') {
+ virtualKeyCode = 0x06;
+ } else if (keysym == ' ') {
+ virtualKeyCode = 0x31;
+ } else if (keysym == XK_Return) {
+ virtualKeyCode = 0x24;
+ keysym = '\r';
+ }
+ keycode = keysym + (virtualKeyCode <<16);
}
return keycode;
@@ -576,19 +577,19 @@ NB: Keep this commented code for a moment for reference.
*
* TkpSetKeycodeAndState --
*
- * The function TkpSetKeycodeAndState takes a keysym and fills in the
- * appropriate members of an XEvent. It is similar to XKeysymToKeycode,
- * but it also sets the modifier mask in the XEvent. It is used by
- * [event generate] and it is in the stubs table.
+ * The function TkpSetKeycodeAndState takes a keysym and fills in the
+ * appropriate members of an XEvent. It is similar to XKeysymToKeycode,
+ * but it also sets the modifier mask in the XEvent. It is used by
+ * [event generate] and it is in the stubs table.
*
* Results:
- * Fills an XEvent, sets the member xkey.keycode with a keycode
- * formatted the same as XKeysymToKeycode and the member xkey.state with
- * the modifiers implied by the keysym. Also fills in xkey.trans_chars,
- * so that the actual characters can be retrieved later.
+ * Fills an XEvent, sets the member xkey.keycode with a keycode
+ * formatted the same as XKeysymToKeycode and the member xkey.state with
+ * the modifiers implied by the keysym. Also fills in xkey.trans_chars,
+ * so that the actual characters can be retrieved later.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
@@ -600,36 +601,36 @@ TkpSetKeycodeAndState(
XEvent *eventPtr)
{
if (keysym == NoSymbol) {
- eventPtr->xkey.keycode = 0;
+ eventPtr->xkey.keycode = 0;
} else {
- Display *display = Tk_Display(tkwin);
- int macKeycode = XKeysymToMacKeycode(display, keysym);
-
- /*
- * See also XKeysymToKeycode.
- */
-
- if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
- eventPtr->xkey.keycode = 0x0010;
- } else {
- eventPtr->xkey.keycode = 0x00FF & keysym;
- }
- eventPtr->xkey.keycode |= (macKeycode & MAC_KEYCODE_MASK) << 16;
-
- if (shiftKey & macKeycode) {
- eventPtr->xkey.state |= ShiftMask;
- }
- if (optionKey & macKeycode) {
- eventPtr->xkey.state |= OPTION_MASK;
- }
-
- if (keysym <= LATIN1_MAX) {
- int done;
- done = Tcl_UniCharToUtf(keysym,eventPtr->xkey.trans_chars);
- eventPtr->xkey.trans_chars[done] = 0;
- } else {
- eventPtr->xkey.trans_chars[0] = 0;
- }
+ Display *display = Tk_Display(tkwin);
+ int macKeycode = XKeysymToMacKeycode(display, keysym);
+
+ /*
+ * See also XKeysymToKeycode.
+ */
+
+ if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
+ eventPtr->xkey.keycode = 0x0010;
+ } else {
+ eventPtr->xkey.keycode = 0x00FF & keysym;
+ }
+ eventPtr->xkey.keycode |= (macKeycode & MAC_KEYCODE_MASK) << 16;
+
+ if (shiftKey & macKeycode) {
+ eventPtr->xkey.state |= ShiftMask;
+ }
+ if (optionKey & macKeycode) {
+ eventPtr->xkey.state |= OPTION_MASK;
+ }
+
+ if (keysym <= LATIN1_MAX) {
+ int done;
+ done = Tcl_UniCharToUtf(keysym,eventPtr->xkey.trans_chars);
+ eventPtr->xkey.trans_chars[done] = 0;
+ } else {
+ eventPtr->xkey.trans_chars[0] = 0;
+ }
}
}
@@ -638,24 +639,24 @@ TkpSetKeycodeAndState(
*
* TkpGetKeySym --
*
- * Given an X KeyPress or KeyRelease event, map the keycode in the event
- * into a keysym.
+ * Given an X KeyPress or KeyRelease event, map the keycode in the event
+ * into a keysym.
*
* Results:
- * The return value is the keysym corresponding to eventPtr, or NoSymbol
- * if no matching keysym could be found.
+ * The return value is the keysym corresponding to eventPtr, or NoSymbol
+ * if no matching keysym could be found.
*
* Side effects:
- * In the first call for a given display, keycode-to-keysym maps get
- * loaded.
+ * In the first call for a given display, keycode-to-keysym maps get
+ * loaded.
*
*----------------------------------------------------------------------
*/
KeySym
TkpGetKeySym(
- TkDisplay *dispPtr, /* Display in which to map keycode. */
- XEvent *eventPtr) /* Description of X event. */
+ TkDisplay *dispPtr, /* Display in which to map keycode. */
+ XEvent *eventPtr) /* Description of X event. */
{
KeySym sym;
int index;
@@ -665,50 +666,50 @@ TkpGetKeySym(
*/
if (dispPtr->bindInfoStale) {
- TkpInitKeymapInfo(dispPtr);
+ TkpInitKeymapInfo(dispPtr);
}
/*
- * Handle pure modifier keys specially. We use -1 as a signal for
+ * Handle pure modifier keys specially. We use -1 as a signal for
* this.
*/
if (eventPtr->xany.send_event == -1) {
- int modifier = eventPtr->xkey.keycode;
- if (modifier == cmdKey) {
- return XK_Meta_L;
- } else if (modifier == shiftKey) {
- return XK_Shift_L;
- } else if (modifier == alphaLock) {
- return XK_Caps_Lock;
- } else if (modifier == optionKey) {
- return XK_Alt_L;
- } else if (modifier == controlKey) {
- return XK_Control_L;
- } else if (modifier == kEventKeyModifierNumLockMask) {
- return XK_Num_Lock;
- } else if (modifier == kEventKeyModifierFnMask) {
- return XK_Super_L;
- } else if (modifier == rightShiftKey) {
- return XK_Shift_R;
- } else if (modifier == rightOptionKey) {
- return XK_Alt_R;
- } else if (modifier == rightControlKey) {
- return XK_Control_R;
- } else {
-
- /*
- * If we get here, we probably need to implement something new.
- */
-
- return NoSymbol;
- }
+ int modifier = eventPtr->xkey.keycode;
+ if (modifier == cmdKey) {
+ return XK_Meta_L;
+ } else if (modifier == shiftKey) {
+ return XK_Shift_L;
+ } else if (modifier == alphaLock) {
+ return XK_Caps_Lock;
+ } else if (modifier == optionKey) {
+ return XK_Alt_L;
+ } else if (modifier == controlKey) {
+ return XK_Control_L;
+ } else if (modifier == kEventKeyModifierNumLockMask) {
+ return XK_Num_Lock;
+ } else if (modifier == kEventKeyModifierFnMask) {
+ return XK_Super_L;
+ } else if (modifier == rightShiftKey) {
+ return XK_Shift_R;
+ } else if (modifier == rightOptionKey) {
+ return XK_Alt_R;
+ } else if (modifier == rightControlKey) {
+ return XK_Control_R;
+ } else {
+
+ /*
+ * If we get here, we probably need to implement something new.
+ */
+
+ return NoSymbol;
+ }
}
/*
* Figure out which of the four slots in the keymap vector to use for
- * this key. Refer to Xlib documentation for more info on how this
- * computation works. (Note: We use "Option" in keymap columns 2 and 3
+ * this key. Refer to Xlib documentation for more info on how this
+ * computation works. (Note: We use "Option" in keymap columns 2 and 3
* where other implementations have "Mode_switch".)
*/
@@ -721,14 +722,14 @@ TkpGetKeySym(
#if 0
if (eventPtr->xkey.state & OPTION_MASK) {
- index |= 2;
+ index |= 2;
}
#endif
if ((eventPtr->xkey.state & ShiftMask)
- || (/* (dispPtr->lockUsage != LU_IGNORE)
- && */ (eventPtr->xkey.state & LockMask))) {
- index |= 1;
+ || (/* (dispPtr->lockUsage != LU_IGNORE)
+ && */ (eventPtr->xkey.state & LockMask))) {
+ index |= 1;
}
/*
@@ -744,20 +745,20 @@ TkpGetKeySym(
*/
if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
- /*&& (dispPtr->lockUsage == LU_CAPS)*/ ) {
-
- /*
- * FIXME: Keysyms are only identical to Unicode for ASCII and
- * Latin-1, so we can't use Tcl_UniCharIsUpper() for keysyms outside
- * that range. This may be a serious problem here.
- */
-
- if ((sym == NoSymbol) || (sym > LATIN1_MAX)
- || !Tcl_UniCharIsUpper(sym)) {
- index &= ~1;
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
- index);
- }
+ /*&& (dispPtr->lockUsage == LU_CAPS)*/ ) {
+
+ /*
+ * FIXME: Keysyms are only identical to Unicode for ASCII and
+ * Latin-1, so we can't use Tcl_UniCharIsUpper() for keysyms outside
+ * that range. This may be a serious problem here.
+ */
+
+ if ((sym == NoSymbol) || (sym > LATIN1_MAX)
+ || !Tcl_UniCharIsUpper(sym)) {
+ index &= ~1;
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ index);
+ }
}
/*
@@ -766,8 +767,8 @@ TkpGetKeySym(
*/
if ((index & 1) && (sym == NoSymbol)) {
- sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
- index & ~1);
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ index & ~1);
}
return sym;
}
@@ -777,30 +778,30 @@ TkpGetKeySym(
*
* TkpInitKeymapInfo --
*
- * This procedure is invoked to scan keymap information to recompute
- * stuff that's important for binding, such as the modifier key (if any)
- * that corresponds to the "Mode_switch" keysym.
+ * This procedure is invoked to scan keymap information to recompute
+ * stuff that's important for binding, such as the modifier key (if any)
+ * that corresponds to the "Mode_switch" keysym.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Keymap-related information in dispPtr is updated.
+ * Keymap-related information in dispPtr is updated.
*
*--------------------------------------------------------------
*/
void
TkpInitKeymapInfo(
- TkDisplay *dispPtr) /* Display for which to recompute keymap
- * information. */
+ TkDisplay *dispPtr) /* Display for which to recompute keymap
+ * information. */
{
dispPtr->bindInfoStale = 0;
/*
* Behaviours that are variable on X11 are defined constant on MacOSX.
* lockUsage is only used above in TkpGetKeySym(), nowhere else
- * currently. There is no offical "Mode_switch" key.
+ * currently. There is no offical "Mode_switch" key.
*/
dispPtr->lockUsage = LU_CAPS;
@@ -810,9 +811,9 @@ TkpInitKeymapInfo(
/*
* With this, <Alt> and <Meta> become synonyms for <Command> and <Option>
* in bindings like they are (and always have been) in the keysyms that
- * are reported by KeyPress events. But the init scripts like text.tcl
+ * are reported by KeyPress events. But the init scripts like text.tcl
* have some disabling bindings for <Meta>, so we don't want this without
- * some changes in those scripts. See also bug #700311.
+ * some changes in those scripts. See also bug #700311.
*/
dispPtr->altModMask = OPTION_MASK;
@@ -825,13 +826,13 @@ TkpInitKeymapInfo(
/*
* MacOSX doesn't use the keycodes for the modifiers for anything, and we
* don't generate them either (the keycodes actually given in the
- * simulated modifier events are bogus). So there is no modifier map.
+ * simulated modifier events are bogus). So there is no modifier map.
* If we ever want to simulate real modifier keycodes, the list will be
* constant in the Carbon implementation.
*/
if (dispPtr->modKeyCodes != NULL) {
- ckfree((char *) dispPtr->modKeyCodes);
+ ckfree((char *) dispPtr->modKeyCodes);
}
dispPtr->numModKeyCodes = 0;
dispPtr->modKeyCodes = NULL;