Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: dialog.c ewins.c iconify.c menus.c pager.c Log Message: Clean up iconbox layout (eliminate recursive resizing). =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v retrieving revision 1.114 retrieving revision 1.115 diff -u -3 -r1.114 -r1.115 --- dialog.c 21 May 2005 21:49:36 -0000 1.114 +++ dialog.c 22 May 2005 15:02:19 -0000 1.115 @@ -628,6 +628,8 @@ ewin->client.event_mask |= KeyPressMask | ExposureMask; ESelectInput(d->win, ewin->client.event_mask); + MoveEwinToDesktop(ewin, EoGetDesk(ewin)); + if (ewin->client.already_placed) { MoveResizeEwin(ewin, EoGetX(ewin), EoGetY(ewin), w, h); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -3 -r1.64 -r1.65 --- ewins.c 22 May 2005 13:41:25 -0000 1.64 +++ ewins.c 22 May 2005 15:02:19 -0000 1.65 @@ -859,8 +859,6 @@ EoIsFloating(ewin)); #endif - MoveEwinToDesktopAt(ewin, EoGetDesk(ewin), EoGetX(ewin), EoGetY(ewin)); - done: EUngrabServer(); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v retrieving revision 1.150 retrieving revision 1.151 diff -u -3 -r1.150 -r1.151 --- iconify.c 21 May 2005 21:49:36 -0000 1.150 +++ iconify.c 22 May 2005 15:02:19 -0000 1.151 @@ -89,7 +89,6 @@ ImageClass *ic_item_base; Imlib_Image *im_item_base; - char force_update; char arrow1_hilited; char arrow1_clicked; char arrow2_hilited; @@ -117,11 +116,16 @@ int bar_thickness; int knob_length; + /* State flags */ + char do_update; }; /* Silly hack to avoid name clash warning when using -Wshadow */ #define y1 y1_ +static void IconboxLayout(Iconbox * ib, int *px, int *py, int *pw, + int *ph); +static void IconboxDraw(Iconbox * ib); static void IconboxRedraw(Iconbox * ib); static void IboxEventScrollWin(XEvent * ev, void *prm); static void IboxEventScrollbarWin(XEvent * ev, void *prm); @@ -334,7 +338,6 @@ ib->h = 0; ib->pos = 0; ib->max = 1; - ib->force_update = 1; ib->arrow1_hilited = 0; ib->arrow1_clicked = 0; ib->arrow2_hilited = 0; @@ -343,6 +346,9 @@ ib->scrollbar_hilited = 0; ib->scrollbar_clicked = 0; ib->scrollbox_clicked = 0; + + ib->do_update = 1; + ib->win = ECreateWindow(VRoot.win, 0, 0, 128, 32, 0); ib->icon_win = ECreateWindow(ib->win, 0, 0, 128, 26, 0); EventCallbackRegister(ib->icon_win, 0, IboxEventIconWin, ib); @@ -437,14 +443,14 @@ } static void -IB_Reconfigure(Iconbox * ib) +IconboxReconfigure(Iconbox * ib) { ImageClass *ic, *ic2; EWin *ewin; int extra; ewin = ib->ewin; - ib->force_update = 1; + ewin->client.width.min = 8; ewin->client.height.min = 8; ewin->client.width.max = 16384; @@ -485,31 +491,26 @@ ewin->client.no_resize_v = 1; ib->max_min = ewin->client.width.min; } +} - ICCCM_MatchSize(ewin); +static void +IconboxEwinLayout(EWin * ewin, int *px, int *py, int *pw, int *ph) +{ + Iconbox *ib = ewin->data; + + IconboxLayout(ib, px, py, pw, ph); } static void IconboxEwinMoveResize(EWin * ewin, int resize __UNUSED__) { - static int call_depth = 0; /* Ugly! */ Iconbox *ib = ewin->data; - if (!ib || call_depth > 0) + if (!resize && !ib->do_update && !TransparencyEnabled()) return; - call_depth++; - - if (!TransparencyEnabled() && - ib->w == ewin->client.w && ib->h == ewin->client.h && !ib->force_update) - goto done; - - ib->w = ewin->client.w; - ib->h = ewin->client.h; - ib->force_update = 1; - IconboxRedraw(ib); - done: - call_depth--; + IconboxDraw(ib); + ib->do_update = 0; } static void @@ -524,6 +525,7 @@ { ewin->data = (Iconbox *) ptr; + ewin->Layout = IconboxEwinLayout; ewin->MoveResize = IconboxEwinMoveResize; ewin->Close = IconboxEwinClose; @@ -562,7 +564,7 @@ ib->ewin = ewin; - IB_Reconfigure(ib); + IconboxReconfigure(ib); w = ewin->client.w; h = ewin->client.h; @@ -578,6 +580,7 @@ ResizeEwin(ewin, w, h); MoveEwin(ewin, VRoot.w - EoGetW(ewin), VRoot.h - EoGetH(ewin)); } + MoveEwinToDesktop(ewin, EoGetDesk(ewin)); ShowEwin(ewin); } @@ -1668,24 +1671,16 @@ } static void -IconboxRedraw(Iconbox * ib) +IconboxLayout(Iconbox * ib, int *px, int *py, int *pw, int *ph) { - char was_shaded = 0; - int i, x, y, w, h; - ImageClass *ib_ic_cover; - int ib_xlt, ib_ylt, ib_ww, ib_hh; - int ib_x0, ib_y0, ib_w0, ib_h0; - Imlib_Image *im, *im2; - int ww, hh; - Pixmap pmap, mask; - - if (!ib || !ib->ewin) - return; + int x, y, w, h; + EWin *ewin = ib->ewin; - x = EoGetX(ib->ewin); - y = EoGetY(ib->ewin); - w = ib->w; - h = ib->h; + x = *px; + y = *py; + w = *pw; + h = *ph; + ICCCM_SizeMatch(ewin, w, h, &w, &h); IconboxLayoutImageWin(ib); @@ -1693,12 +1688,6 @@ { int add = 0; - if (ib->ewin->shaded) - { - was_shaded = 1; - EwinUnShade(ib->ewin); - } - if (ib->orientation) { add = ib->max; @@ -1743,27 +1732,37 @@ } } - if (ib->force_update || - (x != EoGetX(ib->ewin)) || (y != EoGetY(ib->ewin)) || - (w != ib->ewin->client.w) || (h != ib->ewin->client.h)) - { - ib->w = w; - ib->h = h; - MoveResizeEwin(ib->ewin, x, y, w, h); - ib->force_update = 0; - } + IB_FixPos(ib); - if (was_shaded) - EwinShade(ib->ewin); + *px = x; + *py = y; + *pw = ib->w = w; + *ph = ib->h = h; +} + +static void +IconboxDraw(Iconbox * ib) +{ + int i, x, y, w, h; + ImageClass *ib_ic_cover; + int ib_xlt, ib_ylt, ib_ww, ib_hh; + int ib_x0, ib_y0, ib_w0, ib_h0; + Imlib_Image *im, *im2; + int ww, hh; + Pixmap pmap, mask; + + x = EoGetX(ib->ewin); + y = EoGetY(ib->ewin); + w = ib->w; + h = ib->h; - IB_FixPos(ib); IB_DrawScroll(ib); /* Geometry of iconbox window, excluding scrollbar */ ib_xlt = 0; ib_ylt = 0; - ib_ww = ib->w; - ib_hh = ib->h; + ib_ww = w; + ib_hh = h; if (ib->orientation) { ib_ic_cover = ImageclassFind("ICONBOX_COVER_VERTICAL", 0); @@ -1916,11 +1915,26 @@ } static void +IconboxRedraw(Iconbox * ib) +{ + EWin *ewin = ib->ewin; + + ib->do_update = 1; + ResizeEwin(ib->ewin, ewin->client.w, ewin->client.h); +} + +static void IB_Scroll(Iconbox * ib, int dir) { + int ppos; + + ppos = ib->pos; ib->pos += dir; IB_FixPos(ib); - IconboxRedraw(ib); + if (ib->pos == ppos) + return; + + IconboxDraw(ib); } static void @@ -1967,13 +1981,6 @@ } static void -IB_CompleteRedraw(Iconbox * ib) -{ - IB_Reconfigure(ib); - IconboxRedraw(ib); -} - -static void IconboxesShow(void) { int i, num; @@ -2054,7 +2061,7 @@ { Iconbox *ib = (Iconbox *) prm; static int px, py, pos0; - int bs, dp, ppos; + int bs, dp; ImageClass *ic; switch (ev->type) @@ -2108,12 +2115,10 @@ bs = 1; dp = ev->xmotion.x_root - px; } - ppos = ib->pos; - ib->pos = pos0 + (dp * ib->max) / bs; - IB_FixPos(ib); - if (ib->pos != ppos) - IconboxRedraw(ib); - break; + dp = pos0 + (dp * ib->max) / bs - ib->pos; + if (dp) + IB_Scroll(ib, dp); + return; } IB_DrawScroll(ib); } @@ -2152,7 +2157,7 @@ break; ib->arrow1_clicked = 0; IB_Scroll(ib, -8); - break; + return; case EnterNotify: ib->arrow1_hilited = 1; @@ -2184,7 +2189,7 @@ break; ib->arrow2_clicked = 0; IB_Scroll(ib, 8); - break; + return; case EnterNotify: ib->arrow2_hilited = 1; @@ -2319,8 +2324,9 @@ ib->cover_hide = tmp_ib_cover_hide; ib->auto_resize_anchor = tmp_ib_autoresize_anchor; ib->animate = tmp_ib_animate; - IB_CompleteRedraw(ib); + IconboxReconfigure(ib); + IconboxRedraw(ib); IconboxesConfigSave(); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v retrieving revision 1.195 retrieving revision 1.196 diff -u -3 -r1.195 -r1.196 --- menus.c 21 May 2005 21:49:36 -0000 1.195 +++ menus.c 22 May 2005 15:02:19 -0000 1.196 @@ -338,8 +338,12 @@ ESelectInput(m->win, ewin->client.event_mask); ewin->head = head_num; + + MoveEwinToDesktop(ewin, EoGetDesk(ewin)); + if (Conf.menus.animate) EwinInstantShade(ewin, 0); + if (!noshow) { ICCCM_Cmap(NULL); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.142 retrieving revision 1.143 diff -u -3 -r1.142 -r1.143 --- pager.c 22 May 2005 13:45:10 -0000 1.142 +++ pager.c 22 May 2005 15:02:20 -0000 1.143 @@ -650,6 +650,8 @@ MoveResizeEwin(ewin, 0, VRoot.h - (Conf.desks.num - p->desktop) * EoGetH(ewin), w, h); } + MoveEwinToDesktop(ewin, EoGetDesk(ewin)); + PagerRedraw(p, 1); /* show the pager ewin */ ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs