Tue Sep 21 19:37:31 PDT 1999

(Raster)

fix possible memory leak

cleaned up some code

fixed positioning on restart/start of internal wins

fixed iconified startup bugs for clients that ask to be iconified on start

fixed icon pixmap bugs

took my iguana for a walk around the block


SVN revision: 359
This commit is contained in:
Carsten Haitzler 1999-09-22 02:13:51 +00:00
parent e007b4d1c7
commit 80a8e772f7
20 changed files with 614 additions and 311 deletions

View File

@ -2128,3 +2128,20 @@ Tue Sep 21 17:06:31 EST 1999
(Christian) (Christian)
Updated the Eterm theme and some minor fixes. Updated the Eterm theme and some minor fixes.
-------------------------------------------------------------------------------
Tue Sep 21 19:37:31 PDT 1999
(Raster)
fix possible memory leak
cleaned up some code
fixed positioning on restart/start of internal wins
fixed iconified startup bugs for clients that ask to be iconified on start
fixed icon pixmap bugs
took my iguana for a walk around the block

View File

@ -25,6 +25,9 @@
#include <Imlib.h> #include <Imlib.h>
#include <Fnlib.h> #include <Fnlib.h>
/* dmalloc debugging */
/*#include <dmalloc.h> */
/* sgi's stdio.h has: /* sgi's stdio.h has:
* *
* #if _SGIAPI && _NO_ANSIMODE * #if _SGIAPI && _NO_ANSIMODE
@ -1816,7 +1819,7 @@ void SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty,
void SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, void SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx,
int *ty, int num_wins, int speed); int *ty, int num_wins, int speed);
void AddToFamily(Window win); void AddToFamily(Window win);
EWin *AddInternalToFamily(Window win, char noshow, char *bname); EWin *AddInternalToFamily(Window win, char noshow, char *bname, int type, void *ptr);
void SetEwinBorder(EWin * ewin); void SetEwinBorder(EWin * ewin);
void SetEwinToBorder(EWin * ewin, Border * b); void SetEwinToBorder(EWin * ewin, Border * b);
void HonorIclass(char *s, int id); void HonorIclass(char *s, int id);
@ -1830,7 +1833,7 @@ int ChangeEwinWinpartContents(EWin * ewin, int i);
void CalcEwinWinpart(EWin * ewin, int i); void CalcEwinWinpart(EWin * ewin, int i);
void CalcEwinSizes(EWin * ewin); void CalcEwinSizes(EWin * ewin);
EWin *Adopt(Window win); EWin *Adopt(Window win);
EWin *AdoptInternal(Window win, Border * border); EWin *AdoptInternal(Window win, Border * border, int type, void *ptr);
EWin *CreateEwin(void); EWin *CreateEwin(void);
void FreeEwin(EWin * ewin); void FreeEwin(EWin * ewin);
@ -2531,6 +2534,8 @@ void SetSMUserThemePath(char *path);
char *GetSMFile(void); char *GetSMFile(void);
char *GetGenericSMFile(void); char *GetGenericSMFile(void);
void MatchEwinToSM(EWin * ewin); void MatchEwinToSM(EWin * ewin);
void MatchToSnapInfoPager(Pager * p);
void MatchToSnapInfoIconbox(Iconbox * ib);
void SaveSession(int shutdown); void SaveSession(int shutdown);
void autosave(void); void autosave(void);

View File

@ -607,6 +607,8 @@ AddToFamily(Window win)
RaiseProgressbars(); RaiseProgressbars();
ShowEwin(ewin); ShowEwin(ewin);
StackDesktops(); StackDesktops();
UngrabX();
ewin->iconified = 0;
IconifyEwin(ewin); IconifyEwin(ewin);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
@ -774,7 +776,7 @@ AddToFamily(Window win)
} }
EWin * EWin *
AddInternalToFamily(Window win, char noshow, char *bname) AddInternalToFamily(Window win, char noshow, char *bname, int type, void *ptr)
{ {
EWin *ewin; EWin *ewin;
int x, y; int x, y;
@ -789,16 +791,12 @@ AddInternalToFamily(Window win, char noshow, char *bname)
b = FindItem(bname, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER); b = FindItem(bname, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
if (!b) if (!b)
b = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER); b = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
ewin = AdoptInternal(win, b); ewin = AdoptInternal(win, b, type, ptr);
ResizeEwin(ewin, ewin->client.w, ewin->client.h); ResizeEwin(ewin, ewin->client.w, ewin->client.h);
if (ewin->desktop < 0) if (ewin->desktop < 0)
{ ewin->desktop = desks.current;
ewin->desktop = desks.current;
}
else else
{ ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
}
x = ewin->client.x - ewin->border->border.left; x = ewin->client.x - ewin->border->border.left;
y = ewin->client.y - ewin->border->border.top; y = ewin->client.y - ewin->border->border.top;
AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN); AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
@ -1258,7 +1256,7 @@ Adopt(Window win)
} }
EWin * EWin *
AdoptInternal(Window win, Border * border) AdoptInternal(Window win, Border * border, int type, void *ptr)
{ {
EWin *ewin; EWin *ewin;
Border *b; Border *b;
@ -1274,6 +1272,11 @@ AdoptInternal(Window win, Border * border)
ICCCM_GetShapeInfo(ewin); ICCCM_GetShapeInfo(ewin);
ICCCM_GetGeoms(ewin, 0); ICCCM_GetGeoms(ewin, 0);
/* if (type == 1)
* MatchEwinToSnapInfoPager(ewin, (Pager *)ptr);
* else if (type == 2)
* MatchEwinToSnapInfoIconbox(ewin, (Iconbox *)ptr);
* else */
MatchEwinToSnapInfo(ewin); MatchEwinToSnapInfo(ewin);
if (!ewin->border) if (!ewin->border)
ewin->border = border; ewin->border = border;

View File

@ -571,7 +571,7 @@ ShowDialog(Dialog * d)
STATE_NORMAL, 0); STATE_NORMAL, 0);
queue_up = pq; queue_up = pq;
ewin = AddInternalToFamily(d->win, 1, "DEFAULT"); ewin = AddInternalToFamily(d->win, 1, "DEFAULT", 0, d);
XSelectInput(disp, d->win, ExposureMask | PointerMotionMask | XSelectInput(disp, d->win, ExposureMask | PointerMotionMask |
EnterWindowMask | LeaveWindowMask | EnterWindowMask | LeaveWindowMask |
FocusChangeMask | KeyPressMask); FocusChangeMask | KeyPressMask);

View File

@ -43,7 +43,6 @@ HandleDrawQueue()
{ {
if ((lst[i]->win == dq->win) && (lst[i]->text)) if ((lst[i]->win == dq->win) && (lst[i]->text))
{ {
Efree(dq->text);
already = 1; already = 1;
i = num; i = num;
} }
@ -146,6 +145,8 @@ HandleDrawQueue()
dq->iclass->ref_count--; dq->iclass->ref_count--;
if (dq->tclass) if (dq->tclass)
dq->tclass->ref_count--; dq->tclass->ref_count--;
if (dq->text)
Efree(dq->text);
Efree(dq); Efree(dq);
} }
} }
@ -203,6 +204,10 @@ HandleDrawQueue()
PagerRedraw(lst[i]->redraw_pager, lst[i]->newbg); PagerRedraw(lst[i]->redraw_pager, lst[i]->newbg);
/* printf("p %x\n", lst[i]->win); */ /* printf("p %x\n", lst[i]->win); */
} }
if (lst[i]->iclass)
lst[i]->iclass->ref_count--;
if (lst[i]->tclass)
lst[i]->tclass->ref_count--;
Efree(lst[i]); Efree(lst[i]);
} }
Efree(lst); Efree(lst);
@ -755,6 +760,7 @@ EBlendPixImg(EWin * ewin, PixImg * s1, PixImg * s2, PixImg * dst, int x, int y,
} }
/* workaround since XCopyArea doesnt always work with shared pixmaps */ /* workaround since XCopyArea doesnt always work with shared pixmaps */
XShmPutImage(disp, root.win, gc, dst->xim, ox, oy, x, y, w, h, False); XShmPutImage(disp, root.win, gc, dst->xim, ox, oy, x, y, w, h, False);
/* XCopyArea(disp, dst->pmap, root.win, gc, ox, oy, w, h, x, y); */
} }
/* I dont believe it - you cannot do this to a shared pixmaps to the screen */ /* I dont believe it - you cannot do this to a shared pixmaps to the screen */
/* XCopyArea(disp, dst->pmap, root.win, dst->gc, x, y, w, h, x, y); */ /* XCopyArea(disp, dst->pmap, root.win, dst->gc, x, y, w, h, x, y); */
@ -1318,7 +1324,7 @@ PropagateShapes(Window win)
rects[num_rects - rn + k].height = rl[k].height; rects[num_rects - rn + k].height = rl[k].height;
} }
} }
XFree(rl); Efree(rl);
} }
else else
{ {
@ -1352,7 +1358,7 @@ PropagateShapes(Window win)
EShapeCombineMask(disp, win, ShapeBounding, 0, 0, EShapeCombineMask(disp, win, ShapeBounding, 0, 0,
None, ShapeSet); None, ShapeSet);
} }
XFree(rl); Efree(rl);
} }
else else
EShapeCombineMask(disp, win, ShapeBounding, 0, 0, None, ShapeSet); EShapeCombineMask(disp, win, ShapeBounding, 0, 0, None, ShapeSet);

View File

@ -560,6 +560,18 @@ HKeyRelease(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
#if 0
struct _pbuf
{
int w, h, depth;
Pixmap id;
void *stack[32];
struct _pbuf *next;
};
extern struct _pbuf *pbuf = NULL;
#endif
void void
HButtonPress(XEvent * ev) HButtonPress(XEvent * ev)
{ {
@ -568,6 +580,60 @@ HButtonPress(XEvent * ev)
LIST_FINDBY_NAME, LIST_TYPE_SCLASS)); LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
HandleMouseDown(ev); HandleMouseDown(ev);
EDisplayMemUse(); EDisplayMemUse();
#if 0
{
int x, y, maxh = 0, count = 0, mcount = 0, ww, hh;
struct _pbuf *pb;
GC gc;
XGCValues gcv;
gc = XCreateGC(disp, root.win, 0, &gcv);
XSetForeground(disp, gc, WhitePixel(disp, root.scr));
fprintf(stderr, "Pixmaps allocated:\n");
x = 0;
y = 0;
XClearWindow(disp, root.win);
for (pb = pbuf; pb; pb = pb->next)
{
ww = pb->w;
hh = pb->h;
if (ww > 64)
ww = 64;
if (hh > 64)
hh = 64;
if (x + ww > root.w)
{
x = 0;
y += maxh;
maxh = 0;
}
XCopyArea(disp, pb->id, root.win, gc, 0, 0, ww, hh, x, y);
XDrawRectangle(disp, root.win, gc, x, y, ww, hh);
x += ww;
if (hh > maxh)
maxh = hh;
count++;
if (pb->depth == 1)
mcount++;
fprintf(stderr, "%08x (%5ix%5i %i) : "
"%x %x %x %x %x %x %x %x "
"%x %x %x %x %x %x %x %x "
"%x %x %x %x %x %x %x %x "
"%x %x %x %x %x %x %x %x\n",
pb->id, pb->w, pb->h, pb->depth,
pb->stack[0], pb->stack[1], pb->stack[2], pb->stack[3],
pb->stack[4], pb->stack[5], pb->stack[6], pb->stack[7],
pb->stack[8], pb->stack[9], pb->stack[10], pb->stack[11],
pb->stack[12], pb->stack[13], pb->stack[14], pb->stack[15],
pb->stack[16], pb->stack[17], pb->stack[18], pb->stack[19],
pb->stack[20], pb->stack[21], pb->stack[22], pb->stack[23],
pb->stack[24], pb->stack[25], pb->stack[26], pb->stack[27],
pb->stack[28], pb->stack[29], pb->stack[30], pb->stack[31]);
}
fprintf(stderr, "Total %i, %i of them bitmaps\n", count, mcount);
XFreeGC(disp, gc);
}
#endif
EDBUG_RETURN_; EDBUG_RETURN_;
} }

View File

@ -27,8 +27,8 @@ struct _mdata
EWin *ewin; EWin *ewin;
}; };
void ToolTipTimeout(int val, void *data); static void ToolTipTimeout(int val, void *data);
void SubmenuShowTimeout(int val, void *dat); static void SubmenuShowTimeout(int val, void *dat);
static char sentpress = 0; static char sentpress = 0;
static Window click_was_in = 0; static Window click_was_in = 0;
@ -36,10 +36,11 @@ static Time last_time = 0;
static int last_button = 0; static int last_button = 0;
static int pgd_x = 0, pgd_y = 0; static int pgd_x = 0, pgd_y = 0;
void static void
ToolTipTimeout(int val, void *data) ToolTipTimeout(int val, void *data)
{ {
int x, y, dum; int x, y, dum;
unsigned int mask; unsigned int mask;
Window win, rt, ch; Window win, rt, ch;
ActionClass *ac; ActionClass *ac;
@ -73,7 +74,7 @@ ToolTipTimeout(int val, void *data)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleClientMessage(XEvent * ev) HandleClientMessage(XEvent * ev)
{ {
EWin *ewin; EWin *ewin;
@ -192,7 +193,7 @@ HandleClientMessage(XEvent * ev)
} }
void void
HandleFocusWindowIn(Window win) HandleFocusWindowIn(Window win)
{ {
EWin *ewin; EWin *ewin;
@ -232,7 +233,7 @@ HandleFocusWindowIn(Window win)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleFocusWindow(Window win) HandleFocusWindow(Window win)
{ {
EWin *found_ewin; EWin *found_ewin;
@ -266,7 +267,7 @@ HandleFocusWindow(Window win)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleChildShapeChange(XEvent * ev) HandleChildShapeChange(XEvent * ev)
{ {
Window win; Window win;
@ -286,7 +287,7 @@ HandleChildShapeChange(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleMotion(XEvent * ev) HandleMotion(XEvent * ev)
{ {
int dx, dy; int dx, dy;
@ -904,7 +905,7 @@ HandleMotion(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleDestroy(XEvent * ev) HandleDestroy(XEvent * ev)
{ {
Window win; Window win;
@ -984,7 +985,7 @@ HandleDestroy(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleProperty(XEvent * ev) HandleProperty(XEvent * ev)
{ {
Window win; Window win;
@ -1070,7 +1071,7 @@ HandleProperty(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleCirculate(XEvent * ev) HandleCirculate(XEvent * ev)
{ {
Window win; Window win;
@ -1096,7 +1097,7 @@ HandleCirculate(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleReparent(XEvent * ev) HandleReparent(XEvent * ev)
{ {
Window par; Window par;
@ -1153,7 +1154,7 @@ HandleReparent(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleConfigureRequest(XEvent * ev) HandleConfigureRequest(XEvent * ev)
{ {
Window win, winrel; Window win, winrel;
@ -1250,7 +1251,7 @@ HandleConfigureRequest(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleResizeRequest(XEvent * ev) HandleResizeRequest(XEvent * ev)
{ {
Window win; Window win;
@ -1283,7 +1284,7 @@ HandleResizeRequest(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleUnmap(XEvent * ev) HandleUnmap(XEvent * ev)
{ {
Window win; Window win;
@ -1363,7 +1364,7 @@ HandleUnmap(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleMapRequest(XEvent * ev) HandleMapRequest(XEvent * ev)
{ {
EDBUG(5, "HandleMapRequest"); EDBUG(5, "HandleMapRequest");
@ -1380,7 +1381,7 @@ HandleMapRequest(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleExpose(XEvent * ev) HandleExpose(XEvent * ev)
{ {
Window win; Window win;
@ -1471,7 +1472,7 @@ HandleExpose(XEvent * ev)
static int pwin_px, pwin_py; static int pwin_px, pwin_py;
void void
HandleMouseDown(XEvent * ev) HandleMouseDown(XEvent * ev)
{ {
Window win; Window win;
@ -1790,7 +1791,7 @@ HandleMouseDown(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleMouseUp(XEvent * ev) HandleMouseUp(XEvent * ev)
{ {
Window win, win2; Window win, win2;
@ -2344,7 +2345,7 @@ HandleMouseUp(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void static void
SubmenuShowTimeout(int val, void *dat) SubmenuShowTimeout(int val, void *dat)
{ {
int mx, my; int mx, my;
@ -2378,7 +2379,7 @@ SubmenuShowTimeout(int val, void *dat)
val = 0; val = 0;
} }
void void
HandleMouseIn(XEvent * ev) HandleMouseIn(XEvent * ev)
{ {
Window win; Window win;
@ -2534,7 +2535,7 @@ HandleMouseIn(XEvent * ev)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
HandleMouseOut(XEvent * ev) HandleMouseOut(XEvent * ev)
{ {
Window win; Window win;

View File

@ -1,11 +1,45 @@
#include "E.h" #include "E.h"
void ReverseTimeout(int val, void *data); static void ReverseTimeout(int val, void *data);
void AutoraiseTimeout(int val, void *data); static void AutoraiseTimeout(int val, void *data);
static void FixUpBadFocus(int val, void *data);
static void
FixUpBadFocus(int val, void *data)
{
EWin *ewin;
Window win;
int revert;
if (mode.focusmode == FOCUS_CLICK)
return;
XGetInputFocus(disp, &win, &revert);
ewin = GetEwinPointerInClient();
if ((!ewin) && (mode.focusmode = FOCUS_POINTER))
{
ewin = FindItem("", win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (ewin)
{
XSetInputFocus(disp, root.win, RevertToPointerRoot, CurrentTime);
mode.focuswin = NULL;
mode.realfocuswin = NULL;
mode.context_ewin = NULL;
if (mode.kde_support)
KDE_UpdateFocusedWindow();
}
return;
}
if (ewin)
{
if (win != ewin->client.win)
XSetInputFocus(disp, ewin->client.win, RevertToPointerRoot, CurrentTime);
}
val = 0;
data = NULL;
}
/* Mostly stolen from the temporary 'ToolTipTimeout' */ /* Mostly stolen from the temporary 'ToolTipTimeout' */
void static void
AutoraiseTimeout(int val, void *data) AutoraiseTimeout(int val, void *data)
{ {
EWin *found_ewin; EWin *found_ewin;
@ -18,7 +52,7 @@ AutoraiseTimeout(int val, void *data)
data = NULL; data = NULL;
} }
void static void
ReverseTimeout(int val, void *data) ReverseTimeout(int val, void *data)
{ {
EWin *ewin; EWin *ewin;
@ -269,6 +303,7 @@ FocusToEWin(EWin * ewin)
ButtonPressMask, ButtonPressMask,
GrabModeSync, GrabModeAsync, None, None); GrabModeSync, GrabModeAsync, None, None);
} }
DoIn("FIXUP_FOCUS", 0.2, FixUpBadFocus, 0, NULL);
if (!ewin) if (!ewin)
{ {
XSetInputFocus(disp, root.win, RevertToPointerRoot, CurrentTime); XSetInputFocus(disp, root.win, RevertToPointerRoot, CurrentTime);

View File

@ -658,8 +658,8 @@ IclassApply(ImageClass * iclass, Window win, int w, int h,
ESetWindowBackgroundPixmap(disp, win, pmap); ESetWindowBackgroundPixmap(disp, win, pmap);
EShapeCombineMask(disp, win, ShapeBounding, EShapeCombineMask(disp, win, ShapeBounding,
0, 0, mask, ShapeSet); 0, 0, mask, ShapeSet);
Imlib_free_pixmap(id, pmap);
} }
Imlib_free_pixmap(id, pmap);
} }
else else
{ {
@ -711,16 +711,14 @@ IclassApply(ImageClass * iclass, Window win, int w, int h,
0, 0, tm, ShapeSet); 0, 0, tm, ShapeSet);
EFreePixmap(disp, tm); EFreePixmap(disp, tm);
} }
Imlib_free_pixmap(id, pmap);
ESetWindowBackgroundPixmap(disp, win, pmap); ESetWindowBackgroundPixmap(disp, win, pmap);
Imlib_free_pixmap(id, pmap);
} }
} }
} }
if (!is->im) if (!is->im)
{ /* bg color */
/* bg color */ ESetWindowBackground(disp, win, is->bg.pixel);
ESetWindowBackground(disp, win, is->bg.pixel);
}
else if (is->im_file) else if (is->im_file)
{ {
/* if unloadable - then unload */ /* if unloadable - then unload */

View File

@ -368,7 +368,8 @@ ShowIconbox(Iconbox * ib)
xch->res_class = "Enlightenment_IconBox"; xch->res_class = "Enlightenment_IconBox";
XSetClassHint(disp, ib->win, xch); XSetClassHint(disp, ib->win, xch);
XFree(xch); XFree(xch);
ewin = AddInternalToFamily(ib->win, 1, "ICONBOX"); MatchToSnapInfoIconbox(ib);
ewin = AddInternalToFamily(ib->win, 1, "ICONBOX", 2, ib);
if (ewin) if (ewin)
{ {
Snapshot *sn; Snapshot *sn;
@ -406,29 +407,24 @@ ShowIconbox(Iconbox * ib)
ib->iconsize + ib->scroll_thickness + extra; ib->iconsize + ib->scroll_thickness + extra;
ewin->client.no_resize_v = 1; ewin->client.no_resize_v = 1;
} }
ewin->desktop = desks.current;
ewin->ibox = ib; ewin->ibox = ib;
DesktopRemoveEwin(ewin);
ewin->sticky = 1;
ResizeEwin(ewin, 160, 160);
sn = FindSnapshot(ewin); sn = FindSnapshot(ewin);
/* get the size right damnit! */ /* get the size right damnit! */
if (sn) if (sn)
{ {
if ((sn->use_shade) && (sn->shade)) if (sn->use_wh)
InstantUnShadeEwin(ewin); IconboxResize(ib, sn->w, sn->h);
ResizeEwin(ewin, sn->w, sn->h);
if (sn->use_xy)
MoveEwin(ewin, sn->x, sn->y);
} }
else else
MoveEwin(ewin, root.w - (ewin->w), root.h - (ewin->h)); {
ResizeEwin(ewin, 160, 160);
MoveEwin(ewin, root.w - (ewin->w), root.h - (ewin->h));
}
ConformEwinToDesktop(ewin); ConformEwinToDesktop(ewin);
DesktopRemoveEwin(ewin);
DesktopAddEwinToTop(ewin);
if ((sn) && (sn->use_shade) && (sn->shade))
ShadeEwin(ewin);
ShowEwin(ewin); ShowEwin(ewin);
if (((sn) && (sn->use_sticky) && (sn->sticky)) || (!sn))
MakeWindowSticky(ewin);
RememberImportantInfoForEwin(ewin); RememberImportantInfoForEwin(ewin);
} }
IconboxResize(ib, ib->ewin->client.w, ib->ewin->client.h); IconboxResize(ib, ib->ewin->client.w, ib->ewin->client.h);
@ -514,6 +510,10 @@ IB_SnapEWin(EWin * ewin)
h = (w * ewin->h) / ewin->w; h = (w * ewin->h) / ewin->w;
else else
w = (h * ewin->w) / ewin->h; w = (h * ewin->w) / ewin->h;
if (w < 4)
w = 4;
if (h < 4)
h = 4;
ewin->icon_pmap_w = w; ewin->icon_pmap_w = w;
ewin->icon_pmap_h = h; ewin->icon_pmap_h = h;
ewin->icon_pmap = ECreatePixmap(disp, ewin->win, w, h, id->x.depth); ewin->icon_pmap = ECreatePixmap(disp, ewin->win, w, h, id->x.depth);
@ -536,10 +536,10 @@ IB_SnapEWin(EWin * ewin)
y = (r[i].y * h) / ewin->h; y = (r[i].y * h) / ewin->h;
ww = (r[i].width * w) / ewin->w; ww = (r[i].width * w) / ewin->w;
hh = (r[i].height * h) / ewin->h; hh = (r[i].height * h) / ewin->h;
if (ww < 1) if (ww < 4)
ww = 1; ww = 4;
if (hh < 1) if (hh < 4)
hh = 1; hh = 4;
XFillRectangle(disp, ewin->icon_mask, gc, x, y, ww, hh); XFillRectangle(disp, ewin->icon_mask, gc, x, y, ww, hh);
} }
XFree(r); XFree(r);
@ -676,8 +676,8 @@ IB_GetEIcon(EWin * ewin)
if (im) if (im)
{ {
Imlib_render(id, im, im->rgb_width, im->rgb_height); Imlib_render(id, im, im->rgb_width, im->rgb_height);
ewin->icon_pmap = Imlib_move_image(id, im); ewin->icon_pmap = Imlib_copy_image(id, im);
ewin->icon_mask = Imlib_move_mask(id, im); ewin->icon_mask = Imlib_copy_mask(id, im);
ewin->icon_pmap_w = im->rgb_width; ewin->icon_pmap_w = im->rgb_width;
ewin->icon_pmap_h = im->rgb_height; ewin->icon_pmap_h = im->rgb_height;
Imlib_destroy_image(id, im); Imlib_destroy_image(id, im);
@ -981,8 +981,6 @@ void
UpdateAppIcon(EWin * ewin, int imode) UpdateAppIcon(EWin * ewin, int imode)
{ {
/* free whatever we had before */ /* free whatever we had before */
/*Iconbox *ib; */
if (ewin->icon_pmap) if (ewin->icon_pmap)
Imlib_free_pixmap(id, ewin->icon_pmap); Imlib_free_pixmap(id, ewin->icon_pmap);
if (ewin->icon_mask) if (ewin->icon_mask)
@ -1586,14 +1584,15 @@ IB_DrawScroll(Iconbox * ib)
} }
} }
PropagateShapes(ib->win); PropagateShapes(ib->win);
{ if (ib->ewin)
Border *b; {
Border *b;
b = ib->ewin->border; b = ib->ewin->border;
SyncBorderToEwin(ib->ewin); SyncBorderToEwin(ib->ewin);
if (ib->ewin->border == b) if (ib->ewin->border == b)
PropagateShapes(ib->ewin->win); PropagateShapes(ib->ewin->win);
} }
} }
void void
@ -1634,15 +1633,21 @@ RedrawIconbox(Iconbox * ib)
ImageClass *ic; ImageClass *ic;
Pixmap m = 0; Pixmap m = 0;
char pq; char pq;
char was_shaded = 0;
if (!ib) if (!ib)
return; return;
if (ib->auto_resize) if ((ib->auto_resize) && (ib->ewin))
{ {
int add = 0; int add = 0;
int x, y, w, h; int x, y, w, h;
if (ib->ewin->shaded)
{
was_shaded = 1;
UnShadeEwin(ib->ewin);
}
x = ib->ewin->x; x = ib->ewin->x;
y = ib->ewin->y; y = ib->ewin->y;
w = ib->ewin->client.w; w = ib->ewin->client.w;
@ -1652,25 +1657,31 @@ RedrawIconbox(Iconbox * ib)
ic = FindItem("ICONBOX_VERTICAL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS); ic = FindItem("ICONBOX_VERTICAL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
if (ic) if (ic)
add = ic->padding.top + ic->padding.bottom; add = ic->padding.top + ic->padding.bottom;
if ((ib->ewin->border->border.top + if (ib->ewin->border)
ib->ewin->border->border.bottom + add) > {
root.h) if ((ib->ewin->border->border.top +
add = root.h - (ib->ewin->border->border.top + ib->ewin->border->border.bottom + add) >
ib->ewin->border->border.bottom); root.h)
add = root.h - (ib->ewin->border->border.top +
ib->ewin->border->border.bottom);
}
x = ib->ewin->x; x = ib->ewin->x;
y = ib->ewin->y + y = ib->ewin->y +
(((ib->ewin->client.h - add) * ib->auto_resize_anchor) >> 10); (((ib->ewin->client.h - add) * ib->auto_resize_anchor) >> 10);
w = ib->ewin->client.w; w = ib->ewin->client.w;
h = add; h = add;
if ((ib->ewin->y + ib->ewin->border->border.top + if (ib->ewin->border)
ib->ewin->border->border.bottom + add) >
root.h)
{ {
x = ib->ewin->x; if ((ib->ewin->y + ib->ewin->border->border.top +
y = root.h - (ib->ewin->border->border.top + ib->ewin->border->border.bottom + add) >
ib->ewin->border->border.bottom + add); root.h)
w = ib->ewin->client.w; {
h = add; x = ib->ewin->x;
y = root.h - (ib->ewin->border->border.top +
ib->ewin->border->border.bottom + add);
w = ib->ewin->client.w;
h = add;
}
} }
} }
else else
@ -1678,33 +1689,47 @@ RedrawIconbox(Iconbox * ib)
ic = FindItem("ICONBOX_HORIZONTAL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS); ic = FindItem("ICONBOX_HORIZONTAL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
if (ic) if (ic)
add = ic->padding.left + ic->padding.right; add = ic->padding.left + ic->padding.right;
if ((ib->ewin->border->border.left + if (ib->ewin->border)
ib->ewin->border->border.right + add) > {
root.w) if ((ib->ewin->border->border.left +
add = root.w - (ib->ewin->border->border.left + ib->ewin->border->border.right + add) >
ib->ewin->border->border.right); root.w)
add = root.w - (ib->ewin->border->border.left +
ib->ewin->border->border.right);
}
x = ib->ewin->x + x = ib->ewin->x +
(((ib->ewin->client.w - add) * ib->auto_resize_anchor) >> 10); (((ib->ewin->client.w - add) * ib->auto_resize_anchor) >> 10);
y = ib->ewin->y; y = ib->ewin->y;
w = add; w = add;
h = ib->ewin->client.h; h = ib->ewin->client.h;
if ((ib->ewin->x + ib->ewin->border->border.left + if (ib->ewin->border)
ib->ewin->border->border.right + add) >
root.w)
{ {
x = root.w - (ib->ewin->border->border.left + if ((ib->ewin->x + ib->ewin->border->border.left +
ib->ewin->border->border.right + add); ib->ewin->border->border.right + add) >
y = ib->ewin->y; root.w)
w = add; {
h = ib->ewin->client.h; x = root.w - (ib->ewin->border->border.left +
ib->ewin->border->border.right + add);
y = ib->ewin->y;
w = add;
h = ib->ewin->client.h;
}
} }
} }
ib->ewin->x = x; ib->ewin->x = x;
ib->ewin->y = y; ib->ewin->y = y;
ib->ewin->w = w + ib->ewin->border->border.left + if (ib->ewin->border)
ib->ewin->border->border.right; {
ib->ewin->h = h + ib->ewin->border->border.top + ib->ewin->w = w + ib->ewin->border->border.left +
ib->ewin->border->border.bottom; ib->ewin->border->border.right;
ib->ewin->h = h + ib->ewin->border->border.top +
ib->ewin->border->border.bottom;
}
else
{
ib->ewin->w = w;
ib->ewin->h = h;
}
RememberImportantInfoForEwins(ib->ewin); RememberImportantInfoForEwins(ib->ewin);
x = ib->ewin->x; x = ib->ewin->x;
@ -1718,25 +1743,31 @@ RedrawIconbox(Iconbox * ib)
if (ic) if (ic)
add = ic->padding.top + ic->padding.bottom; add = ic->padding.top + ic->padding.bottom;
add += ib->max; add += ib->max;
if ((ib->ewin->border->border.top + if (ib->ewin->border)
ib->ewin->border->border.bottom + add) > {
root.h) if ((ib->ewin->border->border.top +
add = root.h - (ib->ewin->border->border.top + ib->ewin->border->border.bottom + add) >
ib->ewin->border->border.bottom); root.h)
add = root.h - (ib->ewin->border->border.top +
ib->ewin->border->border.bottom);
}
x = ib->ewin->x; x = ib->ewin->x;
y = ib->ewin->y + y = ib->ewin->y +
(((ib->ewin->client.h - add) * ib->auto_resize_anchor) >> 10); (((ib->ewin->client.h - add) * ib->auto_resize_anchor) >> 10);
w = ib->ewin->client.w; w = ib->ewin->client.w;
h = add; h = add;
if ((ib->ewin->y + ib->ewin->border->border.top + if (ib->ewin->border)
ib->ewin->border->border.bottom + add) >
root.h)
{ {
x = ib->ewin->x; if ((ib->ewin->y + ib->ewin->border->border.top +
y = root.h - (ib->ewin->border->border.top + ib->ewin->border->border.bottom + add) >
ib->ewin->border->border.bottom + add); root.h)
w = ib->ewin->client.w; {
h = add; x = ib->ewin->x;
y = root.h - (ib->ewin->border->border.top +
ib->ewin->border->border.bottom + add);
w = ib->ewin->client.w;
h = add;
}
} }
} }
else else
@ -1745,25 +1776,31 @@ RedrawIconbox(Iconbox * ib)
if (ic) if (ic)
add = ic->padding.left + ic->padding.right; add = ic->padding.left + ic->padding.right;
add += ib->max; add += ib->max;
if ((ib->ewin->border->border.left + if (ib->ewin->border)
ib->ewin->border->border.right + add) > {
root.w) if ((ib->ewin->border->border.left +
add = root.w - (ib->ewin->border->border.left + ib->ewin->border->border.right + add) >
ib->ewin->border->border.right); root.w)
add = root.w - (ib->ewin->border->border.left +
ib->ewin->border->border.right);
}
x = ib->ewin->x + x = ib->ewin->x +
(((ib->ewin->client.w - add) * ib->auto_resize_anchor) >> 10); (((ib->ewin->client.w - add) * ib->auto_resize_anchor) >> 10);
y = ib->ewin->y; y = ib->ewin->y;
w = add; w = add;
h = ib->ewin->client.h; h = ib->ewin->client.h;
if ((ib->ewin->x + ib->ewin->border->border.left + if (ib->ewin->border)
ib->ewin->border->border.right + add) >
root.w)
{ {
x = root.w - (ib->ewin->border->border.left + if ((ib->ewin->x + ib->ewin->border->border.left +
ib->ewin->border->border.right + add); ib->ewin->border->border.right + add) >
y = ib->ewin->y; root.w)
w = add; {
h = ib->ewin->client.h; x = root.w - (ib->ewin->border->border.left +
ib->ewin->border->border.right + add);
y = ib->ewin->y;
w = add;
h = ib->ewin->client.h;
}
} }
} }
if ((x != ib->ewin->x) || (y != ib->ewin->y) || if ((x != ib->ewin->x) || (y != ib->ewin->y) ||
@ -1776,6 +1813,8 @@ RedrawIconbox(Iconbox * ib)
ib->w = w; ib->w = w;
ib->h = h; ib->h = h;
} }
if ((was_shaded) && (ib->ewin))
ShadeEwin(ib->ewin);
pq = queue_up; pq = queue_up;
queue_up = 0; queue_up = 0;
@ -2049,8 +2088,11 @@ RedrawIconbox(Iconbox * ib)
ESetWindowBackgroundPixmap(disp, ib->icon_win, ib->pmap); ESetWindowBackgroundPixmap(disp, ib->icon_win, ib->pmap);
XClearWindow(disp, ib->icon_win); XClearWindow(disp, ib->icon_win);
PropagateShapes(ib->win); PropagateShapes(ib->win);
ICCCM_GetShapeInfo(ib->ewin); if (ib->ewin)
PropagateShapes(ib->ewin->win); {
ICCCM_GetShapeInfo(ib->ewin);
PropagateShapes(ib->ewin->win);
}
queue_up = pq; queue_up = pq;
} }

View File

@ -77,7 +77,7 @@ KModuleList;
static KModuleList *KModules = NULL; static KModuleList *KModules = NULL;
void void
KDE_ClientMessage(Window win, Atom atom, long data, Time timestamp) KDE_ClientMessage(Window win, Atom atom, long data, Time timestamp)
{ {
@ -100,7 +100,7 @@ KDE_ClientMessage(Window win, Atom atom, long data, Time timestamp)
} }
void void
KDE_ClientTextMessage(Window win, Atom atom, char *data) KDE_ClientTextMessage(Window win, Atom atom, char *data)
{ {
@ -122,7 +122,7 @@ KDE_ClientTextMessage(Window win, Atom atom, char *data)
} }
void void
KDE_SendMessagesToModules(Atom atom, long data) KDE_SendMessagesToModules(Atom atom, long data)
{ {
@ -141,7 +141,7 @@ KDE_SendMessagesToModules(Atom atom, long data)
} }
void void
KDE_UpdateFocusedWindow(void) KDE_UpdateFocusedWindow(void)
{ {
@ -190,7 +190,7 @@ KDE_UpdateFocusedWindow(void)
} }
void void
KDE_NewWindow(EWin * ewin) KDE_NewWindow(EWin * ewin)
{ {
@ -245,7 +245,7 @@ KDE_NewWindow(EWin * ewin)
} }
void void
KDE_RemoveWindow(EWin * ewin) KDE_RemoveWindow(EWin * ewin)
{ {
@ -275,7 +275,7 @@ KDE_RemoveWindow(EWin * ewin)
} }
void void
KDE_AddModule(Window win) KDE_AddModule(Window win)
{ {
@ -410,7 +410,7 @@ KDE_AddModule(Window win)
} }
void void
KDE_RemoveModule(Window win) KDE_RemoveModule(Window win)
{ {
@ -465,7 +465,7 @@ KDE_RemoveModule(Window win)
} }
void void
KDE_Init(void) KDE_Init(void)
{ {
/* /*
@ -586,7 +586,7 @@ KDE_Init(void)
} }
void void
KDE_Shutdown(void) KDE_Shutdown(void)
{ {
@ -656,7 +656,7 @@ KDE_Shutdown(void)
} }
void void
KDE_ClientInit(Window win) KDE_ClientInit(Window win)
{ {
@ -689,7 +689,7 @@ KDE_ClientInit(Window win)
} }
void void
KDE_ClientChange(Window win, Atom a) KDE_ClientChange(Window win, Atom a)
{ {
@ -772,7 +772,7 @@ KDE_ClientChange(Window win, Atom a)
} }
void void
KDE_GetDecorationHint(Window win, long *dechints) KDE_GetDecorationHint(Window win, long *dechints)
{ {
@ -842,7 +842,7 @@ KDE_GetDecorationHint(Window win, long *dechints)
} }
void void
KDE_CheckClientHints(Window win) KDE_CheckClientHints(Window win)
{ {
@ -865,7 +865,7 @@ KDE_CheckClientHints(Window win)
} }
int int
KDE_WindowCommand(EWin * ewin, char *cmd) KDE_WindowCommand(EWin * ewin, char *cmd)
{ {
@ -921,7 +921,7 @@ KDE_WindowCommand(EWin * ewin, char *cmd)
} }
void void
KDE_Command(char *cmd, XClientMessageEvent * event) KDE_Command(char *cmd, XClientMessageEvent * event)
{ {
@ -1000,7 +1000,7 @@ KDE_Command(char *cmd, XClientMessageEvent * event)
} }
void void
KDE_ProcessClientMessage(XClientMessageEvent * event) KDE_ProcessClientMessage(XClientMessageEvent * event)
{ {
@ -1064,7 +1064,7 @@ KDE_ProcessClientMessage(XClientMessageEvent * event)
} }
void void
KDE_ModuleAssert(Window win) KDE_ModuleAssert(Window win)
{ {
@ -1078,7 +1078,7 @@ KDE_ModuleAssert(Window win)
} }
void void
KDE_PrepModuleEvent(Window win, KMessage msg) KDE_PrepModuleEvent(Window win, KMessage msg)
{ {
@ -1127,7 +1127,7 @@ KDE_PrepModuleEvent(Window win, KMessage msg)
} }
void void
KDE_SetRootArea(void) KDE_SetRootArea(void)
{ {
@ -1146,7 +1146,7 @@ KDE_SetRootArea(void)
} }
void void
KDE_SetNumDesktops(void) KDE_SetNumDesktops(void)
{ {
@ -1182,7 +1182,7 @@ KDE_SetNumDesktops(void)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
KDE_HintChange(Atom a) KDE_HintChange(Atom a)
{ {
@ -1206,7 +1206,7 @@ KDE_HintChange(Atom a)
} }
void void
KDE_UpdateClient(EWin * ewin) KDE_UpdateClient(EWin * ewin)
{ {

View File

@ -5,7 +5,6 @@
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
/* This function runs all the setup for startup, and then /* This function runs all the setup for startup, and then
* proceeds into the primary event loop at the end. * proceeds into the primary event loop at the end.
*/ */
@ -223,11 +222,11 @@ main(int argc, char **argv)
SessionInit(); SessionInit();
ShowDesktopControls(); ShowDesktopControls();
CheckEvent(); CheckEvent();
if (mode.mapslide)
CreateStartupDisplay(0);
/* retreive stuff from last time we were loaded if we're restarting */ /* retreive stuff from last time we were loaded if we're restarting */
ICCCM_GetMainEInfo(); ICCCM_GetMainEInfo();
SetupEnv(); SetupEnv();
if (mode.mapslide)
CreateStartupDisplay(0);
MapUnmap(1); MapUnmap(1);
/* set some more stuff for gnome */ /* set some more stuff for gnome */
GNOME_SetCurrentArea(); GNOME_SetCurrentArea();
@ -244,8 +243,6 @@ main(int argc, char **argv)
EnableAllPagers(); EnableAllPagers();
queue_up = 1; queue_up = 1;
} }
if (!mode.mapslide)
CreateStartupDisplay(0);
if (getpid() == master_pid && init_win_ext) if (getpid() == master_pid && init_win_ext)
{ {
XKillClient(disp, init_win_ext); XKillClient(disp, init_win_ext);
@ -279,6 +276,43 @@ main(int argc, char **argv)
if (mode.display_warp < 0) if (mode.display_warp < 0)
mode.display_warp = 0; mode.display_warp = 0;
mode.startup = 0; mode.startup = 0;
/* SC_Kill(); */
/* ok - paranoia - save current settings to disk */
autosave();
/* let's make sure we set this up and go to our desk anyways */
ICCCM_GetMainEInfo();
GotoDesktop(desks.current);
if (desks.current < (ENLIGHTENMENT_CONF_NUM_DESKTOPS - 1))
{
char ps = 0;
if (!mode.mapslide)
{
ps = desks.slidein;
desks.slidein = 0;
}
GotoDesktop(desks.current + 1);
GotoDesktop(desks.current - 1);
if (!mode.mapslide)
desks.slidein = ps;
}
else if (desks.current > 0)
{
char ps = 0;
if (!mode.mapslide)
{
ps = desks.slidein;
desks.slidein = 0;
}
GotoDesktop(desks.current - 1);
GotoDesktop(desks.current + 1);
if (!mode.mapslide)
desks.slidein = ps;
}
XSync(disp, False);
if (!mode.mapslide)
CreateStartupDisplay(0);
{ {
Background *bg; Background *bg;
@ -289,12 +323,6 @@ main(int argc, char **argv)
LIST_TYPE_BACKGROUND))) LIST_TYPE_BACKGROUND)))
FreeDesktopBG(bg); FreeDesktopBG(bg);
} }
/* SC_Kill(); */
/* ok - paranoia - save current settings to disk */
autosave();
/* let's make sure we set this up and go to our desk anyways */
ICCCM_GetMainEInfo();
GotoDesktop(desks.current);
/* The primary event loop */ /* The primary event loop */
for (;;) for (;;)

View File

@ -5,35 +5,140 @@
/*#define MEM_OUT 1 */ /*#define MEM_OUT 1 */
#ifdef DBUG_MEM #ifdef DBUG_MEM
#define POINTERS_SIZE 256000 #define POINTERS_SIZE 50000
static unsigned int num_pointers = 0; static unsigned int num_pointers = 0;
static void *pointers_ptr[POINTERS_SIZE]; static void *pointers_ptr[POINTERS_SIZE];
static unsigned int pointers_size[POINTERS_SIZE]; static unsigned int pointers_size[POINTERS_SIZE];
#ifdef MEM_OUT
static void *pointers_stack[POINTERS_SIZE][32];
static char pointers_file[POINTERS_SIZE][16];
static int pointers_line[POINTERS_SIZE];
static time_t pointers_time[POINTERS_SIZE];
#define PSTK(y, x) if (__builtin_frame_address(x)) \
pointers_stack[y][x] = __builtin_return_address(x);\
else goto end;
#define PST(y)\
{\
int _pi;\
for (_pi = 0; _pi < 32; _pi++)\
pointers_stack[y][_pi] = NULL;\
PSTK(y, 0); PSTK(y, 1); PSTK(y, 2); PSTK(y, 3); PSTK(y, 4);\
PSTK(y, 5); PSTK(y, 6); PSTK(y, 7); PSTK(y, 8); PSTK(y, 9);\
PSTK(y, 10); PSTK(y, 11); PSTK(y, 12); PSTK(y, 13); PSTK(y, 14);\
PSTK(y, 15); PSTK(y, 16); PSTK(y, 17); PSTK(y, 18); PSTK(y, 19);\
PSTK(y, 20); PSTK(y, 21); PSTK(y, 22); PSTK(y, 23); PSTK(y, 24);\
PSTK(y, 25); PSTK(y, 26); PSTK(y, 27); PSTK(y, 28); PSTK(y, 29);\
PSTK(y, 30); PSTK(y, 31);\
end: \
}
static struct _symtab
{
void *val;
char *symbol;
}
*sym = NULL;
static int sym_count = 0;
char *
getsym(void *p)
{
int i;
for (i = 0; i < sym_count - 1; i++)
{
if ((p > sym[i].val) && (p < sym[i + 1].val))
return sym[i].symbol;
}
return "";
}
#endif
#endif #endif
void void
EDisplayMemUse() EDisplayMemUse()
{ {
#ifdef DBUG_MEM #ifdef DBUG_MEM
FILE *f;
unsigned int i, min, max, sum; unsigned int i, min, max, sum;
max = 0; max = 0;
min = 0x7ffffff; min = 0x7ffffff;
sum = 0; sum = 0;
if (!sym)
{
f = fopen("e.sym", "r");
if (f)
{
void *p;
char buf[256];
while (fscanf(f, "%x %*s %250s\n", &p, buf) != EOF)
{
sym_count++;
sym = realloc(sym, sizeof(struct _symtab) * sym_count);
sym[sym_count - 1].val = p;
sym[sym_count - 1].symbol = strdup(buf);
}
fclose(f);
}
}
f = fopen("e.mem.out", "w");
for (i = 0; i < num_pointers; i++) for (i = 0; i < num_pointers; i++)
{ {
char tm[32];
struct tm tim;
struct tm *tim2;
time_t t2;
sum += pointers_size[i]; sum += pointers_size[i];
if (pointers_size[i] < min) if (pointers_size[i] < min)
min = pointers_size[i]; min = pointers_size[i];
if (pointers_size[i] > max) if (pointers_size[i] > max)
max = pointers_size[i]; max = pointers_size[i];
t2 = pointers_time[i];
tim2 = localtime(&t2);
if (tim2)
{
memcpy(&tim, tim2, sizeof(struct tm));
strftime(tm, 31, "%T", &tim);
}
fprintf(f, "%6i > %p %5i @ %s - %16s line %5i : "
"%s %s %s %s %s %s %s %s "
"%s %s %s %s %s %s %s %s "
"%s %s %s %s %s %s %s %s "
"%s %s %s %s %s %s %s %s\n",
i, pointers_ptr[i], pointers_size[i], tm,
pointers_file[i], pointers_line[i],
getsym(pointers_stack[i][0]), getsym(pointers_stack[i][1]),
getsym(pointers_stack[i][2]), getsym(pointers_stack[i][3]),
getsym(pointers_stack[i][4]), getsym(pointers_stack[i][5]),
getsym(pointers_stack[i][6]), getsym(pointers_stack[i][7]),
getsym(pointers_stack[i][8]), getsym(pointers_stack[i][9]),
getsym(pointers_stack[i][10]), getsym(pointers_stack[i][11]),
getsym(pointers_stack[i][12]), getsym(pointers_stack[i][13]),
getsym(pointers_stack[i][14]), getsym(pointers_stack[i][15]),
getsym(pointers_stack[i][16]), getsym(pointers_stack[i][17]),
getsym(pointers_stack[i][18]), getsym(pointers_stack[i][19]),
getsym(pointers_stack[i][20]), getsym(pointers_stack[i][21]),
getsym(pointers_stack[i][22]), getsym(pointers_stack[i][23]),
getsym(pointers_stack[i][24]), getsym(pointers_stack[i][25]),
getsym(pointers_stack[i][26]), getsym(pointers_stack[i][27]),
getsym(pointers_stack[i][28]), getsym(pointers_stack[i][29]),
getsym(pointers_stack[i][30]), getsym(pointers_stack[i][31]));
} }
if (num_pointers > 0) if (num_pointers > 0)
{ {
fprintf(stderr, "Num:%6i Sum:%8i Av:%8i Min:%8i Max%6i\n", fprintf(f, "Num:%6i Sum:%8i Av:%8i Min:%8i Max%6i\n",
num_pointers, sum, sum / num_pointers, min, max); num_pointers, sum, sum / num_pointers, min, max);
} }
fclose(f);
#endif #endif
} }
@ -77,26 +182,13 @@ __Emalloc(int size, const char *file, int line)
num_pointers++; num_pointers++;
pointers_ptr[num_pointers - 1] = p; pointers_ptr[num_pointers - 1] = p;
pointers_size[num_pointers - 1] = size; pointers_size[num_pointers - 1] = size;
}
#endif
#ifdef MEM_OUT #ifdef MEM_OUT
{ strcpy(pointers_file[num_pointers - 1], file);
FILE *f; pointers_line[num_pointers - 1] = line;
pointers_time[num_pointers - 1] = time(NULL);
f = fopen("e.mem.out", "a"); PST(num_pointers - 1);
if (f)
{
#ifdef DEBUG
int i_call_level;
fprintf(f, "%i ", call_level);
for (i_call_level = 0; i_call_level < call_level; i_call_level++)
fprintf(f, "%s ", call_stack[i_call_level]);
#endif #endif
fprintf(f, " = MALLOC %s %i : %i = %p\n", file, line, size, p); }
fclose(f);
}
}
#endif #endif
EDBUG_RETURN(p); EDBUG_RETURN(p);
} }
@ -204,31 +296,6 @@ __Erealloc(void *ptr, int size, const char *file, int line)
} }
} }
} }
#endif
#ifdef MEM_OUT
{
FILE *f;
f = fopen("e.mem.out", "a");
if (f)
{
#ifdef DEBUG
int i_call_level;
fprintf(f, "%i ", call_level);
for (i_call_level = 0; i_call_level < call_level; i_call_level++)
fprintf(f, "%s ", call_stack[i_call_level]);
#endif
fprintf(f, " = FREE %s %i : %p\n", file, line, ptr);
#ifdef DEBUG
fprintf(f, "%i ", call_level);
for (i_call_level = 0; i_call_level < call_level; i_call_level++)
fprintf(f, "%s ", call_stack[i_call_level]);
#endif
fprintf(f, " = MALLOC %s %i : %i = %p\n", file, line, size, p);
fclose(f);
}
}
#endif #endif
EDBUG_RETURN(p); EDBUG_RETURN(p);
} }
@ -243,7 +310,7 @@ __Efree(void *ptr, const char *file, int line)
EDBUG(9, "Efree"); EDBUG(9, "Efree");
#ifdef DBUG_MEM #ifdef DBUG_MEM
{ {
unsigned int i, j; unsigned int i, j, k;
bad = 1; bad = 1;
for (i = 0; i < num_pointers; i++) for (i = 0; i < num_pointers; i++)
@ -254,6 +321,13 @@ __Efree(void *ptr, const char *file, int line)
{ {
pointers_ptr[j] = pointers_ptr[j + 1]; pointers_ptr[j] = pointers_ptr[j + 1];
pointers_size[j] = pointers_size[j + 1]; pointers_size[j] = pointers_size[j + 1];
#ifdef MEM_OUT
for (k = 0; k < 32; k++)
pointers_stack[j][k] = pointers_stack[j + 1][k];
strcpy(pointers_file[j], pointers_file[j + 1]);
pointers_line[j] = pointers_line[j + 1];
pointers_time[j] = pointers_time[j + 1];
#endif
} }
bad = 0; bad = 0;
i = num_pointers; i = num_pointers;
@ -306,25 +380,6 @@ __Efree(void *ptr, const char *file, int line)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
free(ptr); free(ptr);
#ifdef MEM_OUT
{
FILE *f;
f = fopen("e.mem.out", "a");
if (f)
{
#ifdef DEBUG
int i_call_level;
fprintf(f, "%i ", call_level);
for (i_call_level = 0; i_call_level < call_level; i_call_level++)
fprintf(f, "%s ", call_stack[i_call_level]);
#endif
fprintf(f, " = FREE %s %i : %p\n", file, line, ptr);
fclose(f);
}
}
#endif
EDBUG_RETURN_; EDBUG_RETURN_;
} }
#endif #endif

View File

@ -393,7 +393,7 @@ ShowMenu(Menu * m, char noshow)
mode.y = -((-mode.y) - mode.context_h - mh); mode.y = -((-mode.y) - mode.context_h - mh);
EMoveWindow(disp, m->win, -mode.x, -mode.y); EMoveWindow(disp, m->win, -mode.x, -mode.y);
} }
ewin = AddInternalToFamily(m->win, 1, m->style->border_name); ewin = AddInternalToFamily(m->win, 1, m->style->border_name, 0, m);
if (ewin) if (ewin)
{ {
DesktopRemoveEwin(ewin); DesktopRemoveEwin(ewin);
@ -680,7 +680,8 @@ AddTitleToMenu(Menu * menu, char *title)
void void
RealizeMenu(Menu * m) RealizeMenu(Menu * m)
{ {
int i, maxh, maxw, maxx1, maxx2, w, h, x, y, r, mmw, mmh; int i, maxh = 0, maxw = 0, maxx1, maxx2, w, h, x, y, r,
mmw, mmh;
unsigned int iw, ih; unsigned int iw, ih;
ImlibImage *im; ImlibImage *im;
XSetWindowAttributes att; XSetWindowAttributes att;
@ -1046,7 +1047,6 @@ CreateMenuFromDirectory(char *name, MenuStyle * ms, char *dir)
{ {
s[strlen(s) - 1] = 0; s[strlen(s) - 1] = 0;
word(s, 1, ss); word(s, 1, ss);
EDisplayMemUse();
if (!strcmp(ss, "BG")) if (!strcmp(ss, "BG"))
{ {
Background *bg; Background *bg;

View File

@ -525,9 +525,13 @@ CreatePager(void)
attr.border_pixel = 0; attr.border_pixel = 0;
attr.background_pixel = 0; attr.background_pixel = 0;
attr.save_under = False; attr.save_under = False;
p->win = ECreateWindow(root.win, 0, 0, ((48 * root.w) / root.h) * ax, 48 * ay, 0); p->w = ((48 * root.w) / root.h) * ax;
p->pmap = ECreatePixmap(disp, p->win, ((48 * root.w) / root.h) * ax, 48 * ay, id->x.depth); p->h = 48 * ay;
p->bgpmap = ECreatePixmap(disp, p->win, ((48 * root.w) / root.h) * ax, 48, id->x.depth); p->dw = ((48 * root.w) / root.h) * ax;
p->dh = 48;
p->win = ECreateWindow(root.win, 0, 0, p->w, p->h, 0);
p->pmap = ECreatePixmap(disp, p->win, p->w, p->h, id->x.depth);
p->bgpmap = ECreatePixmap(disp, p->win, p->w / ax, p->h / ay, id->x.depth);
ESetWindowBackgroundPixmap(disp, p->win, p->pmap); ESetWindowBackgroundPixmap(disp, p->win, p->pmap);
XSelectInput(disp, p->win, ButtonPressMask | ButtonReleaseMask | XSelectInput(disp, p->win, ButtonPressMask | ButtonReleaseMask |
PointerMotionMask); PointerMotionMask);
@ -537,15 +541,11 @@ CreatePager(void)
XSelectInput(disp, p->hi_win, ButtonPressMask | ButtonReleaseMask | XSelectInput(disp, p->hi_win, ButtonPressMask | ButtonReleaseMask |
PointerMotionMask); PointerMotionMask);
p->desktop = 0; p->desktop = 0;
p->w = ((48 * root.w) / root.h) * ax;
p->h = 48 * ay;
p->dw = ((48 * root.w) / root.h) * ax;
p->dh = 48;
p->visible = 0; p->visible = 0;
p->update_phase = 0; p->update_phase = 0;
p->ewin = NULL; p->ewin = NULL;
p->border_name = NULL; p->border_name = NULL;
p->sel_win = ECreateWindow(p->win, 0, 0, ((48 * root.w) / root.h) * ax, 48, 0); p->sel_win = ECreateWindow(p->win, 0, 0, p->w / ax, p->h / ay, 0);
pq = queue_up; pq = queue_up;
queue_up = 0; queue_up = 0;
ic = FindItem("PAGER_SEL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS); ic = FindItem("PAGER_SEL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
@ -629,10 +629,11 @@ PagerShow(Pager * p)
XFree(xch); XFree(xch);
pq = queue_up; pq = queue_up;
queue_up = 0; queue_up = 0;
MatchToSnapInfoPager(p);
if (p->border_name) if (p->border_name)
ewin = AddInternalToFamily(p->win, 1, p->border_name); ewin = AddInternalToFamily(p->win, 1, p->border_name, 1, p);
else else
ewin = AddInternalToFamily(p->win, 1, "PAGER"); ewin = AddInternalToFamily(p->win, 1, "PAGER", 1, p);
if (ewin) if (ewin)
{ {
char s[4096]; char s[4096];
@ -651,24 +652,14 @@ PagerShow(Pager * p)
ewin->client.width.max = 320 * ax; ewin->client.width.max = 320 * ax;
ewin->client.height.max = 240 * ay; ewin->client.height.max = 240 * ay;
ewin->pager = p; ewin->pager = p;
ewin->desktop = desks.current;
p->ewin = ewin; p->ewin = ewin;
p->visible = 1; p->visible = 1;
DesktopRemoveEwin(ewin);
ewin->sticky = 1;
sn = FindSnapshot(ewin); sn = FindSnapshot(ewin);
/* get the size right damnit! */ /* get the size right damnit! */
if (sn) if (sn)
{ {
if (sn->use_wh) if (sn->use_wh)
{ PagerRedraw(p, 1);
if ((sn->use_shade) && (sn->shade))
InstantUnShadeEwin(ewin);
p->w = 0;
p->h = 0;
ResizeEwin(ewin, sn->w, sn->h);
PagerRedraw(p, 1);
}
} }
/* no snapshots ? first time ? make a row on the bottom left up */ /* no snapshots ? first time ? make a row on the bottom left up */
else else
@ -683,13 +674,10 @@ PagerShow(Pager * p)
PagerResize(p, pw, ph); PagerResize(p, pw, ph);
PagerRedraw(p, 1); PagerRedraw(p, 1);
} }
ConformEwinToDesktop(ewin);
/* show the pager ewin */ /* show the pager ewin */
DesktopRemoveEwin(ewin);
DesktopAddEwinToTop(ewin);
if ((sn) && (sn->use_shade) && (sn->shade))
ShadeEwin(ewin);
ShowEwin(ewin); ShowEwin(ewin);
if (((sn) && (sn->use_sticky) && (sn->sticky)) || (!sn))
MakeWindowSticky(ewin);
RememberImportantInfoForEwin(ewin); RememberImportantInfoForEwin(ewin);
if (SNAP) if (SNAP)
{ {

View File

@ -492,7 +492,7 @@ SnapshotEwinBorder(EWin * ewin)
sn->border_name = NULL; sn->border_name = NULL;
if (ewin->previous_border) if (ewin->previous_border)
sn->border_name = duplicate(ewin->previous_border->name); sn->border_name = duplicate(ewin->previous_border->name);
else else if (ewin->border)
sn->border_name = duplicate(ewin->border->name); sn->border_name = duplicate(ewin->border->name);
} }
@ -530,7 +530,7 @@ SnapshotEwinLocation(EWin * ewin)
if (!sn) if (!sn)
return; return;
sn->use_xy = 1; sn->use_xy = 1;
if (ewin->pager) if (((ewin->pager) || (ewin->ibox)) && (ewin->border))
{ {
sn->x = ewin->x + ewin->border->border.left; sn->x = ewin->x + ewin->border->border.left;
sn->y = ewin->y + ewin->border->border.top; sn->y = ewin->y + ewin->border->border.top;
@ -732,29 +732,6 @@ SaveSnapInfo(void)
char buf[4096], s[4096]; char buf[4096], s[4096];
FILE *f; FILE *f;
{
Pager **pl;
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
if (pl)
{
for (i = 0; i < num; i++)
{
if (pl[i]->ewin)
{
SnapshotEwinBorder(pl[i]->ewin);
SnapshotEwinSize(pl[i]->ewin);
SnapshotEwinLocation(pl[i]->ewin);
SnapshotEwinLayer(pl[i]->ewin);
SnapshotEwinSticky(pl[i]->ewin);
SnapshotEwinDesktop(pl[i]->ewin);
SnapshotEwinShade(pl[i]->ewin);
}
}
Efree(pl);
}
}
/* Esnprintf(buf, sizeof(buf), "%s.snapshots.%i", GetSMFile(), root.scr); */
Etmp(s); Etmp(s);
f = fopen(s, "w"); f = fopen(s, "w");
if (!f) if (!f)
@ -1061,6 +1038,58 @@ MatchEwinToSnapInfo(EWin * ewin)
} }
} }
void
MatchToSnapInfoPager(Pager * p)
{
XClassHint hint;
char buf[1024];
Snapshot *sn = NULL;
if ((!XGetClassHint(disp, p->win, &hint)))
return;
if ((hint.res_name) && (hint.res_class))
{
Esnprintf(buf, sizeof(buf), "%s.%s", hint.res_name, hint.res_class);
sn = FindItem(buf, 0, LIST_FINDBY_BOTH, LIST_TYPE_SNAPSHOT);
}
if (hint.res_name)
XFree(hint.res_name);
if (hint.res_class)
XFree(hint.res_class);
if (!sn)
return;
if (sn->use_xy)
EMoveWindow(disp, p->win, sn->x, sn->y);
if (sn->use_wh)
PagerResize(p, sn->w, sn->h);
}
void
MatchToSnapInfoIconbox(Iconbox * ib)
{
XClassHint hint;
char buf[1024];
Snapshot *sn = NULL;
if ((!XGetClassHint(disp, ib->win, &hint)))
return;
if ((hint.res_name) && (hint.res_class))
{
Esnprintf(buf, sizeof(buf), "%s.%s", hint.res_name, hint.res_class);
sn = FindItem(buf, 0, LIST_FINDBY_BOTH, LIST_TYPE_SNAPSHOT);
}
if (hint.res_name)
XFree(hint.res_name);
if (hint.res_class)
XFree(hint.res_class);
if (!sn)
return;
if (sn->use_xy)
EMoveWindow(disp, ib->win, sn->x, sn->y);
if (sn->use_wh)
IconboxResize(ib, sn->w, sn->h);
}
void void
MatchEwinToSnapInfoAfter(EWin * ewin) MatchEwinToSnapInfoAfter(EWin * ewin)
{ {

View File

@ -209,7 +209,10 @@ TclassApply(ImageClass * iclass, Window win, int w, int h, int active,
dq->tclass = tclass; dq->tclass = tclass;
if (dq->tclass) if (dq->tclass)
dq->tclass->ref_count++; dq->tclass->ref_count++;
dq->text = duplicate(text); if (text)
dq->text = duplicate(text);
else
dq->text = NULL;
dq->w = w; dq->w = w;
dq->shape_propagate = 0; dq->shape_propagate = 0;
dq->pager = NULL; dq->pager = NULL;

View File

@ -19,6 +19,7 @@ DoIn(char *name, double in_time, void (*func) (int val, void *data),
double tally; double tally;
EDBUG(5, "DoIn"); EDBUG(5, "DoIn");
RemoveTimerEvent(name);
qe = Emalloc(sizeof(Qentry)); qe = Emalloc(sizeof(Qentry));
if (!qe) if (!qe)
EDBUG_RETURN_; EDBUG_RETURN_;

View File

@ -22,14 +22,19 @@ create_font_raster(int width, int height)
{ {
TT_Raster_Map *rmap; TT_Raster_Map *rmap;
rmap = malloc(sizeof(TT_Raster_Map)); rmap = Emalloc(sizeof(TT_Raster_Map));
rmap->width = (width + 3) & -4; rmap->width = (width + 3) & -4;
rmap->rows = height; rmap->rows = height;
rmap->flow = TT_Flow_Down; rmap->flow = TT_Flow_Down;
rmap->cols = rmap->width; rmap->cols = rmap->width;
rmap->size = rmap->rows * rmap->width; rmap->size = rmap->rows * rmap->width;
rmap->bitmap = malloc(rmap->size); if (rmap->size > 0)
memset(rmap->bitmap, 0, rmap->size); {
rmap->bitmap = Emalloc(rmap->size);
memset(rmap->bitmap, 0, rmap->size);
}
else
rmap->bitmap = NULL;
return rmap; return rmap;
} }
@ -38,10 +43,15 @@ duplicate_raster(TT_Raster_Map * rmap)
{ {
TT_Raster_Map *new_rmap; TT_Raster_Map *new_rmap;
new_rmap = malloc(sizeof(TT_Raster_Map)); new_rmap = Emalloc(sizeof(TT_Raster_Map));
*new_rmap = *rmap; *new_rmap = *rmap;
new_rmap->bitmap = malloc(new_rmap->size); if (new_rmap->size > 0)
memcpy(new_rmap->bitmap, rmap->bitmap, new_rmap->size); {
new_rmap->bitmap = Emalloc(new_rmap->size);
memcpy(new_rmap->bitmap, rmap->bitmap, new_rmap->size);
}
else
new_rmap->bitmap = NULL;
return new_rmap; return new_rmap;
} }
@ -54,8 +64,11 @@ clear_raster(TT_Raster_Map * rmap)
static void static void
destroy_font_raster(TT_Raster_Map * rmap) destroy_font_raster(TT_Raster_Map * rmap)
{ {
free(rmap->bitmap); if (!rmap)
free(rmap); return;
if (rmap->bitmap)
Efree(rmap->bitmap);
Efree(rmap);
} }
static TT_Raster_Map * static TT_Raster_Map *
@ -693,9 +706,11 @@ Efont_free(Efont * f)
if (!TT_VALID(f->glyphs[i])) if (!TT_VALID(f->glyphs[i]))
TT_Done_Glyph(f->glyphs[i]); TT_Done_Glyph(f->glyphs[i]);
} }
free(f->glyphs); if (f->glyphs)
free(f->glyphs_cached); Efree(f->glyphs);
free(f); if (f->glyphs_cached)
Efree(f->glyphs_cached);
Efree(f);
} }
Efont * Efont *
@ -719,12 +734,12 @@ Efont_load(char *file, int size)
return NULL; return NULL;
have_engine = 1; have_engine = 1;
} }
f = malloc(sizeof(Efont)); f = Emalloc(sizeof(Efont));
f->engine = engine; f->engine = engine;
error = TT_Open_Face(f->engine, file, &f->face); error = TT_Open_Face(f->engine, file, &f->face);
if (error) if (error)
{ {
free(f); Efree(f);
/* fprintf(stderr, "Unable to open font\n"); */ /* fprintf(stderr, "Unable to open font\n"); */
return NULL; return NULL;
} }
@ -732,7 +747,7 @@ Efont_load(char *file, int size)
if (error) if (error)
{ {
TT_Close_Face(f->face); TT_Close_Face(f->face);
free(f); Efree(f);
/* fprintf(stderr, "Unable to get face properties\n"); */ /* fprintf(stderr, "Unable to get face properties\n"); */
return NULL; return NULL;
} }
@ -740,7 +755,7 @@ Efont_load(char *file, int size)
if (error) if (error)
{ {
TT_Close_Face(f->face); TT_Close_Face(f->face);
free(f); Efree(f);
/* fprintf(stderr, "Unable to create instance\n"); */ /* fprintf(stderr, "Unable to create instance\n"); */
return NULL; return NULL;
} }
@ -765,14 +780,14 @@ Efont_load(char *file, int size)
num_glyphs = f->properties.num_Glyphs; num_glyphs = f->properties.num_Glyphs;
TT_Done_Instance(f->instance); TT_Done_Instance(f->instance);
TT_Close_Face(f->face); TT_Close_Face(f->face);
free(f); Efree(f);
/* fprintf(stderr, "Sorry, but this font doesn't contain any Unicode mapping table\n"); */ /* fprintf(stderr, "Sorry, but this font doesn't contain any Unicode mapping table\n"); */
return NULL; return NULL;
} }
f->num_glyph = 256; f->num_glyph = 256;
f->glyphs = (TT_Glyph *) malloc(256 * sizeof(TT_Glyph)); f->glyphs = (TT_Glyph *) Emalloc(256 * sizeof(TT_Glyph));
memset(f->glyphs, 0, 256 * sizeof(TT_Glyph)); memset(f->glyphs, 0, 256 * sizeof(TT_Glyph));
f->glyphs_cached = (TT_Raster_Map **) malloc(256 * sizeof(TT_Raster_Map *)); f->glyphs_cached = (TT_Raster_Map **) Emalloc(256 * sizeof(TT_Raster_Map *));
memset(f->glyphs_cached, 0, 256 * sizeof(TT_Raster_Map *)); memset(f->glyphs_cached, 0, 256 * sizeof(TT_Raster_Map *));
load_flags = TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH; load_flags = TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH;

15
src/x.c
View File

@ -331,7 +331,18 @@ EShapeGetRectangles(Display * d, Window win, int dest, int *rn, int *ord)
return NULL; return NULL;
} }
else else
return XShapeGetRectangles(d, win, dest, rn, ord); {
XRectangle *r, *rr;
r = XShapeGetRectangles(d, win, dest, rn, ord);
if (r)
{
rr = Emalloc(sizeof(XRectangle) * *rn);
memcpy(rr, r, sizeof(XRectangle) * *rn);
XFree(r);
return rr;
}
}
return NULL; return NULL;
} }
@ -549,7 +560,7 @@ DelXID(Window win)
{ {
XDeleteContext(disp, win, xid_context); XDeleteContext(disp, win, xid_context);
if (xid->rects) if (xid->rects)
Efree(xid->rects); XFree(xid->rects);
Efree(xid); Efree(xid);
} }
} }