[comp.windows.x] Input focus under OLWM

mac@trantor.harris-atd.com (Mike McDonald) (06/15/90)

  I written an application using Xlib that needs both KeyPress and
ButtonPress events. The program works correctly when I'm running twm but
whenever I try to run it under OLWM, it never gets the input focus. (I
do get the button events though.) Does anyone have any ideas of what I'm
doing wrong?

Configurations: Sun3/60s and 3/80s running SunOS4.0.3. Twm is running
under MIT X11R4.11. We've tried OpenWindows 2.0 Beta and MIT X11R4.11
using OpenWindows OLWM.

  Mike McDonald

  mac@trantor.harris-atd.com
  (407) 727-5060

  Advanced Technology Dept.
  Harris Corp.
  M.S. 3A-1912
  P.O. Box 37
  Melbourne, Florida
             32902

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (06/16/90)

> I written an application using Xlib that needs both KeyPress and
> ButtonPress events. The program works correctly when I'm running twm
> but whenever I try to run it under OLWM, it never gets the input
> focus.

Almost certainly, you're not setting the input hint.  In short, your
application is not asking for input; twm is willing to give it to you
anyway, whereas OLWM is not.

> (I do get the button events though.)

Pointer events, such as ButtonPress events, always go where the pointer
is[%]; there is no "please give me / don't give me pointer events"
window manager hint.

Look up XSetWMProperties in the R4 Xlib documentation; that's what you
need to call.  (The crucial thing is the wm_hints.input bit, which
should be set to True.  Of course, you'll also need to add InputHint to
the wm_hints.flags field.)

[%] Grabs complicate things; they can cause events to be generated
    relative to windows that have no relation to the windows they would
    normally be generated relative to.  But this is true of keyboard
    and pointer events both, so it has no relevance to my point above.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu