Fix (hopefully) the problem with windows turning all white.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14310 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2002-08-20 22:18:36 +00:00
parent 7c35f43688
commit 7030f9a839
2 changed files with 40 additions and 19 deletions

View file

@ -1,3 +1,9 @@
2002-08-21 Alexander Malmberg <alexander@malmberg.org>
* Source/art/ARTContext.m: ([WinImage -_exposeRect:]) Guard against
invalid coordinates to (hopefully) fix the problem with windows
turning all white and BadValue warnings appearing.
2002-08-20 Alexander Malmberg <alexander@malmberg.org> 2002-08-20 Alexander Malmberg <alexander@malmberg.org>
* Headers/art/, Source/art/: Add back-art, a backend based on * Headers/art/, Source/art/: Add back-art, a backend based on

View file

@ -382,30 +382,40 @@ extern int XShmGetEventBase(Display *d);
if (r.size.height<=0) if (r.size.height<=0)
return; return;
} }
XShmPutImage(display,drawable,gc,ximage, if (!XShmPutImage(display,drawable,gc,ximage,
r.origin.x,r.origin.y, r.origin.x,r.origin.y,
r.origin.x,r.origin.y, r.origin.x,r.origin.y,
r.size.width,r.size.height, r.size.width,r.size.height,
1); 1))
pending_event=1; {
NSLog(@"XShmPutImage failed?");
}
else
{
pending_event=1;
}
} }
// XFlush(window->display); // XFlush(window->display);
} }
-(void) _exposeRect: (NSRect)r -(void) _exposeRect: (NSRect)r
{ {
if (r.origin.x+r.size.width>window->xframe.size.width) /* TODO: Somehow, we can get negative coordinates in the rectangle. So far
{ I've tracked them back to [NSWindow flushWindow]. Should probably figure
r.size.width=window->xframe.size.width-r.origin.x; out where they're coming from originally, and see if they really should be
if (r.size.width<=0) negative. (Seems to happen when a window is created or resized, so possibly
return; something is refreshing while coordinates are still invalid.
}
if (r.origin.y+r.size.height>window->xframe.size.height) Also, just about every resize of a window causes a few calls here with
{ rects in the new size before we are updated.
r.size.height=window->xframe.size.height-r.origin.y;
if (r.size.height<=0) For now, we just intersect with our known size to avoid problems with X.
return; */
}
r=NSIntersectionRect(r,NSMakeRect(0,0,
window->xframe.size.width,window->xframe.size.height));
if (NSIsEmptyRect(r))
return;
if (use_shm) if (use_shm)
{ {
@ -501,13 +511,18 @@ static int warn=0;
else else
{ {
pending_put=0; pending_put=0;
XShmPutImage(display,drawable,gc,ximage, if (!XShmPutImage(display,drawable,gc,ximage,
r.origin.x,r.origin.y, r.origin.x,r.origin.y,
r.origin.x,r.origin.y, r.origin.x,r.origin.y,
r.size.width,r.size.height, r.size.width,r.size.height,
1); 1))
// XFlush(display); {
pending_event=1; NSLog(@"XShmPutImage failed?");
}
else
{
pending_event=1;
}
} }
/* Performance hack. Check right away for ShmCompletion /* Performance hack. Check right away for ShmCompletion