Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h dialog.c ewmh.c hints.c icccm.c iconify.c menus.c pager.c 


Log Message:
Clean up setting internal window name/class hints.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -3 -r1.268 -r1.269
--- E.h 22 May 2004 16:37:50 -0000      1.268
+++ E.h 22 May 2004 19:31:11 -0000      1.269
@@ -2068,8 +2068,9 @@
 void                EWMH_SetWorkArea(void);
 void                EWMH_SetClientList(void);
 void                EWMH_SetClientStacking(void);
-void                EWMH_SetActiveWindow(const EWin * ewin);
+void                EWMH_SetActiveWindow(Window win);
 void                EWMH_SetShowingDesktop(int on);
+void                EWMH_SetWindowName(Window win, const char *name);
 void                EWMH_SetWindowDesktop(const EWin * ewin);
 void                EWMH_SetWindowState(const EWin * ewin);
 void                EWMH_GetWindowName(EWin * ewin);
@@ -2247,7 +2248,10 @@
 void                HintsSetDesktopViewport(void);
 void                HintsSetClientList(void);
 void                HintsSetClientStacking(void);
-void                HintsSetActiveWindow(EWin * ewin);
+void                HintsSetActiveWindow(Window win);
+void                HintsSetWindowName(Window win, const char *name);
+void                HintsSetWindowClass(Window win, const char *name,
+                                       const char *clss);
 void                HintsSetWindowDesktop(EWin * ewin);
 void                HintsSetWindowArea(EWin * ewin);
 void                HintsSetWindowState(EWin * ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- dialog.c    4 May 2004 19:04:26 -0000       1.88
+++ dialog.c    22 May 2004 19:31:12 -0000      1.89
@@ -607,22 +607,12 @@
    char                pq;
    int                 i, w, h, mw, mh;
    EWin               *ewin;
-   XTextProperty       xtp;
-   XClassHint         *xch;
    Snapshot           *sn;
 
    if (d->title)
      {
-       xtp.encoding = XA_STRING;
-       xtp.format = 8;
-       xtp.value = (unsigned char *)(d->title);
-       xtp.nitems = strlen((char *)(xtp.value));
-       XSetWMName(disp, d->win, &xtp);
-       xch = XAllocClassHint();
-       xch->res_name = d->name;
-       xch->res_class = (char *)"Enlightenment_Dialog";
-       XSetClassHint(disp, d->win, xch);
-       XFree(xch);
+       HintsSetWindowName(d->win, d->title);
+       HintsSetWindowClass(d->win, d->name, "Enlightenment_Dialog");
      }
 
    ewin = FindEwinByDialog(d);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- ewmh.c      5 May 2004 00:17:15 -0000       1.47
+++ ewmh.c      22 May 2004 19:31:12 -0000      1.48
@@ -417,13 +417,11 @@
 }
 
 void
-EWMH_SetActiveWindow(const EWin * ewin)
+EWMH_SetActiveWindow(Window win)
 {
    static Window       win_last_set;
-   Window              win;
 
    EDBUG(6, "EWMH_SetActiveWindow");
-   win = (ewin) ? ewin->client.win : None;
    if (win != win_last_set)
      {
        _ATOM_SET_WINDOW(_NET_ACTIVE_WINDOW, VRoot.win, &win, 1);
@@ -448,6 +446,12 @@
  */
 
 void
+EWMH_SetWindowName(Window win, const char *name)
+{
+   _ATOM_SET_UTF8_STRING(_NET_WM_NAME, win, name);
+}
+
+void
 EWMH_SetWindowDesktop(const EWin * ewin)
 {
    CARD32              val;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- hints.c     4 May 2004 19:04:29 -0000       1.20
+++ hints.c     22 May 2004 19:31:12 -0000      1.21
@@ -134,16 +134,51 @@
 }
 
 void
-HintsSetActiveWindow(EWin * ewin)
+HintsSetActiveWindow(Window win)
 {
    EDBUG(6, "HintsSetActiveWindow");
 #if ENABLE_EWMH
-   EWMH_SetActiveWindow(ewin);
+   EWMH_SetActiveWindow(win);
 #endif
    EDBUG_RETURN_;
 }
 
 void
+HintsSetWindowName(Window win, const char *name)
+{
+   XTextProperty       xtp;
+
+   EDBUG(6, "HintsSetWindowName");
+
+   xtp.encoding = XA_STRING;
+   xtp.format = 8;
+   xtp.value = (unsigned char *)name;
+   xtp.nitems = strlen(name);
+   XSetWMName(disp, win, &xtp);
+
+#if ENABLE_EWMH
+   EWMH_SetWindowName(win, name);
+#endif
+   EDBUG_RETURN_;
+}
+
+void
+HintsSetWindowClass(Window win, const char *name, const char *clss)
+{
+   XClassHint         *xch;
+
+   EDBUG(6, "HintsSetWindowClass");
+
+   xch = XAllocClassHint();
+   xch->res_name = (char *)name;
+   xch->res_class = (char *)clss;
+   XSetClassHint(disp, win, xch);
+   XFree(xch);
+
+   EDBUG_RETURN_;
+}
+
+void
 HintsSetWindowDesktop(EWin * ewin)
 {
    EDBUG(6, "HintsSetWindowDesktop");
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- icccm.c     18 May 2004 23:31:07 -0000      1.63
+++ icccm.c     22 May 2004 19:31:12 -0000      1.64
@@ -487,7 +487,7 @@
    if (!ewin)
      {
        XSetInputFocus(disp, VRoot.win, RevertToPointerRoot, CurrentTime);
-       HintsSetActiveWindow(ewin);
+       HintsSetActiveWindow(None);
        EDBUG_RETURN_;
      }
 
@@ -511,7 +511,7 @@
      }
 /*   else */
    XSetInputFocus(disp, ewin->client.win, RevertToPointerRoot, CurrentTime);
-   HintsSetActiveWindow(ewin);
+   HintsSetActiveWindow(ewin->client.win);
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -3 -r1.108 -r1.109
--- iconify.c   8 May 2004 14:07:41 -0000       1.108
+++ iconify.c   22 May 2004 19:31:12 -0000      1.109
@@ -585,23 +585,16 @@
 IconboxShow(Iconbox * ib)
 {
    EWin               *ewin = NULL;
-   XClassHint         *xch;
-   XTextProperty       xtp;
    char                pq;
 
    pq = Mode.queue_up;
    Mode.queue_up = 0;
-   xtp.encoding = XA_STRING;
-   xtp.format = 8;
-   xtp.value = (unsigned char *)("Iconbox");
-   xtp.nitems = strlen((char *)(xtp.value));
-   XSetWMName(disp, ib->win, &xtp);
-   xch = XAllocClassHint();
-   xch->res_name = ib->name;
-   xch->res_class = (char *)"Enlightenment_IconBox";
-   XSetClassHint(disp, ib->win, xch);
-   XFree(xch);
+
+   HintsSetWindowName(ib->win, "Iconbox");
+   HintsSetWindowClass(ib->win, ib->name, "Enlightenment_IconBox");
+
    MatchToSnapInfoIconbox(ib);
+
    ewin = AddInternalToFamily(ib->win, "ICONBOX", EWIN_TYPE_ICONBOX, ib,
                              IconboxEwinInit);
    if (ewin)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -3 -r1.131 -r1.132
--- menus.c     9 May 2004 21:17:06 -0000       1.131
+++ menus.c     22 May 2004 19:31:12 -0000      1.132
@@ -638,12 +638,11 @@
 void
 MenuRealize(Menu * m)
 {
-   int                 i, maxh = 0, maxw =
-      0, maxx1, maxx2, w, h, x, y, r, mmw, mmh;
+   int                 i, maxh = 0, maxw = 0;
+   int                 maxx1, maxx2, w, h, x, y, r, mmw, mmh;
    unsigned int        iw, ih;
    Imlib_Image        *im;
    XSetWindowAttributes att;
-   XTextProperty       xtp;
    char                pq, has_i, has_s;
 
    EDBUG(5, "MenuRealize");
@@ -655,12 +654,9 @@
 
    if (m->title)
      {
-       xtp.encoding = XA_STRING;
-       xtp.format = 8;
-       xtp.value = (unsigned char *)(m->title);
-       xtp.nitems = strlen((char *)(xtp.value));
-       XSetWMName(disp, m->win, &xtp);
+       HintsSetWindowName(m->win, m->title);
      }
+
    maxh = 0;
    maxx1 = 0;
    maxx2 = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- pager.c     4 May 2004 19:04:33 -0000       1.88
+++ pager.c     22 May 2004 19:31:13 -0000      1.89
@@ -312,7 +312,6 @@
 PagerShow(Pager * p)
 {
    EWin               *ewin = NULL;
-   XClassHint         *xch;
    char                s[4096];
    char                pq;
 
@@ -326,14 +325,13 @@
      }
 
    Esnprintf(s, sizeof(s), "%i", p->desktop);
-   xch = XAllocClassHint();
-   xch->res_name = s;
-   xch->res_class = (char *)"Enlightenment_Pager";
-   XSetClassHint(disp, p->win, xch);
-   XFree(xch);
+   HintsSetWindowClass(p->win, s, "Enlightenment_Pager");
+
    pq = Mode.queue_up;
    Mode.queue_up = 0;
+
    MatchToSnapInfoPager(p);
+
    ewin = AddInternalToFamily(p->win, (p->border_name) ? p->border_name :
                              "PAGER", EWIN_TYPE_PAGER, p, PagerEwinInit);
    if (ewin)
@@ -1023,21 +1021,6 @@
       HideEwin(p->ewin);
 }
 
-static void
-PagerTitle(Pager * p, char *title)
-{
-   XTextProperty       xtp;
-
-   if (!Conf.pagers.enable)
-      return;
-
-   xtp.encoding = XA_STRING;
-   xtp.format = 8;
-   xtp.value = (unsigned char *)(title);
-   xtp.nitems = strlen((char *)(xtp.value));
-   XSetWMName(disp, p->win, &xtp);
-}
-
 void
 UpdatePagerSel(void)
 {
@@ -1427,7 +1410,7 @@
      {
        p->desktop = desk;
        Esnprintf(s, sizeof(s), "%i", desk);
-       PagerTitle(p, s);
+       HintsSetWindowName(p->win, s);
        PagerShow(p);
      }
 }




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to