Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        ewins.c ewins.h hints.c hints.h snaps.c snaps.h 


Log Message:
Client adoption changes - continued.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -3 -r1.120 -r1.121
--- ewins.c     27 Oct 2005 23:18:35 -0000      1.120
+++ ewins.c     29 Oct 2005 15:35:39 -0000      1.121
@@ -254,11 +254,13 @@
       MatchEwinToSM(ewin);
 #endif
    WindowMatchEwinOps(ewin);   /* Window matches */
-   SnapshotsApplyToEwin(ewin); /* Saved settings */
    if (!EwinIsInternal(ewin) && Mode.wm.startup)
       EHintsGetInfo(ewin);     /* E restart hints */
+   SnapshotsEwinMatch(ewin);   /* Find a saved settings match */
+   if (!ewin->state.identified)
+      SnapshotEwinApply(ewin); /* Apply saved settings */
 
-   EwinStateUpdate(ewin);      /* Update after snaps */
+   EwinStateUpdate(ewin);      /* Update after snaps etc. */
 
    ICCCM_Adopt(ewin);
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ewins.h     29 Oct 2005 13:09:31 -0000      1.22
+++ ewins.h     29 Oct 2005 15:35:39 -0000      1.23
@@ -63,6 +63,7 @@
       char                shaped;
       char                shaded;
 
+      unsigned            identified:1;
       unsigned            placed:1;
       unsigned            iconified:1;
       unsigned            docked:1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- hints.c     27 Oct 2005 23:18:35 -0000      1.52
+++ hints.c     29 Oct 2005 15:35:39 -0000      1.53
@@ -30,6 +30,9 @@
 #include "hints.h"
 #include "xwin.h"
 
+static Atom         E16_WIN_DATA;
+static Atom         E16_WIN_BORDER;
+
 /*
  * Functions that set X11-properties from E-internals
  */
@@ -58,6 +61,9 @@
      }
 
    Mode.hints.old_root_pmap = HintsGetRootPixmap(VRoot.win);
+
+   E16_WIN_DATA = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
+   E16_WIN_BORDER = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
 }
 
 void
@@ -297,17 +303,11 @@
 void
 EHintsSetInfo(const EWin * ewin)
 {
-   static Atom         a = 0, aa = 0;
    int                 c[9];
 
    if (EwinIsInternal(ewin))
       return;
 
-   if (!a)
-      a = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
-   if (!aa)
-      aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
-
    c[0] = EoGetDeskNum(ewin);
    c[1] = EoIsSticky(ewin);
    c[2] = EoGetX(ewin);
@@ -318,10 +318,10 @@
    c[7] = ewin->client.h;
    c[8] = ewin->state.docked;
 
-   ecore_x_window_prop_card32_set(_EwinGetClientXwin(ewin), a,
+   ecore_x_window_prop_card32_set(_EwinGetClientXwin(ewin), E16_WIN_DATA,
                                  (unsigned int *)c, 9);
 
-   ecore_x_window_prop_string_set(_EwinGetClientXwin(ewin), aa,
+   ecore_x_window_prop_string_set(_EwinGetClientXwin(ewin), E16_WIN_BORDER,
                                  ewin->normal_border->name);
 
    if (EventDebug(EDBUG_TYPE_SNAPS))
@@ -330,27 +330,23 @@
              ewin->client.w, ewin->client.h, EwinGetName(ewin));
 }
 
-int
+void
 EHintsGetInfo(EWin * ewin)
 {
-   static Atom         a = 0, aa = 0;
    char               *str;
    int                 num;
    int                 c[9];
 
    if (EwinIsInternal(ewin))
-      return 0;
-
-   if (!a)
-      a = XInternAtom(disp, "ENL_INTERNAL_DATA", False);
-   if (!aa)
-      aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
+      return;
 
    num =
-      ecore_x_window_prop_card32_get(_EwinGetClientXwin(ewin), a,
+      ecore_x_window_prop_card32_get(_EwinGetClientXwin(ewin), E16_WIN_DATA,
                                     (unsigned int *)c, 9);
    if (num < 8)
-      return 0;
+      return;
+
+   ewin->state.identified = 1;
 
    EoSetDesk(ewin, DeskGet(c[0]));
    EoSetSticky(ewin, c[1]);
@@ -371,7 +367,8 @@
      }
    ewin->state.placed = 1;
 
-   str = ecore_x_window_prop_string_get(_EwinGetClientXwin(ewin), aa);
+   str =
+      ecore_x_window_prop_string_get(_EwinGetClientXwin(ewin), E16_WIN_BORDER);
    if (str)
       EwinSetBorderByName(ewin, str);
    Efree(str);
@@ -380,8 +377,6 @@
       Eprintf("Snap get einf  %#lx: %4d+%4d %4dx%4d: %s\n",
              _EwinGetClientXwin(ewin), ewin->client.x, ewin->client.y,
              ewin->client.w, ewin->client.h, EwinGetName(ewin));
-
-   return 0;
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- hints.h     27 Oct 2005 23:18:35 -0000      1.1
+++ hints.h     29 Oct 2005 15:35:39 -0000      1.2
@@ -94,7 +94,7 @@
                                     unsigned int color);
 
 void                EHintsSetInfo(const EWin * ewin);
-int                 EHintsGetInfo(EWin * ewin);
+void                EHintsGetInfo(EWin * ewin);
 void                EHintsSetDeskInfo(void);
 void                EHintsGetDeskInfo(void);
 void                EHintsSetInfoOnAll(void);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -3 -r1.102 -r1.103
--- snaps.c     29 Oct 2005 08:48:40 -0000      1.102
+++ snaps.c     29 Oct 2005 15:35:39 -0000      1.103
@@ -138,7 +138,7 @@
 #define SEQ(s1, s2) ((s1) && (s2) && !strcmp(s1, s2))
 
 static int
-SnapshotEwinMatch(Snapshot * sn, EWin * ewin)
+SnapshotEwinMatch(Snapshot * sn, const EWin * ewin)
 {
    char                buf[256], *s;
 
@@ -194,7 +194,10 @@
           continue;
 
        if (!(sn->match_flags & SNAP_MATCH_MULTIPLE))
-          sn->used = ewin;
+         {
+            sn->used = ewin;
+            ewin->snap = sn;
+         }
        goto done;
      }
    sn = NULL;
@@ -274,7 +277,7 @@
 /* record info about this Ewin's attributes */
 
 static void
-SnapEwinBorder(Snapshot * sn, EWin * ewin)
+SnapEwinBorder(Snapshot * sn, const EWin * ewin)
 {
    if (sn->border_name)
       Efree(sn->border_name);
@@ -286,20 +289,20 @@
 }
 
 static void
-SnapEwinDesktop(Snapshot * sn, EWin * ewin)
+SnapEwinDesktop(Snapshot * sn, const EWin * ewin)
 {
    sn->desktop = EoGetDeskNum(ewin);
 }
 
 static void
-SnapEwinSize(Snapshot * sn, EWin * ewin)
+SnapEwinSize(Snapshot * sn, const EWin * ewin)
 {
    sn->w = ewin->client.w;
    sn->h = ewin->client.h;
 }
 
 static void
-SnapEwinLocation(Snapshot * sn, EWin * ewin)
+SnapEwinLocation(Snapshot * sn, const EWin * ewin)
 {
    int                 ax, ay;
 
@@ -316,25 +319,25 @@
 }
 
 static void
-SnapEwinLayer(Snapshot * sn, EWin * ewin)
+SnapEwinLayer(Snapshot * sn, const EWin * ewin)
 {
    sn->layer = EoGetLayer(ewin);
 }
 
 static void
-SnapEwinSticky(Snapshot * sn, EWin * ewin)
+SnapEwinSticky(Snapshot * sn, const EWin * ewin)
 {
    sn->sticky = EoIsSticky(ewin);
 }
 
 static void
-SnapEwinShade(Snapshot * sn, EWin * ewin)
+SnapEwinShade(Snapshot * sn, const EWin * ewin)
 {
    sn->shaded = ewin->state.shaded;
 }
 
 static void
-SnapEwinSkipLists(Snapshot * sn, EWin * ewin)
+SnapEwinSkipLists(Snapshot * sn, const EWin * ewin)
 {
    sn->skiptask = ewin->props.skip_ext_task;
    sn->skipwinlist = ewin->props.skip_winlist;
@@ -342,13 +345,13 @@
 }
 
 static void
-SnapEwinNeverFocus(Snapshot * sn, EWin * ewin)
+SnapEwinNeverFocus(Snapshot * sn, const EWin * ewin)
 {
    sn->neverfocus = ewin->props.never_focus;
 }
 
 static void
-SnapEwinCmd(Snapshot * sn, EWin * ewin)
+SnapEwinCmd(Snapshot * sn, const EWin * ewin)
 {
    if (ewin->icccm.wm_machine &&
        strcmp(ewin->icccm.wm_machine, Mode.wm.machine_name))
@@ -360,7 +363,7 @@
 }
 
 static void
-SnapEwinGroups(Snapshot * sn, EWin * ewin, char onoff)
+SnapEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
 {
    EWin              **gwins = NULL;
    Group             **groups;
@@ -409,7 +412,7 @@
          {
             if (ewin->snap)
               {
-                 sn = SnapshotEwinFind(gwins[i]);
+                 sn = gwins[i]->snap;
                  if (sn)
                    {
                       if (sn->groups)
@@ -425,13 +428,13 @@
 #if USE_COMPOSITE
 
 static void
-SnapEwinOpacity(Snapshot * sn, EWin * ewin)
+SnapEwinOpacity(Snapshot * sn, const EWin * ewin)
 {
    sn->opacity = ewin->ewmh.opacity >> 24;
 }
 
 static void
-SnapEwinShadow(Snapshot * sn, EWin * ewin)
+SnapEwinShadow(Snapshot * sn, const EWin * ewin)
 {
    sn->shadow = EoGetShadow(ewin);
 }
@@ -439,7 +442,7 @@
 #endif
 
 static void
-SnapEwinUpdate(Snapshot * sn, EWin * ewin, unsigned int flags)
+SnapEwinUpdate(Snapshot * sn, const EWin * ewin, unsigned int flags)
 {
    /* FIXME - We should check if anything is actually changed */
 
@@ -497,7 +500,7 @@
 }
 
 void
-SnapshotEwinUpdate(EWin * ewin, unsigned int flags)
+SnapshotEwinUpdate(const EWin * ewin, unsigned int flags)
 {
    Snapshot           *sn;
 
@@ -634,7 +637,7 @@
 }
 
 static void
-SnapshotEwinDialog(EWin * ewin)
+SnapshotEwinDialog(const EWin * ewin)
 {
    Dialog             *d;
    DItem              *table, *di;
@@ -1382,22 +1385,29 @@
    fclose(f);
 }
 
+void
+SnapshotsEwinMatch(EWin * ewin)
+{
+   Snapshot           *sn;
+
+   sn = SnapshotEwinFind(ewin);
+   if (sn)
+      return;
+
+   if (ewin->props.autosave)
+      SnapshotEwinSet(ewin, SNAP_MATCH_DEFAULT, SNAP_USE_ALL | SNAP_AUTO);
+}
+
 /* make a client window conform to snapshot info */
 void
-SnapshotsApplyToEwin(EWin * ewin)
+SnapshotEwinApply(EWin * ewin)
 {
    Snapshot           *sn;
    int                 i, ax, ay;
 
-   sn = SnapshotEwinFind(ewin);
+   sn = ewin->snap;
    if (!sn)
-     {
-       if (ewin->props.autosave)
-          SnapshotEwinSet(ewin, SNAP_MATCH_DEFAULT, SNAP_USE_ALL | SNAP_AUTO);
-       return;
-     }
-
-   ewin->snap = sn;
+      return;
 
    if (ewin->props.autosave)
       sn->track_changes = 1;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- snaps.h     23 Sep 2005 16:12:13 -0000      1.2
+++ snaps.h     29 Oct 2005 15:35:39 -0000      1.3
@@ -55,11 +55,14 @@
 void                LoadSnapInfo(void);
 void                SaveSnapInfo(void);
 void                SpawnSnappedCmds(void);
+
+void                SnapshotsEwinMatch(EWin * ewin);
+void                SnapshotEwinApply(EWin * ewin);
 void                SnapshotEwinUnmatch(EWin * ewin);
-void                SnapshotEwinUpdate(EWin * ewin, unsigned int flags);
+void                SnapshotEwinUpdate(const EWin * ewin, unsigned int flags);
 void                SnapshotEwinParse(EWin * ewin, const char *params);
-void                SnapshotsApplyToEwin(EWin * ewin);
 void                SettingsRemember(void);
+
 extern const char   SnapIpcText[];
 void                SnapIpcFunc(const char *params, Client * c);
 




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to