Path: utzoo!censor!geac!jtsv16!uunet!husc6!bloom-beacon!SCF1.FAC.FORD.COM!carol From: carol@SCF1.FAC.FORD.COM (Carol Toomer-Keay) Newsgroups: comp.windows.x Subject: (none) Message-ID: <8908021904.AA24408@scf1.fac.ford.com> Date: 2 Aug 89 19:04:58 GMT Organization: The Internet Lines: 127 Aug 2, 1989 Hi, I think I've found a bug in XLib. This is complicated to explain but please bear with me. I'm trying to make a popup menu with a pull right menu as one selection. First I create a parent window as a template, then create 8 panes as children of the template. The code that does this resides in a subroutine. The first time the subroutine is called, it works fine. The second time it's called (to create the pull right menu) it creates the parent (menuwin) and then proceeds to create the children. After pane[12] is created, the window id of menuwin (the parent window) changes to that of pane[12]. The suspect code is included. The error I get occurs in the XSetStandardProperties call and says: signal SEGV (segmentation violation) in XSetCommand at 0x650a XSetCommand+0x12: tstl a0@(0,d7:l:4) I stepped through the code with dbx to be sure I'm not crazy!!! The id of menuwin changes after a call to XSelectInput. I've commented the code with the dbx outputs so you can see what I saw. If anyone has a clue as to what is going on here...PLEASE HELP ME!!! I'm not equipped to find bugs in XLib if that's what this is. I'm kind of new at this and I don't have any toolkits to use so solutions must be for XLib. Thanks a bunch! Carol Toomer Ford Aerospace Corp. (408) 743-3945 1260 Crossman Ave. carol@scf1.fac.ford.com Sunnyvale, CA 94089 to code, perchance to compile, ay there's the rub.... whether tis nobler to program the popups and popdowns in XLib, or take a mouse against a C of icons and by deleting, end them! (Disclaimer: These problems are my own and do not reflect those of my company!) --------------------------------------------------------- MakeMenu(root_x, root_y, win_x, win_y, width, height, pane_height, counter) . . . menuwin = XCreateSimpleWindow(Disp, RootWindow(Disp, screen), root_x, root_y, width, height, bw, Black, White); temp = menuwin; /* added to catch the change in value */ /* Create PopupMenuBar here (code deleted) */ /* Create the menu panes for the text */ /* The first time this routine is called, counter = 0. * The second time it's called, counter = MAX_CHOICE = 8 */ /* Going into this loop, menuwin = 11534355. * When counter = 12, panes[12] is created. * panes[12] = 11534361. * After XSelectInput is called for panes[12], * menuwin = panes[12] = 11534361 - WHY? */ for (winindex = counter; winindex < MAX_CHOICE + counter; winindex++) { panes[winindex] = XCreateSimpleWindow(Disp, menuwin, 0, pane_height*(winindex + 1), width, pane_height, bw, Black, White); XSelectInput(Disp, panes[winindex], ExposureMask | EnterWindowMask | LeaveWindowMask | OwnerGrabButtonMask | ButtonReleaseMask ); } XSelectInput(Disp, menuwin, ExposureMask | LeaveWindowMask | OwnerGrabButtonMask ); size_hints.flags = USPosition | USSize; size_hints.x = win_x; size_hints.y = win_y; menuwin = temp; /* reset menuwin to see if this is causing the error */ /* I get the same error whether menuwin = original value * or the panes[12] window id. This problem only occurs * the second time the subrountine is called. The program * works fine the first time. */ XSetStandardProperties(Disp, menuwin, window_name, icon_name, None, Argv, Argc, &size_hints); for (winindex = counter; winindex < MAX_CHOICE + counter; winindex++) { XMapSubwindows(Disp, panes[winindex]); } XMapSubwindows(Disp, menuwin); /* create gcs (code deleted) */ XMapWindow(Disp, menuwin); XWarpPointer(Disp, None, PopupMenuBar, None, None, None, None, width - 10, pane_height/2); for (winindex = counter; winindex < MAX_CHOICE + counter; winindex++) { /* this causes the labels to be written on the panes */ paint_pane(panes[winindex], panes, mgc, PopupMenuFont, WHITE); } return; }