fun with window managers.. (help!)



Hi:

In support of the Gnome Onscreen Keyboard project
(http://developer.gnome.org/projects/AT/GOK) I am testing out ways of
creating GtkWindows that stay on top, and don't take keyboard focus (so
that if used with an alternate pointing device serving as mouse, the key
events the virtual keyboard synthesizes still go to the 'default'
keyboard focus window).  In other words, I need a window that sits on
top of everything but does not cause keyboard focus changes when clicked
on.

It the moment I am using X api mostly because I have docs for it that
are a little more complete than the GDK ones, but I'd like to migrate as
much as possible to gdk to avoid too many explicit X dependencies.

I am running sawfish 0.36, which claims to respect WM_TAKE_FOCUS.  But
it looks as though GDK maybe always calls XSetInputFocus() when it
receives WM_TAKE_FOCUS, which is not what we want.  Furthermore I am
warned that sawfish may not respect these settings if they are called on
already-mapped windows, but it looks to me as though I can't set them on
GDK windows unless they have already been mapped, since I can't change
the initial property/flag settings on gdk_window_new(), can I ?

I need any advice, suggestions as to the best way to do this within GTK+
and GDK.  Below is some code that does *not* appear to work ;-)

  Atom protos;

...

  protos = XInternAtom(GDK_DISPLAY(), "WM_TAKE_FOCUS", False);
  gtk_widget_show (window);
  XSetWMProtocols (GDK_DISPLAY(), GDK_WINDOW_XID (window->window),
&protos, 1);
  wm_hints = XAllocWMHints();
  wm_hints->input = False;
  wm_hints->flags = InputHint;
  XSetWMHints (GDK_DISPLAY (),
	       GDK_WINDOW_XID (window->window),
	       wm_hints);
  XFree (wm_hints);

  gtk_main ();
 ...

When this window is first mapped, it comes to the front.  It is part of
the window focus cycle chain, and if it's unfocussed it still receives
focus on mouseclick.

So what's the best approach?

Thanks

-Bill



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]