[comp.windows.x] xnews problems with input

smarks@eng.sun.COM (Stu t Marks) (05/30/90)

| The department here runs 'xnews' (version 1.0.1) on the SparcStations 
| that we have here.  The problem is that when I take the code that I
| wrote for X11R3 to xnews it doesn't recieve input from the keyboard.
| 
| As an experiment, I called XSetInputFocus() and received input
| for as long as the pointer remained in the window.  (before the &@$*
| window manager took control again).
| 
| Anyway how has Sun muddled things up, and what do I have to do
| to recieve input from the keyboard?

Sorry, this isn't because of any "muddling up" by Sun.  I suspect that your
program isn't supplying the proper "hints" that will allow it to receive
the input focus.  These hints are defined by the ICCCM (an X Consortium
Standard), and the window manager in xnews (really, OpenWindows) will only
assign the focus to a window if it has supplied the proper hints.

Here's a code fragment that you can patch into your program so that it
will create the proper input focus hint.

    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    ...
    Display *dpy;
    Window win;
    XWMHints wmhints;
    ...
    dpy = XOpenDisplay(...);
    ...
    win = XCreateSimpleWindow(...);
    ...
    wmhints.flags = InputHint;
    wmhints.input = True;
    XSetWMHints(dpy, win, &wmhints);
    XMapWindow(dpy, win);

s'marks

Stuart W. Marks			ARPA: smarks@eng.sun.com
Window Systems Group		UUCP: sun!smarks
Sun Microsystems, Inc.