2
* @OPENGROUP_COPYRIGHT@
4
* Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
5
* Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group
6
* ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
7
* the full copyright text.
9
* This software is subject to an open license. It may only be
10
* used on, with or for operating systems which are themselves open
11
* source systems. You must contact The Open Group for a license
12
* allowing distribution and sublicensing of this software on, with,
13
* or for operating systems which are not Open Source programs.
15
* See http://www.opengroup.org/openmotif/license for full
16
* details of the license agreement. Any use, reproduction, or
17
* distribution of the program constitutes recipient's acceptance of
20
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
21
* PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22
* KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
23
* WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
24
* OR FITNESS FOR A PARTICULAR PURPOSE
26
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
27
* NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
28
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
30
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32
* ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
33
* EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGES.
41
static char rcsid[] = "$TOG: xmbind.c /main/10 1997/06/18 17:34:48 samborn $"
47
/* Internal routines "borrowed" from libXm. Don't try this at home! */
48
extern Boolean _XmVirtKeysLoadFileBindings(char *fileName, String *binding);
49
extern int _XmVirtKeysLoadFallbackBindings(Display *display, String *binding);
55
enum { XA_MOTIF_DEFAULT_BINDINGS, XA_MOTIF_BINDINGS };
56
static char *atom_names[] = {
57
"_MOTIF_DEFAULT_BINDINGS", "_MOTIF_BINDINGS" };
59
Atom atoms[XtNumber(atom_names)];
60
XtAppContext app_context;
62
String bindings = NULL;
64
XtToolkitInitialize();
65
app_context = XtCreateApplicationContext();
66
display = XtOpenDisplay(app_context, NULL, argv[0], "Xmbind",
67
NULL, 0, &argc, argv);
69
if (display == NULL) {
70
fprintf(stderr, "%s: Can't open display\n", argv[0]);
74
XInternAtoms(display, atom_names, XtNumber(atom_names), False, atoms);
76
if (_XmVirtKeysLoadFileBindings (argv[1], &bindings) == True) {
77
XDeleteProperty (display, RootWindow (display, 0),
78
atoms[XA_MOTIF_DEFAULT_BINDINGS]);
79
XChangeProperty (display, RootWindow(display, 0),
80
atoms[XA_MOTIF_BINDINGS],
81
XA_STRING, 8, PropModeReplace,
82
(unsigned char *)bindings, strlen(bindings));
88
fprintf(stderr, "%s: Can't open %s\n", argv[0], argv[1]);
93
XDeleteProperty (display, RootWindow (display, 0),
94
atoms[XA_MOTIF_BINDINGS]);
95
XDeleteProperty (display, RootWindow (display, 0),
96
atoms[XA_MOTIF_DEFAULT_BINDINGS]);
98
_XmVirtKeysLoadFallbackBindings (display, &bindings);
105
return 0; /* make compiler happy */