File: open_app.c

package info (click to toggle)
xcopilot 1%3A0.6.6
  • links: PTS
  • area: contrib
  • in suites: potato, slink
  • size: 3,252 kB
  • ctags: 3,406
  • sloc: ansic: 37,932; cpp: 1,918; sh: 329; makefile: 68
file content (63 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* Functions to provide compatibility with older X libs.
   Copyright 1998 Gene McCulley <mcculley@cuspy.com>, Cuspy Solutions, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#include <stdio.h>
#include <stdarg.h>
#include "open_app.h"
#include <X11/Shell.h>

#if XtSpecificationRelease < 6

Widget XtVaOpenApplication(XtAppContext *app_context_return,
                           String application_class,
                           XrmOptionDescRec *options,
                           Cardinal num_options,
                           int *argc_in_out,
                           String *argv_in_out,
                           String *fallback_resources,
                           WidgetClass widget_class,
                           ...)
{
  XtAppContext context;
  Display *display;
  va_list args;
  Widget shell;

  XtToolkitInitialize();
  context = XtCreateApplicationContext();
  if (app_context_return)
    *app_context_return = context;

  if (fallback_resources)
    XtAppSetFallbackResources(context, fallback_resources);

  display = XtOpenDisplay(context, NULL, NULL, application_class, options,
                          num_options, argc_in_out, argv_in_out);
  if (!display) {
    fprintf(stderr, "Failed to open the display.\n");
    exit(1);
  }

  va_start(args, widget_class);
  shell = XtVaAppCreateShell(NULL, NULL, applicationShellWidgetClass, display,
                             args);
  va_end(args);

  return shell;
}

#endif