If possible, create a shared pixmap from the image data and use it as the window's background pixmap.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14501 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2002-09-21 10:16:47 +00:00
parent 3f71ce768e
commit 605ce8e712
3 changed files with 32 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2002-09-21 12:14 Alexander Malmberg <alexander@malmberg.org>
* Headers/x11/XWindowBuffer.h, Source/x11/XWindowBuffer.m
(+windowBufferForWindow:depthInfo:): If possible, create a shared
pixmap from the image data and set it as the background of the
window.
2002-09-20 18:36 Alexander Malmberg <alexander@malmberg.org>
* Source/art/path.m (clip_svp_callback): Use correct x coordinate

View file

@ -67,6 +67,7 @@ that there's only one XWindowBuffer for each window. */
Drawable drawable;
XImage *ximage;
Display *display;
Pixmap pixmap;
int use_shm;
XShmSegmentInfo shminfo;

View file

@ -117,6 +117,13 @@ static int use_shape_hack = 0; /* this is an ugly hack :) */
else
XDestroyImage(wi->ximage);
}
if (wi->pixmap)
{
XFreePixmap(wi->display,wi->pixmap);
XSetWindowBackground(wi->display,wi->window->ident,None);
wi->pixmap=0;
}
wi->has_alpha = 0;
if (wi->alpha)
{
@ -150,10 +157,26 @@ static int use_shape_hack = 0; /* this is an ugly hack :) */
NSLog(@"shmget() failed"); /* TODO */
wi->shminfo.shmaddr = wi->ximage->data = shmat(wi->shminfo.shmid, 0, 0);
wi->shminfo.readOnly = 1;
wi->shminfo.readOnly = 0;
if (!XShmAttach(wi->display, &wi->shminfo))
NSLog(@"XShmAttach() failed");
/* We try to create a shared pixmap using the same buffer, and set
it as the background of the window. This allows X to handle expose
events all by itself, which avoids white flashing when things are
dragged across a window. */
/* TODO: we still get and handle expose events, although we don't
need to. */
wi->pixmap=XShmCreatePixmap(wi->display,wi->drawable,
wi->ximage->data,&wi->shminfo,
wi->window->xframe.size.width,
wi->window->xframe.size.height,
aDI->drawing_depth);
if (wi->pixmap)
{
XSetWindowBackgroundPixmap(wi->display,wi->window->ident,wi->pixmap);
}
/* On some systems (eg. freebsd), X can't attach to the shared
segment if it's marked for destruction, so we make sure it's
attached before marking it. */