[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Take 2: heavy window redrawing can lead to creash
From: |
Willem Rein Oudshoorn |
Subject: |
Take 2: heavy window redrawing can lead to creash |
Date: |
23 Nov 2001 18:12:08 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
Please ignore the previous patch (the one with the Server Grab in it).
The previous patch works, but this one is better.
The diff is against the current CVS version. (Withoug my previous patch)
2001-11-23 Willem Rein Oudshoorn <woudshoo@xs4all.nl>
* xgps/Source/XGGState.m ([XGGState -visibleRectForWindow:win]):
completely rewritten.
Index: Source/XGGState.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/xgps/Source/XGGState.m,v
retrieving revision 1.66
diff -c -r1.66 XGGState.m
*** Source/XGGState.m 2001/11/21 03:35:32 1.66
--- Source/XGGState.m 2001/11/23 17:07:43
***************
*** 2301,2367 ****
- (XRectangle) visibleRectForWindow: (Window) win
{
! XPoint offs; // offset of the argument window in the current window
! XRectangle visible; // part of argument window that is visible in current
window
!
! Window root; // root is where we stop.
! Window parent;
! Window *children; // to be ignored
int x, y, w, h;
int ignored;
-
! XGetGeometry (XDPY,
win,
&root,
&x, &y,
&w, &h,
&ignored,
&ignored);
-
- visible = XGMakeRect (0, 0, w, h);
- offs = XGMakePoint (x, y);
-
- do
- {
- XRectangle bounds;
-
- XQueryTree (XDPY,
- win,
- &root,
- &parent,
- &children,
- &ignored);
-
- if (children != NULL)
- XFree (children);
-
- win = parent;
-
- XGetGeometry (XDPY,
- win,
- &root,
- &x, &y,
- &w, &h,
- &ignored,
- &ignored);
-
-
- //FIXME: These -1 should not be here, but due to
- // some bug elsewhere, which I can not find at the
- // moment they are neccessary
-
- bounds = XGMakeRect (-offs.x, -offs.y, w - 1, h - 1);
-
- visible = XGIntersectionRect (visible, bounds);
-
- offs.x += x;
- offs.y += y;
-
- } while (root != win);
!
! return visible;
}
@end
--- 2301,2344 ----
- (XRectangle) visibleRectForWindow: (Window) win
{
! Display* xdpy = XDPY;
! XRectangle winRect;
! Window root;
! Window ignore;
int x, y, w, h;
int ignored;
! XGetGeometry (xdpy,
win,
&root,
&x, &y,
&w, &h,
&ignored,
&ignored);
! winRect = XGMakeRect (0, 0, w, h);
!
! XGetGeometry (xdpy,
! root,
! &root,
! &ignored, &ignored,
! &w, &h,
! &ignored,
! &ignored);
!
! if (!XTranslateCoordinates (xdpy,
! root,
! win,
! 0, 0,
! &x, &y,
! &ignore))
! { // Should not happen, but if it does play safe.
! return XGMakeRect (0, 0, 0, 0);
! }
! else
! {
! return XGIntersectionRect (winRect, XGMakeRect (x, y, w, h));
! }
}
@end
- Take 2: heavy window redrawing can lead to creash,
Willem Rein Oudshoorn <=