After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 143349 - GDK cannot give input focus to an override_redirect window
GDK cannot give input focus to an override_redirect window
Status: RESOLVED INCOMPLETE
Product: gtk+
Classification: Platform
Component: Backend: X11
2.4.x
Other Linux
: Normal normal
: Small feature
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-05-28 20:25 UTC by Billy Biggs
Modified: 2010-12-17 06:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Billy Biggs 2004-05-28 20:25:01 UTC
Gtk+ 2.4.1

gdk_window_focus in gdkwindow-x11.c uses the EWMH hint _NET_ACTIVE_WINDOW if
available to ask the window manager to give focus to the top level window.  This
does not seem to work for override_redirect windows, and so in order to give an
override_redirect window input focus you have to use XSetInputFocus directly.

I think the fix is to always use XSetInputFocus if the window is
override_redirect in gdk_window_focus().
Comment 1 Matthias Clasen 2004-06-11 04:04:07 UTC
Sounds reasonable. Do you have a patch ?
Comment 2 Billy Biggs 2004-06-11 04:40:42 UTC
I think this is correct but I have also found that if I grab the pointer and
keyboard, focus seems to work correctly without the patch and I don't quite
understand why that is the case.   I have not yet tested this patch either.

Index: gdkwindow-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkwindow-x11.c,v
retrieving revision 1.206
diff -p -u -r1.206 gdkwindow-x11.c
--- a/gdkwindow-x11.c   6 May 2004 02:57:01 -0000       1.206
+++ b/gdkwindow-x11.c   11 Jun 2004 04:37:58 -0000
@@ -1690,6 +1690,7 @@ void
 gdk_window_focus (GdkWindow *window,
                   guint32    timestamp)
 {
+  XWindowAttributes attrs;
   GdkDisplay *display;
   
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1698,8 +1699,13 @@ gdk_window_focus (GdkWindow *window,
     return;
 
   display = GDK_WINDOW_DISPLAY (window);
+  
+  XGetWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+                       GDK_WINDOW_XID (window), 
+                       &attrs);
 
-  if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
+  if (!attrs.override_redirect &&
+      gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
                                           gdk_atom_intern ("_NET_ACTIVE_WINDOW"
, FALSE)))
     {
       XEvent xev;
Comment 3 Matthias Clasen 2004-12-23 17:20:15 UTC
during grabs, events are not delivered as normal, thats why things appear to work 
when the pointer is grabbed to the override redirect.
Comment 4 Javier Jardón (IRC: jjardon) 2010-10-29 16:25:27 UTC
Thank you for taking the time to report this bug and helping to make GTK+ better.

We are sorry that we do not always have the capacity to look at all reported bugs in a timely manner. There have been many changes in GTK+ since that time you reported the bug and your problem may have been fixed with some of the updates.

It would help us a lot if you could test a current, supported, GTK+ version (2.22 or, even better, current master). If you can test it, and it is still an issue, we would appreciate if you could upload any log / test case that are relevant for this particular issue.
Comment 5 Fabio Durán Verdugo 2010-12-17 06:02:28 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for.
Thanks!