@@ -59,8 +59,8 @@ short int wsgl_use_shaders = 1;
5959/*******************************************************************************
6060 * wsgl_init
6161 *
62- * DESCR: Initialize renderer
63- * RETURNS: Non zero or zero on error
62+ * DESCR: Initialize renderer
63+ * RETURNS: Non zero or zero on error
6464 */
6565
6666int wsgl_init (
@@ -118,8 +118,8 @@ int wsgl_init(
118118/*******************************************************************************
119119 * wsgl_close
120120 *
121- * DESCR: Close
122- * RETURNS: N/A
121+ * DESCR: Close
122+ * RETURNS: N/A
123123 */
124124
125125void wsgl_close (
@@ -135,8 +135,8 @@ void wsgl_close(
135135/*******************************************************************************
136136 * wsgl_set_window
137137 *
138- * DESCR: Set render window coordinates
139- * RETURNS: N/A
138+ * DESCR: Set render window coordinates
139+ * RETURNS: N/A
140140 */
141141void wsgl_set_window (
142142 Ws * ws ,
@@ -152,8 +152,8 @@ void wsgl_set_window(
152152/*******************************************************************************
153153 * wsgl_set_viewport
154154 *
155- * DESCR: Set render window viewport
156- * RETURNS: N/A
155+ * DESCR: Set render window viewport
156+ * RETURNS: N/A
157157 */
158158void wsgl_set_viewport (
159159 Ws * ws ,
@@ -172,8 +172,8 @@ void wsgl_set_viewport(
172172/*******************************************************************************
173173 * wsgl_set_hlhsr_mode
174174 *
175- * DESCR: Set render depth mode
176- * RETURNS: N/A
175+ * DESCR: Set render depth mode
176+ * RETURNS: N/A
177177 */
178178void wsgl_set_hlhsr_mode (
179179 Ws * ws ,
@@ -189,8 +189,8 @@ void wsgl_set_hlhsr_mode(
189189/*******************************************************************************
190190 * wsgl_clear
191191 *
192- * DESCR: Clear render window
193- * RETURNS: N/A
192+ * DESCR: Clear render window
193+ * RETURNS: N/A
194194 */
195195void wsgl_clear (
196196 Ws * ws
@@ -202,7 +202,9 @@ void wsgl_clear(
202202 Phg_ret ret ;
203203 Pgcolr gcolr ;
204204 Wsgl_handle wsgl = ws -> render_context ;
205- /* try to get the background color from the color table entry for this ws */
205+ char buffer [6 ];
206+ char * xdg_session_type ;
207+ /* Try to get the background color from the color table entry for this ws */
206208 phg_wsb_inq_LUT_entry (ws , 0 , PINQ_REALIZED , PHG_ARGS_COREP , & ret , & gcolr , NULL );
207209 if (ret .err == 0 ) {
208210 wsgl -> background .val .general .x = gcolr .val .general .x ;
@@ -223,8 +225,13 @@ void wsgl_clear(
223225 glXMakeContextCurrent (ws -> display , ws -> drawable_id , ws -> drawable_id , ws -> glx_context );
224226 }
225227 wsgl_clear_geometry ();
226- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
227- if (ws -> has_double_buffer ) {
228+ xdg_session_type = getenv ("XDG_SESSION_TYPE" );
229+ if (xdg_session_type ){
230+ strncpy (buffer , xdg_session_type , 5 );
231+ } else {
232+ strncpy (buffer , "unkwn" , 5 );
233+ }
234+ if (ws -> has_double_buffer && ( 0 == strncmp (buffer , "x11" , 3 ) || (0 == strncmp (buffer , "tty" , 3 )))) {
228235#ifdef DEBUG
229236 printf ("Swapping buffers in clear\n" );
230237#endif
@@ -236,13 +243,14 @@ void wsgl_clear(
236243#endif
237244 glFlush ();
238245 }
246+ glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
239247}
240248
241249/*******************************************************************************
242250 * wsgl_flush
243251 *
244- * DESCR: Flush settings to render window
245- * RETURNS: N/A
252+ * DESCR: Flush settings to render window
253+ * RETURNS: N/A
246254 */
247255void wsgl_flush (
248256 Ws * ws
@@ -347,8 +355,8 @@ void wsgl_flush(
347355/*******************************************************************************
348356 * init_rendering_state
349357 *
350- * DESCR: Initialize rendering state helper function
351- * RETURNS: N/A
358+ * DESCR: Initialize rendering state helper function
359+ * RETURNS: N/A
352360 */
353361static void init_rendering_state (
354362 Ws * ws
@@ -396,8 +404,8 @@ static void init_rendering_state(
396404/*******************************************************************************
397405 * wsgl_begin_rendering
398406 *
399- * DESCR: Start a rendiering session for workstation
400- * RETURNS: N/A
407+ * DESCR: Start a rendiering session for workstation
408+ * RETURNS: N/A
401409 */
402410void wsgl_begin_rendering (
403411 Ws * ws
@@ -426,8 +434,8 @@ void wsgl_begin_rendering(
426434/*******************************************************************************
427435 * wsgl_end_rendering
428436 *
429- * DESCR: End a rendiering session
430- * RETURNS: N/A
437+ * DESCR: End a rendiering session
438+ * RETURNS: N/A
431439 */
432440void wsgl_end_rendering (
433441 Ws * ws
@@ -454,8 +462,8 @@ void wsgl_end_rendering(
454462/*******************************************************************************
455463 * store_cur_struct
456464 *
457- * DESCR: Store current structure information helper function
458- * RETURNS: N/A
465+ * DESCR: Store current structure information helper function
466+ * RETURNS: N/A
459467 */
460468
461469static void store_cur_struct (
@@ -479,8 +487,8 @@ static void store_cur_struct(
479487/*******************************************************************************
480488 * update_cur_struct
481489 *
482- * DESCR: Update current structure information helper function
483- * RETURNS: N/A
490+ * DESCR: Update current structure information helper function
491+ * RETURNS: N/A
484492 */
485493static void update_cur_struct (
486494 Ws * ws
@@ -545,8 +553,8 @@ static int check_draw_primitive(
545553/*******************************************************************************
546554 * check_highlight_primitive
547555 *
548- * DESCR: check if the current primitive is highlighted
549- * RETURNS: N/A
556+ * DESCR: check if the current primitive is highlighted
557+ * RETURNS: N/A
550558 */
551559static int check_highlight_primitive (
552560 Ws * ws
@@ -575,8 +583,8 @@ static int check_highlight_primitive(
575583/*******************************************************************************
576584 * wsgl_begin_structure
577585 *
578- * DESCR: Mark the beginning of a new structure element
579- * RETURNS: N/A
586+ * DESCR: Mark the beginning of a new structure element
587+ * RETURNS: N/A
580588 */
581589void wsgl_begin_structure (
582590 Ws * ws ,
@@ -614,8 +622,8 @@ void wsgl_begin_structure(
614622/*******************************************************************************
615623 * wsgl_end_structure
616624 *
617- * DESCR: Mark the ending of a structure element
618- * RETURNS: N/A
625+ * DESCR: Mark the ending of a structure element
626+ * RETURNS: N/A
619627 */
620628void wsgl_end_structure (
621629 Ws * ws
@@ -654,8 +662,8 @@ void wsgl_end_structure(
654662/*******************************************************************************
655663 * wsgl_render_element
656664 *
657- * DESCR: Render element to current workstation rendering window
658- * RETURNS: N/A
665+ * DESCR: Render element to current workstation rendering window
666+ * RETURNS: N/A
659667 */
660668void wsgl_render_element (
661669 Ws * ws ,
@@ -1373,16 +1381,9 @@ void wsgl_begin_pick(
13731381 printf ("WSGL begin pick: set render mode to select\n" );
13741382 printf ("WSGL begin pick: buffer size is %d at %p\n" , wsgl -> select_size , (void * )wsgl -> select_buf );
13751383#endif
1376- //glDisable(GL_CULL_FACE);
1377- //glEnable(GL_DEPTH_TEST);
13781384 glRenderMode (GL_SELECT );
13791385 glInitNames ();
1380- /*
1381- glMatrixMode(GL_PROJECTION);
1382- glPushMatrix();
1383- glLoadIdentity();
1384- glMatrixMode(GL_MODELVIEW);
1385- */ }
1386+ }
13861387
13871388/*******************************************************************************
13881389 * wsgl_end_pick
0 commit comments