mirror of
https://github.com/gnustep/libs-back.git
synced 2025-05-30 00:40:55 +00:00
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:
parent
3f71ce768e
commit
605ce8e712
3 changed files with 32 additions and 1 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue