3 /***********************************************************************
14 HISTORIQUE DES MODIFICATIONS :
15 --------------------------------
16 xx-xx-xx : xxx ; Creation.
17 20-02-96 : FMN ; Suppression code inutile:
19 - call_tox_open_display()
20 - call_tox_getscreen(Tint *d_wdth, Tint *d_hght)
21 01-04-96 : CAL ; Integration MINSK portage WNT
22 20-11-97 : CAL ; RererereMerge avec le source de portage.
23 12-02-01 : GG ; BUC60821 Add getpitchsize() function
24 27-03-02 : GG ; RIC120202 Add new function call_tox_set_display
26 ************************************************************************/
28 /*----------------------------------------------------------------------*/
36 #include <X11/Xutil.h>
38 #include <InterfaceGraphic_Aspect.hxx>
40 #include <OpenGl_tgl_all.hxx>
41 #include <OpenGl_txgl.hxx>
42 #include <OpenGl_tgl_tox.hxx>
43 #include <OpenGl_tgl_util.hxx>
45 /*----------------------------------------------------------------------*/
50 Display * call_thedisplay; /* display pointer; defined in tgl/tox */
52 /*----------------------------------------------------------------------*/
57 /*----------------------------------------------------------------------*/
60 call_tox_open_display (void)
64 if (call_thedisplay == NULL)
67 * Specifies the hardware display name, which determines the
68 * display and communications domain to be used.
69 * On a POSIX system, if the display_name is NULL, it defaults
70 * to the value of the DISPLAY environment variable.
72 call_thedisplay = XOpenDisplay ((char*) NULL);
74 if (call_thedisplay != NULL)
75 if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132))
76 XSynchronize (call_thedisplay, 1);
78 XSynchronize (call_thedisplay, 0);
80 fprintf (stderr, "Cannot connect to X server %s\n",
81 XDisplayName ((char*) NULL));
83 return (call_thedisplay == NULL);
88 call_tox_set_display (void *vdisplay)
90 Display *pdisplay = (Display*) vdisplay;
94 call_thedisplay = pdisplay;
96 if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132))
97 XSynchronize (call_thedisplay, 1);
99 XSynchronize (call_thedisplay, 0);
101 fprintf (stderr, "Cannot connect to X server %s\n",
102 XDisplayName ((char*) NULL));
104 return (call_thedisplay != NULL);
108 /*----------------------------------------------------------------------*/
111 call_tox_getscreen( Tint *d_wdth, Tint *d_hght )
113 *d_wdth = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) );
114 *d_hght = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) );
118 /*----------------------------------------------------------------------*/
121 call_tox_getpitchsize( )
123 static float pitch_size = 0.;
125 if( pitch_size == 0. ) {
126 int width = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) );
127 int height = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) );
128 int mmwidth = DisplayWidthMM( call_thedisplay, DefaultScreen(call_thedisplay) );
129 int mmheight = DisplayHeightMM( call_thedisplay, DefaultScreen(call_thedisplay) );
130 pitch_size = ((float)mmwidth/width + (float)mmheight/height)/2.;
136 /*----------------------------------------------------------------------*/
138 # include <windows.h>
139 # include <OpenGl_tgl_all.hxx>
140 # include <OpenGl_txgl.hxx>
142 DISPLAY* call_thedisplay = "DISPLAY"; /* Dummy for Windows NT */
145 call_tox_open_display ( void )
152 call_tox_set_display ( void* vdisplay)
159 call_tox_getscreen ( Tint *d_wdth, Tint *d_hght )
161 *d_wdth = GetSystemMetrics(SM_CXSCREEN);
162 *d_hght = GetSystemMetrics(SM_CYSCREEN);