From: mul@i61s3.ira.uka.de (Peter Mul)
Newsgroups: comp.windows.x.pex
Subject: X-visual
Date: 24 Jul 1992 10:40:47 GMT
Organization: University of Karlsruhe, FRG
Distribution: world
NNTP-Posting-Host: i61s3.ira.uka.de
Keywords: PEX/Phigs, X-Visual selection, Colormaps

Hey!

I have a problem getting the right visual and colors for my application.
I wrote a Graphiktool to display Robotcells on an Evans & Sutherland
ESV 30 system, using PEX/PHIGS. Everything OK. I get as default a 24bit
visual with the right colors.
 
Then I tried to get it running on a SUN workstation. At that moment the
problem arised.
I used Sunphigs2.0 and Motif.
The problem is that my application gets a Pseudocolor visual as my default
visual, with unpredictable Colormaps.
I my application I use sets of three sliders (RGB) to create my colors. On
the ESV30 I could use the 24bit color mode to identify the color directly.
The Phigs part uses the Drawwindow (Drawwindow=XtWindow(drawarea); 
see code below) as the window to display the graphics. 
On a Sun I get different colors in my color mixer and graphikwindow.

The Application should be able to run on 8bit and 24bit color SUNS.
How can I manage that?

The approach to select the right visual and give it as argument to a 
XtCreateWindow() call does not solve my problem as I use Motifwidgets.

Please help me, as I cannot get the right information from the Motif and
Xlib books.


Peter Mul
University of Karlsruhe
mul@ira.uka.de
++31-721-608-4261


Just a small part of the application code I used to test my approaches,
that failed till now.

#ifdef ESV
# include <X11/phigs/phigs.h> /* PEX extensions PHIGS+ */
# include <X11/extensions/XPick.h>
#else
# include <phigs/phigs.h>
#endif

#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include "xsig.h"

#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Intrinsic.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/DrawingA.h>
#include <Xm/Form.h>
#include <Xm/Frame.h>
#include <Xm/Label.h>
#include <Xm/MainW.h>
#include <Xm/PushBG.h>
#include <Xm/RowColumn.h>
#include <Xm/Text.h>
#include <Xm/ToggleBG.h>

Widget      drawarea;
Widget      rowColumn;
Widget      mainTopLevel;
Widget      frame;
Widget      button[6];
Widget      mainwindow;
Widget      rowColumn;
Widget      rowcolumnbuttons;
Widget      statusdisplay;
Widget      systemtimedisplay;
Widget      statusform;
Widget      statuslabel;
Widget      tbutton1;
Widget      virtualTopLevel;
Window      drawwindow;
Widget      drawareaparent;

/*******************************************/
int main(argc, argv)
int   argc;
char *argv[];
/*******************************************/
{
  Arg          args[20];
  int j;
  register int n;

  /*****************************************************/
  /*** X Setup                                       ***/
  /*****************************************************/

  /* Init X Toolkit  */
  virtualTopLevel =
   XtInitialize( argv[0], "vist", NULL, NULL, &argc, argv);

  n = 0;
  XtSetArg( args[n], XtNallowShellResize, FALSE); n++;
  mainTopLevel =
   XtAppCreateShell( PROGRAM_NAME, APPLICATION_CLASS, 
     applicationShellWidgetClass, XtDisplay( virtualTopLevel), args, n);

  /* Create main window */
  mainwindow = XmCreateMainWindow( mainTopLevel, "main1", args, n);
  XtManageChild( mainwindow);

   /* Create row-column widget for screen structuring */
  n = 0;
  rowColumn =
   XtCreateManagedWidget( "rowColumn", 
                          xmRowColumnWidgetClass, mainwindow, args, n);
 
  n = 0;
  drawareaparent = 
   XtCreateManagedWidget( "drawareaparent",
	   		  xmFormWidgetClass, rowColumn, args, n);
  
  /* Create draw area */
  n = 0;
  XtSetArg( args[n], XmNheight, DRAW_AREA_HEIGHT); n++;
  XtSetArg( args[n], XmNwidth,  DRAW_AREA_WIDTH ); n++;
  XtSetArg( args[n], XmNresizePolicy, XmRESIZE_ANY); n++;
  drawarea = 
   XtCreateManagedWidget( "drawarea",
                           xmDrawingAreaWidgetClass, drawareaparent, args,n);
  /* Window for Dials to be sensitive */
  drawwindow  = XtWindow( drawarea);

  XtRealizeWidget(mainTopLevel);
  XtMainLoop();
}






Newsgroups: comp.windows.x.pex