Fix for intermittent BadMatch bug



This will fix the intermittent BadMatch bug that crops up every so
often.
The problem was that we were trying to set the focus to the parent
window,
which was not guaranteed to be mapped and viewable.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v

retrieving revision 1.446
retrieving revision 1.447
diff -u -r1.446 -r1.447
--- ChangeLog   2000/07/24 17:57:55     1.446
+++ ChangeLog   2000/07/24 20:37:56     1.447
@@ -1,3 +1,9 @@
+2000-07-24  Peter Williams  <peterw@helixcode.com>
+
+       * bonobo/bonobo-socket.c (bonobo_socket_focus_out_event): Fix
+       "BadMatch Bug of Death (TM)" -- we were sometimes setting the
+       focus to an unmapped parent window, which is a no-no.
+
 2000-07-24  Dan Winship  <danw@helixcode.com>
 
        * components/text-plain/bonobo-text-plain.c (pstream_load): The

Index: bonobo-socket.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-socket.c,v
retrieving revision 1.1
diff -u -r1.1 -r1.2
--- bonobo-socket.c     2000/07/06 17:12:21     1.1
+++ bonobo-socket.c     2000/07/24 20:37:56     1.2
@@ -390,13 +390,17 @@
 {
        GtkWidget *toplevel;
        BonoboSocket *socket;
+       XWindowAttributes attr;
 
        g_return_val_if_fail (BONOBO_IS_SOCKET (widget), FALSE);
        socket = BONOBO_SOCKET (widget);
 
        toplevel = gtk_widget_get_ancestor (widget,
gtk_window_get_type());
-  
-       if (toplevel)
+       XGetWindowAttributes (GDK_DISPLAY (), GDK_WINDOW_XWINDOW
(toplevel->window), &attr);
+
+       /* FIXME: can we just check the return value of 
+        * XGetWindowAttributes? */
+       if (toplevel && attr.map_state == IsViewable)
        {
                XSetInputFocus (GDK_DISPLAY (),
                                GDK_WINDOW_XWINDOW (toplevel->window),

--
Peter Williams -- peterw@helixcode.com




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