0023830: BRepExtrema_DistShapeShape does not find intersection of face with edge
[occt.git] / src / Xw / Xw_set_window_state.cxx
CommitLineData
b311480e 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
7fd59977 18#define TEST /*GG_050198
19// Synchroniser le changement d'etat d'une fentre
20*/
21
22#include <Xw_Extension.h>
23
24 /* ifdef then trace on */
25#ifdef TRACE
26#define TRACE_SET_WINDOW_STATE
27#endif
28
29/*
30 XW_STATUS Xw_set_window_state (awindow, state):
31 XW_EXT_WINDOW *awindow
32 WINDOWSTATE state ;
33
34 Update the window state ,must be :
35
36 POP if the window must be viewable above all others .
37 PUSH if the window must be behind all others .
38 ICONIFY if the window must be iconify .
39 UNKNOWN if the window must be only Mapped as his old state
40
41 returns XW_SUCCESS always
42*/
43
44#ifdef XW_PROTOTYPE
45XW_STATUS Xw_set_window_state (void *awindow , XW_WINDOWSTATE rstate)
46#else
47XW_STATUS Xw_set_window_state (awindow , rstate)
48void *awindow;
49XW_WINDOWSTATE rstate ;
50#endif /*XW_PROTOTYPE*/
51{
52 XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow;
53 int xc,yc,width,height ;
54
55
56 /*
57 * wait_event ajoute par CAL le 21/03/95 pour pouvoir faire des tests
58 * sur SGI. En effet, lorsque le display est une SGI, on est bloque
59 * sur XWindowEvent. A analyser avec GG.
60 */
61 XW_WINDOWSTATE state ;
62
63#ifndef TEST
64 int wait_event = False ;
65 char svalue[4] ;
66 if( Xw_get_env("Xw_WAIT_EVENT",svalue,sizeof(svalue)) ) {
67 wait_event = True ;
68 printf(" Xw_WAIT_EVENT is %d\n",wait_event) ;
69 }
70#endif
71
72 switch (rstate) {
73 case XW_MAP :
74 if( Xw_get_window_position(pwindow,&xc,&yc,&width,&height)
75 == XW_ICONIFY ){
76// XEvent event ;
77
78 XMapWindow(_DISPLAY,_WINDOW) ;
79 XFlush(_DISPLAY) ;
80#ifdef TEST
81 do {
82 state =
83 Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ;
84 } while ( state == XW_ICONIFY );
85#else
86 if( _EVENT_MASK & ExposureMask ) {
87 if( wait_event )
88 XWindowEvent(_DISPLAY,_WINDOW,ExposureMask,&event) ;
89 }
90 Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ;
91#endif
92 pwindow->axleft = xc - width/2 ;
93 pwindow->axright = xc + width/2 ;
94 pwindow->aytop = yc - height/2 ;
95 pwindow->aybottom = yc + height/2 ;
96 }
97 break ;
98
99 case XW_POP :
100 if( Xw_get_window_position(pwindow,&xc,&yc,&width,&height)
101 != XW_ICONIFY ){
102 XRaiseWindow(_DISPLAY,_WINDOW) ;
103 } else {
104// XEvent event ;
105
106 XMapRaised(_DISPLAY,_WINDOW) ;
107 XFlush(_DISPLAY) ;
108#ifdef TEST
109 do {
110 state =
111 Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ;
112 } while ( state == XW_ICONIFY );
113#else
114 if( _EVENT_MASK & ExposureMask ) {
115 if( wait_event )
116 XWindowEvent(_DISPLAY,_WINDOW,ExposureMask,&event) ;
117 }
118 Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ;
119#endif
120 pwindow->axleft = xc - width/2 ;
121 pwindow->axright = xc + width/2 ;
122 pwindow->aytop = yc - height/2 ;
123 pwindow->aybottom = yc + height/2 ;
124 }
125 break ;
126
127 case XW_PUSH :
128 XLowerWindow(_DISPLAY,_WINDOW) ;
129 break ;
130
131 case XW_ICONIFY :
132 XIconifyWindow(_DISPLAY,_WINDOW,DefaultScreen(_DISPLAY)) ;
133 break ;
134#ifndef DEB
135 default:
136 break ;
137#endif
138 }
139 XFlush(_DISPLAY) ;
140
141#ifdef TRACE_SET_WINDOW_STATE
142if( Xw_get_trace() ) {
143 printf (" Xw_set_window_state(%lx,%d)\n",(long ) pwindow,rstate) ;
144}
145#endif
146
147 return (XW_SUCCESS);
148}