/[dtapublic]/to_be_filed/sf_code/esrgpcpj/shared/tk_base/xutil.c
ViewVC logotype

Contents of /to_be_filed/sf_code/esrgpcpj/shared/tk_base/xutil.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (show annotations) (download)
Sat Oct 8 07:08:47 2016 UTC (7 years, 5 months ago) by dashley
File MIME type: text/plain
File size: 3674 byte(s)
Directories relocated.
1 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tk_base/xutil.c,v 1.1.1.1 2001/06/13 05:16:00 dtashley Exp $ */
2
3 /*
4 * xutil.c --
5 *
6 * This function contains generic X emulation routines.
7 *
8 * Copyright (c) 1995-1996 Sun Microsystems, Inc.
9 *
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * RCS: @(#) $Id: xutil.c,v 1.1.1.1 2001/06/13 05:16:00 dtashley Exp $
14 */
15
16 #include <stdlib.h>
17 #include "tk.h"
18
19 #ifdef MAC_TCL
20 # include <Xutil.h>
21 # include <Xatom.h>
22 #else
23 # include "Xutil.h"
24 # include "Xatom.h"
25 #endif
26
27 /*
28 *----------------------------------------------------------------------
29 *
30 * XInternAtom --
31 *
32 * This procedure simulates the XInternAtom function by calling
33 * Tk_Uid to get a unique id for every atom. This is only a
34 * partial implementation, since it doesn't work across
35 * applications.
36 *
37 * Results:
38 * A new Atom.
39 *
40 * Side effects:
41 * None.
42 *
43 *----------------------------------------------------------------------
44 */
45
46 Atom
47 XInternAtom(display, atom_name, only_if_exists)
48 Display* display;
49 _Xconst char* atom_name;
50 Bool only_if_exists;
51 {
52 static Atom atom = XA_LAST_PREDEFINED;
53
54 display->request++;
55 return ++atom;
56 }
57
58 /*
59 *----------------------------------------------------------------------
60 *
61 * XGetVisualInfo --
62 *
63 * Returns information about the specified visual.
64 *
65 * Results:
66 * Returns a newly allocated XVisualInfo structure.
67 *
68 * Side effects:
69 * Allocates storage.
70 *
71 *----------------------------------------------------------------------
72 */
73
74 XVisualInfo *
75 XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return)
76 Display* display;
77 long vinfo_mask;
78 XVisualInfo* vinfo_template;
79 int* nitems_return;
80 {
81 XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo));
82 info->visual = DefaultVisual(display, 0);
83 info->visualid = info->visual->visualid;
84 info->screen = 0;
85 info->depth = info->visual->bits_per_rgb;
86 info->class = info->visual->class;
87 info->colormap_size = info->visual->map_entries;
88 info->bits_per_rgb = info->visual->bits_per_rgb;
89 info->red_mask = info->visual->red_mask;
90 info->green_mask = info->visual->green_mask;
91 info->blue_mask = info->visual->blue_mask;
92
93 if (((vinfo_mask & VisualIDMask)
94 && (vinfo_template->visualid != info->visualid))
95 || ((vinfo_mask & VisualScreenMask)
96 && (vinfo_template->screen != info->screen))
97 || ((vinfo_mask & VisualDepthMask)
98 && (vinfo_template->depth != info->depth))
99 || ((vinfo_mask & VisualClassMask)
100 && (vinfo_template->class != info->class))
101 || ((vinfo_mask & VisualColormapSizeMask)
102 && (vinfo_template->colormap_size != info->colormap_size))
103 || ((vinfo_mask & VisualBitsPerRGBMask)
104 && (vinfo_template->bits_per_rgb != info->bits_per_rgb))
105 || ((vinfo_mask & VisualRedMaskMask)
106 && (vinfo_template->red_mask != info->red_mask))
107 || ((vinfo_mask & VisualGreenMaskMask)
108 && (vinfo_template->green_mask != info->green_mask))
109 || ((vinfo_mask & VisualBlueMaskMask)
110 && (vinfo_template->blue_mask != info->blue_mask))
111 ) {
112 ckfree((char *) info);
113 return NULL;
114 }
115
116 *nitems_return = 1;
117 return info;
118 }
119
120
121 /* $History: xutil.c $
122 *
123 * ***************** Version 1 *****************
124 * User: Dtashley Date: 1/02/01 Time: 3:20a
125 * Created in $/IjuScripter, IjuConsole/Source/Tk Base
126 * Initial check-in.
127 */
128
129 /* End of XUTIL.C */

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25