bug-gnustep
[Top][All Lists]
Advanced

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

Tiny fix to avoid an X11 error


From: Wim Oudshoorn
Subject: Tiny fix to avoid an X11 error
Date: Fri, 16 Nov 2001 21:20:22 +0100 (CET)

If during a drag operation you move the mouse pointer into the
rootWindow an X protocol error is generated.  The reason for this is
that the function

_findXWindow 

does not return a valid window.  The following patch fixes this.

NOTE on the patch:

A)  This function is, as far as I can see, only called with 
        the argument `topwindow' equal to root.

B)  It fails because the algorithme does inspect all children
        of `topwindow' but not `topwindow' itself.

C)  The fix will return the rootwindow if the original algorithme
        fails. 

D)  Probably a better solution would be: 
        - If the original algorithme fails, check `topwindow'
        - If previous step fails return `root'


OBSERVATION

I lost my XLib programming books after moving, but I think
the algorithme used in the _findXWindow function is wrong,
It uses the fields x, y, width, height from the XWindowAttribute
struct.  But x and y are relative to the parent window and
the algorithme does not take that into account. :-(


I just spend the day hunting the bug in

-[XGGState _compositeGState:fromRect:toPoint:op:]

that makes GNUstep apps crash when dragging an icon near the screen
borders.
Now it seems that all my effort is in vain.

Adam Fedor wrote:
> I had fixed this problem then apparently lost the changes, so I'll
> have to fix it again....

Well, Adam, if have a fix for this also. BUT it needs cleanup.
Because I am totally clueless with respect to what is already
stored in the xgps backend my current implementation is probably
not very efficient.

Wim Oudshoorn.


==================================================================

2001-11-16  Willem Rein Oudshoorn  <woudshoo@xs4all.nl>

        * XGContextEvent.m (_findXWindow): If lookup fails return
        rootwindow and not the None window.
        

Index: XGContextEvent.m
===================================================================
RCS file:
/cvsroot/gnustep/gnustep/core/xgps/Source/SharedX/XGContextEvent.m,v
retrieving revision 1.75
diff -c -r1.75 XGContextEvent.m
*** XGContextEvent.m    2001/11/07 18:40:11     1.75
--- XGContextEvent.m    2001/11/16 19:40:51
***************
*** 2609,2614 ****
--- 2609,2619 ----
   * 4. To find the topmost window under the mouse, we must therefore
   *    check each child from the end of the list back to the start.
   * 5. We expect to encounter our drag window first ... and ignore it.
+  * 6. If we do not find any window we return the root window
+  *
+  *    (FIXME: w.r.t. 6: should we return the root? or the topwindow?
+  *            at the moment it is only called with topwindow == root,
+  *            so it does not really matter)
   */
  static Window
  _findXWindow(Display *display, Window topwindow, Window ignore, int x,
int y)
***************
*** 2645,2649 ****
--- 2650,2660 ----
        }
      }
    XFree(children);
+ 
+   if (found == (Window) None)
+     {
+       found = root;
+     }
+   
    return found;
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]