From: pfuetz@igd.fhg.de (Matthias Pfuetzner)
Newsgroups: comp.windows.x.pex,comp.sys.sun.misc
Subject: Question concerning sunPHIGS and PEX-SI, open_ws, open_phigs calls
Keywords: phigs, sunPHIGS, PEX, PEX-SI, popen_phigs, popen_xphigs, phigs_ws_type_create, popen_ws
Date: 11 Sep 92 13:46:15 GMT
Followup-To: poster
Organization: Zentrum fuer Graphische Datenverarbeitung, Darmstadt, FRG

Hi Everybody!

I again have a question concerning PEX-SI as supplied with X11R5 from MIT and
sunPHIGS from SunSoft.

Is there a real difference between the two following codes, and if yes, what
are these?

CODE 1:
------------------------------------------------------------------------------
   grafik_display = XOpenDisplay( display_name );
   
   xswa.backing_store     = NotUseful;
   xswa.event_mask        = ExposureMask | StructureNotifyMask;
   xswa.override_redirect = True;
   
   visual.visualid = CopyFromParent;
   
   grafik_window =
      XCreateWindow( grafik_display,
                     RootWindow( grafik_display,
                                 DefaultScreen( grafik_display ) ),
                     0,
                     0, 
                     DisplayWidth( grafik_display,
                                   DefaultScreen( grafik_display ) ),
                     DisplayHeight( grafik_display,
                                    DefaultScreen( grafik_display ) ),
		     (unsigned int)0,
                     DefaultDepth( grafik_display,
                                   DefaultScreen( grafik_display ) ),
                     InputOutput,
                     &visual,
                     CWEventMask | CWBackingStore | CWBorderPixel | 
                     CWOverrideRedirect,
                     &xswa );
   
   XMapWindow( grafik_display, grafik_window );
   
   XSync( grafik_display, False );
   XWindowEvent( grafik_display, grafik_window, ExposureMask, &exposureEvent );

   xinfo.display          = grafik_display;
   xinfo.flags.no_monitor = 0;      /* False -> Monitor is running! */
   
   popen_xphigs( NULL, 0, PXPHIGS_INFO_FLAGS_NO_MON |
                          PXPHIGS_INFO_DISPLAY, &xinfo );
   
   conn.display     = grafik_display;
   conn.drawable_id = grafik_window;
   
   popen_ws( 1, (Pconnid)(&conn), phigs_ws_type_x_drawable );
------------------------------------------------------------------------------
CODE 2:
------------------------------------------------------------------------------
   grafik_display = XOpenDisplay( display_name );
   
   xinfo.display = grafik_display;
   
   popen_xphigs( NULL, 0, PXPHIGS_INFO_DISPLAY, &xinfo );
   
   ws_type = phigs_ws_type_create( phigs_ws_type_x_tool, 
                                   (char *)PHIGS_TOOL_X,
                                   (char *)0,
                                   (char *)PHIGS_TOOL_Y,
                                   (char *)0,
                                   (char *)PHIGS_TOOL_WIDTH,
                                   (char *)DisplayWidth( grafik_display,
                                             DefaultScreen( grafik_display ) ),
                                   (char *)PHIGS_TOOL_HEIGHT,
                                   (char *)DisplayHeight( grafik_display,
                                             DefaultScreen( grafik_display ) ),
                                   (char *)PHIGS_TOOL_BORDER_WIDTH,
                                   (char *)0,
                                   (char *)0 );
   
   popen_ws( 1, (char *)display_name, ws_type );
------------------------------------------------------------------------------
My questions in special:

1.) Which code is prefered? Why?

2.) In the case of code 2, why do I have to use XOpenDisplay explicitly for
    retrieving an argument for popen_xphigs, when I later have to specify (in
    popen_ws) the display_name again?

3.) In case of code 2, does the popen_ws call use the existing connection to
    the server, or does it open the display again?

4.) In case of code 2, should I add the options PHIGS_X_DISPLAY and
    PHIGS_X_DISPLAY_NAME to the list of attributes in phigs_ws_type_create?
    Would this adding of attributes allow me to remove the "(char *)
    display_name" argument from the call to popen_ws?

5.) Are there differences in performance and behavior? If yes, which and why?

Thanks in advance!

Sincerly,
        Matthias
-- 
    Matthias Pfuetzner  |  @work:  +49 6151 155-150  | @home: +49 6151 75717
    6100 Darmstadt, FRG | ZGDV, Wilhelminenstrasse 7 | Lichtenbergstrasse 73
      pfuetzner@igd.fhg.de, pfuetzner@zgdvda.UUCP    | Hans-Ulrich Klose sagte:
    Wir pfeifen nicht nach ihrer Tanze... (09.09.92 in der Haushaltsdebatte)