~ubuntu-branches/ubuntu/quantal/openmotif/quantal

« back to all changes in this revision

Viewing changes to clients/xmbind/xmbind.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bauer
  • Date: 2010-06-23 12:12:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100623121231-u89gxdp51sg9wjj2
Tags: 2.3.0-1
* New Maintainer (Closes: #379258) 
* Acknowledge NMU changes
* New upstream release (Closes: #494375)
* Get rid of security patches as they are already part of new upstream
  release (00-xpmvuln.openmotif.patch, 342092-CVE-2005-3964.patch)
* Bump Standards to 3.8.4
* Added {misc:Depends} to make the package lintian cleaner
* Fix weak-library-dev-dependency by adding ${binary:Version}) for the
  -dev Package of openmotif
* Let package depend on autotools-dev to use newer autotools-helper-files
* Work around an autoconf-bug (Gentoo-Bug #1475)
* Added Client-side anti-aliased fonts support via XFT
* Added UTF-8 and UTF8_STRING atom support
* Ability to show text and pixmaps in Label, LabelGadget and all
  derived widgets
* Support of PNG/JPEG image formats in the same way as XPM is supported
* Increase FILE_OFFSET_BITS to 64 to show files >2GB in file-selector
  Idea taken from Magne Oestlyngen (Closes: #288537)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 *  @OPENGROUP_COPYRIGHT@
 
3
 *  COPYRIGHT NOTICE
 
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.
 
8
 *  
 
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.
 
14
 *  
 
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
 
18
 *  this agreement.
 
19
 *  
 
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
 
25
 *  
 
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.
 
35
*/ 
 
36
/* 
 
37
 * HISTORY
 
38
*/ 
 
39
#ifdef REV_INFO
 
40
#ifndef lint
 
41
static char rcsid[] = "$TOG: xmbind.c /main/10 1997/06/18 17:34:48 samborn $"
 
42
#endif
 
43
#endif
 
44
#include <stdio.h>
 
45
#include <Xm/Xm.h>
 
46
 
 
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);
 
50
 
 
51
int main(argc, argv)
 
52
    int argc;
 
53
    char **argv;
 
54
{
 
55
    enum { XA_MOTIF_DEFAULT_BINDINGS, XA_MOTIF_BINDINGS };
 
56
    static char *atom_names[] = {
 
57
      "_MOTIF_DEFAULT_BINDINGS", "_MOTIF_BINDINGS" };
 
58
 
 
59
    Atom atoms[XtNumber(atom_names)];
 
60
    XtAppContext  app_context;
 
61
    Display *display;
 
62
    String bindings = NULL;
 
63
 
 
64
    XtToolkitInitialize();
 
65
    app_context = XtCreateApplicationContext();
 
66
    display = XtOpenDisplay(app_context, NULL, argv[0], "Xmbind",
 
67
                        NULL, 0, &argc, argv);
 
68
    
 
69
    if (display == NULL) {
 
70
        fprintf(stderr, "%s:  Can't open display\n", argv[0]);
 
71
        exit(1);
 
72
    }
 
73
 
 
74
    XInternAtoms(display, atom_names, XtNumber(atom_names), False, atoms);
 
75
    if (argc == 2) {
 
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));
 
83
            XFlush (display);
 
84
            XtFree (bindings);
 
85
            exit(0);
 
86
        }
 
87
        else {
 
88
            fprintf(stderr, "%s:  Can't open %s\n", argv[0], argv[1]);
 
89
            exit(1);
 
90
        }
 
91
    }
 
92
 
 
93
    XDeleteProperty (display, RootWindow (display, 0),
 
94
                     atoms[XA_MOTIF_BINDINGS]);
 
95
    XDeleteProperty (display, RootWindow (display, 0),
 
96
                     atoms[XA_MOTIF_DEFAULT_BINDINGS]);
 
97
 
 
98
    _XmVirtKeysLoadFallbackBindings (display, &bindings);
 
99
 
 
100
    XFlush (display);
 
101
    XtFree (bindings);
 
102
   
 
103
    exit(0);
 
104
 
 
105
    return 0;    /* make compiler happy */
 
106
}
 
107