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:
parent
e007b4d1c7
commit
80a8e772f7
|
@ -2128,3 +2128,20 @@ Tue Sep 21 17:06:31 EST 1999
|
|||
(Christian)
|
||||
|
||||
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
|
||||
|
|
9
src/E.h
9
src/E.h
|
@ -25,6 +25,9 @@
|
|||
#include <Imlib.h>
|
||||
#include <Fnlib.h>
|
||||
|
||||
/* dmalloc debugging */
|
||||
/*#include <dmalloc.h> */
|
||||
|
||||
/* sgi's stdio.h has:
|
||||
*
|
||||
* #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,
|
||||
int *ty, int num_wins, int speed);
|
||||
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 SetEwinToBorder(EWin * ewin, Border * b);
|
||||
void HonorIclass(char *s, int id);
|
||||
|
@ -1830,7 +1833,7 @@ int ChangeEwinWinpartContents(EWin * ewin, int i);
|
|||
void CalcEwinWinpart(EWin * ewin, int i);
|
||||
void CalcEwinSizes(EWin * ewin);
|
||||
EWin *Adopt(Window win);
|
||||
EWin *AdoptInternal(Window win, Border * border);
|
||||
EWin *AdoptInternal(Window win, Border * border, int type, void *ptr);
|
||||
EWin *CreateEwin(void);
|
||||
void FreeEwin(EWin * ewin);
|
||||
|
||||
|
@ -2531,6 +2534,8 @@ void SetSMUserThemePath(char *path);
|
|||
char *GetSMFile(void);
|
||||
char *GetGenericSMFile(void);
|
||||
void MatchEwinToSM(EWin * ewin);
|
||||
void MatchToSnapInfoPager(Pager * p);
|
||||
void MatchToSnapInfoIconbox(Iconbox * ib);
|
||||
void SaveSession(int shutdown);
|
||||
void autosave(void);
|
||||
|
||||
|
|
|
@ -607,6 +607,8 @@ AddToFamily(Window win)
|
|||
RaiseProgressbars();
|
||||
ShowEwin(ewin);
|
||||
StackDesktops();
|
||||
UngrabX();
|
||||
ewin->iconified = 0;
|
||||
IconifyEwin(ewin);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
@ -774,7 +776,7 @@ AddToFamily(Window win)
|
|||
}
|
||||
|
||||
EWin *
|
||||
AddInternalToFamily(Window win, char noshow, char *bname)
|
||||
AddInternalToFamily(Window win, char noshow, char *bname, int type, void *ptr)
|
||||
{
|
||||
EWin *ewin;
|
||||
int x, y;
|
||||
|
@ -789,16 +791,12 @@ AddInternalToFamily(Window win, char noshow, char *bname)
|
|||
b = FindItem(bname, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
|
||||
if (!b)
|
||||
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);
|
||||
if (ewin->desktop < 0)
|
||||
{
|
||||
ewin->desktop = desks.current;
|
||||
}
|
||||
ewin->desktop = desks.current;
|
||||
else
|
||||
{
|
||||
ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
|
||||
}
|
||||
ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
|
||||
x = ewin->client.x - ewin->border->border.left;
|
||||
y = ewin->client.y - ewin->border->border.top;
|
||||
AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
|
||||
|
@ -1258,7 +1256,7 @@ Adopt(Window win)
|
|||
}
|
||||
|
||||
EWin *
|
||||
AdoptInternal(Window win, Border * border)
|
||||
AdoptInternal(Window win, Border * border, int type, void *ptr)
|
||||
{
|
||||
EWin *ewin;
|
||||
Border *b;
|
||||
|
@ -1274,6 +1272,11 @@ AdoptInternal(Window win, Border * border)
|
|||
ICCCM_GetShapeInfo(ewin);
|
||||
ICCCM_GetGeoms(ewin, 0);
|
||||
|
||||
/* if (type == 1)
|
||||
* MatchEwinToSnapInfoPager(ewin, (Pager *)ptr);
|
||||
* else if (type == 2)
|
||||
* MatchEwinToSnapInfoIconbox(ewin, (Iconbox *)ptr);
|
||||
* else */
|
||||
MatchEwinToSnapInfo(ewin);
|
||||
if (!ewin->border)
|
||||
ewin->border = border;
|
||||
|
|
|
@ -571,7 +571,7 @@ ShowDialog(Dialog * d)
|
|||
STATE_NORMAL, 0);
|
||||
queue_up = pq;
|
||||
|
||||
ewin = AddInternalToFamily(d->win, 1, "DEFAULT");
|
||||
ewin = AddInternalToFamily(d->win, 1, "DEFAULT", 0, d);
|
||||
XSelectInput(disp, d->win, ExposureMask | PointerMotionMask |
|
||||
EnterWindowMask | LeaveWindowMask |
|
||||
FocusChangeMask | KeyPressMask);
|
||||
|
|
12
src/draw.c
12
src/draw.c
|
@ -43,7 +43,6 @@ HandleDrawQueue()
|
|||
{
|
||||
if ((lst[i]->win == dq->win) && (lst[i]->text))
|
||||
{
|
||||
Efree(dq->text);
|
||||
already = 1;
|
||||
i = num;
|
||||
}
|
||||
|
@ -146,6 +145,8 @@ HandleDrawQueue()
|
|||
dq->iclass->ref_count--;
|
||||
if (dq->tclass)
|
||||
dq->tclass->ref_count--;
|
||||
if (dq->text)
|
||||
Efree(dq->text);
|
||||
Efree(dq);
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +204,10 @@ HandleDrawQueue()
|
|||
PagerRedraw(lst[i]->redraw_pager, lst[i]->newbg);
|
||||
/* 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);
|
||||
|
@ -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 */
|
||||
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 */
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
XFree(rl);
|
||||
Efree(rl);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1352,7 +1358,7 @@ PropagateShapes(Window win)
|
|||
EShapeCombineMask(disp, win, ShapeBounding, 0, 0,
|
||||
None, ShapeSet);
|
||||
}
|
||||
XFree(rl);
|
||||
Efree(rl);
|
||||
}
|
||||
else
|
||||
EShapeCombineMask(disp, win, ShapeBounding, 0, 0, None, ShapeSet);
|
||||
|
|
66
src/events.c
66
src/events.c
|
@ -560,6 +560,18 @@ HKeyRelease(XEvent * ev)
|
|||
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
|
||||
HButtonPress(XEvent * ev)
|
||||
{
|
||||
|
@ -568,6 +580,60 @@ HButtonPress(XEvent * ev)
|
|||
LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
|
||||
HandleMouseDown(ev);
|
||||
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_;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ struct _mdata
|
|||
EWin *ewin;
|
||||
};
|
||||
|
||||
void ToolTipTimeout(int val, void *data);
|
||||
void SubmenuShowTimeout(int val, void *dat);
|
||||
static void ToolTipTimeout(int val, void *data);
|
||||
static void SubmenuShowTimeout(int val, void *dat);
|
||||
|
||||
static char sentpress = 0;
|
||||
static Window click_was_in = 0;
|
||||
|
@ -36,10 +36,11 @@ static Time last_time = 0;
|
|||
static int last_button = 0;
|
||||
static int pgd_x = 0, pgd_y = 0;
|
||||
|
||||
void
|
||||
static void
|
||||
ToolTipTimeout(int val, void *data)
|
||||
{
|
||||
int x, y, dum;
|
||||
|
||||
unsigned int mask;
|
||||
Window win, rt, ch;
|
||||
ActionClass *ac;
|
||||
|
@ -73,7 +74,7 @@ ToolTipTimeout(int val, void *data)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleClientMessage(XEvent * ev)
|
||||
{
|
||||
EWin *ewin;
|
||||
|
@ -192,7 +193,7 @@ HandleClientMessage(XEvent * ev)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleFocusWindowIn(Window win)
|
||||
{
|
||||
EWin *ewin;
|
||||
|
@ -232,7 +233,7 @@ HandleFocusWindowIn(Window win)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleFocusWindow(Window win)
|
||||
{
|
||||
EWin *found_ewin;
|
||||
|
@ -266,7 +267,7 @@ HandleFocusWindow(Window win)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleChildShapeChange(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -286,7 +287,7 @@ HandleChildShapeChange(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleMotion(XEvent * ev)
|
||||
{
|
||||
int dx, dy;
|
||||
|
@ -904,7 +905,7 @@ HandleMotion(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleDestroy(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -984,7 +985,7 @@ HandleDestroy(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleProperty(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -1070,7 +1071,7 @@ HandleProperty(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleCirculate(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -1096,7 +1097,7 @@ HandleCirculate(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleReparent(XEvent * ev)
|
||||
{
|
||||
Window par;
|
||||
|
@ -1153,7 +1154,7 @@ HandleReparent(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleConfigureRequest(XEvent * ev)
|
||||
{
|
||||
Window win, winrel;
|
||||
|
@ -1250,7 +1251,7 @@ HandleConfigureRequest(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleResizeRequest(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -1283,7 +1284,7 @@ HandleResizeRequest(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleUnmap(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -1363,7 +1364,7 @@ HandleUnmap(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleMapRequest(XEvent * ev)
|
||||
{
|
||||
EDBUG(5, "HandleMapRequest");
|
||||
|
@ -1380,7 +1381,7 @@ HandleMapRequest(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleExpose(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -1471,7 +1472,7 @@ HandleExpose(XEvent * ev)
|
|||
|
||||
static int pwin_px, pwin_py;
|
||||
|
||||
void
|
||||
void
|
||||
HandleMouseDown(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -1790,7 +1791,7 @@ HandleMouseDown(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleMouseUp(XEvent * ev)
|
||||
{
|
||||
Window win, win2;
|
||||
|
@ -2344,7 +2345,7 @@ HandleMouseUp(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SubmenuShowTimeout(int val, void *dat)
|
||||
{
|
||||
int mx, my;
|
||||
|
@ -2378,7 +2379,7 @@ SubmenuShowTimeout(int val, void *dat)
|
|||
val = 0;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleMouseIn(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
@ -2534,7 +2535,7 @@ HandleMouseIn(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
HandleMouseOut(XEvent * ev)
|
||||
{
|
||||
Window win;
|
||||
|
|
45
src/focus.c
45
src/focus.c
|
@ -1,11 +1,45 @@
|
|||
|
||||
#include "E.h"
|
||||
|
||||
void ReverseTimeout(int val, void *data);
|
||||
void AutoraiseTimeout(int val, void *data);
|
||||
static void ReverseTimeout(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' */
|
||||
void
|
||||
static void
|
||||
AutoraiseTimeout(int val, void *data)
|
||||
{
|
||||
EWin *found_ewin;
|
||||
|
@ -18,7 +52,7 @@ AutoraiseTimeout(int val, void *data)
|
|||
data = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ReverseTimeout(int val, void *data)
|
||||
{
|
||||
EWin *ewin;
|
||||
|
@ -269,6 +303,7 @@ FocusToEWin(EWin * ewin)
|
|||
ButtonPressMask,
|
||||
GrabModeSync, GrabModeAsync, None, None);
|
||||
}
|
||||
DoIn("FIXUP_FOCUS", 0.2, FixUpBadFocus, 0, NULL);
|
||||
if (!ewin)
|
||||
{
|
||||
XSetInputFocus(disp, root.win, RevertToPointerRoot, CurrentTime);
|
||||
|
|
10
src/iclass.c
10
src/iclass.c
|
@ -658,8 +658,8 @@ IclassApply(ImageClass * iclass, Window win, int w, int h,
|
|||
ESetWindowBackgroundPixmap(disp, win, pmap);
|
||||
EShapeCombineMask(disp, win, ShapeBounding,
|
||||
0, 0, mask, ShapeSet);
|
||||
Imlib_free_pixmap(id, pmap);
|
||||
}
|
||||
Imlib_free_pixmap(id, pmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -711,16 +711,14 @@ IclassApply(ImageClass * iclass, Window win, int w, int h,
|
|||
0, 0, tm, ShapeSet);
|
||||
EFreePixmap(disp, tm);
|
||||
}
|
||||
Imlib_free_pixmap(id, pmap);
|
||||
ESetWindowBackgroundPixmap(disp, win, pmap);
|
||||
Imlib_free_pixmap(id, pmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is->im)
|
||||
{
|
||||
/* bg color */
|
||||
ESetWindowBackground(disp, win, is->bg.pixel);
|
||||
}
|
||||
/* bg color */
|
||||
ESetWindowBackground(disp, win, is->bg.pixel);
|
||||
else if (is->im_file)
|
||||
{
|
||||
/* if unloadable - then unload */
|
||||
|
|
220
src/iconify.c
220
src/iconify.c
|
@ -368,7 +368,8 @@ ShowIconbox(Iconbox * ib)
|
|||
xch->res_class = "Enlightenment_IconBox";
|
||||
XSetClassHint(disp, ib->win, xch);
|
||||
XFree(xch);
|
||||
ewin = AddInternalToFamily(ib->win, 1, "ICONBOX");
|
||||
MatchToSnapInfoIconbox(ib);
|
||||
ewin = AddInternalToFamily(ib->win, 1, "ICONBOX", 2, ib);
|
||||
if (ewin)
|
||||
{
|
||||
Snapshot *sn;
|
||||
|
@ -406,29 +407,24 @@ ShowIconbox(Iconbox * ib)
|
|||
ib->iconsize + ib->scroll_thickness + extra;
|
||||
ewin->client.no_resize_v = 1;
|
||||
}
|
||||
ewin->desktop = desks.current;
|
||||
ewin->ibox = ib;
|
||||
DesktopRemoveEwin(ewin);
|
||||
ewin->sticky = 1;
|
||||
ResizeEwin(ewin, 160, 160);
|
||||
sn = FindSnapshot(ewin);
|
||||
/* get the size right damnit! */
|
||||
if (sn)
|
||||
{
|
||||
if ((sn->use_shade) && (sn->shade))
|
||||
InstantUnShadeEwin(ewin);
|
||||
ResizeEwin(ewin, sn->w, sn->h);
|
||||
if (sn->use_xy)
|
||||
MoveEwin(ewin, sn->x, sn->y);
|
||||
if (sn->use_wh)
|
||||
IconboxResize(ib, sn->w, sn->h);
|
||||
}
|
||||
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);
|
||||
DesktopRemoveEwin(ewin);
|
||||
DesktopAddEwinToTop(ewin);
|
||||
if ((sn) && (sn->use_shade) && (sn->shade))
|
||||
ShadeEwin(ewin);
|
||||
ShowEwin(ewin);
|
||||
if (((sn) && (sn->use_sticky) && (sn->sticky)) || (!sn))
|
||||
MakeWindowSticky(ewin);
|
||||
|
||||
RememberImportantInfoForEwin(ewin);
|
||||
}
|
||||
IconboxResize(ib, ib->ewin->client.w, ib->ewin->client.h);
|
||||
|
@ -514,6 +510,10 @@ IB_SnapEWin(EWin * ewin)
|
|||
h = (w * ewin->h) / ewin->w;
|
||||
else
|
||||
w = (h * ewin->w) / ewin->h;
|
||||
if (w < 4)
|
||||
w = 4;
|
||||
if (h < 4)
|
||||
h = 4;
|
||||
ewin->icon_pmap_w = w;
|
||||
ewin->icon_pmap_h = h;
|
||||
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;
|
||||
ww = (r[i].width * w) / ewin->w;
|
||||
hh = (r[i].height * h) / ewin->h;
|
||||
if (ww < 1)
|
||||
ww = 1;
|
||||
if (hh < 1)
|
||||
hh = 1;
|
||||
if (ww < 4)
|
||||
ww = 4;
|
||||
if (hh < 4)
|
||||
hh = 4;
|
||||
XFillRectangle(disp, ewin->icon_mask, gc, x, y, ww, hh);
|
||||
}
|
||||
XFree(r);
|
||||
|
@ -676,8 +676,8 @@ IB_GetEIcon(EWin * ewin)
|
|||
if (im)
|
||||
{
|
||||
Imlib_render(id, im, im->rgb_width, im->rgb_height);
|
||||
ewin->icon_pmap = Imlib_move_image(id, im);
|
||||
ewin->icon_mask = Imlib_move_mask(id, im);
|
||||
ewin->icon_pmap = Imlib_copy_image(id, im);
|
||||
ewin->icon_mask = Imlib_copy_mask(id, im);
|
||||
ewin->icon_pmap_w = im->rgb_width;
|
||||
ewin->icon_pmap_h = im->rgb_height;
|
||||
Imlib_destroy_image(id, im);
|
||||
|
@ -981,8 +981,6 @@ void
|
|||
UpdateAppIcon(EWin * ewin, int imode)
|
||||
{
|
||||
/* free whatever we had before */
|
||||
/*Iconbox *ib; */
|
||||
|
||||
if (ewin->icon_pmap)
|
||||
Imlib_free_pixmap(id, ewin->icon_pmap);
|
||||
if (ewin->icon_mask)
|
||||
|
@ -1586,14 +1584,15 @@ IB_DrawScroll(Iconbox * ib)
|
|||
}
|
||||
}
|
||||
PropagateShapes(ib->win);
|
||||
{
|
||||
Border *b;
|
||||
if (ib->ewin)
|
||||
{
|
||||
Border *b;
|
||||
|
||||
b = ib->ewin->border;
|
||||
SyncBorderToEwin(ib->ewin);
|
||||
if (ib->ewin->border == b)
|
||||
PropagateShapes(ib->ewin->win);
|
||||
}
|
||||
b = ib->ewin->border;
|
||||
SyncBorderToEwin(ib->ewin);
|
||||
if (ib->ewin->border == b)
|
||||
PropagateShapes(ib->ewin->win);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1634,15 +1633,21 @@ RedrawIconbox(Iconbox * ib)
|
|||
ImageClass *ic;
|
||||
Pixmap m = 0;
|
||||
char pq;
|
||||
char was_shaded = 0;
|
||||
|
||||
if (!ib)
|
||||
return;
|
||||
|
||||
if (ib->auto_resize)
|
||||
if ((ib->auto_resize) && (ib->ewin))
|
||||
{
|
||||
int add = 0;
|
||||
int x, y, w, h;
|
||||
|
||||
if (ib->ewin->shaded)
|
||||
{
|
||||
was_shaded = 1;
|
||||
UnShadeEwin(ib->ewin);
|
||||
}
|
||||
x = ib->ewin->x;
|
||||
y = ib->ewin->y;
|
||||
w = ib->ewin->client.w;
|
||||
|
@ -1652,25 +1657,31 @@ RedrawIconbox(Iconbox * ib)
|
|||
ic = FindItem("ICONBOX_VERTICAL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
|
||||
if (ic)
|
||||
add = ic->padding.top + ic->padding.bottom;
|
||||
if ((ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
add = root.h - (ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom);
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
if ((ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
add = root.h - (ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom);
|
||||
}
|
||||
x = ib->ewin->x;
|
||||
y = ib->ewin->y +
|
||||
(((ib->ewin->client.h - add) * ib->auto_resize_anchor) >> 10);
|
||||
w = ib->ewin->client.w;
|
||||
h = add;
|
||||
if ((ib->ewin->y + ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
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;
|
||||
if ((ib->ewin->y + ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
{
|
||||
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
|
||||
|
@ -1678,33 +1689,47 @@ RedrawIconbox(Iconbox * ib)
|
|||
ic = FindItem("ICONBOX_HORIZONTAL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
|
||||
if (ic)
|
||||
add = ic->padding.left + ic->padding.right;
|
||||
if ((ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
add = root.w - (ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right);
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
if ((ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
add = root.w - (ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right);
|
||||
}
|
||||
x = ib->ewin->x +
|
||||
(((ib->ewin->client.w - add) * ib->auto_resize_anchor) >> 10);
|
||||
y = ib->ewin->y;
|
||||
w = add;
|
||||
h = ib->ewin->client.h;
|
||||
if ((ib->ewin->x + ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
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 ((ib->ewin->x + ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
{
|
||||
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->y = y;
|
||||
ib->ewin->w = w + ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right;
|
||||
ib->ewin->h = h + ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom;
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
ib->ewin->w = w + ib->ewin->border->border.left +
|
||||
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);
|
||||
|
||||
x = ib->ewin->x;
|
||||
|
@ -1718,25 +1743,31 @@ RedrawIconbox(Iconbox * ib)
|
|||
if (ic)
|
||||
add = ic->padding.top + ic->padding.bottom;
|
||||
add += ib->max;
|
||||
if ((ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
add = root.h - (ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom);
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
if ((ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
add = root.h - (ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom);
|
||||
}
|
||||
x = ib->ewin->x;
|
||||
y = ib->ewin->y +
|
||||
(((ib->ewin->client.h - add) * ib->auto_resize_anchor) >> 10);
|
||||
w = ib->ewin->client.w;
|
||||
h = add;
|
||||
if ((ib->ewin->y + ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
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;
|
||||
if ((ib->ewin->y + ib->ewin->border->border.top +
|
||||
ib->ewin->border->border.bottom + add) >
|
||||
root.h)
|
||||
{
|
||||
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
|
||||
|
@ -1745,25 +1776,31 @@ RedrawIconbox(Iconbox * ib)
|
|||
if (ic)
|
||||
add = ic->padding.left + ic->padding.right;
|
||||
add += ib->max;
|
||||
if ((ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
add = root.w - (ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right);
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
if ((ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
add = root.w - (ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right);
|
||||
}
|
||||
x = ib->ewin->x +
|
||||
(((ib->ewin->client.w - add) * ib->auto_resize_anchor) >> 10);
|
||||
y = ib->ewin->y;
|
||||
w = add;
|
||||
h = ib->ewin->client.h;
|
||||
if ((ib->ewin->x + ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
if (ib->ewin->border)
|
||||
{
|
||||
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 ((ib->ewin->x + ib->ewin->border->border.left +
|
||||
ib->ewin->border->border.right + add) >
|
||||
root.w)
|
||||
{
|
||||
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) ||
|
||||
|
@ -1776,6 +1813,8 @@ RedrawIconbox(Iconbox * ib)
|
|||
ib->w = w;
|
||||
ib->h = h;
|
||||
}
|
||||
if ((was_shaded) && (ib->ewin))
|
||||
ShadeEwin(ib->ewin);
|
||||
|
||||
pq = queue_up;
|
||||
queue_up = 0;
|
||||
|
@ -2049,8 +2088,11 @@ RedrawIconbox(Iconbox * ib)
|
|||
ESetWindowBackgroundPixmap(disp, ib->icon_win, ib->pmap);
|
||||
XClearWindow(disp, ib->icon_win);
|
||||
PropagateShapes(ib->win);
|
||||
ICCCM_GetShapeInfo(ib->ewin);
|
||||
PropagateShapes(ib->ewin->win);
|
||||
if (ib->ewin)
|
||||
{
|
||||
ICCCM_GetShapeInfo(ib->ewin);
|
||||
PropagateShapes(ib->ewin->win);
|
||||
}
|
||||
queue_up = pq;
|
||||
}
|
||||
|
||||
|
|
46
src/kde.c
46
src/kde.c
|
@ -77,7 +77,7 @@ KModuleList;
|
|||
|
||||
static KModuleList *KModules = NULL;
|
||||
|
||||
void
|
||||
void
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -122,7 +122,7 @@ KDE_ClientTextMessage(Window win, Atom atom, char *data)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_SendMessagesToModules(Atom atom, long data)
|
||||
{
|
||||
|
||||
|
@ -141,7 +141,7 @@ KDE_SendMessagesToModules(Atom atom, long data)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_UpdateFocusedWindow(void)
|
||||
{
|
||||
|
||||
|
@ -190,7 +190,7 @@ KDE_UpdateFocusedWindow(void)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_NewWindow(EWin * ewin)
|
||||
{
|
||||
|
||||
|
@ -245,7 +245,7 @@ KDE_NewWindow(EWin * ewin)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_RemoveWindow(EWin * ewin)
|
||||
{
|
||||
|
||||
|
@ -275,7 +275,7 @@ KDE_RemoveWindow(EWin * ewin)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_AddModule(Window win)
|
||||
{
|
||||
|
||||
|
@ -410,7 +410,7 @@ KDE_AddModule(Window win)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_RemoveModule(Window win)
|
||||
{
|
||||
|
||||
|
@ -465,7 +465,7 @@ KDE_RemoveModule(Window win)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_Init(void)
|
||||
{
|
||||
/*
|
||||
|
@ -586,7 +586,7 @@ KDE_Init(void)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_Shutdown(void)
|
||||
{
|
||||
|
||||
|
@ -656,7 +656,7 @@ KDE_Shutdown(void)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_ClientInit(Window win)
|
||||
{
|
||||
|
||||
|
@ -689,7 +689,7 @@ KDE_ClientInit(Window win)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_ClientChange(Window win, Atom a)
|
||||
{
|
||||
|
||||
|
@ -772,7 +772,7 @@ KDE_ClientChange(Window win, Atom a)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_GetDecorationHint(Window win, long *dechints)
|
||||
{
|
||||
|
||||
|
@ -842,7 +842,7 @@ KDE_GetDecorationHint(Window win, long *dechints)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_CheckClientHints(Window win)
|
||||
{
|
||||
|
||||
|
@ -865,7 +865,7 @@ KDE_CheckClientHints(Window win)
|
|||
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
KDE_WindowCommand(EWin * ewin, char *cmd)
|
||||
{
|
||||
|
||||
|
@ -921,7 +921,7 @@ KDE_WindowCommand(EWin * ewin, char *cmd)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_Command(char *cmd, XClientMessageEvent * event)
|
||||
{
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ KDE_Command(char *cmd, XClientMessageEvent * event)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_ProcessClientMessage(XClientMessageEvent * event)
|
||||
{
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ KDE_ProcessClientMessage(XClientMessageEvent * event)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_ModuleAssert(Window win)
|
||||
{
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ KDE_ModuleAssert(Window win)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_PrepModuleEvent(Window win, KMessage msg)
|
||||
{
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ KDE_PrepModuleEvent(Window win, KMessage msg)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_SetRootArea(void)
|
||||
{
|
||||
|
||||
|
@ -1146,7 +1146,7 @@ KDE_SetRootArea(void)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_SetNumDesktops(void)
|
||||
{
|
||||
|
||||
|
@ -1182,7 +1182,7 @@ KDE_SetNumDesktops(void)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_HintChange(Atom a)
|
||||
{
|
||||
|
||||
|
@ -1206,7 +1206,7 @@ KDE_HintChange(Atom a)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KDE_UpdateClient(EWin * ewin)
|
||||
{
|
||||
|
||||
|
|
50
src/main.c
50
src/main.c
|
@ -5,7 +5,6 @@
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
||||
/* This function runs all the setup for startup, and then
|
||||
* proceeds into the primary event loop at the end.
|
||||
*/
|
||||
|
@ -223,11 +222,11 @@ main(int argc, char **argv)
|
|||
SessionInit();
|
||||
ShowDesktopControls();
|
||||
CheckEvent();
|
||||
if (mode.mapslide)
|
||||
CreateStartupDisplay(0);
|
||||
/* retreive stuff from last time we were loaded if we're restarting */
|
||||
ICCCM_GetMainEInfo();
|
||||
SetupEnv();
|
||||
if (mode.mapslide)
|
||||
CreateStartupDisplay(0);
|
||||
MapUnmap(1);
|
||||
/* set some more stuff for gnome */
|
||||
GNOME_SetCurrentArea();
|
||||
|
@ -244,8 +243,6 @@ main(int argc, char **argv)
|
|||
EnableAllPagers();
|
||||
queue_up = 1;
|
||||
}
|
||||
if (!mode.mapslide)
|
||||
CreateStartupDisplay(0);
|
||||
if (getpid() == master_pid && init_win_ext)
|
||||
{
|
||||
XKillClient(disp, init_win_ext);
|
||||
|
@ -279,6 +276,43 @@ main(int argc, char **argv)
|
|||
if (mode.display_warp < 0)
|
||||
mode.display_warp = 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;
|
||||
|
||||
|
@ -289,12 +323,6 @@ main(int argc, char **argv)
|
|||
LIST_TYPE_BACKGROUND)))
|
||||
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 */
|
||||
for (;;)
|
||||
|
|
185
src/memory.c
185
src/memory.c
|
@ -5,35 +5,140 @@
|
|||
/*#define MEM_OUT 1 */
|
||||
|
||||
#ifdef DBUG_MEM
|
||||
#define POINTERS_SIZE 256000
|
||||
#define POINTERS_SIZE 50000
|
||||
static unsigned int num_pointers = 0;
|
||||
static void *pointers_ptr[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
|
||||
|
||||
void
|
||||
EDisplayMemUse()
|
||||
{
|
||||
#ifdef DBUG_MEM
|
||||
FILE *f;
|
||||
unsigned int i, min, max, sum;
|
||||
|
||||
max = 0;
|
||||
min = 0x7ffffff;
|
||||
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++)
|
||||
{
|
||||
char tm[32];
|
||||
struct tm tim;
|
||||
struct tm *tim2;
|
||||
time_t t2;
|
||||
|
||||
sum += pointers_size[i];
|
||||
if (pointers_size[i] < min)
|
||||
min = pointers_size[i];
|
||||
if (pointers_size[i] > max)
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
fclose(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -77,26 +182,13 @@ __Emalloc(int size, const char *file, int line)
|
|||
num_pointers++;
|
||||
pointers_ptr[num_pointers - 1] = p;
|
||||
pointers_size[num_pointers - 1] = size;
|
||||
}
|
||||
#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]);
|
||||
strcpy(pointers_file[num_pointers - 1], file);
|
||||
pointers_line[num_pointers - 1] = line;
|
||||
pointers_time[num_pointers - 1] = time(NULL);
|
||||
PST(num_pointers - 1);
|
||||
#endif
|
||||
fprintf(f, " = MALLOC %s %i : %i = %p\n", file, line, size, p);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
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
|
||||
EDBUG_RETURN(p);
|
||||
}
|
||||
|
@ -243,7 +310,7 @@ __Efree(void *ptr, const char *file, int line)
|
|||
EDBUG(9, "Efree");
|
||||
#ifdef DBUG_MEM
|
||||
{
|
||||
unsigned int i, j;
|
||||
unsigned int i, j, k;
|
||||
|
||||
bad = 1;
|
||||
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_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;
|
||||
i = num_pointers;
|
||||
|
@ -306,25 +380,6 @@ __Efree(void *ptr, const char *file, int line)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
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_;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -393,7 +393,7 @@ ShowMenu(Menu * m, char noshow)
|
|||
mode.y = -((-mode.y) - mode.context_h - mh);
|
||||
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)
|
||||
{
|
||||
DesktopRemoveEwin(ewin);
|
||||
|
@ -680,7 +680,8 @@ AddTitleToMenu(Menu * menu, char *title)
|
|||
void
|
||||
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;
|
||||
ImlibImage *im;
|
||||
XSetWindowAttributes att;
|
||||
|
@ -1046,7 +1047,6 @@ CreateMenuFromDirectory(char *name, MenuStyle * ms, char *dir)
|
|||
{
|
||||
s[strlen(s) - 1] = 0;
|
||||
word(s, 1, ss);
|
||||
EDisplayMemUse();
|
||||
if (!strcmp(ss, "BG"))
|
||||
{
|
||||
Background *bg;
|
||||
|
|
40
src/pager.c
40
src/pager.c
|
@ -525,9 +525,13 @@ CreatePager(void)
|
|||
attr.border_pixel = 0;
|
||||
attr.background_pixel = 0;
|
||||
attr.save_under = False;
|
||||
p->win = ECreateWindow(root.win, 0, 0, ((48 * root.w) / root.h) * ax, 48 * ay, 0);
|
||||
p->pmap = ECreatePixmap(disp, p->win, ((48 * root.w) / root.h) * ax, 48 * ay, id->x.depth);
|
||||
p->bgpmap = ECreatePixmap(disp, p->win, ((48 * root.w) / root.h) * ax, 48, id->x.depth);
|
||||
p->w = ((48 * root.w) / root.h) * ax;
|
||||
p->h = 48 * ay;
|
||||
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);
|
||||
XSelectInput(disp, p->win, ButtonPressMask | ButtonReleaseMask |
|
||||
PointerMotionMask);
|
||||
|
@ -537,15 +541,11 @@ CreatePager(void)
|
|||
XSelectInput(disp, p->hi_win, ButtonPressMask | ButtonReleaseMask |
|
||||
PointerMotionMask);
|
||||
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->update_phase = 0;
|
||||
p->ewin = 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;
|
||||
queue_up = 0;
|
||||
ic = FindItem("PAGER_SEL", 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
|
||||
|
@ -629,10 +629,11 @@ PagerShow(Pager * p)
|
|||
XFree(xch);
|
||||
pq = queue_up;
|
||||
queue_up = 0;
|
||||
MatchToSnapInfoPager(p);
|
||||
if (p->border_name)
|
||||
ewin = AddInternalToFamily(p->win, 1, p->border_name);
|
||||
ewin = AddInternalToFamily(p->win, 1, p->border_name, 1, p);
|
||||
else
|
||||
ewin = AddInternalToFamily(p->win, 1, "PAGER");
|
||||
ewin = AddInternalToFamily(p->win, 1, "PAGER", 1, p);
|
||||
if (ewin)
|
||||
{
|
||||
char s[4096];
|
||||
|
@ -651,24 +652,14 @@ PagerShow(Pager * p)
|
|||
ewin->client.width.max = 320 * ax;
|
||||
ewin->client.height.max = 240 * ay;
|
||||
ewin->pager = p;
|
||||
ewin->desktop = desks.current;
|
||||
p->ewin = ewin;
|
||||
p->visible = 1;
|
||||
DesktopRemoveEwin(ewin);
|
||||
ewin->sticky = 1;
|
||||
sn = FindSnapshot(ewin);
|
||||
/* get the size right damnit! */
|
||||
if (sn)
|
||||
{
|
||||
if (sn->use_wh)
|
||||
{
|
||||
if ((sn->use_shade) && (sn->shade))
|
||||
InstantUnShadeEwin(ewin);
|
||||
p->w = 0;
|
||||
p->h = 0;
|
||||
ResizeEwin(ewin, sn->w, sn->h);
|
||||
PagerRedraw(p, 1);
|
||||
}
|
||||
PagerRedraw(p, 1);
|
||||
}
|
||||
/* no snapshots ? first time ? make a row on the bottom left up */
|
||||
else
|
||||
|
@ -683,13 +674,10 @@ PagerShow(Pager * p)
|
|||
PagerResize(p, pw, ph);
|
||||
PagerRedraw(p, 1);
|
||||
}
|
||||
ConformEwinToDesktop(ewin);
|
||||
/* show the pager ewin */
|
||||
DesktopRemoveEwin(ewin);
|
||||
DesktopAddEwinToTop(ewin);
|
||||
if ((sn) && (sn->use_shade) && (sn->shade))
|
||||
ShadeEwin(ewin);
|
||||
ShowEwin(ewin);
|
||||
if (((sn) && (sn->use_sticky) && (sn->sticky)) || (!sn))
|
||||
MakeWindowSticky(ewin);
|
||||
RememberImportantInfoForEwin(ewin);
|
||||
if (SNAP)
|
||||
{
|
||||
|
|
79
src/snaps.c
79
src/snaps.c
|
@ -492,7 +492,7 @@ SnapshotEwinBorder(EWin * ewin)
|
|||
sn->border_name = NULL;
|
||||
if (ewin->previous_border)
|
||||
sn->border_name = duplicate(ewin->previous_border->name);
|
||||
else
|
||||
else if (ewin->border)
|
||||
sn->border_name = duplicate(ewin->border->name);
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,7 @@ SnapshotEwinLocation(EWin * ewin)
|
|||
if (!sn)
|
||||
return;
|
||||
sn->use_xy = 1;
|
||||
if (ewin->pager)
|
||||
if (((ewin->pager) || (ewin->ibox)) && (ewin->border))
|
||||
{
|
||||
sn->x = ewin->x + ewin->border->border.left;
|
||||
sn->y = ewin->y + ewin->border->border.top;
|
||||
|
@ -732,29 +732,6 @@ SaveSnapInfo(void)
|
|||
char buf[4096], s[4096];
|
||||
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);
|
||||
f = fopen(s, "w");
|
||||
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
|
||||
MatchEwinToSnapInfoAfter(EWin * ewin)
|
||||
{
|
||||
|
|
|
@ -209,7 +209,10 @@ TclassApply(ImageClass * iclass, Window win, int w, int h, int active,
|
|||
dq->tclass = tclass;
|
||||
if (dq->tclass)
|
||||
dq->tclass->ref_count++;
|
||||
dq->text = duplicate(text);
|
||||
if (text)
|
||||
dq->text = duplicate(text);
|
||||
else
|
||||
dq->text = NULL;
|
||||
dq->w = w;
|
||||
dq->shape_propagate = 0;
|
||||
dq->pager = NULL;
|
||||
|
|
|
@ -19,6 +19,7 @@ DoIn(char *name, double in_time, void (*func) (int val, void *data),
|
|||
double tally;
|
||||
|
||||
EDBUG(5, "DoIn");
|
||||
RemoveTimerEvent(name);
|
||||
qe = Emalloc(sizeof(Qentry));
|
||||
if (!qe)
|
||||
EDBUG_RETURN_;
|
||||
|
|
51
src/ttfont.c
51
src/ttfont.c
|
@ -22,14 +22,19 @@ create_font_raster(int width, int height)
|
|||
{
|
||||
TT_Raster_Map *rmap;
|
||||
|
||||
rmap = malloc(sizeof(TT_Raster_Map));
|
||||
rmap = Emalloc(sizeof(TT_Raster_Map));
|
||||
rmap->width = (width + 3) & -4;
|
||||
rmap->rows = height;
|
||||
rmap->flow = TT_Flow_Down;
|
||||
rmap->cols = rmap->width;
|
||||
rmap->size = rmap->rows * rmap->width;
|
||||
rmap->bitmap = malloc(rmap->size);
|
||||
memset(rmap->bitmap, 0, rmap->size);
|
||||
if (rmap->size > 0)
|
||||
{
|
||||
rmap->bitmap = Emalloc(rmap->size);
|
||||
memset(rmap->bitmap, 0, rmap->size);
|
||||
}
|
||||
else
|
||||
rmap->bitmap = NULL;
|
||||
return rmap;
|
||||
}
|
||||
|
||||
|
@ -38,10 +43,15 @@ duplicate_raster(TT_Raster_Map * 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->bitmap = malloc(new_rmap->size);
|
||||
memcpy(new_rmap->bitmap, rmap->bitmap, new_rmap->size);
|
||||
if (new_rmap->size > 0)
|
||||
{
|
||||
new_rmap->bitmap = Emalloc(new_rmap->size);
|
||||
memcpy(new_rmap->bitmap, rmap->bitmap, new_rmap->size);
|
||||
}
|
||||
else
|
||||
new_rmap->bitmap = NULL;
|
||||
return new_rmap;
|
||||
}
|
||||
|
||||
|
@ -54,8 +64,11 @@ clear_raster(TT_Raster_Map * rmap)
|
|||
static void
|
||||
destroy_font_raster(TT_Raster_Map * rmap)
|
||||
{
|
||||
free(rmap->bitmap);
|
||||
free(rmap);
|
||||
if (!rmap)
|
||||
return;
|
||||
if (rmap->bitmap)
|
||||
Efree(rmap->bitmap);
|
||||
Efree(rmap);
|
||||
}
|
||||
|
||||
static TT_Raster_Map *
|
||||
|
@ -693,9 +706,11 @@ Efont_free(Efont * f)
|
|||
if (!TT_VALID(f->glyphs[i]))
|
||||
TT_Done_Glyph(f->glyphs[i]);
|
||||
}
|
||||
free(f->glyphs);
|
||||
free(f->glyphs_cached);
|
||||
free(f);
|
||||
if (f->glyphs)
|
||||
Efree(f->glyphs);
|
||||
if (f->glyphs_cached)
|
||||
Efree(f->glyphs_cached);
|
||||
Efree(f);
|
||||
}
|
||||
|
||||
Efont *
|
||||
|
@ -719,12 +734,12 @@ Efont_load(char *file, int size)
|
|||
return NULL;
|
||||
have_engine = 1;
|
||||
}
|
||||
f = malloc(sizeof(Efont));
|
||||
f = Emalloc(sizeof(Efont));
|
||||
f->engine = engine;
|
||||
error = TT_Open_Face(f->engine, file, &f->face);
|
||||
if (error)
|
||||
{
|
||||
free(f);
|
||||
Efree(f);
|
||||
/* fprintf(stderr, "Unable to open font\n"); */
|
||||
return NULL;
|
||||
}
|
||||
|
@ -732,7 +747,7 @@ Efont_load(char *file, int size)
|
|||
if (error)
|
||||
{
|
||||
TT_Close_Face(f->face);
|
||||
free(f);
|
||||
Efree(f);
|
||||
/* fprintf(stderr, "Unable to get face properties\n"); */
|
||||
return NULL;
|
||||
}
|
||||
|
@ -740,7 +755,7 @@ Efont_load(char *file, int size)
|
|||
if (error)
|
||||
{
|
||||
TT_Close_Face(f->face);
|
||||
free(f);
|
||||
Efree(f);
|
||||
/* fprintf(stderr, "Unable to create instance\n"); */
|
||||
return NULL;
|
||||
}
|
||||
|
@ -765,14 +780,14 @@ Efont_load(char *file, int size)
|
|||
num_glyphs = f->properties.num_Glyphs;
|
||||
TT_Done_Instance(f->instance);
|
||||
TT_Close_Face(f->face);
|
||||
free(f);
|
||||
Efree(f);
|
||||
/* fprintf(stderr, "Sorry, but this font doesn't contain any Unicode mapping table\n"); */
|
||||
return NULL;
|
||||
}
|
||||
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));
|
||||
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 *));
|
||||
|
||||
load_flags = TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH;
|
||||
|
|
15
src/x.c
15
src/x.c
|
@ -331,7 +331,18 @@ EShapeGetRectangles(Display * d, Window win, int dest, int *rn, int *ord)
|
|||
return NULL;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -549,7 +560,7 @@ DelXID(Window win)
|
|||
{
|
||||
XDeleteContext(disp, win, xid_context);
|
||||
if (xid->rects)
|
||||
Efree(xid->rects);
|
||||
XFree(xid->rects);
|
||||
Efree(xid);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue