diff --git a/src/E.h b/src/E.h index e37752d9..1a283d76 100644 --- a/src/E.h +++ b/src/E.h @@ -724,7 +724,6 @@ struct _ewin char shaded; char active; char never_use_area; - Window parent; char shapedone; char fixedpos; char ignorearrange; diff --git a/src/buttons.c b/src/buttons.c index b7d1b45f..7a8ae4ef 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -246,18 +246,14 @@ ButtonShow(Button * b) void ButtonMoveToDesktop(Button * b, int desk) { - int pdesk; - if (desk < 0 || desk >= DesksGetNumber()) return; if (EoIsSticky(b) && EoGetLayer(b) == 1) desk = 0; - pdesk = EoGetDesk(b); - EoSetDesk(b, desk); - if (desk != pdesk) - EReparentWindow(EoGetWin(b), DeskGetWin(desk), EoGetX(b), EoGetY(b)); + if (desk != EoGetDesk(b)) + EoReparent(b, desk, EoGetX(b), EoGetY(b)); } void diff --git a/src/desktops.c b/src/desktops.c index c7972952..992d0362 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -930,10 +930,7 @@ MoveStickyWindowsToCurrentDesk(void) if (!EoIsSticky(ewin)) continue; - EoSetDesk(ewin, desk); - ewin->parent = EoGetWin(d); - EReparentWindow(EoGetWin(ewin), ewin->parent, VRoot.w, VRoot.h); - EMoveWindow(EoGetWin(ewin), EoGetX(ewin), EoGetY(ewin)); + EoReparent(ewin, desk, EoGetX(ewin), EoGetY(ewin)); HintsSetWindowArea(ewin); HintsSetWindowDesktop(ewin); } diff --git a/src/draw.c b/src/draw.c index 7b2bd905..e75dae63 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1312,6 +1312,7 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast) } if (firstlast == 2) { +#if 0 /* FIXME - Remove? */ /* If we're moving a group, don't do this, * otherwise we have a lot of garbage onscreen */ if (!EoIsFloating(ewin) || !ewin->groups @@ -1322,6 +1323,7 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast) else MoveResizeEwin(ewin, ewin->shape_x, ewin->shape_y, pw, ph); } +#endif EFreeGC(gc); gc = 0; } diff --git a/src/ecompmgr.c b/src/ecompmgr.c index c21035af..7d2cf392 100644 --- a/src/ecompmgr.c +++ b/src/ecompmgr.c @@ -53,8 +53,6 @@ #define CAN_DO_USABLE 0 #define ENABLE_SHADOWS 1 -#if HAS_NAME_WINDOW_PIXMAP -#endif #define ENABLE_DEBUG 1 #if ENABLE_DEBUG @@ -85,7 +83,14 @@ typedef struct #if HAS_NAME_WINDOW_PIXMAP Pixmap pixmap; #endif - XWindowAttributes a; + struct + { + int class; /* FIXME - Remove? */ + int map_state; /* FIXME - Remove? */ + int depth; /* FIXME - Remove? */ + Visual *visual; /* FIXME - Remove? */ + int border_width; + } a; int rcx, rcy, rcw, rch; #if CAN_DO_USABLE Bool usable; /* mapped and all damaged at one point */ @@ -162,6 +167,7 @@ static XserverRegion allDamage; #define WINDOW_TRANS 1 #define WINDOW_ARGB 2 +static void ECompMgrWinSetPicts(EObj * eo); static void ECompMgrDamageAll(void); static void ECompMgrHandleRootEvent(XEvent * ev, void *prm); static void ECompMgrHandleWindowEvent(XEvent * ev, void *prm); @@ -706,16 +712,21 @@ win_extents(Display * dpy, EObj * eo) XRectangle r; #if HAS_NAME_WINDOW_PIXMAP - cw->rcx = cw->a.x; - cw->rcy = cw->a.y; - cw->rcw = cw->a.width + cw->a.border_width * 2; - cw->rch = cw->a.height + cw->a.border_width * 2; -#else - cw->rcx = cw->a.x + cw->a.border_width; - cw->rcy = cw->a.y + cw->a.border_width; - cw->rcw = cw->a.width; - cw->rch = cw->a.height; + if (Mode_compmgr.use_pixmap) + { + cw->rcx = eo->x; + cw->rcy = eo->y; + cw->rcw = eo->w + cw->a.border_width * 2; + cw->rch = eo->h + cw->a.border_width * 2; + } + else #endif + { + cw->rcx = eo->x + cw->a.border_width; + cw->rcy = eo->y + cw->a.border_width; + cw->rcw = eo->w; + cw->rch = eo->h; + } r.x = cw->rcx; r.y = cw->rcy; @@ -895,19 +906,15 @@ ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity) D1printf("ECompMgrWinChangeOpacity: %#lx opacity=%#x\n", eo->win, cw->opacity); - /* Invalidate stuff changed by opacity */ - ECompMgrWinInvalidate(eo, INV_OPACITY); - if (eo->shown) /* FIXME - ??? */ /* Extents may be unchanged, however, we must repaint */ if (cw->extents != None) ECompMgrDamageMerge(eo->desk, cw->extents, 0); - if (cw->a.class == InputOnly) - pictfmt = NULL; - else - pictfmt = XRenderFindVisualFormat(dpy, cw->a.visual); + /* Invalidate stuff changed by opacity */ + ECompMgrWinInvalidate(eo, INV_OPACITY); + pictfmt = XRenderFindVisualFormat(dpy, cw->a.visual); if (pictfmt && pictfmt->type == PictTypeDirect && pictfmt->direct.alphaMask) mode = WINDOW_ARGB; else if (cw->opacity != OPAQUE) @@ -942,6 +949,8 @@ ECompMgrWinMap(EObj * eo) if (cw->extents == None) cw->extents = win_extents(disp, eo); ECompMgrDamageMerge(eo->desk, cw->extents, 0); + + ECompMgrWinSetPicts(eo); } static void @@ -984,8 +993,15 @@ ECompMgrWinSetPicts(EObj * eo) { ECmWinInfo *cw = eo->cmhook; - if (cw->a.class == InputOnly) - return; + if (eo->type == EOBJ_TYPE_DESK) + { + if (cw->picture == None) + { + cw->picture = DeskBackgroundPictureGet((Desk *) eo); + cw->damaged = 1; /* FIXME - ??? */ + } + return; + } #if HAS_NAME_WINDOW_PIXMAP if (cw->pixmap != None) @@ -997,40 +1013,26 @@ ECompMgrWinSetPicts(EObj * eo) XRenderFreePicture(disp, cw->picture); cw->picture = None; } + Eprintf("*** ECompMgrWinSetPicts pixmap set!!!\n"); } if (Mode_compmgr.use_pixmap) cw->pixmap = XCompositeNameWindowPixmap(disp, eo->win); #endif -#if 0 - if (cw->picture != None) - { - XRenderFreePicture(disp, cw->picture); - cw->picture = None; - } -#endif if (cw->picture == None) { - if (eo->type == EOBJ_TYPE_DESK) - { - cw->picture = DeskBackgroundPictureGet((Desk *) eo); - cw->damaged = 1; /* FIXME - ??? */ - } - else - { - XRenderPictFormat *pictfmt; - XRenderPictureAttributes pa; - Drawable draw = eo->win; + XRenderPictFormat *pictfmt; + XRenderPictureAttributes pa; + Drawable draw = eo->win; #if HAS_NAME_WINDOW_PIXMAP - if (cw->pixmap) - draw = cw->pixmap; + if (cw->pixmap) + draw = cw->pixmap; #endif - pictfmt = XRenderFindVisualFormat(disp, cw->a.visual); - pa.subwindow_mode = IncludeInferiors; - cw->picture = XRenderCreatePicture(disp, draw, - pictfmt, CPSubwindowMode, &pa); - } + pictfmt = XRenderFindVisualFormat(disp, cw->a.visual); + pa.subwindow_mode = IncludeInferiors; + cw->picture = XRenderCreatePicture(disp, draw, + pictfmt, CPSubwindowMode, &pa); D2printf("New picture %#lx\n", cw->picture); } } @@ -1039,11 +1041,16 @@ void ECompMgrWinNew(EObj * eo) { ECmWinInfo *cw; - Status ok; + XWindowAttributes attr; if (!Conf_compmgr.enable) /* FIXME - Here? */ return; + if (!XGetWindowAttributes(disp, eo->win, &attr)) + return; + if (attr.class == InputOnly) + return; + cw = Ecalloc(1, sizeof(ECmWinInfo)); if (!cw) return; @@ -1052,27 +1059,16 @@ ECompMgrWinNew(EObj * eo) eo->cmhook = cw; - ok = XGetWindowAttributes(disp, eo->win, &cw->a); - if (!ok || cw->a.class == InputOnly) - { - free(cw); - eo->cmhook = NULL; - return; - } - cw->damaged = 0; #if CAN_DO_USABLE cw->usable = False; #endif -#if 0 - if (cw->a.class == InputOnly) - { - cw->damage_sequence = 0; - cw->damage = None; - } - else -#endif + cw->a.class = attr.class; /* FIXME - remove */ + cw->a.map_state = attr.map_state; /* FIXME - remove */ + cw->a.depth = attr.depth; + cw->a.visual = attr.visual; + cw->a.border_width = attr.border_width; if (eo->type != EOBJ_TYPE_DESK) { @@ -1086,7 +1082,9 @@ ECompMgrWinNew(EObj * eo) #if HAS_NAME_WINDOW_PIXMAP cw->pixmap = None; #endif +#if 0 /* FIXME - Remove? */ ECompMgrWinSetPicts(eo); +#endif cw->alphaPict = None; cw->borderSize = None; @@ -1123,31 +1121,14 @@ ECompMgrWinNew(EObj * eo) } void -ECompMgrWinMoveResize(EObj * eo, int x, int y, int w, int h, int bw) +ECompMgrWinMoveResize(EObj * eo, int change_xy, int change_wh, int change_bw) { ECmWinInfo *cw = eo->cmhook; XserverRegion damage = None; - int change_xy, change_wh, change_bw, invalidate; + int invalidate; - D1printf("ECompMgrWinMoveResize %#lx %#lx %d %d %d %d %d\n", - eo->win, cw->extents, x, y, w, h, bw); - - /* Invalidate old window region */ -#if CAN_DO_USABLE - if (cw->usable) -#endif - if (eo->shown) /* FIXME - ??? */ - { - damage = XFixesCreateRegion(disp, 0, 0); - if (cw->extents != None) - XFixesCopyRegion(disp, damage, cw->extents); - if (EventDebug(EDBUG_TYPE_COMPMGR3)) - ERegionShow("old-extents:", damage); - } - - change_xy = cw->a.x != x || cw->a.y != y; - change_wh = cw->a.width != w || cw->a.height != h; - change_bw = cw->a.border_width != bw; + D1printf("ECompMgrWinMoveResize %#lx xy=%d wh=%d bw=%d\n", + eo->win, change_xy, change_wh, change_bw); invalidate = 0; if (change_xy || change_bw) @@ -1155,31 +1136,34 @@ ECompMgrWinMoveResize(EObj * eo, int x, int y, int w, int h, int bw) if (change_wh || change_bw) invalidate |= INV_SIZE; - if (invalidate) + if (!invalidate) + return; + + if (!eo->shown) { ECompMgrWinInvalidate(eo, invalidate); - if (eo->shown) /* FIXME - ??? */ - if (invalidate & INV_SIZE) - ECompMgrWinSetPicts(eo); - - cw->a.x = x; - cw->a.y = y; - cw->a.width = w; - cw->a.height = h; - cw->a.border_width = bw; - - /* Find new window region */ - if (eo->shown) /* FIXME - ??? */ - cw->extents = win_extents(disp, eo); + return; } -#if 0 - if (eo->shown) /* FIXME - ??? */ - { - /* Hmmm. Why if not changed? */ - /* Invalidate new window region */ - XFixesUnionRegion(disp, damage, damage, cw->extents); - } + /* Invalidate old window region */ + damage = XFixesCreateRegion(disp, 0, 0); + if (cw->extents != None) + XFixesCopyRegion(disp, damage, cw->extents); + if (EventDebug(EDBUG_TYPE_COMPMGR3)) + ERegionShow("old-extents:", damage); + + ECompMgrWinInvalidate(eo, invalidate); + + if (invalidate & INV_SIZE) /* FIXME - ??? */ + ECompMgrWinSetPicts(eo); + + /* Find new window region */ + cw->extents = win_extents(disp, eo); + +#if 1 + /* Hmmm. Why if not changed? - To get shadows painted. */ + /* Invalidate new window region */ + XFixesUnionRegion(disp, damage, damage, cw->extents); #endif if (damage != None) @@ -1191,45 +1175,48 @@ ECompMgrWinConfigure(EObj * eo, XEvent * ev) { ECmWinInfo *cw = eo->cmhook; int x, y, w, h, bw; + int change_xy, change_wh, change_bw; - /* Can this change ?!? */ - cw->a.override_redirect = ev->xconfigure.override_redirect; - - eo->x = x = ev->xconfigure.x; - eo->y = y = ev->xconfigure.y; - eo->w = w = ev->xconfigure.width; - eo->h = h = ev->xconfigure.height; + x = ev->xconfigure.x; + y = ev->xconfigure.y; + w = ev->xconfigure.width; + h = ev->xconfigure.height; bw = ev->xconfigure.border_width; - ECompMgrWinMoveResize(eo, x, y, w, h, bw); + change_xy = eo->x != x || eo->y != y; + change_wh = eo->w != w || eo->h != h; + change_bw = cw->a.border_width != bw; + + eo->x = x; + eo->y = y; + eo->w = w; + eo->h = h; + cw->a.border_width = bw; + + ECompMgrWinMoveResize(eo, change_xy, change_wh, change_bw); } void -ECompMgrWinReparent(EObj * eo, int desk, int x, int y) +ECompMgrWinReparent(EObj * eo, int desk, int change_xy) { ECmWinInfo *cw = eo->cmhook; - D1printf("ECompMgrWinReparent %#lx %#lx d=%d x,y=%d,%d\n", - eo->win, cw->extents, desk, x, y); + D1printf("ECompMgrWinReparent %#lx %#lx d=%d->%d x,y=%d,%d %d\n", + eo->win, cw->extents, eo->desk, desk, eo->x, eo->y, change_xy); /* Invalidate old window region */ - if (eo->shown) - { - if (EventDebug(EDBUG_TYPE_COMPMGR3)) - ERegionShow("old-extents:", cw->extents); - ECompMgrDamageMerge(eo->desk, cw->extents, 0); - } + if (EventDebug(EDBUG_TYPE_COMPMGR3)) + ERegionShow("old-extents:", cw->extents); + ECompMgrDamageMerge(eo->desk, cw->extents, change_xy); - if (cw->a.x != x || cw->a.y != y) + if (change_xy) { + cw->extents = None; ECompMgrWinInvalidate(eo, INV_POS); - cw->a.x = x; - cw->a.y = y; - /* Find new window region */ - if (eo->shown) /* FIXME - ??? */ - cw->extents = win_extents(disp, eo); + cw->extents = win_extents(disp, eo); + ECompMgrDamageMerge(desk, cw->extents, 0); } } @@ -1340,8 +1327,8 @@ ECompMgrWinDamage(EObj * eo, XEvent * ev __UNUSED__) #endif if (cw->damage_bounds.x <= 0 && cw->damage_bounds.y <= 0 && - cw->a.width <= cw->damage_bounds.x + cw->damage_bounds.width && - cw->a.height <= cw->damage_bounds.y + cw->damage_bounds.height) + eo->width <= cw->damage_bounds.x + cw->damage_bounds.width && + eo->height <= cw->damage_bounds.y + cw->damage_bounds.height) { cw->usable = True; } @@ -1590,9 +1577,10 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode) XRenderComposite(dpy, PictOpOver, cw->shadowPict ? cw-> shadowPict : transBlackPicture, cw->picture, pbuf, - 0, 0, 0, 0, x + cw->rcx + cw->shadow_dx, - y + cw->rcy + cw->shadow_dy, cw->shadow_width, - cw->shadow_height); + 0, 0, 0, 0, + x + cw->rcx + cw->shadow_dx, + y + cw->rcy + cw->shadow_dy, + cw->shadow_width, cw->shadow_height); break; case ECM_SHADOWS_BLURRED: if (cw->shadow == None) @@ -1600,11 +1588,11 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode) ERegionSubtractOffset(cw->clip, x, y, cw->borderSize); XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, cw->clip); - XRenderComposite(dpy, PictOpOver, blackPicture, cw->shadow, - pbuf, 0, 0, 0, 0, + XRenderComposite(dpy, PictOpOver, blackPicture, cw->shadow, pbuf, + 0, 0, 0, 0, x + cw->rcx + cw->shadow_dx, - y + cw->rcy + cw->shadow_dy, cw->shadow_width, - cw->shadow_height); + y + cw->rcy + cw->shadow_dy, + cw->shadow_width, cw->shadow_height); break; } #endif diff --git a/src/ecompmgr.h b/src/ecompmgr.h index 04a10c72..e45385cd 100644 --- a/src/ecompmgr.h +++ b/src/ecompmgr.h @@ -37,9 +37,9 @@ void ECompMgrWinNew(EObj * eo); void ECompMgrWinDel(EObj * eo, Bool gone, Bool do_fade); void ECompMgrWinMap(EObj * eo); void ECompMgrWinUnmap(EObj * eo); -void ECompMgrWinMoveResize(EObj * eo, int x, int y, int w, int h, - int bw); -void ECompMgrWinReparent(EObj * eo, int desk, int x, int y); +void ECompMgrWinMoveResize(EObj * eo, int change_xy, + int change_wh, int change_bw); +void ECompMgrWinReparent(EObj * eo, int desk, int change_xy); void ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity); Pixmap ECompMgrWinGetPixmap(const EObj * eo); diff --git a/src/eobj.c b/src/eobj.c index 652e386b..edc66577 100644 --- a/src/eobj.c +++ b/src/eobj.c @@ -182,25 +182,6 @@ EobjFini(EObj * eo) Efree(eo->name); } -static EObj * -EobjCreate(Window win, int type) -{ - EObj *eo; - XWindowAttributes attr; - - if (!XGetWindowAttributes(disp, win, &attr)) - return NULL; - - eo = Ecalloc(1, sizeof(EObj)); - if (!eo) - return eo; - - EobjInit(eo, type, win, attr.x, attr.y, attr.width, attr.height, NULL); - eo->name = ecore_x_icccm_title_get(win); - - return eo; -} - void EobjDestroy(EObj * eo) { @@ -247,15 +228,22 @@ EObj * EobjRegister(Window win, int type) { EObj *eo; + XWindowAttributes attr; eo = EobjListStackFind(win); if (eo) return eo; - eo = EobjCreate(win, type); + if (!XGetWindowAttributes(disp, win, &attr)) + return NULL; + + eo = Ecalloc(1, sizeof(EObj)); if (!eo) return eo; + EobjInit(eo, type, win, attr.x, attr.y, attr.width, attr.height, NULL); + eo->name = ecore_x_icccm_title_get(win); + #if 1 /* FIXME - TBD */ if (type == EOBJ_TYPE_EXT) { @@ -319,6 +307,10 @@ EobjUnmap(EObj * eo) void EobjMoveResize(EObj * eo, int x, int y, int w, int h) { + int move, resize; + + move = x != eo->x || y != eo->y; + resize = w != eo->w || h != eo->h; eo->x = x; eo->y = y; eo->w = w; @@ -339,7 +331,7 @@ EobjMoveResize(EObj * eo, int x, int y, int w, int h) } #if USE_COMPOSITE if (eo->cmhook) - ECompMgrWinMoveResize(eo, x, y, w, h, 0); + ECompMgrWinMoveResize(eo, move, resize, 0); #endif } @@ -359,18 +351,20 @@ void EobjReparent(EObj * eo, int desk, int x, int y) { Desk *d; + int move; d = DeskGet(desk); if (!d) return; + move = x != eo->x || y != eo->y; eo->x = x; eo->y = y; EReparentWindow(eo->win, EoGetWin(d), x, y); #if USE_COMPOSITE - if (eo->cmhook) - ECompMgrWinReparent(eo, desk, x, y); + if (eo->shown && eo->cmhook) + ECompMgrWinReparent(eo, desk, move); #endif EobjSetDesk(eo, desk); } diff --git a/src/moveresize.c b/src/moveresize.c index 56a8dc08..319617ed 100644 --- a/src/moveresize.c +++ b/src/moveresize.c @@ -108,7 +108,7 @@ ActionMoveEnd(EWin * ewin) gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE, Mode.nogroup || Mode.move.swap, &num); -#if 1 /* Is this OK? */ +#if 0 /* FIXME - Remove? */ if (Conf.movres.mode_move == 0) for (i = 0; i < num; i++) DetermineEwinFloat(gwins[i], 0, 0); @@ -125,6 +125,8 @@ ActionMoveEnd(EWin * ewin) d = DesktopAt(Mode.x, Mode.y); + if (Conf.movres.mode_move == 0) + EoChangeOpacity(ewin, ewin->ewmh.opacity); for (i = 0; i < num; i++) { if ((EoIsFloating(gwins[i])) || (Conf.movres.mode_move > 0)) @@ -147,7 +149,6 @@ ActionMoveEnd(EWin * ewin) } } - EoChangeOpacity(ewin, ewin->ewmh.opacity); RaiseEwin(gwins[i]); } @@ -415,7 +416,8 @@ ActionMoveHandleMotion(void) EoGetY(ewin1), ewin1->client.w, ewin1->client.h, 0); } Mode.mode = MODE_MOVE; - EoChangeOpacity(ewin, OpacityExt(Conf.movres.opacity)); + if (Conf.movres.mode_move == 0) + EoChangeOpacity(ewin, OpacityExt(Conf.movres.opacity)); } dx = Mode.x - Mode.px;