Commit f7eff7f8 authored by Christoph Berg's avatar Christoph Berg

Import upstream tarball 2.47

parents
This diff is collapsed.
This diff is collapsed.
/* xkeycaps, Copyright (c) 1991, 1992, 1993 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
#ifndef _KbdWidget_H_
#define _KbdWidget_H_
typedef struct _KeyboardRec *KeyboardWidget;
typedef struct _KeyboardClassRec *KeyboardWidgetClass;
extern WidgetClass keyboardWidgetClass;
#endif /* _KbdWidget_H_ */
/* xkeycaps, Copyright (c) 1991, 1992, 1993, 1996, 1997
* Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
#ifndef _KbdWidgetP_H_
#define _KbdWidgetP_H_
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
#include <X11/cursorfont.h>
#include "KbdWidget.h"
#include "KeyWidget.h"
#include "xkeycaps.h"
typedef struct {
int mumble; /* No new procedures */
} KeyboardClassPart;
/* Full class record declaration */
typedef struct _KeyboardClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
KeyboardClassPart keyboard_class;
} KeyboardClassRec;
extern KeyboardClassRec keyboardClassRec;
/* New fields for the Keyboard widget record */
typedef struct {
String kbd_name;
Cursor select_cursor;
int max_width, max_height; /* In key units (computed) */
int x_scale, y_scale;
int default_keysyms_per_code; /* computed... */
char key_state_vector [32]; /* Bit-vector of keys down (redundant.) */
char modifier_vector [32]; /* Bit-vector of modifier-key-p. */
KeyWidget key_under_mouse;
KeyWidget mouse_highlighted_key; /* Key the mouse is pressed on */
KeyWidget documented_key; /* Key about which info is presented */
unsigned int tracking_key; /* Mask of buttons down */
Window target_window; /* window we're typing at */
#ifdef HAVE_XTRAP /* Whether to try to use the XTrap */
Boolean use_xtrap; /* server extension to read events. */
char *trap_data; /* The XTrap "Trap Context" */
#endif
struct info_labels *label_widgets; /* For info.c */
struct key_menus *key_menus; /* For commands.c */
/* These slots are initialized when a keyboard is selected, and are not
changed at run-time. They are copies of what came from the various
keyboard definition files. */
const char *short_name; /* ID for the "-kbd" command-line option. */
const char *vendor; /* Who makes the computer that this keyboard
usually comes with (e.g., "Sun", "NCD", "PC".) */
const char *kbd_style; /* What this particular instance is named
(e.g., "type-2", "104-key", "LK401".) */
unsigned int nrows;
struct KeyWidget_row *rows;
int default_scale;
int horiz_border, vert_border;
} KeyboardPart;
typedef struct _KeyboardRec { /* full instance record */
CorePart core;
CompositePart composite;
KeyboardPart keyboard;
} KeyboardRec;
#endif /* _KbdWidgetP_H_ */
This diff is collapsed.
/* xkeycaps, Copyright (c) 1991, 1992, 1993 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
#ifndef _KeyWidget_H_
#define _KeyWidget_H_
typedef struct _KeyRec *KeyWidget;
typedef struct _KeyClassRec *KeyWidgetClass;
extern WidgetClass keyWidgetClass;
#ifdef __STDC__
extern void KeyHighlight (KeyWidget);
extern void KeyDehighlight (KeyWidget);
#endif
#endif /* _KeyWidget_H_ */
/* xkeycaps, Copyright (c) 1991, 1992, 1993, 1996
* Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
#ifndef _KeyWidgetP_H_
#define _KeyWidgetP_H_
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
#include <X11/cursorfont.h>
#include "KeyWidget.h"
#include "xkeycaps.h"
typedef struct {
void (* highlight_key) P((KeyWidget));
void (* dehighlight_key) P((KeyWidget));
} KeyClassPart;
/* Full class record declaration */
typedef struct _KeyClassRec {
CoreClassPart core_class;
KeyClassPart key_class;
} KeyClassRec;
extern KeyClassRec keyClassRec;
/* New fields for the Key widget record */
typedef struct {
int gutter_width;
Pixel highlight_pixel, background_pixel;
Pixel keycap_pixel, keycode_pixel;
XFontStruct *keycap_font, *keycode_font, *cursor_font;
GC keycap_gc, keycode_gc, cursor_gc;
String key_name;
int highlighted_p; /* Whether it's drawn highlighted now */
unsigned short x, y; /* Position in keyboard units */
int key_highlighted; /* Whether this key (the real one) is down
* This is duplicated in kbd->key_state_vector
*/
int mouse_highlighted; /* Whether a button is depressed on this */
unsigned long modifier_bits; /* Which modifiers this key CURRENTLY sets */
int auto_repeat_p; /* Whether this key autorepeats */
/* These slots are initialized when a keyboard is selected, and are not
changed at run-time. They are copies of what came from the various
keyboard definition files. */
unsigned short width; /* Width of the key in some arbitrary units */
unsigned short height; /* Height of the key in some arbitrary units */
const char *keysym_1;
const char *keysym_2;
const char *keysym_3;
KeyCode keycode; /* This never changes */
KeySym default_keysyms[8]; /* This never changes */
unsigned long default_mods; /* never changes, unlike modifier_bits slot */
} KeyPart;
typedef struct _KeyRec { /* full instance record */
CorePart core;
KeyPart key;
} KeyRec;
struct KeyWidget_row { /* like keyboard_row_geometry,
but of KeyWidgets. */
unsigned int nkeys;
unsigned int height;
KeyWidget *keys;
};
#endif /* _KeyWidgetP_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* xkeycaps, Copyright (c) 1993, 1997 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
/* This is only in its own .c file to help incremental linking performance. */
/* Make sure all possible keysyms get defined. */
#undef XK_MISCELLANY
#define XK_MISCELLANY
#undef XK_XKB_KEYS
#define XK_XKB_KEYS
#undef XK_3270
#define XK_3270
#undef XK_LATIN1
#define XK_LATIN1
#undef XK_LATIN2
#define XK_LATIN2
#undef XK_LATIN3
#define XK_LATIN3
#undef XK_LATIN4
#define XK_LATIN4
#undef XK_ARABIC
#define XK_ARABIC
#undef XK_KATAKANA
#define XK_KATAKANA
#undef XK_CYRILLIC
#define XK_CYRILLIC
#undef XK_GREEK
#define XK_GREEK
#undef XK_TECHNICAL
#define XK_TECHNICAL
#undef XK_SPECIAL
#define XK_SPECIAL
#undef XK_PUBLISHING
#define XK_PUBLISHING
#undef XK_APL
#define XK_APL
#undef XK_HEBREW
#define XK_HEBREW
#undef XK_THAI
#define XK_THAI
#undef XK_KOREAN
#define XK_KOREAN
#include <X11/keysymdef.h>
#ifdef __hpux
# include <X11/HPkeysym.h>
#endif
#if defined(AIX) && !defined(ps2)
# include <X11/aix_keysym.h>
#endif
#include "keysym-compat.h"
#include "kbddef.h"
#undef countof
#define countof(x) (sizeof((x)) / sizeof(*(x)))
#define DEFKBD(short, vendor, style, server_id, geom, caps, codes, map) \
{ (short), (vendor), (style), (server_id), \
(geom), (caps), (codes), (map), \
countof((caps)), countof((codes)), countof((map)) \
}
#include "all-kbds.h" /* first include it for the #includes... */
#define KBD DEFKBD
const struct keyboard_instance all_kbds [] = {
#include "all-kbds.h" /* then include it for the KBD calls. */
{ 0 }
};
#!/bin/sh
#
# xkeycaps, Copyright (c) 1991, 1992, 1993, 1996, 1997
# Jamie Zawinski <jwz@jwz.org>
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation. No representations are made about the suitability of this
# software for any purpose. It is provided "as is" without express or
# implied warranty.
#
# *********************************************
# * *
# * ALERT! *
# * *
# * Have you read "defining.txt" yet? *
# * Please do, before adding a new *
# * keyboard description to xkeycaps. *
# * It will make my life much easier! *
# * *
# * *
# *********************************************
#
# This parses the output of xmodmap to automatically generate *-map.h files
# which encode the current keyboard state in the format the the xkeycaps
# source requires. Be certain you are running this on a virgin keymap; you
# don't want to encode a modified keymap into the xkeycaps source.
NAME=$1
if [ "x$NAME" = "x" ]; then
NAME=FOO
fi
echo "static const struct default_keycode_map ${NAME}_map [] = {"
( xmodmap -pm ; echo "======" ; xmodmap -pk ) |
sed 's/(no name)/(UNKNOWN_KEYSYM)/' |
awk '
BEGIN {
parsing_mods = 1;
}
{
# First parse the output of "xmodmap -pm", and fill the "bits" table
# with keysym/maskname pairs for those keycodes with modifier bits.
# (Its not quite right that we index off of syms instead of codes
# but I dont feel writing a parser for hex numbers right now...)
if (parsing_mods)
{
if ( $0 ~ /^======$/ )
{
parsing_mods = 0;
}
else if ( $0 ~ /^shift|lock|control|mod[1-5]/ )
{
for (i = 2; i <= NF; i+=2)
{
L = length ($1);
if ( $0 ~ /^shift/ ) { M = "ShiftMask"; }
else if ( $0 ~ /^lock/ ) { M = "LockMask"; }
else if ( $0 ~ /^control/ ) { M = "ControlMask"; }
else if ( $0 ~ /^mod/ ) { M = "Mod" substr($0,4,1) "Mask"; }
else { M = "????"; }
bits [ $i ] = M;
}
}
else if ( NF == 0 || $0 ~ / keys per modifier, / )
{
}
else
{
printf " /* %s */\n", $0;
}
}
#
# Now reformat the output of "xmodmap -pk"
# If we dont recognise a line, print it inside of /* */.
#
else if ( $0 ~ /^[ \t]*[0-9][0-9]*[ \t][ \t]*$/ ) { }
else if ( $0 ~ /^[ \t]*[0-9][0-9]*[ \t]/ )
{
printf " { %3d, ", $1;
# Look in the "bits" table for the modifier bit masks to print here.
this_sym = substr ($3, 2, length($3) - 2);
this_bits = bits [ this_sym ];
if ( this_bits == 0 ) { printf "0,\t"; }
else { printf "%s,", this_bits; }
# Print out the keysyms of this keycode, with commas as appropriate.
for (i = 3; i <= NF; i+=2)
{
if (i == 7) { printf "\n\t\t"; }
keysym = substr ($i, 2, length($i) - 2);
printf "\t";
if ( i == 7) { printf " "; }
if ( i == 3) { printf "{ "; }
# Print "NoSymbol" as "0" instead "XK_NoSymbol".
if (keysym == "NoSymbol" )
{ printf "0"; }
# Print "hpFooBar" as "hpXK_FooBar" instead of "XK_hpFooBar".
else if ( keysym ~ /^hp/ )
{ keysym = substr (keysym, 3, length(keysym));
printf "hpXK_%s", keysym; }
# Print "SunFoo" as "SunXK_Foo" instead of "XK_SunFoo".
else if ( keysym ~ /^Sun/ )
{ keysym = substr (keysym, 4, length(keysym));
printf "SunXK_%s", keysym; }
# Sigh... print "apLineDel" as "DXK_Remove" and
# "apSave" as "TekXK_Setup"...
else if ( keysym ~ /^apLineDel$/ )
{ printf "DXK_Remove"; }
else if ( keysym ~ /^apSave$/ )
{ printf "TekXK_Setup"; }
else
{ printf "XK_%s", keysym; }
if (i < NF) printf ",";
}
printf " }},\n";
}
else if (NF == 0 \
|| $0 ~ /^There are [0-9]* KeySyms per KeyCode/ \
|| $0 ~ /^[ \t]*KeyCode[ \t]*Keysym[ \t]*\(Keysym\)/ \
|| $0 ~ /^[ \t]*Value[ \t]*Value[ \t]*\(Name\)/ )
{
}
else
{
printf " /* %s */\n", $0;
}
}
'
echo " };"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This is the widget hierarchy for the XKeyCaps program, for your
resource-frobbing pleasure.
xkeycaps (Shell)
vertical (Paned)
horizontal (Paned)
buttons (Form)
<buttons> (Command or MenuButton)
info (Form)
labels (Form)
keycode (Label)
keysym (Label)
[and so on...]
line (Box)
keycode (Label)
keysym (Label)
[and so on...]
Keyboard
A (Key)
B (Key)
C (Key)
[and so on...]
editKey (TransientShell)
vertical (Paned)
label (Label)
horizontal (Paned)
keysymBox (Form)
symsOfCode (Label)
keysymLine (Box)
keysym1 (Label)
keysymValue (Toggle)
[and so on...]
modifierBox (Box)
modifiers (Label)
modShift (Toggle)
[and so on...]
keysetBox (Form)
allKeySets (Label)
keysetsVp (Viewport)
vertical (Scrollbar)
keysets (List)
keysymBox (Form)
allKeySyms (Label)
keysymsVp (Viewport)
vertical (Scrollbar)
keysyms (List)
buttons (Box)
undo (Button)
abort (Button)
ok (Button)
selectKbd (TransientShell)
vertical (Paned)
label (Label)
label2 (Label)
horizontal (Paned)
vendorBox (Form)
vendors (Label)
vendorsVp (Viewport)
vendorsList (List)
keyboardBox (Form)
keyboards (Label)
keyboardsVp (Viewport)
keyboardsList (List)
keymapBox (Form)
keymaps (Label)
keymapsVp (Viewport)
keymapsList (List)
buttons (Box)
abort (Button)
ok (Button)
spacer (Label)
kbd_icon (Label)
writeQuery (TransientShell)
vertical (Paned)
label (Label)
buttons (Paned)