Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c evhandlers.c globals.c hints.c icccm.c ipc.c 
        main.c menus.c screen.c session.c setup.c 


Log Message:
Nested E. Maybe not really useful (yet?) but good for debugging and fun toy.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.297
retrieving revision 1.298
diff -u -3 -r1.297 -r1.298
--- E.h 29 Jun 2004 13:19:23 -0000      1.297
+++ E.h 30 Jun 2004 13:03:58 -0000      1.298
@@ -643,7 +643,18 @@
 }
 Client;
 
-typedef struct _root
+typedef struct
+{
+   Window              win;
+   Visual             *vis;
+   int                 depth;
+   Colormap            cmap;
+   int                 scr;
+   int                 w, h;
+}
+RealRoot;
+
+typedef struct
 {
    Window              win;
    Visual             *vis;
@@ -652,7 +663,7 @@
    int                 scr;
    int                 w, h;
 }
-Root;
+VirtRoot;
 
 typedef struct _modcurve
 {
@@ -1301,6 +1312,7 @@
    {
       char                master;      /* We are the master E */
       char                single;      /* No slaves */
+      char                window;      /* Running in virtual root window */
       pid_t               master_pid;
       int                 master_screen;
       char                startup;
@@ -1785,6 +1797,7 @@
                                        void (*init) (EWin * ewin, void *ptr));
 void                HonorIclass(char *s, int id);
 void                EwinWithdraw(EWin * ewin);
+void                EwinReparent(EWin * ewin, Window parent);
 void                SyncBorderToEwin(EWin * ewin);
 void                BorderWinpartChange(EWin * ewin, int i, int force);
 void                EwinBorderUpdateInfo(EWin * ewin);
@@ -2874,7 +2887,8 @@
 extern FnlibData   *pFnlibData;
 #endif
 extern List        *lists;
-extern Root         VRoot;
+extern RealRoot     RRoot;
+extern VirtRoot     VRoot;
 extern EConf        Conf;
 extern EMode        Mode;
 extern Desktops     desks;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -3 -r1.203 -r1.204
--- borders.c   29 Jun 2004 09:31:40 -0000      1.203
+++ borders.c   30 Jun 2004 13:03:59 -0000      1.204
@@ -1427,6 +1427,8 @@
    EwinListDelete(&EwinListStack, ewin);
    EwinListDelete(&EwinListFocus, ewin);
 
+   XSelectInput(disp, ewin->client.win, 0);
+
    HintsSetClientList();
 
    UnmatchEwinToSnapInfo(ewin);
@@ -1434,8 +1436,6 @@
    if (ewin->iconified > 0)
       RemoveMiniIcon(ewin);
 
-   HintsDelWindowHints(ewin);
-
    lst = EwinListTransientFor(ewin, &num);
    for (i = 0; i < num; i++)
      {
@@ -1499,6 +1499,14 @@
                   ewin->client.y);
 
    ICCCM_Withdraw(ewin);
+   HintsDelWindowHints(ewin);
+   EwinDestroy(ewin);
+}
+
+void
+EwinReparent(EWin * ewin, Window parent)
+{
+   EReparentWindow(disp, ewin->client.win, parent, 0, 0);
    EwinDestroy(ewin);
 }
 
@@ -3489,8 +3497,6 @@
 static void
 BorderWinpartEventMouseUp(XEvent * ev, EWin * ewin, int j)
 {
-   Window              win2;
-
    if ((ewin->bits[j].state == STATE_CLICKED) && (!ewin->bits[j].left))
       ewin->bits[j].state = STATE_HILITED;
    else
@@ -3498,8 +3504,7 @@
    ewin->bits[j].left = 0;
    BorderWinpartChange(ewin, j, 0);
 
-   win2 = WindowAtXY(ev->xbutton.x_root, ev->xbutton.y_root);
-   if (win2 == Mode.context_win && (ewin->border->part[j].aclass))
+   if (ewin->bits[j].win == Mode.context_win && ewin->border->part[j].aclass)
       EventAclass(ev, ewin, ewin->border->part[j].aclass);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -3 -r1.168 -r1.169
--- evhandlers.c        28 Jun 2004 20:57:50 -0000      1.168
+++ evhandlers.c        30 Jun 2004 13:04:00 -0000      1.169
@@ -22,17 +22,14 @@
  */
 #include "E.h"
 
-static ToolTip     *ttip = NULL;
-
-static void         ToolTipTimeout(int val, void *data);
-
 static char         sentpress = 0;
 
+static ToolTip     *ttip = NULL;
+
 static void
 ToolTipTimeout(int val, void *data)
 {
    int                 x, y, dum;
-
    unsigned int        mask;
    Window              win, rt, ch;
    ActionClass        *ac;
@@ -42,12 +39,14 @@
    /* In the case of multiple screens, check to make sure
     * the root window is still where the mouse is... */
    if (False ==
-       XQueryPointer(disp, VRoot.win, &rt, &ch, &x, &y, &dum, &dum, &mask))
+       XQueryPointer(disp, VRoot.win, &rt, &ch, &dum, &dum, &x, &y, &mask))
       EDBUG_RETURN_;
+
    /* dont pop up tooltip is mouse button down */
    if (mask &
        (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask))
       EDBUG_RETURN_;
+
    win = WindowAtXY(x, y);
    ac = FindActionClass(win);
    if (!ac)
@@ -92,6 +91,23 @@
       DoIn("TOOLTIP_TIMEOUT", Conf.tooltips.delay, ToolTipTimeout, 0, NULL);
 }
 
+static void
+ModeGetXY(Window rwin, int rx, int ry)
+{
+   Window              child;
+
+   if (Mode.wm.window)
+     {
+       XTranslateCoordinates(disp, rwin, VRoot.win,
+                             rx, ry, &Mode.x, &Mode.y, &child);
+     }
+   else
+     {
+       Mode.x = rx;
+       Mode.y = ry;
+     }
+}
+
 void
 HandleKeyPress(XEvent * ev)
 {
@@ -167,8 +183,7 @@
    Mode.last_button = ev->xbutton.button;
    Mode.last_bpress = win;
 
-   Mode.x = ev->xbutton.x_root;
-   Mode.y = ev->xbutton.y_root;
+   ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
 
    desk_click = -1;
    for (i = 0; i < Conf.desks.num; i++)
@@ -256,8 +271,7 @@
    TooltipsHandleEvent();
    UnGrabTheButtons();
 
-   Mode.x = ev->xbutton.x_root;
-   Mode.y = ev->xbutton.y_root;
+   ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
 
    pslideout = Mode.slideout;
 
@@ -344,10 +358,11 @@
 
    TooltipsHandleEvent();
    EdgeHandleMotion(ev);
+
    Mode.px = Mode.x;
    Mode.py = Mode.y;
-   Mode.x = ev->xmotion.x_root;
-   Mode.y = ev->xmotion.y_root;
+   ModeGetXY(ev->xmotion.root, ev->xmotion.x_root, ev->xmotion.y_root);
+
    desks.current = DesktopAt(Mode.x, Mode.y);
 
    if ((!(ev->xmotion.state
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/globals.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- globals.c   4 May 2004 19:04:29 -0000       1.37
+++ globals.c   30 Jun 2004 13:04:00 -0000      1.38
@@ -42,7 +42,8 @@
 FnlibData          *pFnlibData;
 #endif
 List               *lists;
-Root                VRoot;
+RealRoot            RRoot;
+VirtRoot            VRoot;
 EConf               Conf;
 EMode               Mode;
 Desktops            desks;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- hints.c     31 May 2004 20:14:50 -0000      1.23
+++ hints.c     30 Jun 2004 13:04:00 -0000      1.24
@@ -296,7 +296,7 @@
 HintsProcessPropertyChange(EWin * ewin, Atom atom_change)
 {
    EDBUG(6, "HintsHandlePropertyChange");
-#if ENABLE_GNOME
+#if 0                          /* No! - ENABLE_GNOME */
    GNOME_GetHints(ewin, atom_change);
 #endif
 #if ENABLE_EWMH
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -3 -r1.70 -r1.71
--- icccm.c     27 Jun 2004 15:59:32 -0000      1.70
+++ icccm.c     30 Jun 2004 13:04:00 -0000      1.71
@@ -62,12 +62,19 @@
    E_XA_WM_HINTS = XInternAtom(disp, "WM_HINTS", False);
    E_XA_WM_CLIENT_LEADER = XInternAtom(disp, "WM_CLIENT_LEADER", False);
    E_XA_WM_TRANSIENT_FOR = XInternAtom(disp, "WM_TRANSIENT_FOR", False);
+
+   if (Mode.wm.window)
+     {
+       Atom                wm_props[1] = { E_XA_WM_DELETE_WINDOW };
+       XSetWMProtocols(disp, VRoot.win, wm_props, 1);
+     }
 }
 
 void
 ICCCM_ProcessClientMessage(XClientMessageEvent * event)
 {
    EWin               *ewin;
+   Atom                a;
 
    if (event->message_type == E_XA_WM_CHANGE_STATE)
      {
@@ -81,6 +88,12 @@
                IconifyEwin(ewin);
          }
      }
+   else if (event->message_type == E_XA_WM_PROTOCOLS)
+     {
+       a = event->data.l[0];
+       if (a == E_XA_WM_DELETE_WINDOW)
+          SessionExit(NULL);
+     }
 }
 
 void
@@ -318,6 +331,7 @@
    XEvent              ev;
    XWindowChanges      xwc;
    int                 d;
+   Window              child;
 
    EDBUG(6, "ICCCM_Configure");
 
@@ -358,6 +372,10 @@
    ev.xconfigure.window = ewin->client.win;
    ev.xconfigure.x = desks.desk[d].x + ewin->client.x;
    ev.xconfigure.y = desks.desk[d].y + ewin->client.y;
+   if (Mode.wm.window)
+      XTranslateCoordinates(disp, VRoot.win, RRoot.win,
+                           ev.xconfigure.x, ev.xconfigure.y,
+                           &ev.xconfigure.x, &ev.xconfigure.y, &child);
    ev.xconfigure.width = ewin->client.w;
    ev.xconfigure.height = ewin->client.h;
    ev.xconfigure.border_width = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -3 -r1.164 -r1.165
--- ipc.c       29 Jun 2004 13:19:23 -0000      1.164
+++ ipc.c       30 Jun 2004 13:04:01 -0000      1.165
@@ -5873,6 +5873,26 @@
    CommsSend(c, buf);
 }
 
+static void
+IPC_Reparent(const char *params, Client * c __UNUSED__)
+{
+   char                param1[FILEPATH_LEN_MAX];
+   char                param2[FILEPATH_LEN_MAX];
+   EWin               *ewin, *enew;
+
+   if (params == NULL)
+      return;
+
+   sscanf(params, "%100s %100s", param1, param2);
+
+   ewin = IpcFindEwin(param1);
+   enew = IpcFindEwin(param2);
+   if (!ewin || !enew)
+      IpcPrintf("No matching client or target EWin found\n");
+   else
+      EwinReparent(ewin, enew->client.win);
+}
+
 /* the IPC Array */
 
 /* the format of an IPC member of the IPC array is as follows:
@@ -6383,6 +6403,11 @@
     IPC_EwinInfo2, "win_info", "wi", "Show client window info", NULL},
    {
     IPC_MiscInfo, "dump_info", NULL, "TBD", NULL},
+   {
+    IPC_Reparent,
+    "reparent", "rep",
+    "Reparent window",
+    "usage:\n" "  reparent <windowid> <new parent>"},
 };
 
 /* The IPC Handler */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/main.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -3 -r1.97 -r1.98
--- main.c      19 Jun 2004 21:31:40 -0000      1.97
+++ main.c      30 Jun 2004 13:04:18 -0000      1.98
@@ -151,6 +151,12 @@
             {
                no_overwrite = 1;
             }
+          else if ((!strcmp("-window", argv[j])) && (argc - j > 1))
+            {
+               sscanf(argv[++j], "%dx%d", &VRoot.w, &VRoot.h);
+               Mode.wm.window = 1;
+               Mode.wm.single = 1;
+            }
           else if ((!strcmp("-h", argv[j])) || (!strcmp("-help", argv[j])) ||
                    (!strcmp("-?", argv[j])) || (!strcmp("--help", argv[j])))
             {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -3 -r1.141 -r1.142
--- menus.c     28 Jun 2004 23:37:55 -0000      1.141
+++ menus.c     30 Jun 2004 13:04:18 -0000      1.142
@@ -262,15 +262,6 @@
    GetWinWH(m->items[0]->win, &w, &h);
    GetWinWH(m->win, &mw, &mh);
 
-   if (!Mode.button)
-     {
-       int                 dum;
-       Window              rt, ch;
-
-       XQueryPointer(disp, m->win, &rt, &ch, &(Mode.x), &(Mode.y), &dum, &dum,
-                     (unsigned int *)&dum);
-     }
-
    wx = 0;
    wy = 0;
    if (Conf.menusonscreen)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/screen.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- screen.c    4 May 2004 19:04:34 -0000       1.6
+++ screen.c    30 Jun 2004 13:04:18 -0000      1.7
@@ -24,7 +24,7 @@
 #include "E.h"
 
 #ifdef HAS_XINERAMA
-char                xinerama_active;
+char                xinerama_active = 0;
 static XineramaScreenInfo *screens = NULL;
 static int          num_screens = 0;
 #endif
@@ -32,6 +32,8 @@
 void
 ScreenInit(void)
 {
+   if (Mode.wm.window)
+      return;
 #ifdef HAS_XINERAMA
    xinerama_active = XineramaIsActive(disp);
    Conf.extra_head = 0;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- session.c   27 Jun 2004 15:59:32 -0000      1.74
+++ session.c   30 Jun 2004 13:04:18 -0000      1.75
@@ -133,14 +133,17 @@
 default_save_prefix(void)
 {
    static char        *def_prefix = NULL;
+   char                s[1024];
 
-   if (!def_prefix)
-     {
-       char                s[1024];
+   if (def_prefix)
+      return def_prefix;
+
+   if (Mode.wm.window)
+      Esnprintf(s, sizeof(s), "%s/...e_session-window", EDirUser());
+   else
+      Esnprintf(s, sizeof(s), "%s/...e_session-XXXXXX", EDirUser());
+   def_prefix = Estrdup(s);
 
-       Esnprintf(s, sizeof(s), "%s/...e_session-XXXXXX", EDirUser());
-       def_prefix = Estrdup(s);
-     }
    return def_prefix;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -3 -r1.132 -r1.133
--- setup.c     29 Jun 2004 13:19:23 -0000      1.132
+++ setup.c     30 Jun 2004 13:04:18 -0000      1.133
@@ -111,10 +111,13 @@
    EDBUG_RETURN_;
 }
 
+/*
+ * This function sets up all of our connections to X
+ */
 void
 SetupX(void)
 {
-   /* This function sets up all of our connections to X */
+   char                buf[128];
 
    EDBUG(6, "SetupX");
 
@@ -209,13 +212,58 @@
    XSetIOErrorHandler((XIOErrorHandler) HandleXIOError);
 
    /* Root defaults */
-   VRoot.scr = DefaultScreen(disp);
-   VRoot.win = DefaultRootWindow(disp);
-   VRoot.vis = DefaultVisual(disp, VRoot.scr);
-   VRoot.depth = DefaultDepth(disp, VRoot.scr);
-   VRoot.cmap = DefaultColormap(disp, VRoot.scr);
-   VRoot.w = DisplayWidth(disp, VRoot.scr);
-   VRoot.h = DisplayHeight(disp, VRoot.scr);
+   RRoot.scr = DefaultScreen(disp);
+   RRoot.win = DefaultRootWindow(disp);
+   RRoot.vis = DefaultVisual(disp, RRoot.scr);
+   RRoot.depth = DefaultDepth(disp, RRoot.scr);
+   RRoot.cmap = DefaultColormap(disp, RRoot.scr);
+   RRoot.w = DisplayWidth(disp, RRoot.scr);
+   RRoot.h = DisplayHeight(disp, RRoot.scr);
+
+   VRoot.win = RRoot.win;
+   VRoot.vis = RRoot.vis;
+   VRoot.depth = RRoot.depth;
+   VRoot.cmap = RRoot.cmap;
+
+   if (Mode.wm.window)
+     {
+       XSetWindowAttributes attr;
+       XClassHint         *xch;
+       XTextProperty       xtp;
+
+       /* Running E in its own virtual root window */
+       attr.backing_store = NotUseful;
+       attr.override_redirect = False;
+       attr.colormap = VRoot.cmap;
+       attr.border_pixel = 0;
+       attr.background_pixel = 0;
+       attr.save_under = True;
+       VRoot.win = XCreateWindow(disp, RRoot.win, 0, 0, VRoot.w, VRoot.h, 0,
+                                 VRoot.depth, InputOutput, VRoot.vis,
+                                 CWOverrideRedirect | CWSaveUnder |
+                                 CWBackingStore | CWColormap | CWBackPixel |
+                                 CWBorderPixel, &attr);
+
+       xtp.encoding = XA_STRING;
+       xtp.format = 8;
+       xtp.value = (unsigned char *)("Enlightenment");
+       xtp.nitems = strlen((char *)(xtp.value));
+       XSetWMName(disp, VRoot.win, &xtp);
+       xch = XAllocClassHint();
+       xch->res_name = (char *)"Virtual-Root";
+       xch->res_class = (char *)"Enlightenment";
+       XSetClassHint(disp, VRoot.win, xch);
+       XFree(xch);
+     }
+   else
+     {
+       /* Running E normally on the root window */
+       VRoot.w = RRoot.w;
+       VRoot.h = RRoot.h;
+     }
+
+   Esnprintf(buf, sizeof(buf), "%#lx", VRoot.win);
+   Esetenv("ENL_WM_ROOT", buf, 1);
 
    /* initialise imlib */
 #if USE_IMLIB2




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to