XmeGetDesktopColorCells and manual init... - Motif

This is a discussion on XmeGetDesktopColorCells and manual init... - Motif ; I wish to pick a visual and private colormap for an application. I am using the XRT widgets in the application. I followed a Motif manual and initialized as such, XtToolkitInitialize (); app_context = XtCreateApplicationContext (); xDisplay = XtOpenDisplay ( ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: XmeGetDesktopColorCells and manual init...

  1. XmeGetDesktopColorCells and manual init...


    I wish to pick a visual and private colormap for an application. I am
    using the XRT widgets in the application. I followed a Motif manual
    and initialized as such,

    XtToolkitInitialize ();
    app_context = XtCreateApplicationContext ();
    xDisplay = XtOpenDisplay ( app_context, NULL,
    "my_program", "ProgramClass",
    NULL, 0, &argc, argv);

    I can enumerate the possible visuals for the display and see if my
    target exists [an 8-bit pseudo-color]. I can then populate the
    private color map with the colors my application needs and pass this
    to XtAppCreateShell().

    However, I find it impossible to display the XRT widgets. If I create
    an application shell and realize it before managing the XRT widgets, I
    can use XtScreen(widget) to feed XmeGetDesktopColorCells(). However,
    this means that the shell window will appear briefly on the screen.
    Once the default desktop colors are in the color map, everything seems
    to be fine [ie. displaying XRT widgets].

    How can you get a "Screen *" without having created a widget in an
    application? I tried to use XrmGetResource() with an XtRScreen and
    XtCScreen. However, I am a bit feeble in understanding how to get
    from use XtRScreen to a default "Screen *".

    Ok, I understand that is rather specific and you might want to ask why
    am I doing this. I wish to display gray scale images over a slow
    network. The 8-bit visual seems to give far better performance on a
    10Mb unswitch ethernet, than the default 24bit true color. The images
    might have arbitrary bits depths (1,2,4,6,8), but I wish to keep only
    a 6 bit color map for the application. Full 8 bit gray scale images
    would have color information truncated.

    tia,
    Bill Pringlemeir.

    --
    Married men live longer than single men, but married men are much more
    willing to die - Dilworth

  2. Re: XmeGetDesktopColorCells and manual init...


    Bill Pringlemeir wrote:

    > I wish to pick a visual and private colormap for an application. I am
    > using the XRT widgets in the application. I followed a Motif manual
    > and initialized as such,
    >
    > XtToolkitInitialize ();
    > app_context = XtCreateApplicationContext ();
    > xDisplay = XtOpenDisplay ( app_context, NULL,
    > "my_program", "ProgramClass",
    > NULL, 0, &argc, argv);
    >

    ---8<---
    > How can you get a "Screen *" without having created a widget in an
    > application?


    Did you try

    scr_ptr = DefaultScreenOfDisplay(xDisplay);

    or
    scr_ptr = ScreenOfDisplay(xDisplay, scr_number)

    ?


  3. Re: XmeGetDesktopColorCells and manual init...

    In article <1134179228.255948.309400@g14g2000cwa.googlegroups. com> nojunk@gate.cpmet.ufpel.tche.br writes:

    >Bill Pringlemeir wrote:


    >> How can you get a "Screen *" without having created a widget in an
    >> application?

    >
    >Did you try
    >
    > scr_ptr = DefaultScreenOfDisplay(xDisplay);
    >
    >or
    > scr_ptr = ScreenOfDisplay(xDisplay, scr_number)
    >
    >?


    For figuring out this type of thing I highly recommend the X AND MOTIF QUICK
    REFERENCE GUIDE by Randi J. Rost from Digital Press.

    -Pete Zakel
    (phz@seeheader.nospam)

    "You could get a new lease on life -- if only you didn't need the first
    and last month in advance."

  4. Re: XmeGetDesktopColorCells and manual init...

    > Bill Pringlemeir wrote:

    >> How can you get a "Screen *" without having created a widget in an
    >> application?


    On 9 Dec 2005, nojunk@gate.cpmet.ufpel.tche.br wrote:

    > Did you try


    > scr_ptr = DefaultScreenOfDisplay(xDisplay);


    > or
    > scr_ptr = ScreenOfDisplay(xDisplay, scr_number)


    Sorry, I did grep the X11 headers for "Screen *", but I missed these
    functions and went off on a tangent thinking it wasn't so obvious...

    Regards,
    Bill Pringlemeir.

    --
    Schrodinger on QED: I don't like it, and I'm sorry I ever had anything
    to do with it.

  5. Re: XmeGetDesktopColorCells and manual init...

    Bill Pringlemeir wrote:

    >>scr_ptr = DefaultScreenOfDisplay(xDisplay);

    >
    >>or
    >>scr_ptr = ScreenOfDisplay(xDisplay, scr_number)

    >
    > Sorry, I did grep the X11 headers for "Screen *", but I missed these
    > functions and went off on a tangent thinking it wasn't so obvious...


    That is because it is a macro, not a function.

    Dušan Peterc
    http://www.arahne.si

  6. Re: XmeGetDesktopColorCells and manual init...

    > Bill Pringlemeir wrote:

    >> Sorry, I did grep the X11 headers for "Screen *", but I missed
    >> these functions and went off on a tangent thinking it wasn't so
    >> obvious...


    On 12 Dec 2005, arahne@arahne.si wrote:

    > That is because it is a macro, not a function.


    [X]*DefaultScreenOfDisplay() and [X]*ScreenOfDisplay() have both a
    function and a macro actually [at least on the system I am working
    with]. The "Xlib - C Language X interface" specification says that
    there should be both. Many standards provide this as you may need to
    take the address of a function in some cases [The 'C' standards,
    ctype.h comes to mind].

    Sorry, you can not disprove my incompetence.

    fwiw,
    Bill Pringlemeir.

    --
    Some people are alive because it's against the law to kill them.

+ Reply to Thread