Tue Sep 7 08:50:03 PDT 1999

(Raster)

added lots of paranoia checkign around the PixImg stuff in draw.c - if creation
fails at any point it cleans up and bails out... if creation of any piximg
fails E drops back to opque move mode automatically.


SVN revision: 188
This commit is contained in:
Carsten Haitzler 1999-09-07 15:44:23 +00:00
parent 7b7fe410fa
commit 005d2f7366
2 changed files with 65 additions and 0 deletions

View File

@ -1325,3 +1325,12 @@ Tue Sep 7 00:12:33 PDT 1999
(Raster)
you can now drag from the pager into the iconbox.. :)
-------------------------------------------------------------------------------
Tue Sep 7 08:50:03 PDT 1999
(Raster)
added lots of paranoia checkign around the PixImg stuff in draw.c - if creation
fails at any point it cleans up and bails out... if creation of any piximg
fails E drops back to opque move mode automatically.

View File

@ -266,18 +266,67 @@ ECreatePixImg(Window win, int w, int h)
return NULL;
pi = Emalloc(sizeof(PixImg));
if (!pi)
return NULL;
pi->shminfo = Emalloc(sizeof(XShmSegmentInfo));
if (!pi->shminfo)
{
Efree(pi);
return NULL;
}
pi->xim = XShmCreateImage(disp, root.vis, root.depth, ZPixmap, NULL,
pi->shminfo, w, h);
if (!pi->xim)
{
Efree(pi->shminfo);
Efree(pi);
return NULL;
}
pi->shminfo->shmid = shmget(IPC_PRIVATE, pi->xim->bytes_per_line *
pi->xim->height, IPC_CREAT | 0666);
if (pi->shminfo->shmid < 0)
{
XDestroyImage(pi->xim);
Efree(pi->shminfo);
Efree(pi);
return NULL;
}
pi->shminfo->shmaddr = pi->xim->data = shmat(pi->shminfo->shmid, 0, 0);
if (!pi->shminfo->shmaddr)
{
shmctl(pi->shminfo->shmid, IPC_RMID, 0);
XDestroyImage(pi->xim);
Efree(pi->shminfo);
Efree(pi);
return NULL;
}
pi->shminfo->readOnly = False;
XShmAttach(disp, pi->shminfo);
pi->pmap = XShmCreatePixmap(disp, win, pi->shminfo->shmaddr, pi->shminfo,
w, h, root.depth);
if (!pi->pmap)
{
XShmDetach(disp, pi->shminfo);
shmdt(pi->shminfo->shmaddr);
shmctl(pi->shminfo->shmid, IPC_RMID, 0);
XDestroyImage(pi->xim);
Efree(pi->shminfo);
Efree(pi);
return NULL;
}
gcv.subwindow_mode = IncludeInferiors;
pi->gc = XCreateGC(disp, win, GCSubwindowMode, &gcv);
if (!pi->gc)
{
XShmDetach(disp, pi->shminfo);
shmdt(pi->shminfo->shmaddr);
shmctl(pi->shminfo->shmid, IPC_RMID, 0);
XDestroyImage(pi->xim);
Efree(pi->shminfo);
XFreePixmap(disp, pi->pmap);
Efree(pi);
return NULL;
}
return pi;
}
@ -1030,6 +1079,13 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
root_pi = ECreatePixImg(root.win, root.w, root.h);
ewin_pi = ECreatePixImg(root.win, ewin->w, ewin->h);
draw_pi = ECreatePixImg(root.win, ewin->w, ewin->h);
if ((!root_pi) || (!ewin_pi) || (!draw_pi))
{
mode.movemode = 0;
UngrabX();
DrawEwinShape(ewin, mode.movemode, x, y, w, h, firstlast);
EDBUG_RETURN_;
}
EFillPixmap(root.win, root_pi->pmap, x1, y1, ewin->w, ewin->h);
EFillPixmap(ewin->win, ewin_pi->pmap, 0, 0, ewin->w, ewin->h);
EBlendPixImg(ewin, root_pi, ewin_pi, draw_pi, x, y,