0023830: BRepExtrema_DistShapeShape does not find intersection of face with edge
[occt.git] / src / Xw / Xw_get_window_info.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18
19 #include <Xw_Extension.h>
20
21 /* ifdef then trace on */
22 #ifdef TRACE
23 #define TRACE_GET_WINDOW_INFO
24 #endif
25
26 /*
27    XW_STATUS Xw_get_window_info (awindow,window,pixmap,root,colormap,
28                                                         vclass,depth,visualid):
29    XW_EXT_WINDOW *awindow       Extended Window structure
30    Aspect_Handle *window                Window XID
31    Aspect_Handle *pixmap                Pixmap XID or 0 if DoubleBuffering is DISABLE
32    Aspect_Handle *root                  Root XID
33    Aspect_Handle *colormap              Colormap XID    
34    Xw_TypeOfVisual *vclass      Visual Class
35    int *depth                   Planes depth
36    int *visualid                visualid
37
38         Returns the X window attributes of an existing window
39
40         returns XW_ERROR if something is wrong
41         returns XW_SUCCESS else
42
43 */
44
45 #ifdef XW_PROTOTYPE
46 XW_STATUS Xw_get_window_info (void *awindow,Aspect_Handle *window,Aspect_Handle *pixmap,
47         Aspect_Handle *root,Aspect_Handle *colormap,Xw_TypeOfVisual  *vclass,int *depth,int *visualid)
48 #else
49 XW_STATUS Xw_get_window_info (awindow,window,pixmap,root,colormap,vclass,depth,visualid)
50 void *awindow;
51 Aspect_Handle *window;
52 Aspect_Handle *pixmap;
53 Aspect_Handle *root;
54 Aspect_Handle *colormap;
55 Xw_TypeOfVisual  *vclass;
56 int *depth;
57 int *visualid;
58 #endif /*XW_PROTOTYPE*/
59 {
60 XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ;
61 XWindowAttributes attributes ;
62
63         if ( !Xw_isdefine_window(pwindow) ) {
64             /*ERROR*Bad EXT_WINDOW Address*/
65             Xw_set_error(24,"Xw_get_window_info",pwindow) ;
66             return (XW_ERROR) ;
67         }
68
69         if( !XGetWindowAttributes(_DISPLAY,_WINDOW,&attributes) ) {
70         /*ERROR*Bad Window Attributes*/
71             Xw_set_error(54,"Xw_get_window_info",&_WINDOW) ;
72             return (XW_ERROR) ;
73         }
74
75         *window = _WINDOW ;
76         *pixmap = _PIXMAP ;
77         *root = attributes.root ;
78 #if defined(__cplusplus) || defined(c_plusplus)
79         *vclass = (Xw_TypeOfVisual) attributes.visual->c_class ;
80 #else
81         *vclass = (Xw_TypeOfVisual) attributes.visual->class ;
82 #endif
83         *depth = attributes.depth ;
84         *colormap = attributes.colormap ;
85         *visualid = attributes.visual->visualid ;
86
87 #ifdef  TRACE_GET_WINDOW_INFO
88 if( Xw_get_trace() > 1 ) {
89     printf (" Xw_get_window_info(%lx,%lx,%lx,%lx,%lx,%d,%d,%d)\n",
90                 (long ) awindow,(long ) *window,(long ) *pixmap,(long ) *root,(long ) *colormap,*vclass,*depth,*visualid) ;
91 }
92 #endif
93
94         return (XW_SUCCESS) ;
95 }