Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: pager.c Log Message: Yet another attempt to get pager scaling on resolution change right. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.195 retrieving revision 1.196 diff -u -3 -r1.195 -r1.196 --- pager.c 18 Feb 2006 08:30:08 -0000 1.195 +++ pager.c 19 Feb 2006 22:25:27 -0000 1.196 @@ -82,6 +82,7 @@ char do_newbg; char do_update; int x1, y1, x2, y2; + float scale; } Pager; static void PagerScanCancel(Pager * p); @@ -481,26 +482,41 @@ static void PagerReconfigure(Pager * p, int apply) { - int ax, ay, w, h; - double aspect; + int ax, ay, w, h, dx, dy; + double aspect, f; DesksGetAreaSize(&ax, &ay); - w = (int)(p->w * (double)VRoot.w / p->screen_w); - h = (int)(p->h * (double)VRoot.h / p->screen_h); - p->screen_w = VRoot.w; - p->screen_h = VRoot.h; - aspect = ((double)VRoot.w) / ((double)VRoot.h); + + dx = 2; + for (;;) + { + f = dx / aspect; + dy = (int)(f + .5); + f -= (double)dy; + if (f < 0) + f = -f; + if (f < .1) + break; + dx *= 2; + if (dx >= 16) + break; + } + ICCCM_SetSizeConstraints(p->ewin, VRoot.w / 64 * ax, VRoot.h / 64 * ay, VRoot.w / 4 * ax, VRoot.h / 4 * ay, - 0, 0, ax, ay, + 0, 0, dx * ax, dy * ay, aspect * ((double)ax / (double)ay), aspect * ((double)ax / (double)ay)); if (apply) - EwinResize(p->ewin, w, h); + { + w = (int)(ax * VRoot.w / p->scale + .5); + h = (int)(ay * VRoot.h / p->scale + .5); + EwinResize(p->ewin, w, h); + } } static void @@ -602,6 +618,9 @@ p->dw = w / ax; p->dh = h / ay; + if (p->scale <= 0. || Mode.op_source == OPSRC_USER) + p->scale = ((float)VRoot.w / p->dw + (float)VRoot.h / p->dh) / 2; + p->pmap = ECreatePixmap(p->win, p->w, p->h, VRoot.depth); ESetWindowBackgroundPixmap(p->win, p->pmap); p->do_newbg = 1; @@ -1650,12 +1669,18 @@ } static void +_PagersReconfigureTimeout(int val __UNUSED__, void *data __UNUSED__) +{ + PagersForeach(NULL, _PagerReconfigure, NULL); +} + +static void PagersReconfigure(void) { if (!Conf_pagers.enable) return; - PagersForeach(NULL, _PagerReconfigure, NULL); + DoIn("pg-cfg", .5, _PagersReconfigureTimeout, 0, NULL); } /* ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs