[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XForms] drawing into a foreign window

From: Patrick
Subject: [XForms] drawing into a foreign window
Date: Wed, 28 Dec 2016 13:37:21 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0

Hi Guys

I am doing something weird.

I want to mix ncurses and xforms.

I can obtain the window ID that the ncurses program is running in. I wanted to override the FL_FORM struct so that the window ID is the terminal window's ID.

I tracked Window in the FL_FORMS struct on line 896 to window(lowercase) and then this back to line 96 in X.h

Window is a typedef of XID on line 66 of X.h

XID is type unsigned long.

I tried to hack arrows.c from demos like this:

main( int    argc,
      char * argv[ ] )
    FL_FORM *form;
    FL_OBJECT *obj;

    fl_initialize( &argc, argv, "FormDemo", 0, 0 );

    form = fl_bgn_form( FL_FLAT_BOX, 400, 400 );
    form->window = 83886089;
printf("first time, window is is %lu \n", form->window) ;

    obj = fl_add_button( FL_NORMAL_BUTTON, 50, 250, 100, 100, "@1" );
    fl_set_object_lcolor( obj, FL_BLUE );

    obj = fl_add_button( FL_NORMAL_BUTTON, 150, 150, 100, 100, "@square" );
    fl_set_object_lcolor( obj, FL_GREEN );

    fl_end_form( );

    fl_show_form( form, FL_PLACE_ASPECT, FL_TRANSIENT, "Buttons" );

    while ( fl_do_forms( ) != obj )
        /* empty */ ;

printf("second time, window is is %lu \n", form->window) ;

    fl_finish( );
    return 0;

The window ID in the second printf statement does not match the one I assigned to it but the first one does.

Am I close? Is there a better way to do this?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]