Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c dialog.c finders.c iconify.c menus.c pager.c 


Log Message:
Improve on menu transparency. Avoid some unnecessary redraws.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -3 -r1.217 -r1.218
--- E.h 2 Mar 2004 19:17:13 -0000       1.217
+++ E.h 7 Mar 2004 08:14:24 -0000       1.218
@@ -1693,16 +1693,14 @@
 void                SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx,
                                 int *ty, int num_wins, int speed);
 void                AddToFamily(Window win);
-EWin               *AddInternalToFamily(Window win, char noshow, char *bname,
-                                       int type, void *ptr);
+EWin               *AddInternalToFamily(Window win, char *bname, int type,
+                                       void *ptr,
+                                       void (*init) (EWin * ewin, void *ptr));
 void                HonorIclass(char *s, int id);
 void                SyncBorderToEwin(EWin * ewin);
 int                 ChangeEwinWinpart(EWin * ewin, int i);
 void                DrawEwin(EWin * ewin);
 int                 ChangeEwinWinpartContents(EWin * ewin, int i);
-EWin               *Adopt(Window win);
-EWin               *AdoptInternal(Window win, Border * border, int type,
-                                 void *ptr);
 EWin               *CreateEwin(void);
 void                FreeEwin(EWin * ewin);
 void                EwinSetArea(EWin * ewin, int ax, int ay);
@@ -2092,7 +2090,7 @@
 EWin               *FindEwinByDialog(Dialog * d);
 Dialog             *FindDialogButton(Window win, int *bnum);
 Dialog             *FindDialog(Window win);
-char                FindADialog(void);
+int                 FindADialog(void);
 EWin               *FindEwinSpawningMenu(Menu * m);
 Pager              *FindPager(Window win);
 DItem              *FindDialogItem(Window win, Dialog ** dret);
@@ -2317,7 +2315,6 @@
 void                MenuAddTitle(Menu * menu, const char *title);
 void                MenuAddStyle(Menu * menu, const char *style);
 void                MenuRealize(Menu * m);
-void                MenuDrawItem(Menu * m, MenuItem * mi, char shape);
 Menu               *MenuCreateFromDirectory(char *name, MenuStyle * ms,
                                            char *dir);
 Menu               *MenuCreateFromFlatFile(char *name, MenuStyle * ms,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -3 -r1.143 -r1.144
--- borders.c   2 Mar 2004 19:17:16 -0000       1.143
+++ borders.c   7 Mar 2004 08:14:24 -0000       1.144
@@ -26,6 +26,8 @@
 static void         EwinSetBorderInit(EWin * ewin);
 static void         EwinSetBorderTo(EWin * ewin, Border * b);
 static void         DetermineEwinArea(EWin * ewin);
+EWin               *Adopt(Window win);
+EWin               *AdoptInternal(Window win, Border * border, int type);
 
 #if 0
 #define DELETE_EWIN_REFERENCE(ew, ew_ref) \
@@ -208,10 +210,8 @@
    int                 dsec, dusec;
    double              tm;
    char                firstlast;
-   Window              winid;
 
    EDBUG(3, "SlideEwinTo");
-   winid = ewin->client.win;
    spd = 16;
    min = 2;
    firstlast = 0;
@@ -351,7 +351,6 @@
    int                 i, k, num, speed, fx, fy, x, y;
    char                doslide, manplace;
    char                pq;
-   Window              winid;
    char                cangrab = 0;
 
    EDBUG(3, "AddToFamily");
@@ -376,7 +375,6 @@
      }
    /* grab that server */
    GrabX();
-   winid = win;
    speed = conf.slidespeedmap;
    doslide = conf.mapslide;
    manplace = 0;
@@ -687,16 +685,14 @@
 }
 
 EWin               *
-AddInternalToFamily(Window win, char noshow, char *bname, int type, void *ptr)
+AddInternalToFamily(Window win, char *bname, int type, void *ptr,
+                   void (*init) (EWin * ewin, void *ptr))
 {
    EWin               *ewin;
-   int                 x, y;
    char                pq;
-   Window              winid;
    Border             *b;
 
    EDBUG(3, "AddInternalToFamily");
-   winid = win;
    b = NULL;
 
    if (bname)
@@ -705,27 +701,28 @@
        if (!b)
           b = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
      }
-   ewin = AdoptInternal(win, b, type, ptr);
-   ResizeEwin(ewin, ewin->client.w, ewin->client.h);
+   ewin = AdoptInternal(win, b, type);
+   AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
+
    if (ewin->desktop < 0)
       ewin->desktop = desks.current;
    else
       ewin->desktop = DESKTOPS_WRAP_NUM(ewin->desktop);
-   x = ewin->client.x - ewin->border->border.left;
-   y = ewin->client.y - ewin->border->border.top;
-   AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
+   DesktopAddEwinToTop(ewin);
+
+   if (init)
+      init(ewin, ptr);         /* Type specific initialisation */
+
+   ICCCM_Configure(ewin);
+
    pq = queue_up;
    queue_up = 0;
    DrawEwin(ewin);
    PropagateShapes(ewin->win);
    queue_up = pq;
-   MoveEwinToDesktopAt(ewin, ewin->desktop, x, y);
-   RaiseEwin(ewin);
-   StackDesktops();
-   if (!noshow)
-      ShowEwin(ewin);
-   ICCCM_Configure(ewin);
+
    UngrabX();
+
    EDBUG_RETURN(ewin);
 }
 
@@ -1205,7 +1202,7 @@
 }
 
 EWin               *
-AdoptInternal(Window win, Border * border, int type, void *ptr)
+AdoptInternal(Window win, Border * border, int type)
 {
    EWin               *ewin;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- dialog.c    1 Mar 2004 21:03:53 -0000       1.78
+++ dialog.c    7 Mar 2004 08:14:24 -0000       1.79
@@ -583,6 +583,14 @@
    DialogMoveResize(ewin, 0);
 }
 
+static void
+DialogEwinInit(EWin * ewin, void *ptr)
+{
+   ewin->dialog = (Dialog *) ptr;
+   ewin->MoveResize = DialogMoveResize;
+   ewin->Refresh = DialogRefresh;
+}
+
 void
 ShowDialog(Dialog * d)
 {
@@ -665,14 +673,13 @@
    pq = queue_up;
    queue_up = 0;
 
-   ewin = AddInternalToFamily(d->win, 1, NULL, EWIN_TYPE_DIALOG, d);
+   ewin = AddInternalToFamily(d->win, NULL, EWIN_TYPE_DIALOG, d,
+                             DialogEwinInit);
    XSelectInput(disp, d->win,
                ExposureMask | PointerMotionMask | EnterWindowMask |
                LeaveWindowMask | FocusChangeMask | KeyPressMask);
    if (ewin)
      {
-       DesktopRemoveEwin(ewin);
-       DesktopAddEwinToTop(ewin);
        sn = FindSnapshot(ewin);
        /* get the size right damnit! */
        if (sn && sn->use_wh)
@@ -683,16 +690,12 @@
          }
        else
          {
-            if (FindADialog())
+            if (FindADialog() > 1)
                ArrangeEwin(ewin);
             else
                ArrangeEwinCentered(ewin, 0);
          }
-       RestackEwin(ewin);
        ShowEwin(ewin);
-       ewin->dialog = d;
-       ewin->MoveResize = DialogMoveResize;
-       ewin->Refresh = DialogRefresh;
      }
 
    if (!FindDialog(d->win))
@@ -2306,6 +2309,7 @@
    GetWinXY(win, &x, &y);
    GetWinWH(win, (unsigned int *)&w, (unsigned int *)&h);
    DialogDrawArea(d, x, y, w, h);
+
    if (di == NULL)
       goto exit;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/finders.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- finders.c   29 Feb 2004 01:30:17 -0000      1.25
+++ finders.c   7 Mar 2004 08:14:24 -0000       1.26
@@ -436,23 +436,20 @@
    EDBUG_RETURN(NULL);
 }
 
-char
+int
 FindADialog(void)
 {
    EWin              **ewins;
-   int                 i, num;
+   int                 i, num, n;
 
    EDBUG(6, "FindADialog");
    ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
-   for (i = 0; i < num; i++)
+   for (i = n = 0; i < num; i++)
      {
        if (ewins[i]->dialog)
-         {
-            Efree(ewins);
-            EDBUG_RETURN(1);
-         }
+          n++;
      }
    if (ewins)
       Efree(ewins);
-   EDBUG_RETURN(0);
+   EDBUG_RETURN(n);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- iconify.c   1 Mar 2004 21:03:53 -0000       1.90
+++ iconify.c   7 Mar 2004 08:14:24 -0000       1.91
@@ -558,6 +558,14 @@
    IconboxRedraw(ib);
 }
 
+static void
+IconboxEwinInit(EWin * ewin, void *ptr)
+{
+   ewin->ibox = (Iconbox *) ptr;
+   ewin->MoveResize = IconboxMoveResize;
+   ewin->Refresh = IconboxRefresh;
+}
+
 void
 IconboxShow(Iconbox * ib)
 {
@@ -579,16 +587,14 @@
    XSetClassHint(disp, ib->win, xch);
    XFree(xch);
    MatchToSnapInfoIconbox(ib);
-   ewin = AddInternalToFamily(ib->win, 1, "ICONBOX", EWIN_TYPE_ICONBOX, ib);
+   ewin = AddInternalToFamily(ib->win, "ICONBOX", EWIN_TYPE_ICONBOX, ib,
+                             IconboxEwinInit);
    if (ewin)
      {
        Snapshot           *sn;
        int                 w, h;
 
        ib->ewin = ewin;
-       ewin->ibox = ib;
-       ewin->MoveResize = IconboxMoveResize;
-       ewin->Refresh = IconboxRefresh;
 
        IB_Reconfigure(ib);
        sn = FindSnapshot(ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -3 -r1.106 -r1.107
--- menus.c     1 Mar 2004 21:03:53 -0000       1.106
+++ menus.c     7 Mar 2004 08:14:24 -0000       1.107
@@ -23,6 +23,8 @@
 #define DECLARE_STRUCT_MENU 1
 #include "E.h"
 
+static void         MenuDrawItem(Menu * m, MenuItem * mi, char shape);
+
 static void         FileMenuUpdate(int val, void *data);
 static void         FillFlatFileMenu(Menu * m, MenuStyle * ms, char *name,
                                     char *file, Menu * parent);
@@ -108,6 +110,7 @@
    EWin               *ewin;
 
    EDBUG(5, "MenuHide");
+
    if (m->win)
       EUnmapWindow(disp, m->win);
 
@@ -134,6 +137,7 @@
    EDBUG_RETURN_;
 }
 
+void                MenuRedraw(Menu * m);
 static void
 MenuMoveResize(EWin * ewin, int resize)
 {
@@ -143,7 +147,7 @@
       return;
 
    if (conf.theme.transparency || IclassIsTransparent(m->style->bg_iclass))
-      MenuRealize(m);
+      MenuRedraw(m);
 }
 
 static void
@@ -152,6 +156,14 @@
    MenuMoveResize(ewin, 0);
 }
 
+static void
+MenuEwinInit(EWin * ewin, void *ptr)
+{
+   ewin->menu = (Menu *) ptr;
+   ewin->MoveResize = MenuMoveResize;
+   ewin->Refresh = MenuRefresh;
+}
+
 void
 MenuShow(Menu * m, char noshow)
 {
@@ -301,29 +313,21 @@
        EMoveWindow(disp, m->win, -mode.x, -mode.y);
      }
 
-   ewin =
-      AddInternalToFamily(m->win, 1, m->style->border_name, EWIN_TYPE_MENU, m);
+   ewin = AddInternalToFamily(m->win, m->style->border_name, EWIN_TYPE_MENU, m,
+                             MenuEwinInit);
    if (ewin)
      {
-       DesktopRemoveEwin(ewin);
        ewin->head = head_num;
-       DesktopAddEwinToTop(ewin);
-       if (ewin->desktop != 0)
-          MoveEwin(ewin, ewin->x - desks.desk[ewin->desktop].x,
-                   ewin->y - desks.desk[ewin->desktop].y);
-       RestackEwin(ewin);
        if (conf.menuslide)
           InstantShadeEwin(ewin, 0);
        ICCCM_Cmap(NULL);
+       MoveEwin(ewin, ewin->x, ewin->y);
        if (!noshow)
          {
             ShowEwin(ewin);
             if (conf.menuslide)
                UnShadeEwin(ewin);
          }
-       ewin->menu = m;
-       ewin->MoveResize = MenuMoveResize;
-       ewin->Refresh = MenuRefresh;
      }
 
    m->stuck = 0;
@@ -503,9 +507,9 @@
 
    if (m->items)
       Efree(m->items);
-
    if (m->data)
       Efree(m->data);
+   FreePmapMask(&m->pmm);
 
    Efree(m);
 
@@ -738,11 +742,13 @@
        x = m->style->bg_iclass->padding.left;
        y = m->style->bg_iclass->padding.top;
      }
+
    r = 0;
    mmw = 0;
    mmh = 0;
    pq = queue_up;
    queue_up = 0;
+
    for (i = 0; i < m->num; i++)
      {
        EMoveResizeWindow(disp, m->items[i]->win, x, y, maxw, maxh);
@@ -814,9 +820,20 @@
      }
    EResizeWindow(disp, m->win, mmw, mmh);
 
+   queue_up = pq;
+   EDBUG_RETURN_;
+}
+
+void
+MenuRedraw(Menu * m)
+{
+   int                 i, w, h;
+
    if (!m->style->use_item_bg)
      {
-       IclassApplyCopy(m->style->bg_iclass, m->win, mmw, mmh, 0, 0,
+       GetWinWH(m->win, &w, &h);
+       FreePmapMask(&m->pmm);
+       IclassApplyCopy(m->style->bg_iclass, m->win, w, h, 0, 0,
                        STATE_NORMAL, &m->pmm, 1);
        ESetWindowBackgroundPixmap(disp, m->win, m->pmm.pmap);
        EShapeCombineMask(disp, m->win, ShapeBounding, 0, 0, m->pmm.mask,
@@ -830,9 +847,6 @@
           MenuDrawItem(m, m->items[i], 0);
        PropagateShapes(m->win);
      }
-
-   queue_up = pq;
-   EDBUG_RETURN_;
 }
 
 void
@@ -850,7 +864,7 @@
    queue_up = 0;
 
    mi_pmm = &(mi->pmm[(int)(mi->state)]);
-   if (IclassIsTransparent(m->style->bg_iclass))
+   if (conf.theme.transparency || IclassIsTransparent(m->style->bg_iclass))
       FreePmapMask(mi_pmm);
    if (!mi_pmm->pmap)
      {
@@ -1852,6 +1866,30 @@
    EDBUG_RETURN(m);
 }
 
+#if 0
+Menu               *
+MenuCreateMoveToDesktop(char *name, MenuStyle * ms)
+{
+   Menu               *m;
+   int                 i;
+   char                s1[256], s2[256];
+
+   MenuItem           *mi;
+
+   EDBUG(5, "MenuCreateDesktops");
+   m = MenuCreate(name);
+   m->style = ms;
+   for (i = 0; i < mode.numdesktops; i++)
+     {
+       Esnprintf(s1, sizeof(s1), _("Desktop %i"), i);
+       Esnprintf(s2, sizeof(s2), "%i", i);
+       mi = MenuItemCreate(s1, NULL, ACTION_MOVE_TO_DESK, s2, NULL);
+       MenuAddItem(m, mi);
+     }
+   EDBUG_RETURN(m);
+}
+#endif
+
 Menu               *
 MenuCreateFromGroups(char *name, MenuStyle * ms)
 {
@@ -2375,6 +2413,7 @@
       return;
    if (!FindEwinByMenu(data->m))
       return;
+
    GetWinXY(data->mi->win, &mx, &my);
    GetWinWH(data->mi->win, &mw, &mh);
    MenuShow(data->mi->child, 1);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -3 -r1.71 -r1.72
--- pager.c     1 Mar 2004 21:03:54 -0000       1.71
+++ pager.c     7 Mar 2004 08:14:24 -0000       1.72
@@ -280,6 +280,14 @@
 {
 }
 
+static void
+PagerEwinInit(EWin * ewin, void *ptr)
+{
+   ewin->pager = (Pager *) ptr;
+   ewin->MoveResize = PagerMoveResize;
+   ewin->Refresh = PagerRefresh;
+}
+
 void
 PagerShow(Pager * p)
 {
@@ -306,9 +314,8 @@
    pq = queue_up;
    queue_up = 0;
    MatchToSnapInfoPager(p);
-   ewin = AddInternalToFamily(p->win, 1,
-                             (p->border_name) ? p->border_name : "PAGER",
-                             EWIN_TYPE_PAGER, p);
+   ewin = AddInternalToFamily(p->win, (p->border_name) ? p->border_name :
+                             "PAGER", EWIN_TYPE_PAGER, p, PagerEwinInit);
    if (ewin)
      {
        char                s[4096];
@@ -326,9 +333,6 @@
        ewin->client.height.min = 8 * ay;
        ewin->client.width.max = 320 * ax;
        ewin->client.height.max = 240 * ay;
-       ewin->pager = p;
-       ewin->MoveResize = PagerMoveResize;
-       ewin->Refresh = PagerRefresh;
 
        p->ewin = ewin;
        p->visible = 1;




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to