GetActKey.c revision 1477040f
1444c061aSmrg/* $Xorg: GetActKey.c,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */ 2444c061aSmrg 3444c061aSmrg/*LINTLIBRARY*/ 4444c061aSmrg 5444c061aSmrg/*********************************************************** 61477040fSmrgCopyright 1993 Sun Microsystems, Inc. All rights reserved. 71477040fSmrg 81477040fSmrgPermission is hereby granted, free of charge, to any person obtaining a 91477040fSmrgcopy of this software and associated documentation files (the "Software"), 101477040fSmrgto deal in the Software without restriction, including without limitation 111477040fSmrgthe rights to use, copy, modify, merge, publish, distribute, sublicense, 121477040fSmrgand/or sell copies of the Software, and to permit persons to whom the 131477040fSmrgSoftware is furnished to do so, subject to the following conditions: 141477040fSmrg 151477040fSmrgThe above copyright notice and this permission notice (including the next 161477040fSmrgparagraph) shall be included in all copies or substantial portions of the 171477040fSmrgSoftware. 181477040fSmrg 191477040fSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 201477040fSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 211477040fSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 221477040fSmrgTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 231477040fSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 241477040fSmrgFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 251477040fSmrgDEALINGS IN THE SOFTWARE. 261477040fSmrg 271477040fSmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 28444c061aSmrg 29444c061aSmrg All Rights Reserved 30444c061aSmrg 31444c061aSmrgPermission to use, copy, modify, and distribute this software and its 32444c061aSmrgdocumentation for any purpose and without fee is hereby granted, 33444c061aSmrgprovided that the above copyright notice appear in all copies and that 34444c061aSmrgboth that copyright notice and this permission notice appear in 351477040fSmrgsupporting documentation, and that the name of Digital not be 36444c061aSmrgused in advertising or publicity pertaining to distribution of the 37444c061aSmrgsoftware without specific, written prior permission. 38444c061aSmrg 39444c061aSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 40444c061aSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 41444c061aSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 42444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 43444c061aSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 44444c061aSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 45444c061aSmrgSOFTWARE. 46444c061aSmrg 47444c061aSmrg******************************************************************/ 48444c061aSmrg 49444c061aSmrg/* 50444c061aSmrg 51444c061aSmrgCopyright 1987, 1988, 1998 The Open Group 52444c061aSmrg 53444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its 54444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that 55444c061aSmrgthe above copyright notice appear in all copies and that both that 56444c061aSmrgcopyright notice and this permission notice appear in supporting 57444c061aSmrgdocumentation. 58444c061aSmrg 59444c061aSmrgThe above copyright notice and this permission notice shall be included in 60444c061aSmrgall copies or substantial portions of the Software. 61444c061aSmrg 62444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 65444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 66444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 67444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 68444c061aSmrg 69444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be 70444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings 71444c061aSmrgin this Software without prior written authorization from The Open Group. 72444c061aSmrg 73444c061aSmrg*/ 74444c061aSmrg 75444c061aSmrg#ifdef HAVE_CONFIG_H 76444c061aSmrg#include <config.h> 77444c061aSmrg#endif 78444c061aSmrg#include "IntrinsicI.h" 79444c061aSmrg 80444c061aSmrgKeySym XtGetActionKeysym( 81444c061aSmrg XEvent *event, 82444c061aSmrg Modifiers *modifiers_return) 83444c061aSmrg{ 84444c061aSmrg TMKeyContext tm_context; 85444c061aSmrg Modifiers modifiers; 86444c061aSmrg KeySym keysym, retval; 87444c061aSmrg 88444c061aSmrg LOCK_PROCESS; 89444c061aSmrg tm_context= _XtGetPerDisplay(event->xany.display)->tm_context; 90444c061aSmrg if (event->xany.type != KeyPress && event->xany.type != KeyRelease) { 91444c061aSmrg UNLOCK_PROCESS; 92444c061aSmrg return NoSymbol; 93444c061aSmrg } 94444c061aSmrg if (tm_context != NULL 95444c061aSmrg && event == tm_context->event 96444c061aSmrg && event->xany.serial == tm_context->serial ) { 97444c061aSmrg 98444c061aSmrg if (modifiers_return != NULL) 99444c061aSmrg *modifiers_return = tm_context->modifiers; 100444c061aSmrg retval = tm_context->keysym; 101444c061aSmrg UNLOCK_PROCESS; 102444c061aSmrg return retval; 103444c061aSmrg } 104444c061aSmrg 105444c061aSmrg XtTranslateKeycode( event->xany.display, (KeyCode)event->xkey.keycode, 106444c061aSmrg event->xkey.state, &modifiers, &keysym ); 107444c061aSmrg 108444c061aSmrg if (modifiers_return != NULL) 109444c061aSmrg *modifiers_return = event->xkey.state & modifiers; 110444c061aSmrg 111444c061aSmrg UNLOCK_PROCESS; 112444c061aSmrg return keysym; 113444c061aSmrg} 114