[comp.windows.x] Problem with popups and focus

news@bellcore.bellcore.com (news) (10/16/90)

I'm having trouble with popup windows.  Under openwin and under
whatever DEC's window manager is (mwm?), I can't manage to type to the
popup.  I get perfectly fine behavior using twm.  I assume that a power
struggle of some sort is going on between my application and some window
managers.

My program is written using Xt and the old HP widgets, and I'm building
a popup window on the fly.  Here are some code fragments:

void
fname_popup(popup_pop)
    Widget popup_pop;
{
...
    i = 0;
    if (mono) init_mono(args, &i);
    XtSetArg(args[i], XtNx, x); i++;
    XtSetArg(args[i], XtNy, y); i++;
    fpopup = XtCreatePopupShell("FSavePopup",
        transientShellWidgetClass, popup_pop, args, i);
...
/*
 * Create the text widget to solicit the filename.
*/
    i = 0;
    if (mono) init_mono(args, &i);
    XtSetArg(args[i], XtNeditType, (int) XwtextEdit); i++;
    XtSetArg(args[i], XtNxRefName, (String) "FSaveText"); i++;
    XtSetArg(args[i], XtNxAddWidth, (Boolean) True); i++;
    ftext = XtCreateManagedWidget("FSaveName",
        XwtexteditWidgetClass, fform, args, i);
...
	XtPopup(fpopup, XtGrabExclusive);
}

I never have understood popups very well.  Can someone tell me what I
might do to resolve this problem?  I'm hoping for a solution that can
be implemented in a few lines, of course, using the HP or Athena
widgets; I'm not ready for a wholesale rewrite in another widget set.

Debby
dfs@bellcore.com

murphy@ufp.dco.dec.com (Rick Murphy) (10/19/90)

In article <27913@bellcore.bellcore.com>, news@bellcore.bellcore.com (news)
writes:
 >I'm having trouble with popup windows.  Under openwin and under
>whatever DEC's window manager is (mwm?), I can't manage to type to the
>popup.  I get perfectly fine behavior using twm.  I assume that a power
>struggle of some sort is going on between my application and some window
>managers.
    ...deleted...
>I never have understood popups very well.  Can someone tell me what I
>might do to resolve this problem?  I'm hoping for a solution that can
>be implemented in a few lines, of course, using the HP or Athena
>widgets; I'm not ready for a wholesale rewrite in another widget set.

You need to set XtNinput to true on the popup; otherwise, it won't accept
keyboard focus.
(ICCCM requires this; some window managers are more 'forgiving'.)
	-Rick
--
Rick Murphy, WA1SPT/4			DEC Washington ULTRIX Resource Center
Domain:  murphy@ufp.dco.dec.com -or- murphy@ufp.enet.dec.com
Bang:    decwrl!ufp.enet!murphy
Ding:	 (301) 306-2985
Disclaimer: This nonsense came from an AI program written in TECO. Ignore it.