Re: Focus fixes on new 2.4 schedule?



On Tue, Feb 17, 2004 at 06:07:56PM -0600, Gregory Merchan wrote:
> Could the change to the globally active input model be
> put on the 2.4 schedule now? There is a patch for a
> significant portion of the change in bugzilla.
> 
> The bugs for the fix can be seen here:
> 
>   http://bugzilla.gnome.org/showdependencytree.cgi?id=133047

If it's too much, then please consider one small part.
Bug #133042 asks for an API to issue a SetInputFocus request.
This can be done now by using X directly, but that will
leave gdk in a bad state since the focus window is not
public. A hack I've used in demo programs is to query the
xwindow tree and hope that an xwindow with geometry 1x1-1-1
is the GdkToplevelX11 focus_window.

One option is to change the X11 backend of gdk_window_focus()
to issue the request, instead of sending a _NET_ACTIVE_WINDOW
message for the window manager. This is easy and allows for
a bug fix too:

  void
  gdk_window_focus (GdkWindow *window, guint32 timestamp)
  {
    GdkDisplay     *display;
    GdkToplevelX11 *toplevel;
        
    g_return_if_fail (GDK_IS_WINDOW (window));
    
    if (GDK_WINDOW_DESTROYED (window))
      return;
      
    display = GDK_WINDOW_DISPLAY (window);

    toplevel = _gdk_x11_window_get_toplevel (window);

    _gdk_x11_set_input_focus_safe (display,
                                   toplevel->focus_window,
                                   RevertToParent,
                                   timestamp);
    
  }

[ At the moment, gdk_window_focus() sets focus to the xwindow
  of the passed-in GdkWindow, not the focus_window. ]

Another option is to add new API. It would be something simple like:

  void gdk_window_set_input_focus (GdkWindow *window,
                                   guint32    timestamp);

The X11 backend being:

  void
  gdk_window_set_input_focus (GdkWindow *window, guint32 timestamp)
  {
    GdkDisplay     *display;
    GdkToplevelX11 *toplevel;
        
    g_return_if_fail (GDK_IS_WINDOW (window));
    
    if (GDK_WINDOW_DESTROYED (window))
      return;
      
    display = GDK_WINDOW_DISPLAY (window);

    toplevel = _gdk_x11_window_get_toplevel (window);

    _gdk_x11_set_input_focus_safe (display,
                                   toplevel->focus_window,
                                   RevertToParent,
                                   timestamp);
  }

The Win32 backend seems to be:

  void
  gdk_window_set_input_focus (GdkWindow *window, guint32 timestamp)
  {
    gdk_window_focus (window, timestamp);
  }

linux-fb doesn't have a backend for gdk_window_focus(), so
I've no clue what its backend would be for this.


Cheers,
Greg



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