XForms: I've RTFM, still stuck [Was: Re: different visuals...]

From: Michal Szymanski (msz@astrouw.edu.pl)
Date: Wed May 09 2001 - 05:26:34 EDT

  • Next message: Michal Szymanski: "XForms: Re: I've RTFM, still stuck [Was: Re: different visuals...]"

    # To subscribers of the xforms list from Michal Szymanski <msz@astrouw.edu.pl> :

    On Wed, May 09, 2001 at 09:32:31AM +0200, I wrote:
    >
    > Is it possible to set visual for a single window (or just a canvas in a
    > window) to a value different than for the whole XForms application?
    >
    > My server is 24-bit but offers both True- and PseudoColor visuals.
    > It would be convenient for me to have all windows in TrueColor but one
    > canvas displaying an image set for PseudoColor 8-bit indexed colormap.

    I've RTFM (which I should have done before :), found
    fl_set_canvas_visual() and fl_set_canvas_depth() routines but this
    did not help much as it does not seem to work (or, more likely, I do not
    know how to use it). I've written simple test program with a single form
    containing EXIT button and a canvas. Then I put following into test_main.c:

    #include "forms.h"
    #include "test.h"

    int main(int argc, char *argv[])
    {
      FD_test *fd_test;
      int i, class;
      XVisualInfo *xv;
      
      fl_initialize(&argc, argv, 0, 0, 0);
      fd_test = create_form_test();

      /* fill-in form initialization code */

      for (i=0;i<6;i++) {
        xv = fl_state[i].xvinfo;
        class = fl_state[i].vclass;
        if (class == PseudoColor ) {
          printf("found PseudoColor visual\n");
        }
        fl_set_canvas_visual(fd_test->canvas, xv->visual);
        fl_set_canvas_depth(fd_test->canvas, xv->depth);
      }
      /* show the first form */
      fl_show_form(fd_test->test,FL_PLACE_CENTERFREE,FL_FULLBORDER,"test");
      fl_do_forms();
      return 0;
    }

    following the advice from the Manual which says that the canvas
    attributes should be changed before the window is created (before the
    form the canvas is in, is shown).

    The test program fails with:

      X Error of failed request: BadMatch (invalid parameter attributes)
        Major opcode of failed request: 1 (X_CreateWindow)

    It is run in a 24-bit server, so the default visual is TrueColor. It
    also fails, however, if I change the visual and depth of the canvas
    to that of TrueColor entry in fl_state array.

    Any hints?

    regards, Michal.

    -- 
      Michal Szymanski (msz@astrouw.edu.pl)
      Warsaw University Observatory, Warszawa, POLAND
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil   or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    



    This archive was generated by hypermail 2b29 : Wed May 09 2001 - 05:33:17 EDT