Subject: Re: gnuplot in widget (code; experiment) - DN [1]


tom <tmb at ncal point verio point com x@x.x> - 15 Jul 2000 - comp.lang.tcl

 I did a little experiment.  First, I created an X application and
 got its id with xwininfo.  Then I created a Tcl container frame with

         frame .foo -container 1
         pack .foo -fill both -expand yes
         winfo id .foo

 Then, I run "xreparent (window-id) (.foo-id)" (program
 given below).

 This works: the X window appears in the Tk frame; I tried it with
 xterm, Netscape, and rxvt. The problem is: the geometry management
 doesn't work.  The embedded window never gets resized when the Tk
 window or frame changes size.  If I embed another Tk toplevel with the
 "-use" command line option, things work OK for that Tk toplevel.

 Any ideas?  The man page for "frame -container" claims that the frame
 does all the things with resizing and colors that a toplevel window
 would expect.

 Tom.

 $ cat xreparent.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <X11/X.h>
 #include <X11/Xlib.h>

 int main(int argc,char **argv) {
     if(argc!=3) {
         fprintf(stderr,"usage: %s window parent\n",argv[0]);
         exit(1);
     }
     Display *display = XOpenDisplay(getenv("DISPLAY"));
     Window window,parent;
     if(sscanf(argv[1],"0x%x",&window)!=1 && sscanf(argv[1],"%d",&window)!=1) {
         fprintf(stderr,"bad window id");
         exit(1);
     }
     if(sscanf(argv[2],"0x%x",&parent)!=1 && sscanf(argv[2],"%d",&parent)!=1) {
         fprintf(stderr,"bad parent id");
         exit(1);
     }
     XReparentWindow(display,window,parent,0,0);
     XMapWindow(display,window);
     XMoveWindow(display,window,0,0);
     XSync(display,0);
 }
 $ g++ ... xreparent.cc
 $ ./xreparent 0x4c0461e 0x4800005

Last modified
2000-07-20

(195.108.246.52)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated