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