Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: snaps.c Log Message: Fix initial iconbox/pager saved settings. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -3 -r1.81 -r1.82 --- snaps.c 17 Feb 2005 22:36:46 -0000 1.81 +++ snaps.c 18 Feb 2005 18:03:58 -0000 1.82 @@ -54,6 +54,46 @@ #endif }; +static Snapshot * +SnapshotCreate(const char *name) +{ + Snapshot *sn; + + sn = Ecalloc(1, sizeof(Snapshot)); + sn->name = Estrdup(name); + AddItemEnd(sn, sn->name, 0, LIST_TYPE_SNAPSHOT); + + return sn; +} + +static void +SnapshotDestroy(Snapshot * sn) +{ + /* Just making sure */ + sn = RemoveItem((char *)sn, 0, LIST_FINDBY_POINTER, LIST_TYPE_SNAPSHOT); + if (!sn) + return; + + if (sn->used) + sn->used->snap = NULL; + + if (sn->name) + Efree(sn->name); + if (sn->win_title) + Efree(sn->win_title); + if (sn->win_name) + Efree(sn->win_name); + if (sn->win_class) + Efree(sn->win_class); + if (sn->border_name) + Efree(sn->border_name); + if (sn->cmd) + Efree(sn->cmd); + if (sn->groups) + Efree(sn->groups); + Efree(sn); +} + /* * Stupid hack to fix apps that set WM_WINDOW_ROLE to * a <name>-<pid>-<something>-<time> like thing. @@ -78,7 +118,7 @@ /* Format the window identifier string */ static int -EwinMakeID(EWin * ewin, char *buf, int len) +SnapEwinMakeID(EWin * ewin, char *buf, int len) { char s[256]; @@ -100,7 +140,7 @@ /* find a snapshot state that applies to this ewin */ static Snapshot * -SnapshotFind(EWin * ewin) +SnapshotEwinFind(EWin * ewin) { Snapshot *sn; char buf[4096]; @@ -108,7 +148,7 @@ if (ewin->snap) return ewin->snap; - if (EwinMakeID(ewin, buf, sizeof(buf))) + if (SnapEwinMakeID(ewin, buf, sizeof(buf))) return NULL; sn = FindItem(buf, 0, LIST_FINDBY_BOTH, LIST_TYPE_SNAPSHOT); @@ -121,59 +161,19 @@ return sn; } -static Snapshot * -SnapshotCreate(const char *name) -{ - Snapshot *sn; - - sn = Ecalloc(1, sizeof(Snapshot)); - sn->name = Estrdup(name); - AddItemEnd(sn, sn->name, 0, LIST_TYPE_SNAPSHOT); - - return sn; -} - -static void -SnapshotDestroy(Snapshot * sn) -{ - /* Just making sure */ - sn = RemoveItem((char *)sn, 0, LIST_FINDBY_POINTER, LIST_TYPE_SNAPSHOT); - if (!sn) - return; - - if (sn->used) - sn->used->snap = NULL; - - if (sn->name) - Efree(sn->name); - if (sn->win_title) - Efree(sn->win_title); - if (sn->win_name) - Efree(sn->win_name); - if (sn->win_class) - Efree(sn->win_class); - if (sn->border_name) - Efree(sn->border_name); - if (sn->cmd) - Efree(sn->cmd); - if (sn->groups) - Efree(sn->groups); - Efree(sn); -} - /* find a snapshot state that applies to this ewin Or if that doesnt exist */ /* create a new one */ static Snapshot * -GetSnapshot(EWin * ewin) +SnapshotEwinGet(EWin * ewin) { Snapshot *sn; char buf[4096]; - sn = SnapshotFind(ewin); + sn = SnapshotEwinFind(ewin); if (sn) return sn; - if (EwinMakeID(ewin, buf, sizeof(buf))) + if (SnapEwinMakeID(ewin, buf, sizeof(buf))) return NULL; sn = SnapshotCreate(buf); @@ -314,7 +314,7 @@ { sn = gwins[i]->snap; if (!sn) - sn = GetSnapshot(gwins[i]); + sn = SnapshotEwinGet(gwins[i]); if (sn) { if (sn->groups) @@ -334,7 +334,7 @@ { if (ewin->snap) { - sn = GetSnapshot(gwins[i]); + sn = SnapshotEwinFind(gwins[i]); if (sn) { if (sn->groups) @@ -409,7 +409,7 @@ if (!(flags & SNAP_USE_ALL)) return; - sn = GetSnapshot(ewin); + sn = SnapshotEwinGet(ewin); if (!sn) return; @@ -429,6 +429,10 @@ if (!sn || !sn->track_changes) return; +#if 0 + Eprintf("SnapshotEwinUpdate %s: %#x\n", EwinGetName(ewin), flags); +#endif + if (flags & sn->use_flags) SnapEwinUpdate(sn, ewin, flags); } @@ -449,7 +453,7 @@ { char buf[4096]; - if (EwinMakeID(ewin, buf, sizeof(buf))) + if (SnapEwinMakeID(ewin, buf, sizeof(buf))) return; sn = RemoveItem(buf, 0, LIST_FINDBY_BOTH, LIST_TYPE_SNAPSHOT); } @@ -1392,20 +1396,17 @@ Snapshot *sn; int i, ax, ay; - sn = SnapshotFind(ewin); + sn = SnapshotEwinFind(ewin); if (!sn) - return; + { + if (ewin->props.autosave) + SnapshotEwinSet(ewin, SNAP_USE_ALL | SNAP_AUTO); + return; + } ewin->snap = sn; ListChangeItemID(LIST_TYPE_SNAPSHOT, ewin->snap, 1); - if (ewin->props.autosave) - { - sn->track_changes = 1; - if (!sn->use_flags) - sn->use_flags = SNAP_USE_ALL; - } - if (sn->use_flags & SNAP_USE_STICKY) EoSetSticky(ewin, sn->sticky); @@ -1490,7 +1491,7 @@ ewin->client.w, ewin->client.h, EwinGetName(ewin)); } -/* make a client window conform to snapshot info */ +/* Detach snapshot from ewin */ void SnapshotEwinUnmatch(EWin * ewin) { ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs