/[dtapublic]/projs/ets/trunk/src/c_tk_base_7_5_w_mods/xutil.c
ViewVC logotype

Diff of /projs/ets/trunk/src/c_tk_base_7_5_w_mods/xutil.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

to_be_filed/sf_code/esrgpcpj/shared/tk_base/xutil.c revision 29 by dashley, Sat Oct 8 07:08:47 2016 UTC projs/ets/trunk/src/c_tk_base_7_5_w_mods/xutil.c revision 220 by dashley, Sun Jul 22 15:58:07 2018 UTC
# Line 1  Line 1 
 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tk_base/xutil.c,v 1.1.1.1 2001/06/13 05:16:00 dtashley Exp $ */  
   
 /*  
  * xutil.c --  
  *  
  *      This function contains generic X emulation routines.  
  *  
  * Copyright (c) 1995-1996 Sun Microsystems, Inc.  
  *  
  * See the file "license.terms" for information on usage and redistribution  
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.  
  *  
  * RCS: @(#) $Id: xutil.c,v 1.1.1.1 2001/06/13 05:16:00 dtashley Exp $  
  */  
   
 #include <stdlib.h>  
 #include "tk.h"  
   
 #ifdef MAC_TCL  
 #       include <Xutil.h>  
 #       include <Xatom.h>  
 #else  
 #       include "Xutil.h"  
 #       include "Xatom.h"  
 #endif  
   
 /*  
  *----------------------------------------------------------------------  
  *  
  * XInternAtom --  
  *  
  *      This procedure simulates the XInternAtom function by calling  
  *      Tk_Uid to get a unique id for every atom.  This is only a  
  *      partial implementation, since it doesn't work across  
  *      applications.  
  *  
  * Results:  
  *      A new Atom.  
  *  
  * Side effects:  
  *      None.  
  *  
  *----------------------------------------------------------------------  
  */  
   
 Atom  
 XInternAtom(display, atom_name, only_if_exists)  
     Display* display;  
     _Xconst char* atom_name;  
     Bool only_if_exists;  
 {  
     static Atom atom = XA_LAST_PREDEFINED;  
       
     display->request++;  
     return ++atom;  
 }  
   
 /*  
  *----------------------------------------------------------------------  
  *  
  * XGetVisualInfo --  
  *  
  *      Returns information about the specified visual.  
  *  
  * Results:  
  *      Returns a newly allocated XVisualInfo structure.  
  *  
  * Side effects:  
  *      Allocates storage.  
  *  
  *----------------------------------------------------------------------  
  */  
   
 XVisualInfo *  
 XGetVisualInfo(display, vinfo_mask, vinfo_template, nitems_return)  
     Display* display;  
     long vinfo_mask;  
     XVisualInfo* vinfo_template;  
     int* nitems_return;  
 {  
     XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo));  
     info->visual = DefaultVisual(display, 0);  
     info->visualid = info->visual->visualid;  
     info->screen = 0;  
     info->depth = info->visual->bits_per_rgb;  
     info->class = info->visual->class;  
     info->colormap_size = info->visual->map_entries;  
     info->bits_per_rgb = info->visual->bits_per_rgb;  
     info->red_mask = info->visual->red_mask;  
     info->green_mask = info->visual->green_mask;  
     info->blue_mask = info->visual->blue_mask;  
       
     if (((vinfo_mask & VisualIDMask)  
             && (vinfo_template->visualid != info->visualid))  
             || ((vinfo_mask & VisualScreenMask)  
                     && (vinfo_template->screen != info->screen))  
             || ((vinfo_mask & VisualDepthMask)  
                     && (vinfo_template->depth != info->depth))  
             || ((vinfo_mask & VisualClassMask)  
                     && (vinfo_template->class != info->class))  
             || ((vinfo_mask & VisualColormapSizeMask)  
                     && (vinfo_template->colormap_size != info->colormap_size))  
             || ((vinfo_mask & VisualBitsPerRGBMask)  
                     && (vinfo_template->bits_per_rgb != info->bits_per_rgb))  
             || ((vinfo_mask & VisualRedMaskMask)  
                     && (vinfo_template->red_mask != info->red_mask))  
             || ((vinfo_mask & VisualGreenMaskMask)  
                     && (vinfo_template->green_mask != info->green_mask))  
             || ((vinfo_mask & VisualBlueMaskMask)  
                     && (vinfo_template->blue_mask != info->blue_mask))  
         ) {  
         ckfree((char *) info);  
         return NULL;  
     }  
   
     *nitems_return = 1;  
     return info;  
 }  
   
   
 /* $History: xutil.c $  
  *  
  * *****************  Version 1  *****************  
  * User: Dtashley     Date: 1/02/01    Time: 3:20a  
  * Created in $/IjuScripter, IjuConsole/Source/Tk Base  
  * Initial check-in.  
  */  
   
 /* End of XUTIL.C */  
1    /* $Header$ */
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    /* End of xutil.c */

Legend:
Removed from v.29  
changed lines
  Added in v.220

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25