Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!purdue!decwrl!hplabs!hp-pcd!hpcvlx!fred
From: fred@hpcvlx.HP.COM (Fred Taft)
Newsgroups: comp.windows.x
Subject: Re: HP's Xtk Fixes (as Context Diffs)
Message-ID: <1610048@hpcvlx.HP.COM>
Date: 19 Aug 88 19:52:22 GMT
References: <1610043@hpcvlx.HP.COM>
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 89

### bug number:   649
### area:         Xt
### severity:     low
### comments:     

VERSION:
	X Window System, Version 11, Release 2

AREA:
	Xt

SYNOPSIS:
	XtNameToWidget fails on primitives with popup children

DESCRIPTION:
	The XtNameToWidget function that translates a widget name 
        to a widget instance doesn't take into account a primitive 
        widget with popup childrens. This is used, for instance, with 
        the HP Widget set when using their menu manager, menu panels, etc...  

	Is the "if (!XtIsComposite(root)) return NULL;" to strong in 
        NameListToWidget?

FIX:

*** Intrinsic.c	Fri Aug 19 12:13:12 1988
--- Intrinsic.new.c	Fri Aug 19 12:12:57 1988
***************
*** 249,255
  
      name = *names;
      if (name == NULLQUARK) return root;
-     if (! XtIsComposite(root)) return NULL;
  
      children = ((CompositeWidget) root)->composite.children;
      for (i = 0; i < ((CompositeWidget) root)->composite.num_children; i++) {

--- 249,254 -----
  
      name = *names;
      if (name == NULLQUARK) return root;
  
      /* Check normal children only if this is a composite widget */
      if (XtIsComposite(root))
***************
*** 251,260
      if (name == NULLQUARK) return root;
      if (! XtIsComposite(root)) return NULL;
  
!     children = ((CompositeWidget) root)->composite.children;
!     for (i = 0; i < ((CompositeWidget) root)->composite.num_children; i++) {
! 	if (name == children[i]->core.xrm_name)
! 	    return NameListToWidget(children[i], &names[1]);
      }
      children = root->core.popup_list;
      for (i = 0; i < root->core.num_popups; i++) {

--- 250,263 -----
      name = *names;
      if (name == NULLQUARK) return root;
  
!     /* Check normal children only if this is a composite widget */
!     if (XtIsComposite(root))
!     {
!        children = ((CompositeWidget) root)->composite.children;
!        for (i = 0; i < ((CompositeWidget) root)->composite.num_children; i++) {
! 	   if (name == children[i]->core.xrm_name)
! 	       return NameListToWidget(children[i], &names[1]);
!        }
      }
  
      /* Even non-composite widgets may have popup children */
***************
*** 256,261
  	if (name == children[i]->core.xrm_name)
  	    return NameListToWidget(children[i], &names[1]);
      }
      children = root->core.popup_list;
      for (i = 0; i < root->core.num_popups; i++) {
  	if (name == children[i]->core.xrm_name)

--- 259,266 -----
  	       return NameListToWidget(children[i], &names[1]);
         }
      }
+ 
+     /* Even non-composite widgets may have popup children */
      children = root->core.popup_list;
      for (i = 0; i < root->core.num_popups; i++) {
  	if (name == children[i]->core.xrm_name)