Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: ecompmgr.c eobj.c eobj.h ewins.c ewins.h ewmh.c icccm.c Log Message: Clean up client adoption. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v retrieving revision 1.77 retrieving revision 1.78 diff -u -3 -r1.77 -r1.78 --- ecompmgr.c 24 Oct 2005 16:05:30 -0000 1.77 +++ ecompmgr.c 24 Oct 2005 17:35:09 -0000 1.78 @@ -1381,9 +1381,10 @@ if (!Mode_compmgr.active) /* FIXME - Here? */ return; - if (!XGetWindowAttributes(disp, eo->win, &attr)) + if (eo->inputonly) return; - if (attr.class == InputOnly) + + if (!XGetWindowAttributes(disp, eo->win, &attr)) return; cw = Ecalloc(1, sizeof(ECmWinInfo)); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/eobj.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -3 -r1.54 -r1.55 --- eobj.c 16 Oct 2005 09:33:49 -0000 1.54 +++ eobj.c 24 Oct 2005 17:35:09 -0000 1.55 @@ -132,9 +132,14 @@ if (win == None) { if (type == EOBJ_TYPE_EVENT) - win = ECreateEventWindow(VRoot.win, x, y, w, h); + { + win = ECreateEventWindow(VRoot.win, x, y, w, h); + eo->inputonly = 1; + } else - win = ECreateWindow(EoGetWin(eo->desk), x, y, w, h, su); + { + win = ECreateWindow(EoGetWin(eo->desk), x, y, w, h, su); + } } eo->type = type; eo->win = win; @@ -250,6 +255,8 @@ EobjInit(eo, type, win, attr.x, attr.y, attr.width, attr.height, 0, NULL); eo->name = ecore_x_icccm_title_get(win); eo->external = 1; + if (attr.class == InputOnly) + eo->inputonly = 1; #if 1 /* FIXME - TBD */ if (type == EOBJ_TYPE_EXT) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/eobj.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- eobj.h 23 Oct 2005 15:02:51 -0000 1.16 +++ eobj.h 24 Oct 2005 17:35:09 -0000 1.17 @@ -40,6 +40,7 @@ char sticky; char floating; unsigned external:1; + unsigned inputonly:1; unsigned shown:1; unsigned gone:1; unsigned noredir:1; /* Do not redirect */ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -3 -r1.116 -r1.117 --- ewins.c 23 Oct 2005 15:02:51 -0000 1.116 +++ ewins.c 24 Oct 2005 17:35:09 -0000 1.117 @@ -49,6 +49,8 @@ static void EwinSlideIn(int val __UNUSED__, void *data); +static void EwinGetGeometry(EWin * ewin); + static void EwinChangesStart(EWin * ewin); static void EwinChangesProcess(EWin * ewin); @@ -72,18 +74,6 @@ EwinCreate(Window win, int type) { EWin *ewin; - XSetWindowAttributes att; - Window frame; - int use_argb; - XWindowAttributes win_attr; - - use_argb = 0; - if (type == EWIN_TYPE_NORMAL) - { - if (!XGetWindowAttributes(disp, win, &win_attr)) - return NULL; - use_argb = Conf.argb_client_mode > 0 && EVisualIsARGB(win_attr.visual); - } ewin = Ecalloc(1, sizeof(EWin)); @@ -96,6 +86,7 @@ ewin->lw = -1; ewin->lh = -1; + ewin->client.win = win; ewin->client.x = -1; ewin->client.y = -1; ewin->client.w = -1; @@ -125,24 +116,87 @@ ewin->ewmh.opacity = 0; /* If 0, ignore */ - if (use_argb) - frame = ECreateVisualWindow(VRoot.win, -10, -10, 1, 1, 1, &win_attr); + return ewin; +} + +static int +EwinGetAttributes(EWin * ewin) +{ + XWindowAttributes xwa; + + if (!XGetWindowAttributes(disp, _EwinGetClientXwin(ewin), &xwa)) + return -1; + + ewin->client.x = xwa.x; + ewin->client.y = xwa.y; + ewin->client.w = xwa.width; + ewin->client.h = xwa.height; + ewin->client.bw = xwa.border_width; + ewin->client.cmap = xwa.colormap; + ewin->client.grav = NorthWestGravity; + ewin->client.argb = EVisualIsARGB(xwa.visual); + + if (EventDebug(EDBUG_TYPE_SNAPS)) + Eprintf("Snap get attr %#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; +} + +static void +EwinGetHints(EWin * ewin) +{ + if (EventDebug(EDBUG_TYPE_EWINS)) + Eprintf("EwinGetHints %#lx\n", _EwinGetClientWin(ewin)); + + ICCCM_GetTitle(ewin, 0); + ICCCM_GetInfo(ewin, 0); + + if (EwinIsInternal(ewin)) + return; + + ICCCM_GetHints(ewin, 0); + ICCCM_GetGeoms(ewin, 0); + MWM_GetHints(ewin, 0); + HintsGetWindowHints(ewin); + SessionGetInfo(ewin, 0); +} + +static void +EwinManage(EWin * ewin) +{ + XSetWindowAttributes att; + Window frame; + XWindowAttributes win_attr; + + if (ewin->client.argb && Conf.argb_client_mode > 0) + { + if (!XGetWindowAttributes(disp, _EwinGetClientXwin(ewin), &win_attr)) + return; + frame = ECreateVisualWindow(VRoot.win, -10, -10, 1, 1, 1, &win_attr); + ewin->win_container = + ECreateVisualWindow(frame, 0, 0, 1, 1, 0, &win_attr); + + if (Conf.argb_client_mode == 1) + ewin->props.no_border = 1; + + } else - frame = None; + { + frame = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1); + ewin->win_container = ECreateWindow(frame, 0, 0, 1, 1, 0); + } ewin->o.stacked = -1; /* Not placed on desk yet */ EoSetDesk(ewin, DesksGetCurrent()); EoInit(ewin, EOBJ_TYPE_EWIN, frame, -10, -10, -1, -1, 1, NULL); + EoSetName(ewin, Estrdup(ewin->icccm.wm_name)); EoSetLayer(ewin, 4); EoSetShadow(ewin, 1); EobjListFocusAdd(&ewin->o, 1); EobjListOrderAdd(&ewin->o); - if (use_argb) - ewin->win_container = - ECreateVisualWindow(EoGetWin(ewin), 0, 0, 1, 1, 0, &win_attr); - else - ewin->win_container = ECreateWindow(EoGetWin(ewin), 0, 0, 1, 1, 0); att.event_mask = EWIN_CONTAINER_EVENT_MASK; att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask; EChangeWindowAttributes(ewin->win_container, @@ -153,13 +207,10 @@ att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask; EChangeWindowAttributes(EoGetWin(ewin), CWEventMask | CWDontPropagate, &att); - ewin->client.win = win; - FocusEwinSetGrabs(ewin); - ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK; if (EventDebug(EDBUG_TYPE_EWINS)) - Eprintf("EwinCreate %#lx frame=%#lx cont=%#lx st=%d\n", + Eprintf("EwinManage %#lx frame=%#lx cont=%#lx st=%d\n", _EwinGetClientXwin(ewin), EoGetWin(ewin), _EwinGetContainerXwin(ewin), ewin->state.state); @@ -172,18 +223,65 @@ if (!EwinIsInternal(ewin)) { - XShapeSelectInput(disp, win, ShapeNotifyMask); - ESetWindowBorderWidth(win, 0); + XShapeSelectInput(disp, _EwinGetClientXwin(ewin), ShapeNotifyMask); + ESetWindowBorderWidth(_EwinGetClientXwin(ewin), 0); ewin->client.bw = 0; } - if (use_argb && Conf.argb_client_mode < 2) - ewin->border = - FindItem("BORDERLESS", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER); + ICCCM_AdoptStart(ewin); + + /* We must reparent after getting original window position */ + EReparentWindow(_EwinGetClientWin(ewin), ewin->win_container, 0, 0); + + EwinUpdateShapeInfo(ewin); ModulesSignal(ESIGNAL_EWIN_CREATE, ewin); +} - return ewin; +static void +EwinConfigure(EWin * ewin) +{ + EwinStateUpdate(ewin); + +#if 0 /* Do we want this? */ + if (!EwinIsInternal(ewin)) + MatchEwinToSM(ewin); +#endif + WindowMatchEwinOps(ewin); /* Window matches */ + SnapshotsApplyToEwin(ewin); /* Saved settings */ + if (!EwinIsInternal(ewin) && Mode.wm.startup) + EHintsGetInfo(ewin); /* E restart hints */ + + EwinStateUpdate(ewin); /* Update after snaps */ + + ICCCM_Adopt(ewin); + + EwinBorderSelect(ewin); /* Select border before calculating geometry */ + EwinGetGeometry(ewin); /* Calculate window geometry before border parts */ + EwinBorderSetTo(ewin, NULL); + + EwinEventsConfigure(ewin, 1); + + if (!ewin->props.no_button_grabs) + GrabButtonGrabs(ewin); + + FocusEwinSetGrabs(ewin); + + if (ewin->state.shaded) + EwinInstantShade(ewin, 1); + + if (ewin->ewmh.opacity == 0) + ewin->ewmh.opacity = 0xffffffff; + EoChangeOpacity(ewin, ewin->ewmh.opacity); + + HintsSetWindowState(ewin); + HintsSetWindowOpacity(ewin); + + HintsSetClientList(); + + if (EventDebug(EDBUG_TYPE_EWINS)) + Eprintf("EwinConfigure %#lx st=%d: %s\n", _EwinGetClientXwin(ewin), + ewin->state.state, EwinGetName(ewin)); } static void @@ -550,66 +648,6 @@ ewin->state.inhibit_close = 0; } -static void -Adopt(EWin * ewin) -{ - ICCCM_AdoptStart(ewin); - ICCCM_GetTitle(ewin, 0); - ICCCM_GetHints(ewin, 0); - ICCCM_GetInfo(ewin, 0); - EwinUpdateShapeInfo(ewin); - ICCCM_GetGeoms(ewin, 0); - if (!EwinIsInternal(ewin)) - { - MWM_GetHints(ewin, 0); - ICCCM_GetColormap(ewin); - HintsGetWindowHints(ewin); - SessionGetInfo(ewin, 0); - } - -#if 0 /* Do we want this? */ - if (!EwinIsInternal(ewin)) - MatchEwinToSM(ewin); -#endif - WindowMatchEwinOps(ewin); /* Window matches */ - SnapshotsApplyToEwin(ewin); /* Saved settings */ - if (!EwinIsInternal(ewin) && Mode.wm.startup) - EHintsGetInfo(ewin); /* E restart hints */ - - EoSetName(ewin, Estrdup(ewin->icccm.wm_name)); /* FIXME */ - - if (ewin->ewmh.opacity == 0) - ewin->ewmh.opacity = 0xffffffff; - EoChangeOpacity(ewin, ewin->ewmh.opacity); - - EwinStateUpdate(ewin); - - if (!ewin->props.no_button_grabs) - GrabButtonGrabs(ewin); - - /* We must reparent after getting original window position */ - EReparentWindow(_EwinGetClientWin(ewin), ewin->win_container, 0, 0); - ICCCM_Adopt(ewin); - - EwinBorderSelect(ewin); /* Select border before calculating geometry */ - EwinGetGeometry(ewin); /* Calculate window geometry before border parts */ - EwinBorderSetTo(ewin, NULL); - - EwinEventsConfigure(ewin, 1); - - if (ewin->state.shaded) - EwinInstantShade(ewin, 1); - - HintsSetWindowState(ewin); - HintsSetWindowOpacity(ewin); - - HintsSetClientList(); - - if (EventDebug(EDBUG_TYPE_EWINS)) - Eprintf("Adopt %#lx st=%d: %s\n", _EwinGetClientXwin(ewin), - ewin->state.state, EwinGetName(ewin)); -} - void AddToFamily(EWin * ewin, Window win) { @@ -626,13 +664,17 @@ else ewin = EwinCreate(win, EWIN_TYPE_NORMAL); if (!ewin) + return; + + if (EwinGetAttributes(ewin)) { Eprintf("Window is gone %#lx\n", win); + /* We got here by MapRequest. DestroyNotify should follow. */ goto done; } - - /* adopt the new baby */ - Adopt(ewin); + EwinGetHints(ewin); + EwinManage(ewin); + EwinConfigure(ewin); /* if it hasn't been planted on a desktop - assign it the current desktop */ dsk = EoGetDesk(ewin); @@ -882,13 +924,17 @@ if (!ewin) goto done; - if (bname) - ewin->border = FindItem(bname, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER); + EwinGetAttributes(ewin); + EwinGetHints(ewin); + EwinManage(ewin); if (init) init(ewin, ptr); /* Type specific initialisation */ - Adopt(ewin); + if (bname) + ewin->border = FindItem(bname, 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER); + + EwinConfigure(ewin); #if 0 Eprintf("Desk=%d, layer=%d, sticky=%d, floating=%d\n", =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- ewins.h 20 Oct 2005 18:18:13 -0000 1.19 +++ ewins.h 24 Oct 2005 17:35:09 -0000 1.20 @@ -53,6 +53,7 @@ int grav; Colormap cmap; long event_mask; + unsigned argb:1; } client; struct =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -3 -r1.90 -r1.91 --- ewmh.c 4 Sep 2005 08:10:11 -0000 1.90 +++ ewmh.c 24 Oct 2005 17:35:09 -0000 1.91 @@ -672,9 +672,6 @@ ewin->ewmh.opacity = opacity; - /* Set frame window hint for xcompmgr */ - ecore_x_netwm_opacity_set(EoGetWin(ewin), opacity); - EwinChange(ewin, EWIN_CHANGE_OPACITY); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -3 -r1.112 -r1.113 --- icccm.c 18 Oct 2005 18:00:53 -0000 1.112 +++ icccm.c 24 Oct 2005 17:35:09 -0000 1.113 @@ -85,19 +85,8 @@ ICCCM_GetColormap(EWin * ewin) { XWindowAttributes xwa; - Ecore_X_Window win; - int num; - if (EwinIsInternal(ewin)) - return; - - /* Hmmm.. Why? */ - win = _EwinGetClientXwin(ewin); - num = ecore_x_window_prop_window_get(_EwinGetClientXwin(ewin), - ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - &win, 1); - - ewin->client.cmap = 0; + ewin->client.cmap = None; if (XGetWindowAttributes(disp, _EwinGetClientXwin(ewin), &xwa) && xwa.colormap) ewin->client.cmap = xwa.colormap; @@ -323,11 +312,11 @@ return; } - ICCCM_GetColormap(ewin); - if (EwinIsInternal(ewin)) return; + ICCCM_GetColormap(ewin); + if ((ewin->client.cmap) && (Mode.current_cmap != ewin->client.cmap)) { XWindowAttributes xwa; @@ -393,25 +382,11 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change) { XSizeHints hint; - Window ww; long mask; - int x, y, w, h, bw, dummy; if (atom_change && atom_change != ECORE_X_ATOM_WM_NORMAL_HINTS) return; - x = ewin->client.x; - y = ewin->client.y; - w = ewin->client.w; - h = ewin->client.h; - bw = ewin->client.bw; - EGetGeometry(_EwinGetClientWin(ewin), &ww, &x, &y, &w, &h, &bw, &dummy); - ewin->client.x = x; - ewin->client.y = y; - ewin->client.w = w; - ewin->client.h = h; - ewin->client.bw = bw; - if (XGetWMNormalHints(disp, _EwinGetClientXwin(ewin), &hint, &mask)) { if (!(ewin->state.placed)) @@ -424,8 +399,6 @@ ewin->icccm.grav = NorthWestGravity; ewin->client.grav = ewin->icccm.grav; - ewin->client.x = x; - ewin->client.y = y; if ((hint.flags & PPosition) && (!EoIsSticky(ewin))) { Desk *dsk; @@ -455,12 +428,6 @@ ewin->state.placed = 1; } } - else - { - ewin->client.x = 0; - ewin->client.y = 0; - ewin->state.placed = 0; - } if (hint.flags & PMinSize) { @@ -633,9 +600,6 @@ Atom *prop; int i, num; - if (EwinIsInternal(ewin)) - return; - hint = NULL; if (atom_change == 0 || atom_change == ECORE_X_ATOM_WM_HINTS) hint = XGetWMHints(disp, _EwinGetClientXwin(ewin)); ------------------------------------------------------- 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