Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h ecompmgr.c eimage.c eobj.h pager.c 


Log Message:
Add live pager update mode (when composite is enabled), take 1.

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.563
retrieving revision 1.564
diff -u -3 -r1.563 -r1.564
--- E.h 24 Aug 2006 21:32:28 -0000      1.563
+++ E.h 28 Aug 2006 22:46:22 -0000      1.564
@@ -669,6 +669,7 @@
 #define EDBUG_TYPE_ICONBOX      143
 #define EDBUG_TYPE_VERBOSE      144
 #define EDBUG_TYPE_SYNC         145
+#define EDBUG_TYPE_PAGER        146
 
 int                 EventDebug(unsigned int type);
 void                EventDebugSet(unsigned int type, int value);
===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- ecompmgr.c  13 Aug 2006 09:17:02 -0000      1.123
+++ ecompmgr.c  28 Aug 2006 22:46:22 -0000      1.124
@@ -1709,6 +1709,7 @@
          }
 #endif
      }
+   eo->serial = ev->xany.serial;
    ECompMgrDamageMergeObject(eo, parts, 1);
 }
 
===================================================================
RCS file: /cvs/e/e16/e/src/eimage.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- eimage.c    21 May 2006 18:44:15 -0000      1.7
+++ eimage.c    28 Aug 2006 22:46:22 -0000      1.8
@@ -110,6 +110,10 @@
       sw = imlib_image_get_width();
    if (sh <= 0)
       sh = imlib_image_get_height();
+   if (dw <= 0)
+      dw = sw;
+   if (dh <= 0)
+      dh = sh;
    return imlib_create_cropped_scaled_image(sx, sy, sw, sh, dw, dh);
 }
 
===================================================================
RCS file: /cvs/e/e16/e/src/eobj.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- eobj.h      7 Aug 2006 20:47:12 -0000       1.31
+++ eobj.h      28 Aug 2006 22:46:22 -0000      1.32
@@ -52,6 +52,7 @@
 #if USE_COMPOSITE
    unsigned int        opacity;
    void               *cmhook;
+   unsigned int        serial;
 #endif
    char               *name;
 };
===================================================================
RCS file: /cvs/e/e16/e/src/pager.c,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -3 -r1.224 -r1.225
--- pager.c     24 Aug 2006 21:52:28 -0000      1.224
+++ pager.c     28 Aug 2006 22:46:22 -0000      1.225
@@ -38,9 +38,15 @@
 #include "tooltips.h"
 #include "xwin.h"
 
-#define DEBUG_PAGER 0
+#define DEBUG_PAGER 1
+#if DEBUG_PAGER
+#define Dprintf(fmt...) if(EventDebug(EDBUG_TYPE_PAGER))Eprintf(fmt)
+#else
+#define Dprintf(fmt...)
+#endif
 
 #define USE_PAGER_BACKGROUND_CACHE 1
+#define IMG_SCALE 2
 
 #define EwinGetVX(ew) (ew->vx)
 #define EwinGetVY(ew) (ew->vy)
@@ -53,7 +59,7 @@
    char                zoom;
    char                title;
    char                hiq;
-   char                snap;
+   int                 mode;
    int                 scanspeed;
    int                 sel_button;
    int                 win_button;
@@ -85,17 +91,20 @@
    char                do_update;
    int                 x1, y1, x2, y2;
    float               scale;
+   unsigned int        serial;
+   int                 serdif;
 } Pager;
 
 static void         PagerScanCancel(Pager * p);
 static void         PagerScanTimeout(int val, void *data);
 static void         PagerUpdateTimeout(int val, void *data);
 static void         PagerCheckUpdate(Pager * p, void *prm);
-static void         PagerEwinUpdateFromPager(Pager * p, EWin * ewin);
+static void         PagerUpdateEwinsFromPager(Pager * p);
 static void         PagerHiwinHide(void);
 static void         PagerEwinGroupSet(void);
 static void         PagerEvent(Win win, XEvent * ev, void *prm);
 static void         PagerHiwinEvent(Win win, XEvent * ev, void *prm);
+static void         doPagerUpdate(Pager * p);
 
 static Ecore_List  *pager_list = NULL;
 
@@ -178,7 +187,7 @@
    int                 y, y2, phase, cx, cy, ww, hh, xx, yy;
    static int          offsets[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
 
-   if (!Conf_pagers.snap)
+   if (Conf_pagers.mode == 0)
       return;
 
    p = (Pager *) data;
@@ -198,6 +207,12 @@
    if (Mode.mode != MODE_NONE)
       return;
 
+   if (Conf_pagers.mode == 2)
+     {
+       doPagerUpdate(p);
+       return;
+     }
+
    DeskCurrentGetArea(&cx, &cy);
    ww = p->dw;
    hh = p->dh;
@@ -229,13 +244,7 @@
    p->update_phase++;
    if (p->update_phase >= y2)
      {
-       int                 i, num;
-       EWin               *const *lst;
-
-       lst = EwinListGetForDesk(&num, p->dsk);
-       for (i = 0; i < num; i++)
-          PagerEwinUpdateFromPager(p, lst[i]);
-
+       PagerUpdateEwinsFromPager(p);
        p->update_phase = 0;
      }
 }
@@ -259,7 +268,7 @@
 static void
 PagerEwinUpdateMini(Pager * p, EWin * ewin)
 {
-   int                 w, h, use_iclass;
+   int                 w, h, update, use_iclass, serdif;
    Drawable            draw;
 
    w = (EoGetW(ewin) * p->dw) / VRoot.w;
@@ -270,7 +279,24 @@
    if (h < 1)
       h = 1;
 
-   if ((ewin->mini_w == w) && (ewin->mini_h == h))
+   serdif = EoObj(ewin)->serial - p->serial;
+
+   update = 0;
+   if (!ewin->mini_pmm.pmap)
+      update = 1;
+   if (ewin->mini_w != w || ewin->mini_h != h)
+      update = 1;
+
+   if (serdif > 0 && ewin->type != EWIN_TYPE_PAGER)
+      update = 1;
+   if (serdif > p->serdif)
+      p->serdif = serdif;
+
+   Dprintf("PagerEwinUpdateMini %#lx/%#lx wxh=%dx%d ser=%#x/%#x dif=%d: %s\n",
+          EwinGetClientXwin(ewin), EoGetXwin(ewin), w, h,
+          EoObj(ewin)->serial, p->serial, serdif, EwinGetName(ewin));
+
+   if (!update)
       return;
 
    FreePmapMask(&ewin->mini_pmm);
@@ -279,7 +305,7 @@
    ewin->mini_h = h;
 
    draw = None;
-   if (Conf_pagers.snap)
+   if (Conf_pagers.mode)
      {
        draw = EoGetPixmap(ewin);
        if (draw == None && EwinIsOnScreen(ewin))
@@ -300,6 +326,7 @@
                ImageclassApplySimple(ic, p->win, None, STATE_NORMAL,
                                      0, 0, w, h);
          }
+       Dprintf("Use Iclass, pmap=%#lx\n", ewin->mini_pmm.pmap);
      }
    else
      {
@@ -308,6 +335,7 @@
        ScaleRect(EoGetWin(ewin), draw, p->win, None, &ewin->mini_pmm.pmap,
                  0, 0, EoGetW(ewin), EoGetH(ewin), 0, 0, w, h,
                  Conf_pagers.hiq);
+       Dprintf("Grab scaled, pmap=%#lx\n", ewin->mini_pmm.pmap);
      }
 
 #if 0                          /* FIXME - Remove? */
@@ -335,7 +363,7 @@
       return;
 
    update_screen_included = update_screen_only = 0;
-   if (Conf_pagers.snap && p->dsk == DesksGetCurrent())
+   if (Conf_pagers.mode == 1 && p->dsk == DesksGetCurrent())
      {
        /* Update from screen unless update area is entirely off-screen */
        if (!(p->x2 <= vx || p->y2 <= vy ||
@@ -401,6 +429,9 @@
             XFillRectangle(disp, p->pmap, gc, wx, wy, ww, wh);
          }
      }
+   if (p->serdif > 0)
+      p->serial += p->serdif;
+   p->serdif = 0;
 
    if (!update_screen_included)
      {
@@ -409,6 +440,7 @@
      }
 
  do_screen_update:
+   Dprintf("doPagerUpdate %d: Snap screen\n", p->dsk->num);
    /* Update pager area by snapshotting entire screen */
    ScaleRect(VRoot.win, VRoot.xwin, p->win, p->pmap, NULL, 0, 0,
             VRoot.w, VRoot.h, cx * p->dw, cy * p->dh, p->dw, p->dh,
@@ -418,9 +450,7 @@
    EClearWindow(p->win);
 
    /* Update ewin snapshots */
-   lst = EwinListGetForDesk(&num, p->dsk);
-   for (i = 0; i < num; i++)
-      PagerEwinUpdateFromPager(p, lst[i]);
+   PagerUpdateEwinsFromPager(p);
 
  done:
    p->x1 = p->y1 = 99999;
@@ -447,7 +477,7 @@
    p->do_update = 1;
    pager_update_pending = 1;
 
-   if (!Conf_pagers.snap)
+   if (Conf_pagers.mode == 0)
       return;
 
    DoIn("pg-upd", .2, PagerUpdateTimeout, 0, NULL);
@@ -511,7 +541,7 @@
    pmap = p->bgpmap = ECreatePixmap(p->win, p->dw, p->dh, 0);
 
    bg = DeskBackgroundGet(p->dsk);
-   if (Conf_pagers.snap && bg)
+   if (Conf_pagers.mode != 0 && bg)
      {
 #if USE_PAGER_BACKGROUND_CACHE
        char                s[4096];
@@ -542,7 +572,7 @@
        return;
      }
 
-   if (Conf_pagers.snap && p->dsk->bg.pmap)
+   if (Conf_pagers.mode != 0 && p->dsk->bg.pmap)
      {
        ScaleRect(VRoot.win, p->dsk->bg.pmap, p->win, pmap, NULL, 0, 0,
                  VRoot.w, VRoot.h, 0, 0, p->dw, p->dh, Conf_pagers.hiq);
@@ -766,8 +796,6 @@
 {
    if (!pager_update_pending || !Conf_pagers.enable)
       return;
-   if (Mode.mode != MODE_NONE && Conf_pagers.snap)
-      return;
 
    PagersForeach(NULL, PagerCheckUpdate, NULL);
 
@@ -795,6 +823,8 @@
    if (!EoIsShown(ewin) || !EwinIsOnScreen(ewin))
       return;
 
+   Dprintf("PagerEwinUpdateFromPager %d\n", p->dsk->num);
+
    x = EwinGetVX(ewin);
    y = EwinGetVY(ewin);
    w = EoGetW(ewin);
@@ -838,6 +868,17 @@
 }
 
 static void
+PagerUpdateEwinsFromPager(Pager * p)
+{
+   int                 i, num;
+   EWin               *const *lst;
+
+   lst = EwinListGetForDesk(&num, p->dsk);
+   for (i = 0; i < num; i++)
+      PagerEwinUpdateFromPager(p, lst[i]);
+}
+
+static void
 PagersUpdateEwin(EWin * ewin, int gone)
 {
    Desk               *dsk;
@@ -931,7 +972,7 @@
    mi = MenuItemCreate(_("Pager Settings..."), NULL, "pg cfg", NULL);
    MenuAddItem(p_menu, mi);
 
-   if (Conf_pagers.snap)
+   if (Conf_pagers.mode)
      {
        mi = MenuItemCreate(_("Snapshotting Off"), NULL, "pg snap off", NULL);
        MenuAddItem(p_menu, mi);
@@ -997,9 +1038,7 @@
    static EWin        *tt_ewin = NULL;
    ToolTip            *tt;
 
-#if DEBUG_PAGER
-   Eprintf("PagerShowTt %s\n", (ewin) ? EwinGetIconName(ewin) : NULL);
-#endif
+   Dprintf("PagerShowTt %s\n", (ewin) ? EwinGetIconName(ewin) : NULL);
 
    if (!Conf_pagers.title || (ewin == tt_ewin))
       return;
@@ -1048,9 +1087,7 @@
 static void
 PagerHiwinHide(void)
 {
-#if DEBUG_PAGER
-   Eprintf("PagerHiwinHide\n");
-#endif
+   Dprintf("PagerHiwinHide\n");
    HiwinHide(hiwin);
    PagerShowTt(NULL);
 }
@@ -1077,9 +1114,7 @@
 static void
 PagerZoomChange(Pager * p, int delta)
 {
-#if DEBUG_PAGER
-   Eprintf("PagerZoomChange delta=%d\n", delta);
-#endif
+   Dprintf("PagerZoomChange delta=%d\n", delta);
 
    if (delta == 0)
       return;
@@ -1194,12 +1229,14 @@
 }
 
 static void
-PagersSetSnap(char onoff)
+PagersSetMode(int mode)
 {
    EWin               *const *lst;
    int                 i, num;
 
-   Conf_pagers.snap = onoff;
+   if (mode == Conf_pagers.mode)
+      return;
+   Conf_pagers.mode = mode;
 
    lst = EwinListGetAll(&num);
    for (i = 0; i < num; i++)
@@ -1210,7 +1247,7 @@
 
    PagersUpdateBackground(NULL);
 
-   if (Conf_pagers.snap && Conf_pagers.scanspeed > 0)
+   if (Conf_pagers.mode != 0 && Conf_pagers.scanspeed > 0)
       PagersForeach(DesksGetCurrent(), _PagerSetSnap, NULL);
 
    autosave();
@@ -1388,10 +1425,8 @@
    EWin               *ewin, *ewin2, **gwins;
    int                 x, y;
 
-#if DEBUG_PAGER
-   Eprintf("PagerHiwinHandleMouseUp m=%d d=%d x,y=%d,%d\n", Mode.mode,
-          p->dsk, px, py);
-#endif
+   Dprintf("PagerHiwinHandleMouseUp m=%d d=%d x,y=%d,%d\n", Mode.mode,
+          p->dsk->num, px, py);
 
    if (Mode.mode != MODE_PAGER_DRAG)
      {
@@ -1470,9 +1505,7 @@
 {
    Pager              *p = (Pager *) prm;
 
-#if DEBUG_PAGER
-   Eprintf("PagerEvent ev=%d\n", ev->type);
-#endif
+   Dprintf("PagerEvent ev=%d\n", ev->type);
 
    switch (ev->type)
      {
@@ -1518,9 +1551,7 @@
    if (!p)
       return;
 
-#if DEBUG_PAGER
-   Eprintf("PagerHiwinEvent ev=%d\n", ev->type);
-#endif
+   Dprintf("PagerHiwinEvent ev=%d\n", ev->type);
 
    switch (ev->type)
      {
@@ -1675,7 +1706,7 @@
  */
 static char         tmp_show_pagers;
 static char         tmp_pager_hiq;
-static char         tmp_pager_snap;
+static int          tmp_pager_mode;
 static char         tmp_pager_zoom;
 static char         tmp_pager_title;
 static char         tmp_pager_do_scan;
@@ -1706,10 +1737,8 @@
                Conf_pagers.scanspeed = tmp_pager_scan_speed;
             else
                Conf_pagers.scanspeed = 0;
-            PagersSetSnap(tmp_pager_snap);
          }
-       if (Conf_pagers.snap != tmp_pager_snap)
-          PagersSetSnap(tmp_pager_snap);
+       PagersSetMode(tmp_pager_mode);
      }
    autosave();
 }
@@ -1733,7 +1762,7 @@
 
    tmp_show_pagers = Conf_pagers.enable;
    tmp_pager_hiq = Conf_pagers.hiq;
-   tmp_pager_snap = Conf_pagers.snap;
+   tmp_pager_mode = Conf_pagers.mode;
    tmp_pager_zoom = Conf_pagers.zoom;
    tmp_pager_title = Conf_pagers.title;
    tmp_pager_sel_button = Conf_pagers.sel_button;
@@ -1752,10 +1781,38 @@
    DialogItemSetText(di, _("Enable pager display"));
    DialogItemCheckButtonSetPtr(di, &tmp_show_pagers);
 
-   di = DialogAddItem(table, DITEM_CHECKBUTTON);
+   di = DialogAddItem(table, DITEM_SEPARATOR);
+   DialogItemSetColSpan(di, 2);
+
+   di = DialogAddItem(table, DITEM_TEXT);
+   DialogItemSetColSpan(di, 2);
+   DialogItemSetFill(di, 0, 0);
+   DialogItemSetAlign(di, 0, 512);
+   DialogItemSetText(di, _("Pager Mode:"));
+
+   radio = di = DialogAddItem(table, DITEM_RADIOBUTTON);
+   DialogItemSetColSpan(di, 2);
+   DialogItemSetText(di, _("Simple"));
+   DialogItemRadioButtonSetFirst(di, radio);
+   DialogItemRadioButtonGroupSetVal(di, 0);
+
+   di = DialogAddItem(table, DITEM_RADIOBUTTON);
    DialogItemSetColSpan(di, 2);
    DialogItemSetText(di, _("Make miniature snapshots of the screen"));
-   DialogItemCheckButtonSetPtr(di, &tmp_pager_snap);
+   DialogItemRadioButtonSetFirst(di, radio);
+   DialogItemRadioButtonGroupSetVal(di, 1);
+
+#if USE_COMPOSITE
+   di = DialogAddItem(table, DITEM_RADIOBUTTON);
+   DialogItemSetColSpan(di, 2);
+   DialogItemSetText(di, _("Live Update"));
+   DialogItemRadioButtonSetFirst(di, radio);
+   DialogItemRadioButtonGroupSetVal(di, 2);
+   DialogItemRadioButtonGroupSetValPtr(radio, &tmp_pager_mode);
+#endif
+
+   di = DialogAddItem(table, DITEM_SEPARATOR);
+   DialogItemSetColSpan(di, 2);
 
    di = DialogAddItem(table, DITEM_CHECKBUTTON);
    DialogItemSetColSpan(di, 2);
@@ -2006,9 +2063,9 @@
    else if (!strcmp(prm1, "snap"))
      {
        if (!strcmp(p, "on"))
-          PagersSetSnap(1);
+          PagersSetMode(1);
        else if (!strcmp(p, "off"))
-          PagersSetSnap(0);
+          PagersSetMode(0);
      }
    else if (!strcmp(prm1, "zoom"))
      {
@@ -2045,7 +2102,7 @@
    CFG_ITEM_BOOL(Conf_pagers, zoom, 1),
    CFG_ITEM_BOOL(Conf_pagers, title, 1),
    CFG_ITEM_BOOL(Conf_pagers, hiq, 1),
-   CFG_ITEM_BOOL(Conf_pagers, snap, 1),
+   CFG_ITEM_INT(Conf_pagers, mode, 1),
    CFG_ITEM_INT(Conf_pagers, scanspeed, 10),
    CFG_ITEM_INT(Conf_pagers, sel_button, 2),
    CFG_ITEM_INT(Conf_pagers, win_button, 1),



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to