From: <enl...@li...> - 2005-10-24 16:05:37
|
Enlightenment CVS committal Author : kwo Project : e16 Module : e Dir : e16/e/src Modified Files: E.h Makefile.am backgrounds.c config.c desktops.c desktops.h ecompmgr.c iclass.c menus-misc.c pager.c startup.c Added Files: backgrounds.h Log Message: Fix bug in desktop background assignment. Split off backgrounds.h. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.500 retrieving revision 1.501 diff -u -3 -r1.500 -r1.501 --- E.h 23 Oct 2005 15:02:51 -0000 1.500 +++ E.h 24 Oct 2005 16:05:30 -0000 1.501 @@ -837,27 +837,6 @@ void ArrangeEwinCenteredXY(EWin * ewin, int *px, int *py); void ArrangeEwins(const char *params); -/* backgrounds.c */ -int BackgroundsConfigLoad(FILE * fs); -char *BackgroundGetUniqueString(Background * bg); -void BackgroundPixmapFree(Background * bg); -void BackgroundImagesFree(Background * bg, int free_pmap); -void BackgroundDestroyByName(const char *name); -Pixmap BackgroundApply(Background * bg, Drawable draw, - unsigned int rw, unsigned int rh, - int is_win); -void BackgroundSet(Background * bg, Window win, unsigned int rw, - unsigned int rh); -void BackgroundIncRefcount(Background * bg); -void BackgroundDecRefcount(Background * bg); -void BackgroundTouch(Background * bg); -const char *BackgroundGetName(const Background * bg); -int BackgroundGetColor(const Background * bg); -Pixmap BackgroundGetPixmap(const Background * bg); -Background *BrackgroundCreateFromImage(const char *bgid, - const char *file, char *thumb, - int thlen); - /* borders.c */ Border *BorderCreate(const char *name); void BorderDestroy(Border * b); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v retrieving revision 1.56 retrieving revision 1.57 diff -u -3 -r1.56 -r1.57 --- Makefile.am 26 Sep 2005 17:32:09 -0000 1.56 +++ Makefile.am 24 Oct 2005 16:05:30 -0000 1.57 @@ -24,6 +24,7 @@ areas.c \ arrange.c \ backgrounds.c \ + backgrounds.h \ borders.c \ buttons.c \ buttons.h \ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- backgrounds.c 10 Oct 2005 19:40:10 -0000 1.45 +++ backgrounds.c 24 Oct 2005 16:05:30 -0000 1.46 @@ -23,6 +23,7 @@ */ #include <time.h> #include "E.h" +#include "backgrounds.h" #include "desktops.h" #include "emodule.h" #include "iclass.h" @@ -961,6 +962,12 @@ return (bg) ? bg->pmap : None; } +int +BackgroundIsNone(const Background * bg) +{ + return (bg) ? !strcmp(bg->name, "NONE") : 1; +} + static time_t BackgroundGetTimestamp(const Background * bg) { @@ -1338,12 +1345,11 @@ } #endif - for (j = 0; j < (DesksGetNumber()); j++) + for (j = 0; j < DesksGetNumber(); j++) { Desk *dsk = DeskGet(j); - if ((!strcmp(bglist[i]->name, "NONE")) - && (!DeskGetBackground(dsk))) + if (BackgroundIsNone(bglist[i]) && !DeskGetBackground(dsk)) fprintf(fs, "564 %d\n", j); if (DeskGetBackground(dsk) == bglist[i]) fprintf(fs, "564 %d\n", j); @@ -1791,7 +1797,7 @@ STATE_CLICKED : STATE_NORMAL, x, 0, 64 + 8, 48 + 8); - if (!strcmp(BackgroundGetName(bglist[i]), "NONE")) + if (BackgroundIsNone(bglist[i])) { TextClass *tc; @@ -2104,7 +2110,7 @@ } SoundPlay("SOUND_SETTINGS_BG"); - if ((!bg) || ((bg) && (!strcmp(BackgroundGetName(bg), "NONE")))) + if (!bg || (bg && BackgroundIsNone(bg))) { Esnprintf(s, sizeof(s), "__NEWBG_%i", (unsigned)time(NULL)); bg = BackgroundCreate(s, NULL, NULL, 1, 1, 0, 0, 0, 0, NULL, 1, =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v retrieving revision 1.139 retrieving revision 1.140 diff -u -3 -r1.139 -r1.140 --- config.c 25 Sep 2005 00:50:52 -0000 1.139 +++ config.c 24 Oct 2005 16:05:30 -0000 1.140 @@ -22,6 +22,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" +#include "backgrounds.h" #include "buttons.h" #include "conf.h" #include "menus.h" =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v retrieving revision 1.192 retrieving revision 1.193 diff -u -3 -r1.192 -r1.193 --- desktops.c 19 Oct 2005 16:16:41 -0000 1.192 +++ desktops.c 24 Oct 2005 16:05:30 -0000 1.193 @@ -22,6 +22,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" +#include "backgrounds.h" #include "buttons.h" #include "desktops.h" #include "emodule.h" @@ -389,9 +390,14 @@ lst = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND); if (lst) { - rnd = rand(); - rnd %= num; - bg = lst[rnd]; + for (;;) + { + rnd = rand(); + rnd %= num; + bg = lst[rnd]; + if (num <= 1 || !BackgroundIsNone(bg)) + break; + } Efree(lst); } } @@ -833,10 +839,12 @@ if (!bg) return; - if (BackgroundGetPixmap(bg) != None) + if (dsk->bg_isset && dsk->pmap == BackgroundGetPixmap(bg)) return; BackgroundSet(bg, EoGetWin(dsk), EoGetW(dsk), EoGetH(dsk)); + dsk->bg_isset = 1; + dsk->pmap = BackgroundGetPixmap(bg); HintsSetRootInfo(EoGetWin(dsk), BackgroundGetPixmap(bg), BackgroundGetColor(bg)); } @@ -859,7 +867,7 @@ if (refresh) BackgroundPixmapFree(dsk->bg); - if (bg && !strcmp(BackgroundGetName(bg), "NONE")) + if (bg && BackgroundIsNone(bg)) bg = NULL; if (dsk->bg != bg) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/desktops.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- desktops.h 19 Oct 2005 16:16:41 -0000 1.8 +++ desktops.h 24 Oct 2005 16:05:30 -0000 1.9 @@ -35,11 +35,13 @@ EObj o; unsigned int num; char viewable; + char bg_isset; Background *bg; struct _button *tag; int current_area_x; int current_area_y; long event_mask; + Pixmap pmap; struct { int dirty; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -3 -r1.76 -r1.77 --- ecompmgr.c 23 Oct 2005 15:02:51 -0000 1.76 +++ ecompmgr.c 24 Oct 2005 16:05:30 -0000 1.77 @@ -29,6 +29,7 @@ #include "E.h" #if USE_COMPOSITE +#include "backgrounds.h" #include "desktops.h" #include "ecompmgr.h" #include "emodule.h" =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -3 -r1.79 -r1.80 --- iclass.c 16 Oct 2005 21:39:14 -0000 1.79 +++ iclass.c 24 Oct 2005 16:05:30 -0000 1.80 @@ -22,6 +22,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" +#include "backgrounds.h" #include "conf.h" #include "desktops.h" #include "emodule.h" =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/menus-misc.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- menus-misc.c 20 Oct 2005 21:42:45 -0000 1.22 +++ menus-misc.c 24 Oct 2005 16:05:30 -0000 1.23 @@ -22,6 +22,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" +#include "backgrounds.h" #include "conf.h" #include "desktops.h" #include "ewins.h" =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.180 retrieving revision 1.181 diff -u -3 -r1.180 -r1.181 --- pager.c 12 Oct 2005 17:20:42 -0000 1.180 +++ pager.c 24 Oct 2005 16:05:30 -0000 1.181 @@ -22,6 +22,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" +#include "backgrounds.h" #include "desktops.h" #include "emodule.h" #include "ewins.h" =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/startup.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -3 -r1.63 -r1.64 --- startup.c 18 Oct 2005 19:51:14 -0000 1.63 +++ startup.c 24 Oct 2005 16:05:30 -0000 1.64 @@ -22,6 +22,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "E.h" +#include "backgrounds.h" #include "eobj.h" #include "iclass.h" #include "xwin.h" |