summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixKey.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-10-21 01:51:44 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-10-21 01:51:44 (GMT)
commitcb95f825a841442bb3ecb6b8c20141a1b0d91fbd (patch)
tree8eda7ecc96291e4c7217e176677468d30f46eaef /unix/tkUnixKey.c
parent046e642eac6a7a6e251d0b386a654bdac0d75603 (diff)
downloadtk-cb95f825a841442bb3ecb6b8c20141a1b0d91fbd.zip
tk-cb95f825a841442bb3ecb6b8c20141a1b0d91fbd.tar.gz
tk-cb95f825a841442bb3ecb6b8c20141a1b0d91fbd.tar.bz2
Whitespace/style/ANSI improvements
Diffstat (limited to 'unix/tkUnixKey.c')
-rw-r--r--unix/tkUnixKey.c150
1 files changed, 75 insertions, 75 deletions
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 6be5584..615ec82 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -1,4 +1,4 @@
-/*
+/*
* tkUnixKey.c --
*
* This file contains routines for dealing with international keyboard
@@ -6,28 +6,27 @@
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixKey.c,v 1.10 2002/06/17 20:09:01 hobbs Exp $
+ * RCS: @(#) $Id: tkUnixKey.c,v 1.11 2005/10/21 01:51:45 dkf Exp $
*/
#include "tkInt.h"
/*
- * Prototypes for local procedures defined in this file:
+ * Prototypes for local functions defined in this file:
*/
-
/*
*----------------------------------------------------------------------
*
* Tk_SetCaretPos --
*
- * This enables correct placement of the XIM caret. This is called
- * by widgets to indicate their cursor placement, and the caret
- * location is used by TkpGetString to place the XIM caret.
- * This is currently only used for over-the-spot XIM.
+ * This enables correct placement of the XIM caret. This is called by
+ * widgets to indicate their cursor placement, and the caret location is
+ * used by TkpGetString to place the XIM caret. This is currently only
+ * used for over-the-spot XIM.
*
* Results:
* None
@@ -39,11 +38,11 @@
*/
void
-Tk_SetCaretPos(tkwin, x, y, height)
- Tk_Window tkwin;
- int x;
- int y;
- int height;
+Tk_SetCaretPos(
+ Tk_Window tkwin,
+ int x,
+ int y,
+ int height)
{
TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);
@@ -68,19 +67,19 @@ Tk_SetCaretPos(tkwin, x, y, height)
* Returns the UTF string.
*
* Side effects:
- * Stores the input string in the specified Tcl_DString. Modifies
- * the internal input state. This routine can only be called
- * once for a given event.
+ * Stores the input string in the specified Tcl_DString. Modifies the
+ * internal input state. This routine can only be called once for a given
+ * event.
*
*----------------------------------------------------------------------
*/
char *
-TkpGetString(winPtr, eventPtr, dsPtr)
- 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
+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. */
{
int len;
@@ -107,8 +106,8 @@ TkpGetString(winPtr, eventPtr, dsPtr)
#endif
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), Tcl_DStringLength(&buf),
- (KeySym *) NULL, &status);
+ Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), NULL,
+ &status);
/*
* If the buffer wasn't big enough, grow the buffer and try again.
*/
@@ -116,7 +115,7 @@ TkpGetString(winPtr, eventPtr, dsPtr)
if (status == XBufferOverflow) {
Tcl_DStringSetLength(&buf, len);
len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(&buf), len, (KeySym *) NULL, &status);
+ Tcl_DStringValue(&buf), len, NULL, &status);
}
if ((status != XLookupChars) && (status != XLookupBoth)) {
len = 0;
@@ -124,9 +123,10 @@ TkpGetString(winPtr, eventPtr, dsPtr)
#if TK_XIM_SPOT
/*
- * Adjust the XIM caret position. We might want to check that
- * this is the right caret.winPtr as well.
+ * Adjust the XIM caret position. We might want to check that this is
+ * the right caret.winPtr as well.
*/
+
if (dispPtr->flags & TK_DISPLAY_XIM_SPOT) {
spot.x = dispPtr->caret.x;
spot.y = dispPtr->caret.y + dispPtr->caret.height;
@@ -138,13 +138,11 @@ TkpGetString(winPtr, eventPtr, dsPtr)
#endif
} else {
len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
- Tcl_DStringLength(&buf), (KeySym *) NULL,
- (XComposeStatus *) NULL);
+ Tcl_DStringLength(&buf), NULL, NULL);
}
#else /* TK_USE_INPUT_METHODS */
len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
- Tcl_DStringLength(&buf), (KeySym *) NULL,
- (XComposeStatus *) NULL);
+ Tcl_DStringLength(&buf), NULL, NULL);
#endif /* TK_USE_INPUT_METHODS */
Tcl_DStringSetLength(&buf, len);
@@ -155,25 +153,23 @@ TkpGetString(winPtr, eventPtr, dsPtr)
}
/*
- * When mapping from a keysym to a keycode, need
- * information about the modifier state that should be used
- * so that when they call XKeycodeToKeysym taking into
- * account the xkey.state, they will get back the original
- * keysym.
+ * When mapping from a keysym to a keycode, need information about the
+ * modifier state that should be used so that when they call XKeycodeToKeysym
+ * taking into account the xkey.state, they will get back the original keysym.
*/
void
-TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
- Tk_Window tkwin;
- KeySym keySym;
- XEvent *eventPtr;
+TkpSetKeycodeAndState(
+ Tk_Window tkwin,
+ KeySym keySym,
+ XEvent *eventPtr)
{
Display *display;
int state;
KeyCode keycode;
-
+
display = Tk_Display(tkwin);
-
+
if (keySym == NoSymbol) {
keycode = 0;
} else {
@@ -203,26 +199,24 @@ TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
*
* 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(dispPtr, eventPtr)
- TkDisplay *dispPtr; /* Display in which to
- * map keycode. */
- XEvent *eventPtr; /* Description of X event. */
+TkpGetKeySym(
+ TkDisplay *dispPtr, /* Display in which to map keycode. */
+ XEvent *eventPtr) /* Description of X event. */
{
KeySym sym;
int index;
@@ -236,9 +230,9 @@ TkpGetKeySym(dispPtr, eventPtr)
}
/*
- * 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.
+ * 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.
*/
index = 0;
@@ -253,10 +247,9 @@ TkpGetKeySym(dispPtr, eventPtr)
sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
/*
- * Special handling: if the key was shifted because of Lock, but
- * lock is only caps lock, not shift lock, and the shifted keysym
- * isn't upper-case alphabetic, then switch back to the unshifted
- * keysym.
+ * Special handling: if the key was shifted because of Lock, but lock is
+ * only caps lock, not shift lock, and the shifted keysym isn't upper-case
+ * alphabetic, then switch back to the unshifted keysym.
*/
if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
@@ -271,8 +264,8 @@ TkpGetKeySym(dispPtr, eventPtr)
}
/*
- * Another bit of special handling: if this is a shifted key and there
- * is no keysym defined, then use the keysym for the unshifted key.
+ * Another bit of special handling: if this is a shifted key and there is
+ * no keysym defined, then use the keysym for the unshifted key.
*/
if ((index & 1) && (sym == NoSymbol)) {
@@ -287,10 +280,9 @@ TkpGetKeySym(dispPtr, eventPtr)
*
* 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 "mode
- * switch".
+ * This function is invoked to scan keymap information to recompute stuff
+ * that's important for binding, such as the modifier key (if any) that
+ * corresponds to "mode switch".
*
* Results:
* None.
@@ -302,8 +294,8 @@ TkpGetKeySym(dispPtr, eventPtr)
*/
void
-TkpInitKeymapInfo(dispPtr)
- TkDisplay *dispPtr; /* Display for which to recompute keymap
+TkpInitKeymapInfo(
+ TkDisplay *dispPtr) /* Display for which to recompute keymap
* information. */
{
XModifierKeymap *modMapPtr;
@@ -316,9 +308,9 @@ TkpInitKeymapInfo(dispPtr)
modMapPtr = XGetModifierMapping(dispPtr->display);
/*
- * Check the keycodes associated with the Lock modifier. If
- * any of them is associated with the XK_Shift_Lock modifier,
- * then Lock has to be interpreted as Shift Lock, not Caps Lock.
+ * Check the keycodes associated with the Lock modifier. If any of them is
+ * associated with the XK_Shift_Lock modifier, then Lock has to be
+ * interpreted as Shift Lock, not Caps Lock.
*/
dispPtr->lockUsage = LU_IGNORE;
@@ -339,9 +331,9 @@ TkpInitKeymapInfo(dispPtr)
}
/*
- * Look through the keycodes associated with modifiers to see if
- * the the "mode switch", "meta", or "alt" keysyms are associated
- * with any modifiers. If so, remember their modifier mask bits.
+ * Look through the keycodes associated with modifiers to see if the the
+ * "mode switch", "meta", or "alt" keysyms are associated with any
+ * modifiers. If so, remember their modifier mask bits.
*/
dispPtr->modeModMask = 0;
@@ -411,3 +403,11 @@ TkpInitKeymapInfo(dispPtr)
}
XFreeModifiermap(modMapPtr);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */