diff --git a/src/E.h b/src/E.h index e06deadb..34ed1d8a 100644 --- a/src/E.h +++ b/src/E.h @@ -216,16 +216,13 @@ typedef struct { #define RROOT RRoot.win typedef struct { - Window xwin; Win win; - Visual *vis; - int depth; - Colormap cmap; int scr; - int w, h; Pixmap pmap; /* Compositing buffer */ } VirtRoot; +#define VROOT VRoot.win + /* Configuration parameters */ typedef struct { struct { @@ -489,6 +486,7 @@ typedef struct { char exit_now; char save_ok; char coredump; + int win_w, win_h; int exit_mode; char *exit_param; int child_count; diff --git a/src/aclass.c b/src/aclass.c index b28f7f62..171f77c3 100644 --- a/src/aclass.c +++ b/src/aclass.c @@ -1497,7 +1497,7 @@ GrabActionKey(Action * aa) mod = (aa->anymodifier) ? AnyModifier : aa->modifiers; - GrabKeySet(aa->key, mod, VRoot.win); + GrabKeySet(aa->key, mod, VROOT); } static void @@ -1510,5 +1510,5 @@ UnGrabActionKey(Action * aa) mod = (aa->anymodifier) ? AnyModifier : aa->modifiers; - GrabKeyRelease(aa->key, mod, VRoot.win); + GrabKeyRelease(aa->key, mod, VROOT); } diff --git a/src/arrange.c b/src/arrange.c index 15fec654..adb4f23f 100644 --- a/src/arrange.c +++ b/src/arrange.c @@ -777,16 +777,16 @@ ArrangeGetRectList(RectBox ** pfixed, int *nfixed, RectBox ** pfloating, w += x; x = 0; } - if ((x + w) > VRoot.w) - w = VRoot.w - x; + if ((x + w) > WinGetW(VROOT)) + w = WinGetW(VROOT) - x; if (y < 0) { h += y; y = 0; } - if ((y + h) > VRoot.h) - h = VRoot.h - y; + if ((y + h) > WinGetH(VROOT)) + h = WinGetH(VROOT) - y; if ((w <= 0) || (h <= 0)) continue; @@ -842,8 +842,8 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py) newrect.p = EoGetLayer(ewin); ret = EMALLOC(RectBox, num + 1); - ArrangeRects(fixed, num, &newrect, 1, ret, 0, 0, VRoot.w, VRoot.h, - ARRANGE_BY_SIZE, 1); + ArrangeRects(fixed, num, &newrect, 1, ret, 0, 0, + WinGetW(VROOT), WinGetH(VROOT), ARRANGE_BY_SIZE, 1); for (i = 0; i < num + 1; i++) { @@ -899,8 +899,8 @@ ArrangeEwins(const char *params) ArrangeGetRectList(&fixed, &nfix, &floating, &nflt, NULL); ret = EMALLOC(RectBox, nflt + nfix); - ArrangeRects(fixed, nfix, floating, nflt, ret, 0, 0, VRoot.w, VRoot.h, - method, 1); + ArrangeRects(fixed, nfix, floating, nflt, ret, 0, 0, + WinGetW(VROOT), WinGetH(VROOT), method, 1); for (i = nfix; i < nflt + nfix; i++) { diff --git a/src/backgrounds.c b/src/backgrounds.c index db2ffba7..c035115e 100644 --- a/src/backgrounds.c +++ b/src/backgrounds.c @@ -492,12 +492,12 @@ BgFindImageSize(BgPart * bgp, unsigned int rw, unsigned int rh, if (bgp->xperc > 0) w = (rw * bgp->xperc) >> 10; else - w = (iw * rw) / VRoot.w; + w = (iw * rw) / WinGetW(VROOT); if (bgp->yperc > 0) h = (rh * bgp->yperc) >> 10; else - h = (ih * rh) / VRoot.h; + h = (ih * rh) / WinGetH(VROOT); if (w <= 0) w = 1; @@ -614,7 +614,7 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw, if (!hasbg && !hasfg) { /* Solid color only */ - EAllocColor(VRoot.cmap, &bg->bg_solid); + EAllocColor(WinGetCmap(VROOT), &bg->bg_solid); if (!is_win) { @@ -840,7 +840,7 @@ BrackgroundCreateFromImage(const char *bgid, const char *file, if (bg) return bg; - scr_asp = (VRoot.w << 16) / VRoot.h; + scr_asp = (WinGetW(VROOT) << 16) / WinGetH(VROOT); im_asp = (width << 16) / height; if (width == height) { @@ -988,8 +988,8 @@ BackgroundCacheMini(Background * bg, int keep, int nuke) } /* Create new cached bg mini image */ - pmap = ECreatePixmap(VRoot.win, 64, 48, 0); - BackgroundApplyPmap(bg, VRoot.win, pmap, 64, 48); + pmap = ECreatePixmap(VROOT, 64, 48, 0); + BackgroundApplyPmap(bg, VROOT, pmap, 64, 48); im = EImageGrabDrawable(pmap, None, 0, 0, 64, 48, 0); EImageSave(im, s); EFreePixmap(pmap); diff --git a/src/buttons.c b/src/buttons.c index 7e5297f0..858ee46b 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -234,8 +234,8 @@ ButtonCalc(Button * b) } else { - w = ((b->geom.xsizerel * VRoot.w) >> 10) + b->geom.xsizeabs; - h = ((b->geom.ysizerel * VRoot.h) >> 10) + b->geom.ysizeabs; + w = ((b->geom.xsizerel * WinGetW(VROOT)) >> 10) + b->geom.xsizeabs; + h = ((b->geom.ysizerel * WinGetH(VROOT)) >> 10) + b->geom.ysizeabs; } if (w > b->geom.width_max) w = b->geom.width_max; @@ -247,8 +247,8 @@ ButtonCalc(Button * b) h = b->geom.height_min; xo = (w * b->geom.xorigin) >> 10; yo = (h * b->geom.yorigin) >> 10; - x = ((b->geom.xrel * VRoot.w) >> 10) + b->geom.xabs - xo; - y = ((b->geom.yrel * VRoot.h) >> 10) + b->geom.yabs - yo; + x = ((b->geom.xrel * WinGetW(VROOT)) >> 10) + b->geom.xabs - xo; + y = ((b->geom.yrel * WinGetH(VROOT)) >> 10) + b->geom.yabs - yo; EoMoveResize(b, x, y, w, h); } @@ -338,21 +338,21 @@ ButtonMoveToCoord(Button * b, int x, int y) if (ButtonIsFixed(b)) return; - if ((x + (EoGetW(b) >> 1)) < (VRoot.w / 3)) + if ((x + (EoGetW(b) >> 1)) < (WinGetW(VROOT) / 3)) relx = 0; - else if ((x + (EoGetW(b) >> 1)) > ((VRoot.w * 2) / 3)) + else if ((x + (EoGetW(b) >> 1)) > ((WinGetW(VROOT) * 2) / 3)) relx = 1024; else relx = 512; - rx = (relx * VRoot.w) >> 10; + rx = (relx * WinGetW(VROOT)) >> 10; absx = x - rx; - if ((y + (EoGetH(b) >> 1)) < (VRoot.h / 3)) + if ((y + (EoGetH(b) >> 1)) < (WinGetH(VROOT) / 3)) rely = 0; - else if ((y + (EoGetH(b) >> 1)) > ((VRoot.h * 2) / 3)) + else if ((y + (EoGetH(b) >> 1)) > ((WinGetH(VROOT) * 2) / 3)) rely = 1024; else rely = 512; - ry = (rely * VRoot.h) >> 10; + ry = (rely * WinGetH(VROOT)) >> 10; absy = y - ry; if (!(b->flags & FLAG_FIXED_HORIZ)) { diff --git a/src/comms.c b/src/comms.c index 2204a979..c70d1727 100644 --- a/src/comms.c +++ b/src/comms.c @@ -288,14 +288,14 @@ CommsInit(void) { char s[1024]; - comms_win = ECreateEventWindow(VRoot.win, -100, -100, 5, 5); + comms_win = ECreateEventWindow(VROOT, -100, -100, 5, 5); ESelectInput(comms_win, StructureNotifyMask | SubstructureNotifyMask); EventCallbackRegister(comms_win, 0, ClientHandleCommsEvents, NULL); - EventCallbackRegister(VRoot.win, 0, ClientHandleRootEvents, NULL); + EventCallbackRegister(VROOT, 0, ClientHandleRootEvents, NULL); Esnprintf(s, sizeof(s), "WINID %8lx", WinGetXwin(comms_win)); ecore_x_window_prop_string_set(WinGetXwin(comms_win), E16_ATOM_COMMS_WIN, s); - ecore_x_window_prop_string_set(VRoot.xwin, E16_ATOM_COMMS_WIN, s); + ecore_x_window_prop_string_set(WinGetXwin(VROOT), E16_ATOM_COMMS_WIN, s); } static void diff --git a/src/config.c b/src/config.c index 3b0901c0..4a1f7332 100644 --- a/src/config.c +++ b/src/config.c @@ -248,9 +248,9 @@ ConfigFilePreparse(const char *path, const char *dest) "%s %s", epp_path, EDirRoot(), Mode.theme.path, EDirRoot(), E_PKG_VERSION, EDirRoot(), EDirBin(), - Mode.theme.path, EDirUser(), EDirUserCache(), VRoot.w, - VRoot.h, VRoot.w, VRoot.h, VRoot.depth, def_user, def_home, - def_shell, path, dest); + Mode.theme.path, EDirUser(), EDirUserCache(), + WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT), + WinGetDepth(VROOT), def_user, def_home, def_shell, path, dest); system(execline); Efree(def_user); diff --git a/src/container.c b/src/container.c index 313b2e07..059fefea 100644 --- a/src/container.c +++ b/src/container.c @@ -115,7 +115,7 @@ ContainerCreate(const char *name) ct->scrollbar_clicked = 0; ct->scrollbox_clicked = 0; - ct->win = ECreateClientWindow(VRoot.win, 0, 0, 1, 1); + ct->win = ECreateClientWindow(VROOT, 0, 0, 1, 1); ct->icon_win = ECreateWindow(ct->win, 0, 0, 128, 26, 0); EventCallbackRegister(ct->icon_win, 0, ContainerEventIconWin, ct); ct->cover_win = ECreateWindow(ct->win, 0, 0, 128, 26, 0); @@ -324,7 +324,8 @@ ContainerShow(Container * ct) /* The first one */ EwinMoveToDesktop(ewin, EoGetDesk(ewin)); EwinResize(ewin, 128, 32); - EwinMove(ewin, VRoot.w - EoGetW(ewin), VRoot.h - EoGetH(ewin)); + EwinMove(ewin, WinGetW(VROOT) - EoGetW(ewin), + WinGetH(VROOT) - EoGetH(ewin)); } EwinShow(ewin); @@ -1013,15 +1014,15 @@ ContainerLayout(Container * ct, int *px, int *py, int *pw, int *ph) add = ct->max; if (ct->ewin->border) { - if ((bt + bb + add) > VRoot.h) - add = VRoot.h - (bt + bb); + if ((bt + bb + add) > WinGetH(VROOT)) + add = WinGetH(VROOT) - (bt + bb); } y += (((ct->ewin->client.h - add) * ct->auto_resize_anchor) >> 10); h = add; if (ct->ewin->border) { - if ((EoGetY(ct->ewin) + bt + bb + add) > VRoot.h) - y = VRoot.h - (bt + bb + add); + if ((EoGetY(ct->ewin) + bt + bb + add) > WinGetH(VROOT)) + y = WinGetH(VROOT) - (bt + bb + add); } } else @@ -1029,15 +1030,15 @@ ContainerLayout(Container * ct, int *px, int *py, int *pw, int *ph) add = ct->max; if (ct->ewin->border) { - if ((bl + br + add) > VRoot.w) - add = VRoot.w - (bl + br); + if ((bl + br + add) > WinGetW(VROOT)) + add = WinGetW(VROOT) - (bl + br); } x += (((ct->ewin->client.w - add) * ct->auto_resize_anchor) >> 10); w = add; if (ct->ewin->border) { - if ((EoGetX(ct->ewin) + bl + br + add) > VRoot.w) - x = VRoot.w - (bl + br + add); + if ((EoGetX(ct->ewin) + bl + br + add) > WinGetW(VROOT)) + x = WinGetW(VROOT) - (bl + br + add); } } } diff --git a/src/cursors.c b/src/cursors.c index d81b4e3a..d25e09ce 100644 --- a/src/cursors.c +++ b/src/cursors.c @@ -64,14 +64,14 @@ ECursorCreate(const char *name, const char *image, int native_id, EColor * fg, mask = 0; xh = 0; yh = 0; - XReadBitmapFile(disp, VRoot.xwin, msk, &w, &h, &mask, &xh, &yh); - XReadBitmapFile(disp, VRoot.xwin, img, &w, &h, &pmap, &xh, &yh); - XQueryBestCursor(disp, VRoot.xwin, w, h, &ww, &hh); + XReadBitmapFile(disp, WinGetXwin(VROOT), msk, &w, &h, &mask, &xh, &yh); + XReadBitmapFile(disp, WinGetXwin(VROOT), img, &w, &h, &pmap, &xh, &yh); + XQueryBestCursor(disp, WinGetXwin(VROOT), w, h, &ww, &hh); curs = None; if ((w <= ww) && (h <= hh) && (pmap)) { - EAllocXColor(VRoot.cmap, &fgxc, fg); - EAllocXColor(VRoot.cmap, &bgxc, bg); + EAllocXColor(WinGetCmap(VROOT), &fgxc, fg); + EAllocXColor(WinGetCmap(VROOT), &bgxc, bg); if (xh < 0 || xh >= (int)w) xh = (int)w / 2; if (yh < 0 || yh >= (int)h) diff --git a/src/desktops.c b/src/desktops.c index 86a0987d..ae422107 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -98,8 +98,8 @@ DeskControlsCreate(Desk * dsk) Conf.desks.dragbar_width = 64; if (Conf.desks.dragbar_length < 0) Conf.desks.dragbar_length = 0; - else if (Conf.desks.dragbar_length > VRoot.w) - Conf.desks.dragbar_length = VRoot.w; + else if (Conf.desks.dragbar_length > WinGetW(VROOT)) + Conf.desks.dragbar_length = WinGetW(VROOT); Esnprintf(ac1, sizeof(ac1), "DRAGBAR_DESKTOP_%i", dsk->num); if (!ActionclassFind(ac1)) @@ -232,7 +232,7 @@ DeskControlsCreate(Desk * dsk) case 0: w[0] = w[1] = w[2] = h[0] = h[1] = Conf.desks.dragbar_width; if (Conf.desks.dragbar_length == 0) - h[2] = VRoot.h - (Conf.desks.dragbar_width * 2); + h[2] = WinGetH(VROOT) - (Conf.desks.dragbar_width * 2); else h[2] = Conf.desks.dragbar_length; x[0] = x[1] = x[2] = 0; @@ -243,10 +243,10 @@ DeskControlsCreate(Desk * dsk) case 1: w[0] = w[1] = w[2] = h[0] = h[1] = Conf.desks.dragbar_width; if (Conf.desks.dragbar_length == 0) - h[2] = VRoot.h - (Conf.desks.dragbar_width * 2); + h[2] = WinGetH(VROOT) - (Conf.desks.dragbar_width * 2); else h[2] = Conf.desks.dragbar_length; - x[0] = x[1] = x[2] = VRoot.w - Conf.desks.dragbar_width; + x[0] = x[1] = x[2] = WinGetW(VROOT) - Conf.desks.dragbar_width; y[m] = 0; y[n] = y[m] + h[m]; y[o] = y[n] + h[n]; @@ -254,7 +254,7 @@ DeskControlsCreate(Desk * dsk) case 2: h[0] = h[1] = h[2] = w[0] = w[1] = Conf.desks.dragbar_width; if (Conf.desks.dragbar_length == 0) - w[2] = VRoot.w - (Conf.desks.dragbar_width * 2); + w[2] = WinGetW(VROOT) - (Conf.desks.dragbar_width * 2); else w[2] = Conf.desks.dragbar_length; y[0] = y[1] = y[2] = 0; @@ -265,10 +265,10 @@ DeskControlsCreate(Desk * dsk) case 3: h[0] = h[1] = h[2] = w[0] = w[1] = Conf.desks.dragbar_width; if (Conf.desks.dragbar_length == 0) - w[2] = VRoot.w - (Conf.desks.dragbar_width * 2); + w[2] = WinGetW(VROOT) - (Conf.desks.dragbar_width * 2); else w[2] = Conf.desks.dragbar_length; - y[0] = y[1] = y[2] = VRoot.h - Conf.desks.dragbar_width; + y[0] = y[1] = y[2] = WinGetH(VROOT) - Conf.desks.dragbar_width; x[m] = 0; x[n] = x[m] + w[m]; x[o] = x[n] + w[n]; @@ -306,7 +306,7 @@ DeskControlsCreate(Desk * dsk) b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", 2, ic4, ac1, NULL, NULL, 1, FLAG_FIXED_VERT, 1, 99999, 1, 99999, 0, 0, - EoGetX(dsk) + VRoot.w - + EoGetX(dsk) + WinGetW(VROOT) - Conf.desks.dragbar_width, 0, EoGetY(dsk), 0, 0, 0, 0, 0, 1, 0, 1); } @@ -322,8 +322,8 @@ DeskControlsCreate(Desk * dsk) b = ButtonCreate("_DESKTOP_DESKRAY_DRAG_CONTROL", 2, ic4, ac1, NULL, NULL, 1, FLAG_FIXED_HORIZ, 1, 99999, 1, 99999, 0, 0, EoGetX(dsk), 0, - EoGetY(dsk) + VRoot.h - Conf.desks.dragbar_width, - 0, 0, 0, 0, 0, 1, 0, 1); + EoGetY(dsk) + WinGetH(VROOT) - + Conf.desks.dragbar_width, 0, 0, 0, 0, 0, 1, 0, 1); } } #endif @@ -356,7 +356,7 @@ DeskConfigure(Desk * dsk) if (dsk->num > 0) { - EoMove(dsk, VRoot.w, 0); + EoMove(dsk, WinGetW(VROOT), 0); EoMap(dsk, 0); } @@ -382,11 +382,12 @@ DeskCreate(int desk, int configure) dsk->num = desk; desks.order[desk] = desk; - win = (desk == 0) ? VRoot.win : NoWin; + win = (desk == 0) ? VROOT : NoWin; Esnprintf(buf, sizeof(buf), "Desk-%d", desk); EoSetNoRedirect(dsk, 1); - EoInit(dsk, EOBJ_TYPE_DESK, win, 0, 0, VRoot.w, VRoot.h, 0, buf); + EoInit(dsk, EOBJ_TYPE_DESK, win, + 0, 0, WinGetW(VROOT), WinGetH(VROOT), 0, buf); EventCallbackRegister(EoGetWin(dsk), 0, DeskHandleEvents, dsk); EoSetFade(dsk, 0); EoSetShadow(dsk, 0); @@ -397,7 +398,8 @@ DeskCreate(int desk, int configure) #if !USE_BG_WIN_ON_ALL_DESKS /* TBD - Use per virtual root bg window? */ #if USE_COMPOSITE /* Add background window */ - eo = EobjWindowCreate(EOBJ_TYPE_ROOT_BG, 0, 0, VRoot.w, VRoot.h, + eo = EobjWindowCreate(EOBJ_TYPE_ROOT_BG, + 0, 0, WinGetW(VROOT), WinGetH(VROOT), 0, "Root-bg"); eo->floating = 0; eo->fade = eo->shadow = 0; @@ -420,7 +422,8 @@ DeskCreate(int desk, int configure) #if USE_COMPOSITE /* Add background window */ Esnprintf(buf, sizeof(buf), "Desk-bg-%d", desk); - eo = EobjWindowCreate(EOBJ_TYPE_MISC, 0, 0, VRoot.w, VRoot.h, 0, buf); + eo = EobjWindowCreate(EOBJ_TYPE_MISC, + 0, 0, WinGetW(VROOT), WinGetH(VROOT), 0, buf); eo->floating = 0; eo->fade = eo->shadow = 0; EobjReparent(eo, EoObj(dsk), 0, 0); @@ -474,7 +477,7 @@ Win DeskGetBackgroundWin(const Desk * dsk) { if (!dsk) - return VRoot.win; + return VROOT; return EobjGetWin(dsk->bg.o); } @@ -537,14 +540,14 @@ DeskBackgroundConfigure(Desk * dsk) if (pmap != None) { ESetWindowBackgroundPixmap(win, pmap); - if (dsk->num == 0 && win != VRoot.win) - ESetWindowBackgroundPixmap(VRoot.win, pmap); + if (dsk->num == 0 && win != VROOT) + ESetWindowBackgroundPixmap(VROOT, pmap); } else { ESetWindowBackground(win, pixel); - if (dsk->num == 0 && win != VRoot.win) - ESetWindowBackground(VRoot.win, pixel); + if (dsk->num == 0 && win != VROOT) + ESetWindowBackground(VROOT, pixel); } EClearWindow(win); } @@ -557,8 +560,8 @@ DeskBackgroundConfigure(Desk * dsk) HintsSetRootInfo(EoGetWin(dsk), None, 0); ESetWindowBackgroundPixmap(win, None); - if (dsk->num == 0 && win != VRoot.win) - ESetWindowBackgroundPixmap(VRoot.win, None); + if (dsk->num == 0 && win != VROOT) + ESetWindowBackgroundPixmap(VROOT, None); } } @@ -644,7 +647,7 @@ DeskBackgroundRefresh(Desk * dsk, int why) if (bg && dsk->viewable) if (Conf.hints.set_xroot_info_on_root_window && dsk->num > 0) - HintsSetRootInfo(VRoot.win, pmap, pixel); + HintsSetRootInfo(VROOT, pmap, pixel); if (changed) ModulesSignal(ESIGNAL_BACKGROUND_CHANGE, dsk); @@ -700,7 +703,7 @@ DeskResize(int desk, int w, int h) if (dsk->num != 0) { - x = (dsk->viewable) ? EoGetX(dsk) : VRoot.w; + x = (dsk->viewable) ? EoGetX(dsk) : WinGetW(VROOT); EoMoveResize(dsk, x, 0, w, h); } #if USE_COMPOSITE @@ -1009,8 +1012,8 @@ DesktopAt(int x, int y) for (i = 0; i < Conf.desks.num; i++) { dsk = _DeskGet(desks.order[i]); - if (x >= EoGetX(dsk) && x < (EoGetX(dsk) + VRoot.w) && - y >= EoGetY(dsk) && y < (EoGetY(dsk) + VRoot.h)) + if (x >= EoGetX(dsk) && x < (EoGetX(dsk) + WinGetW(VROOT)) && + y >= EoGetY(dsk) && y < (EoGetY(dsk) + WinGetH(VROOT))) return _DeskGet(desks.order[i]); } return _DeskGet(0); @@ -1126,7 +1129,7 @@ DeskHide(unsigned int desk) if (dsk->viewable) BackgroundTouch(dsk->bg.bg); dsk->viewable = 0; - EoMove(dsk, VRoot.w, 0); + EoMove(dsk, WinGetW(VROOT), 0); } static void @@ -1209,20 +1212,20 @@ DeskGoto(Desk * dsk) { default: case 0: - x = VRoot.w; + x = WinGetW(VROOT); y = 0; break; case 1: - x = -VRoot.w; + x = -WinGetW(VROOT); y = 0; break; case 2: x = 0; - y = VRoot.h; + y = WinGetH(VROOT); break; case 3: x = 0; - y = -VRoot.h; + y = -WinGetH(VROOT); break; } DeskMove(dsk, x, y); @@ -1626,8 +1629,8 @@ DeskCurrentGotoArea(int ax, int ay) ModulesSignal(ESIGNAL_AREA_SWITCH_START, NULL); - dx = VRoot.w * (ax - pax); - dy = VRoot.h * (ay - pay); + dx = WinGetW(VROOT) * (ax - pax); + dy = WinGetH(VROOT) * (ay - pay); if (dx < 0) SoundPlay("SOUND_MOVE_AREA_LEFT"); @@ -1862,8 +1865,6 @@ DeskEventButtonRelease(Desk * dsk, XEvent * ev) static void DeskRootResize(int root, int w, int h) { - int ww, hh; - if (EDebug(EDBUG_TYPE_DESKS)) Eprintf("DeskRootResize %d %dx%d\n", root, w, h); @@ -1873,20 +1874,17 @@ DeskRootResize(int root, int w, int h) WinGetH(RROOT) = h; } - if (w == VRoot.w && h == VRoot.h) + if (w == WinGetW(VROOT) && h == WinGetH(VROOT)) return; - EWindowSync(VRoot.win); + EWindowSync(VROOT); /* Quit if size is not final */ - EGetGeometry(VRoot.win, NULL, NULL, NULL, &ww, &hh, NULL, NULL); - if (w != ww || h != hh) + if (w != WinGetW(VROOT) || h != WinGetH(VROOT)) return; - Mode.screen.w_old = VRoot.w; - Mode.screen.h_old = VRoot.h; - VRoot.w = w; - VRoot.h = h; + Mode.screen.w_old = WinGetW(VROOT); + Mode.screen.h_old = WinGetH(VROOT); ScreenInit(); DesksResize(w, h); @@ -1910,7 +1908,7 @@ DeskPropertyChange(Desk * dsk, XEvent * ev) if (EDebug(EDBUG_TYPE_DESKS)) Eprintf("DeskPropertyChange win=%#lx _XROOTPMAP_ID=%#lx\n", ev->xany.window, pmap); - if (ev->xany.window != VRoot.xwin) + if (ev->xany.window != WinGetXwin(VROOT)) return; if (pmap == dsk->bg.pmap) return; @@ -1925,7 +1923,7 @@ DeskPropertyChange(Desk * dsk, XEvent * ev) if (EDebug(EDBUG_TYPE_DESKS)) Eprintf("DeskPropertyChange win=%#lx _XROOTCOLOR_PIXEL\n", ev->xany.window); - if (ev->xany.window != VRoot.xwin) + if (ev->xany.window != WinGetXwin(VROOT)) return; } } @@ -1958,12 +1956,12 @@ DeskHandleEvents(Win win __UNUSED__, XEvent * ev, void *prm) break; case ConfigureNotify: - if (ev->xconfigure.window == VRoot.xwin) + if (ev->xconfigure.window == WinGetXwin(VROOT)) DeskRootResize(0, ev->xconfigure.width, ev->xconfigure.height); break; case PropertyNotify: - if (ev->xany.window == VRoot.xwin) + if (ev->xany.window == WinGetXwin(VROOT)) DeskPropertyChange(dsk, ev); break; @@ -2005,7 +2003,7 @@ DeskDragdirSet(const char *params) for (i = 1; i < Conf.desks.num; i++) { dsk = _DeskGet(i); - EoMove(dsk, (dsk->viewable) ? 0 : VRoot.w, 0); + EoMove(dsk, (dsk->viewable) ? 0 : WinGetW(VROOT), 0); } DesksControlsRefresh(); } diff --git a/src/dialog.c b/src/dialog.c index 88d8bf32..c4287b50 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -239,7 +239,7 @@ DialogCreate(const char *name) ecore_list_append(dialog_list, d); d->name = Estrdup(name); - d->win = ECreateClientWindow(VRoot.win, -20, -20, 2, 2); + d->win = ECreateClientWindow(VROOT, -20, -20, 2, 2); EventCallbackRegister(d->win, 0, DialogHandleEvents, d); d->iclass = ImageclassAlloc("DIALOG", 1); diff --git a/src/dock.c b/src/dock.c index 230fd140..de56bbbd 100644 --- a/src/dock.c +++ b/src/dock.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2007 Kim Woelders + * Copyright (C) 2004-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -41,18 +41,18 @@ DockappFindEmptySpotFor(EWin * eapp) x = Conf.dock.startx; if (x < 0) x = 0; - else if (x > VRoot.w - EoGetW(eapp)) - x = VRoot.w - EoGetW(eapp); + else if (x > WinGetW(VROOT) - EoGetW(eapp)) + x = WinGetW(VROOT) - EoGetW(eapp); y = Conf.dock.starty; if (y < 0) y = 0; - else if (y > VRoot.h - EoGetH(eapp)) - y = VRoot.h - EoGetH(eapp); + else if (y > WinGetH(VROOT) - EoGetH(eapp)) + y = WinGetH(VROOT) - EoGetH(eapp); } - step_right = Conf.dock.startx < VRoot.w; - step_down = Conf.dock.starty < VRoot.h; + step_right = Conf.dock.startx < WinGetW(VROOT); + step_down = Conf.dock.starty < WinGetH(VROOT); lst = EwinListGetAll(&num); for (j = 0; j < num; j++) @@ -78,7 +78,7 @@ DockappFindEmptySpotFor(EWin * eapp) { case DOCK_RIGHT: x = EoGetX(ewin) + EoGetW(ewin); - if (x + w >= VRoot.w) + if (x + w >= WinGetW(VROOT)) { x = Conf.dock.startx; y += (step_down) ? h : -h; @@ -94,7 +94,7 @@ DockappFindEmptySpotFor(EWin * eapp) break; case DOCK_DOWN: y = EoGetY(ewin) + EoGetH(ewin); - if (y + h >= VRoot.h) + if (y + h >= WinGetH(VROOT)) { y = Conf.dock.starty; x += (step_right) ? w : -w; @@ -104,7 +104,7 @@ DockappFindEmptySpotFor(EWin * eapp) y = EoGetY(ewin) - h; if (y < 0) { - y = VRoot.h - h; + y = WinGetH(VROOT) - h; x += (step_right) ? w : -w; } break; @@ -112,10 +112,10 @@ DockappFindEmptySpotFor(EWin * eapp) } } - if (x < 0 || y < 0 || x + w > VRoot.w || y + h > VRoot.h) + if (x < 0 || y < 0 || x + w > WinGetW(VROOT) || y + h > WinGetH(VROOT)) { - x = VRoot.w - w / 2; - y = VRoot.h - h / 2; + x = WinGetW(VROOT) - w / 2; + y = WinGetH(VROOT) - h / 2; } EoMove(eapp, x, y); diff --git a/src/draw.c b/src/draw.c index 8de67e0c..715e44b3 100644 --- a/src/draw.c +++ b/src/draw.c @@ -90,14 +90,14 @@ static Font font = None; /* Used in mode 1 (technical) */ if (_d < 3) _d = 3; \ DRAW_H_ARROW(_dr, _gc, _a + bl, _a + bl + _c - 1, _b + bt + _d - 16); \ DRAW_H_ARROW(_dr, _gc, 0, _a - 1, _b + bt + (_d / 2)); \ - DRAW_H_ARROW(_dr, _gc, _a + _c + bl + br, VRoot.w - 1, _b + bt + (_d / 2)); \ + DRAW_H_ARROW(_dr, _gc, _a + _c + bl + br, WinGetW(VROOT) - 1, _b + bt + (_d / 2)); \ DRAW_V_ARROW(_dr, _gc, _b + bt, _b + bt + _d - 1, _a + bl + 16); \ DRAW_V_ARROW(_dr, _gc, 0, _b - 1, _a + bl + (_c / 2)); \ - DRAW_V_ARROW(_dr, _gc, _b + _d + bt + bb, VRoot.h - 1, _a + bl + (_c / 2)); \ - XDrawLine(disp, _dr, _gc, _a, 0, _a, VRoot.h); \ - XDrawLine(disp, _dr, _gc, _a + _c + bl + br - 1, 0, _a + _c + bl + br - 1, VRoot.h); \ - XDrawLine(disp, _dr, _gc, 0, _b, VRoot.w, _b); \ - XDrawLine(disp, _dr, _gc, 0, _b + _d + bt + bb - 1, VRoot.w, _b + _d + bt + bb - 1); \ + DRAW_V_ARROW(_dr, _gc, _b + _d + bt + bb, WinGetH(VROOT) - 1, _a + bl + (_c / 2)); \ + XDrawLine(disp, _dr, _gc, _a, 0, _a, WinGetH(VROOT)); \ + XDrawLine(disp, _dr, _gc, _a + _c + bl + br - 1, 0, _a + _c + bl + br - 1, WinGetH(VROOT)); \ + XDrawLine(disp, _dr, _gc, 0, _b, WinGetW(VROOT), _b); \ + XDrawLine(disp, _dr, _gc, 0, _b + _d + bt + bb - 1, WinGetW(VROOT), _b + _d + bt + bb - 1); \ XDrawRectangle(disp, _dr, _gc, _a + bl + 1, _b + bt + 1, _c - 3, _d - 3); \ } while(0) @@ -158,7 +158,7 @@ _ShapeGetColor(void) color_value = Conf.movres.color; SET_COLOR(&color, _R(color_value), _G(color_value), _B(color_value)); - EAllocColor(VRoot.cmap, &color); + EAllocColor(WinGetCmap(VROOT), &color); color_pixel = color.pixel; color_valid = 1; @@ -187,7 +187,8 @@ _ShapeWinCreate(int md) if (!sw) return NULL; - EoInit(sw, EOBJ_TYPE_MISC, None, 0, 0, VRoot.w, VRoot.h, 2, "Wires"); + EoInit(sw, EOBJ_TYPE_MISC, None, + 0, 0, WinGetW(VROOT), WinGetH(VROOT), 2, "Wires"); if (!EoGetWin(sw)) goto bail_out; @@ -203,7 +204,8 @@ _ShapeWinCreate(int md) if (md == 1) { - sw->mask = ECreatePixmap(EoGetWin(sw), VRoot.w, VRoot.h, 1); + sw->mask = + ECreatePixmap(EoGetWin(sw), WinGetW(VROOT), WinGetH(VROOT), 1); sw->gc = EXCreateGC(sw->mask, 0, NULL); if (sw->mask == None || !sw->gc) goto bail_out; @@ -230,7 +232,8 @@ _ShapeSet(ShapeWin * sw, int md, int x, int y, int w, int h, char str[32]; XSetForeground(disp, sw->gc, 0); - XFillRectangle(disp, sw->mask, sw->gc, 0, 0, VRoot.w, VRoot.h); + XFillRectangle(disp, sw->mask, sw->gc, + 0, 0, WinGetW(VROOT), WinGetH(VROOT)); XSetForeground(disp, sw->gc, 1); DO_DRAW_MODE_1(sw->mask, sw->gc, x, y, w, h); EShapeCombineMask(EoGetWin(sw), ShapeBounding, 0, 0, sw->mask, @@ -259,7 +262,7 @@ static PixImg *draw_pi = NULL; static void _PixImgsCreate(Window root, const EWin * ewin) { - root_pi = ECreatePixImg(root, VRoot.w, VRoot.h); + root_pi = ECreatePixImg(root, WinGetW(VROOT), WinGetH(VROOT)); ewin_pi = ECreatePixImg(root, EoGetW(ewin), EoGetH(ewin)); draw_pi = ECreatePixImg(root, EoGetW(ewin), EoGetH(ewin)); } @@ -283,7 +286,7 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, { static GC gc = 0; static Pixmap b2 = 0, b3 = 0; - Window root = VRoot.xwin; + Window root = WinGetXwin(VROOT); int x1, y1, w1, h1, dx, dy; int bl, br, bt, bb; char str[32]; @@ -512,7 +515,7 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, wt = EoGetW(ewin); ht = EoGetH(ewin); - root_pi = ECreatePixImg(root, VRoot.w, VRoot.h); + root_pi = ECreatePixImg(root, WinGetW(VROOT), WinGetH(VROOT)); EFillPixmap(root, root_pi->pmap, x, y, wt, ht); EBlendPixImg(EoGetWin(ewin), root_pi, ewin_pi, draw_pi, x, y, EoGetW(ewin), EoGetH(ewin)); diff --git a/src/ecompmgr.c b/src/ecompmgr.c index 2c08567e..a52f1a9c 100644 --- a/src/ecompmgr.c +++ b/src/ecompmgr.c @@ -597,7 +597,7 @@ ECompMgrDeskConfigure(Desk * dsk) { GC gc; - pmap = XCreatePixmap(disp, Mode_compmgr.root, 1, 1, VRoot.depth); + pmap = XCreatePixmap(disp, Mode_compmgr.root, 1, 1, WinGetDepth(VROOT)); gc = EXCreateGC(pmap, 0, NULL); XSetClipMask(disp, gc, 0); XSetFillStyle(disp, gc, FillSolid); @@ -611,7 +611,7 @@ ECompMgrDeskConfigure(Desk * dsk) } pa.repeat = True; - pictfmt = XRenderFindVisualFormat(disp, VRoot.vis); + pictfmt = XRenderFindVisualFormat(disp, WinGetVisual(VROOT)); pict = XRenderCreatePicture(disp, pmap, pictfmt, CPRepeat, &pa); if (pmap != dsk->bg.pmap) @@ -1526,7 +1526,7 @@ ECompMgrWinNew(EObj * eo) if (!Mode_compmgr.active) /* FIXME - Here? */ return; - if (eo->inputonly || eo->win == VRoot.win) + if (eo->inputonly || eo->win == VROOT) { eo->noredir = 1; return; @@ -2269,7 +2269,7 @@ ECompMgrRepaint(void) D1printf("ECompMgrRepaint desk picture=%#lx\n", pict); XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region); XRenderComposite(dpy, PictOpSrc, pict, None, pbuf, - 0, 0, 0, 0, 0, 0, VRoot.w, VRoot.h); + 0, 0, 0, 0, 0, 0, WinGetW(VROOT), WinGetH(VROOT)); #endif /* Paint trans windows and shadows bottom up */ @@ -2284,7 +2284,7 @@ ECompMgrRepaint(void) { XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, Mode_compmgr.damage); XRenderComposite(dpy, PictOpSrc, pbuf, None, rootPicture, - 0, 0, 0, 0, 0, 0, VRoot.w, VRoot.h); + 0, 0, 0, 0, 0, 0, WinGetW(VROOT), WinGetH(VROOT)); } Mode_compmgr.got_damage = 0; @@ -2303,7 +2303,7 @@ static void ECompMgrRootBufferCreate(unsigned int w, unsigned int h) { /* Root buffer picture and pixmap */ - rootBuffer = EPictureCreateBuffer(VRoot.win, w, h, &VRoot.pmap); + rootBuffer = EPictureCreateBuffer(VROOT, w, h, &VRoot.pmap); /* Screen region */ Mode_compmgr.rgn_screen = ERegionCreateRect(0, 0, w, h); @@ -2340,7 +2340,7 @@ ECompMgrRootExpose(void *prm __UNUSED__, XEvent * ev) static int n_expose = 0; int more = ev->xexpose.count + 1; - if (ev->xexpose.window != VRoot.xwin) + if (ev->xexpose.window != WinGetXwin(VROOT)) return; D1printf("ECompMgrRootExpose %d %d %d\n", n_expose, size_expose, @@ -2435,13 +2435,13 @@ ECompMgrStart(void) Conf_compmgr.override_redirect.opacity = OpacityFix(Conf_compmgr.override_redirect.opacity, 100); - ECompMgrRootBufferCreate(VRoot.w, VRoot.h); + ECompMgrRootBufferCreate(WinGetW(VROOT), WinGetH(VROOT)); - Mode_compmgr.root = VRoot.xwin; + Mode_compmgr.root = WinGetXwin(VROOT); #if USE_COMPOSITE_OVERLAY_WINDOW if (Conf_compmgr.use_cow && !Mode.wm.window) { - Mode_compmgr.cow = XCompositeGetOverlayWindow(disp, VRoot.xwin); + Mode_compmgr.cow = XCompositeGetOverlayWindow(disp, WinGetXwin(VROOT)); if (Mode_compmgr.cow != None) { /* Ok, got the cow! */ @@ -2462,7 +2462,7 @@ ECompMgrStart(void) #endif pa.subwindow_mode = IncludeInferiors; - pictfmt = XRenderFindVisualFormat(disp, VRoot.vis); + pictfmt = XRenderFindVisualFormat(disp, WinGetVisual(VROOT)); rootPicture = XRenderCreatePicture(disp, Mode_compmgr.root, pictfmt, CPSubwindowMode, &pa); @@ -2474,18 +2474,19 @@ ECompMgrStart(void) switch (Mode_compmgr.mode) { case ECM_MODE_ROOT: - XCompositeRedirectSubwindows(disp, VRoot.xwin, CompositeRedirectManual); + XCompositeRedirectSubwindows(disp, WinGetXwin(VROOT), + CompositeRedirectManual); #if USE_DESK_EXPOSE /* FIXME - Remove? */ - ESelectInputChange(VRoot.xwin, ExposureMask, 0); + ESelectInputChange(WinGetXwin(VROOT), ExposureMask, 0); #endif break; case ECM_MODE_WINDOW: #if USE_DESK_EXPOSE /* FIXME - Remove? */ - ESelectInputChange(VRoot.xwin, ExposureMask, 0); + ESelectInputChange(WinGetXwin(VROOT), ExposureMask, 0); #endif break; case ECM_MODE_AUTO: - XCompositeRedirectSubwindows(disp, VRoot.xwin, + XCompositeRedirectSubwindows(disp, WinGetXwin(VROOT), CompositeRedirectAutomatic); break; } @@ -2495,7 +2496,7 @@ ECompMgrStart(void) rgn_tmp = ERegionCreate(); rgn_tmp2 = ERegionCreate(); - EventCallbackRegister(VRoot.win, 0, ECompMgrHandleRootEvent, NULL); + EventCallbackRegister(VROOT, 0, ECompMgrHandleRootEvent, NULL); wm_cm_sel = SelectionAcquire("_NET_WM_CM_S", NULL, NULL); @@ -2560,14 +2561,15 @@ ECompMgrStop(void) REGION_DESTROY(rgn_tmp2); if (Mode_compmgr.mode == ECM_MODE_ROOT) - XCompositeUnredirectSubwindows(disp, VRoot.xwin, CompositeRedirectManual); + XCompositeUnredirectSubwindows(disp, WinGetXwin(VROOT), + CompositeRedirectManual); - EventCallbackUnregister(VRoot.win, 0, ECompMgrHandleRootEvent, NULL); + EventCallbackUnregister(VROOT, 0, ECompMgrHandleRootEvent, NULL); #if USE_COMPOSITE_OVERLAY_WINDOW if (Mode_compmgr.cow != None) { - XCompositeReleaseOverlayWindow(disp, VRoot.xwin); + XCompositeReleaseOverlayWindow(disp, WinGetXwin(VROOT)); Mode_compmgr.cow = None; } #endif @@ -2721,13 +2723,13 @@ ECompMgrHandleRootEvent(Win win __UNUSED__, XEvent * ev, void *prm) case ReparentNotify: case EX_EVENT_REPARENT_GONE: xwin = ev->xreparent.window; - if (ev->xreparent.parent == VRoot.xwin) + if (ev->xreparent.parent == WinGetXwin(VROOT)) goto case_CreateNotify; else goto case_DestroyNotify; case ConfigureNotify: - if (ev->xconfigure.window == VRoot.xwin) + if (ev->xconfigure.window == WinGetXwin(VROOT)) { ECompMgrRootConfigure(prm, ev); } diff --git a/src/edbus.c b/src/edbus.c index ebe24522..343ed2a3 100644 --- a/src/edbus.c +++ b/src/edbus.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Kim Woelders + * Copyright (C) 2007-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -246,7 +246,7 @@ DbusInit(void) if (Mode.wm.window) { - sprintf(buf, "org.e16.wm.w%#x", (unsigned int)VRoot.xwin); + sprintf(buf, "org.e16.wm.w%#x", (unsigned int)WinGetXwin(VROOT)); } else { diff --git a/src/edge.c b/src/edge.c index 9814c35c..3ac7ff89 100644 --- a/src/edge.c +++ b/src/edge.c @@ -62,25 +62,25 @@ EdgeTimeout(int val, void *data __UNUSED__) case 0: if (ax == 0 && !Conf.desks.areas_wraparound) return; - dx = VRoot.w - 2; + dx = WinGetW(VROOT) - 2; dax = -1; break; case 1: if (ax == (aw - 1) && !Conf.desks.areas_wraparound) return; - dx = -(VRoot.w - 2); + dx = -(WinGetW(VROOT) - 2); dax = 1; break; case 2: if (ay == 0 && !Conf.desks.areas_wraparound) return; - dy = VRoot.h - 2; + dy = WinGetH(VROOT) - 2; day = -1; break; case 3: if (ay == (ah - 1) && !Conf.desks.areas_wraparound) return; - dy = -(VRoot.h - 2); + dy = -(WinGetH(VROOT) - 2); day = 1; break; default: @@ -94,7 +94,7 @@ EdgeTimeout(int val, void *data __UNUSED__) Mode.events.py = Mode.events.my; Mode.events.mx = Mode.events.cx += dx; Mode.events.my = Mode.events.cy += dy; - EXWarpPointer(VRoot.xwin, Mode.events.mx, Mode.events.my); + EXWarpPointer(WinGetXwin(VROOT), Mode.events.mx, Mode.events.my); DeskCurrentMoveAreaBy(dax, day); Mode.events.px = Mode.events.mx; Mode.events.py = Mode.events.my; @@ -155,11 +155,11 @@ EdgeCheckMotion(int x, int y) if (x == 0) dir = 0; - else if (x == VRoot.w - 1) + else if (x == WinGetW(VROOT) - 1) dir = 1; else if (y == 0) dir = 2; - else if (y == VRoot.h - 1) + else if (y == WinGetH(VROOT) - 1) dir = 3; else dir = -1; @@ -180,21 +180,21 @@ EdgeWindowShow(int which, int on) default: case 1: /* Left */ eo = w1; - h = VRoot.h; + h = WinGetH(VROOT); break; case 2: /* Right */ eo = w2; - x = VRoot.w - 1; - h = VRoot.h; + x = WinGetW(VROOT) - 1; + h = WinGetH(VROOT); break; case 3: /* Top */ eo = w3; - w = VRoot.w; + w = WinGetW(VROOT); break; case 4: /* Bottom */ eo = w4; - y = VRoot.h - 1; - w = VRoot.w; + y = WinGetH(VROOT) - 1; + w = WinGetW(VROOT); break; } @@ -222,12 +222,16 @@ EdgeWindowsShow(void) if (!w1) { - w1 = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, 0, 1, VRoot.h, 0, "Edge-L"); - w2 = EobjWindowCreate(EOBJ_TYPE_EVENT, VRoot.w - 1, 0, 1, VRoot.h, 0, - "Edge-R"); - w3 = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, 0, VRoot.w, 1, 0, "Edge-T"); - w4 = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, VRoot.h - 1, VRoot.w, 1, 0, - "Edge-B"); + w1 = EobjWindowCreate(EOBJ_TYPE_EVENT, + 0, 0, 1, WinGetH(VROOT), 0, "Edge-L"); + w2 = EobjWindowCreate(EOBJ_TYPE_EVENT, + WinGetW(VROOT) - 1, 0, 1, WinGetH(VROOT), + 0, "Edge-R"); + w3 = EobjWindowCreate(EOBJ_TYPE_EVENT, + 0, 0, WinGetW(VROOT), 1, 0, "Edge-T"); + w4 = EobjWindowCreate(EOBJ_TYPE_EVENT, + 0, WinGetH(VROOT) - 1, WinGetW(VROOT), 1, + 0, "Edge-B"); ESelectInput(w1->win, EnterWindowMask | LeaveWindowMask); ESelectInput(w2->win, EnterWindowMask | LeaveWindowMask); ESelectInput(w3->win, EnterWindowMask | LeaveWindowMask); diff --git a/src/eobj.c b/src/eobj.c index 94c8d9ce..698082cf 100644 --- a/src/eobj.c +++ b/src/eobj.c @@ -175,7 +175,7 @@ EobjInit(EObj * eo, int type, Win win, int x, int y, int w, int h, { if (type == EOBJ_TYPE_EVENT) { - win = ECreateEventWindow(VRoot.win, x, y, w, h); + win = ECreateEventWindow(VROOT, x, y, w, h); eo->inputonly = 1; } else @@ -218,7 +218,7 @@ EobjInit(EObj * eo, int type, Win win, int x, int y, int w, int h, } ECompMgrWinNew(eo); #endif - if (EobjGetXwin(eo) != VRoot.xwin) + if (EobjGetXwin(eo) != WinGetXwin(VROOT)) EobjListStackAdd(eo, 1); if (EDebug(EDBUG_TYPE_EWINS)) diff --git a/src/events.c b/src/events.c index dcf56e81..10988bb1 100644 --- a/src/events.c +++ b/src/events.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2007 Kim Woelders + * Copyright (C) 2004-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -130,11 +130,11 @@ ExtInitSS(int available) { XScreenSaverInfo *xssi = XScreenSaverAllocInfo(); - XScreenSaverQueryInfo(disp, VRoot.xwin, xssi); + XScreenSaverQueryInfo(disp, WinGetXwin(VROOT), xssi); Eprintf(" Screen saver window=%#lx\n", xssi->window); XFree(xssi); } - XScreenSaverSelectInput(disp, VRoot.xwin, + XScreenSaverSelectInput(disp, WinGetXwin(VROOT), ScreenSaverNotifyMask | ScreenSaverCycleMask); } #endif @@ -147,7 +147,7 @@ ExtInitRR(int available) return; /* Listen for RandR events */ - XRRSelectInput(disp, VRoot.xwin, RRScreenChangeNotifyMask); + XRRSelectInput(disp, WinGetXwin(VROOT), RRScreenChangeNotifyMask); } #endif @@ -277,7 +277,7 @@ ModeGetXY(Window rwin, int rx, int ry) if (Mode.wm.window) { - XTranslateCoordinates(disp, rwin, VRoot.xwin, rx, ry, + XTranslateCoordinates(disp, rwin, WinGetXwin(VROOT), rx, ry, &Mode.events.cx, &Mode.events.cy, &child); } else @@ -307,7 +307,7 @@ HandleEvent(XEvent * ev) Mode.events.time = ev->xkey.time; ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root); #if 0 /* FIXME - Why? */ - if (ev->xkey.root != VRoot.xwin) + if (ev->xkey.root != WinGetXwin(VROOT)) { XSetInputFocus(disp, ev->xkey.root, RevertToPointerRoot, CurrentTime); @@ -373,7 +373,7 @@ HandleEvent(XEvent * ev) break; do_stuff: - if (ev->xany.window == VRoot.xwin) + if (ev->xany.window == WinGetXwin(VROOT)) ActionclassesGlobalEvent(ev); break; } diff --git a/src/ewin-ops.c b/src/ewin-ops.c index 9c3b3293..74ed7412 100644 --- a/src/ewin-ops.c +++ b/src/ewin-ops.c @@ -128,14 +128,14 @@ EwinFixPosition(EWin * ewin) return; x = EoGetX(ewin); - if ((x + ewin->border->border.left + 1) > VRoot.w) - x = VRoot.w - ewin->border->border.left - 1; + if ((x + ewin->border->border.left + 1) > WinGetW(VROOT)) + x = WinGetW(VROOT) - ewin->border->border.left - 1; else if ((x + EoGetW(ewin) - ewin->border->border.right - 1) < 0) x = 0 - EoGetW(ewin) + ewin->border->border.right + 1; y = EoGetY(ewin); - if ((y + ewin->border->border.top + 1) > VRoot.h) - y = VRoot.h - ewin->border->border.top - 1; + if ((y + ewin->border->border.top + 1) > WinGetH(VROOT)) + y = WinGetH(VROOT) - ewin->border->border.top - 1; else if ((y + EoGetH(ewin) - ewin->border->border.bottom - 1) < 0) y = 0 - EoGetH(ewin) + ewin->border->border.bottom + 1; @@ -241,8 +241,8 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags) if (Mode.mode == MODE_NONE && Mode.move.check) { /* Don't throw windows offscreen */ - sw = VRoot.w; - sh = VRoot.h; + sw = WinGetW(VROOT); + sh = WinGetH(VROOT); if (EoIsSticky(ewin)) { xo = yo = 0; @@ -600,18 +600,19 @@ GetOnScreenPos(int x, int y, int w, int h, int *px, int *py) { int dx, dy; - if (x + w > 4 && x <= VRoot.w - 4 && y + h > 4 && y <= VRoot.h - 4) + if (x + w > 4 && x <= WinGetW(VROOT) - 4 && + y + h > 4 && y <= WinGetH(VROOT) - 4) goto done; dx = w / 2; dy = h / 2; - x = (x + dx) % VRoot.w; + x = (x + dx) % WinGetW(VROOT); if (x < 0) - x += VRoot.w; + x += WinGetW(VROOT); x -= dx; - y = (y + dy) % VRoot.h; + y = (y + dy) % WinGetH(VROOT); if (y < 0) - y += VRoot.h; + y += WinGetH(VROOT); y -= dy; done: @@ -715,13 +716,13 @@ EwinStick(EWin * ewin) /* Avoid "losing" windows made sticky while not in the current viewport */ dx = EoGetW(ewin) / 2; dy = EoGetH(ewin) / 2; - x = (EoGetX(ewin) + dx) % VRoot.w; + x = (EoGetX(ewin) + dx) % WinGetW(VROOT); if (x < 0) - x += VRoot.w; + x += WinGetW(VROOT); x -= dx; - y = (EoGetY(ewin) + dy) % VRoot.h; + y = (EoGetY(ewin) + dy) % WinGetH(VROOT); if (y < 0) - y += VRoot.h; + y += WinGetH(VROOT); y -= dy; EoSetSticky(ewin, 1); @@ -1382,8 +1383,8 @@ void EwinMoveToArea(EWin * ewin, int ax, int ay) { DesksFixArea(&ax, &ay); - EwinMove(ewin, EoGetX(ewin) + (VRoot.w * (ax - ewin->area_x)), - EoGetY(ewin) + (VRoot.h * (ay - ewin->area_y))); + EwinMove(ewin, EoGetX(ewin) + (WinGetW(VROOT) * (ax - ewin->area_x)), + EoGetY(ewin) + (WinGetH(VROOT) * (ay - ewin->area_y))); } void diff --git a/src/ewins.c b/src/ewins.c index 4db99952..85dc91a4 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -230,7 +230,7 @@ EwinManage(EWin * ewin) if (!frame) { frame = - ECreateObjectWindow(VRoot.win, ewin->client.x, ewin->client.y, + ECreateObjectWindow(VROOT, ewin->client.x, ewin->client.y, ewin->client.w, ewin->client.h, 0, 0, EwinGetClientWin(ewin)); ewin->win_container = @@ -439,23 +439,23 @@ DetermineEwinFloat(EWin * ewin, int dx, int dy) { case 0: if (((x + dx < 0) || - ((x + dx + w <= VRoot.w) && + ((x + dx + w <= WinGetW(VROOT)) && (DesktopAt(xd + x + dx + w - 1, yd) != dsk)))) dofloat = 1; break; case 1: - if (((x + dx + w > VRoot.w) || + if (((x + dx + w > WinGetW(VROOT)) || ((x + dx >= 0) && (DesktopAt(xd + x + dx, yd) != dsk)))) dofloat = 1; break; case 2: if (((y + dy < 0) || - ((y + dy + h <= VRoot.h) && + ((y + dy + h <= WinGetH(VROOT)) && (DesktopAt(xd, yd + y + dy + h - 1) != dsk)))) dofloat = 1; break; case 3: - if (((y + dy + h > VRoot.h) || + if (((y + dy + h > WinGetH(VROOT)) || ((y + dy >= 0) && (DesktopAt(xd, yd + y + dy) != dsk)))) dofloat = 1; break; @@ -710,10 +710,10 @@ AddToFamily(EWin * ewin, Window xwin) if (ewin->icccm.transient) { if (ewin->icccm.transient_for == None || - ewin->icccm.transient_for == VRoot.xwin) + ewin->icccm.transient_for == WinGetXwin(VROOT)) { /* Group transient */ - ewin->icccm.transient_for = VRoot.xwin; + ewin->icccm.transient_for = WinGetXwin(VROOT); #if 0 /* Maybe? */ ewin->layer++; #endif @@ -808,7 +808,7 @@ AddToFamily(EWin * ewin, Window xwin) if (Conf.place.manual && !Mode.place.doing_manual && !ewin->state.placed && !ewin->icccm.transient) { - if (GrabPointerSet(VRoot.win, ECSR_GRAB, 0) == GrabSuccess) + if (GrabPointerSet(VROOT, ECSR_GRAB, 0) == GrabSuccess) manplace = 1; } } @@ -833,8 +833,8 @@ AddToFamily(EWin * ewin, Window xwin) cy -= EoGetH(ewin) / 2; /* keep it all on this screen if possible */ - cx = MIN(cx, VRoot.w - EoGetW(ewin)); - cy = MIN(cy, VRoot.h - EoGetH(ewin)); + cx = MIN(cx, WinGetW(VROOT) - EoGetW(ewin)); + cy = MIN(cy, WinGetH(VROOT) - EoGetH(ewin)); cx = MAX(cx, 0); cy = MAX(cy, 0); @@ -850,7 +850,7 @@ AddToFamily(EWin * ewin, Window xwin) ewin2 = NULL; if (EwinGetTransientFor(ewin) != None) ewin2 = EwinFindByClient(EwinGetTransientFor(ewin)); - parent = (ewin2) ? EoGetWin(ewin) : VRoot.win; + parent = (ewin2) ? EoGetWin(ewin) : VROOT; x = (WinGetW(parent) - EoGetW(ewin)) / 2; y = (WinGetH(parent) - EoGetH(ewin)) / 2; } @@ -890,7 +890,7 @@ AddToFamily(EWin * ewin, Window xwin) EwinMoveToDesktopAt(ewin, dsk, x, y); EwinMove(ewin, x, y); EwinShow(ewin); - GrabPointerSet(VRoot.win, ECSR_GRAB, 0); + GrabPointerSet(VROOT, ECSR_GRAB, 0); Mode.place.doing_manual = 1; EoSetFloating(ewin, 1); /* Causes reparenting to root */ ActionMoveStart(ewin, 0, 0); @@ -901,23 +901,23 @@ AddToFamily(EWin * ewin, Window xwin) k = rand() % 4; if (k == 0) { - fx = (rand() % (VRoot.w)) - EoGetW(ewin); + fx = (rand() % (WinGetW(VROOT))) - EoGetW(ewin); fy = -EoGetH(ewin); } else if (k == 1) { - fx = (rand() % (VRoot.w)); - fy = VRoot.h; + fx = (rand() % (WinGetW(VROOT))); + fy = WinGetH(VROOT); } else if (k == 2) { fx = -EoGetW(ewin); - fy = (rand() % (VRoot.h)); + fy = (rand() % (WinGetH(VROOT))); } else { - fx = VRoot.w; - fy = (rand() % (VRoot.h)) - EoGetH(ewin); + fx = WinGetW(VROOT); + fy = (rand() % (WinGetH(VROOT))) - EoGetH(ewin); } Mode.place.doing_slide = 1; ewin->state.animated = 1; @@ -1036,7 +1036,7 @@ EwinWithdraw(EWin * ewin, Win to) /* Park the client window on the new root */ x = ewin->client.x; y = ewin->client.y; - ETranslateCoordinates(EwinGetClientWin(ewin), VRoot.win, + ETranslateCoordinates(EwinGetClientWin(ewin), VROOT, -ewin->border->border.left, -ewin->border->border.top, &x, &y, &win); EReparentWindow(EwinGetClientWin(ewin), to, x, y); @@ -1190,7 +1190,7 @@ EwinEventUnmap(EWin * ewin, XEvent * ev) if (EoIsGone(ewin)) return; - EwinWithdraw(ewin, VRoot.win); + EwinWithdraw(ewin, VROOT); } static void @@ -1598,7 +1598,7 @@ EwinIsOnScreen(const EWin * ewin) w = EoGetW(ewin); h = EoGetH(ewin); - if (x + w <= 0 || x >= VRoot.w || y + h <= 0 || y >= VRoot.h) + if (x + w <= 0 || x >= WinGetW(VROOT) || y + h <= 0 || y >= WinGetH(VROOT)) return 0; return 1; @@ -1617,8 +1617,8 @@ EwinRememberPositionSet(EWin * ewin) if (!EoIsSticky(ewin)) { DeskGetArea(EoGetDesk(ewin), &ax, &ay); - ewin->req_x += ax * VRoot.w; - ewin->req_y += ay * VRoot.h; + ewin->req_x += ax * WinGetW(VROOT); + ewin->req_y += ay * WinGetH(VROOT); } } @@ -1635,8 +1635,8 @@ EwinRememberPositionGet(EWin * ewin, Desk * dsk, int *px, int *py) if (!EoIsSticky(ewin)) { DeskGetArea(dsk, &ax, &ay); - x -= ax * VRoot.w; - y -= ay * VRoot.h; + x -= ax * WinGetW(VROOT); + y -= ay * WinGetH(VROOT); } *px = x; @@ -1715,8 +1715,8 @@ EwinReposition(EWin * ewin) wdo = Mode.screen.w_old; hdo = Mode.screen.h_old; - wdn = VRoot.w; - hdn = VRoot.h; + wdn = WinGetW(VROOT); + hdn = WinGetH(VROOT); x = EoGetX(ewin); y = EoGetY(ewin); @@ -2016,7 +2016,7 @@ EwinListTransients(const EWin * ewin, int *num, int group) if (ew == ewin) continue; - if (EwinGetTransientFor(ew) == VRoot.xwin && + if (EwinGetTransientFor(ew) == WinGetXwin(VROOT) && EwinGetWindowGroup(ew) == EwinGetWindowGroup(ewin)) { lst = EREALLOC(EWin *, lst, j + 1); @@ -2053,7 +2053,7 @@ EwinListTransientFor(const EWin * ewin, int *num) /* Regular parent or if root trans, top level group members */ if ((EwinGetTransientFor(ewin) == EwinGetClientXwin(ew)) || (!EwinIsTransient(ew) && - EwinGetTransientFor(ewin) == VRoot.xwin && + EwinGetTransientFor(ewin) == WinGetXwin(VROOT) && EwinGetWindowGroup(ew) == EwinGetWindowGroup(ewin))) { lst = EREALLOC(EWin *, lst, j + 1); @@ -2132,7 +2132,7 @@ EwinsManage(void) xwins = NULL; num = 0; - XQueryTree(disp, VRoot.xwin, &rt, &par, &xwins, &num); + XQueryTree(disp, WinGetXwin(VROOT), &rt, &par, &xwins, &num); if (!xwins) return; @@ -2464,7 +2464,7 @@ EwinHandleEventsRoot(Win win __UNUSED__, XEvent * ev, void *prm __UNUSED__) static void EwinsInit(void) { - EventCallbackRegister(VRoot.win, 0, EwinHandleEventsRoot, NULL); + EventCallbackRegister(VROOT, 0, EwinHandleEventsRoot, NULL); } /* diff --git a/src/ewmh.c b/src/ewmh.c index 02785311..cae977be 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -175,11 +175,12 @@ EWMH_Init(Window win_wm_check) atom_list[atom_count++] = ECORE_X_ATOM_NET_FRAME_EXTENTS; atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_OPACITY; - ecore_x_window_prop_atom_set(VRoot.xwin, ECORE_X_ATOM_NET_SUPPORTED, - atom_list, atom_count); + ecore_x_window_prop_atom_set(WinGetXwin(VROOT), + ECORE_X_ATOM_NET_SUPPORTED, atom_list, + atom_count); /* Set WM info properties */ - ecore_x_netwm_wm_identify(VRoot.xwin, win_wm_check, e_wm_name); + ecore_x_netwm_wm_identify(WinGetXwin(VROOT), win_wm_check, e_wm_name); } /* @@ -189,7 +190,7 @@ EWMH_Init(Window win_wm_check) void EWMH_SetDesktopCount(void) { - ecore_x_netwm_desk_count_set(VRoot.xwin, DesksGetNumber()); + ecore_x_netwm_desk_count_set(WinGetXwin(VROOT), DesksGetNumber()); } void @@ -206,7 +207,7 @@ EWMH_SetDesktopRoots(void) for (i = 0; i < n_desks; i++) wl[i] = EoGetXwin(DeskGet(i)); - ecore_x_netwm_desk_roots_set(VRoot.xwin, wl, n_desks); + ecore_x_netwm_desk_roots_set(WinGetXwin(VROOT), wl, n_desks); Efree(wl); } @@ -215,7 +216,7 @@ void EWMH_SetDesktopNames(void) { /* Fall back to defaults */ - ecore_x_netwm_desk_names_set(VRoot.xwin, NULL, DesksGetNumber()); + ecore_x_netwm_desk_names_set(WinGetXwin(VROOT), NULL, DesksGetNumber()); } void @@ -224,7 +225,8 @@ EWMH_SetDesktopSize(void) int ax, ay; DesksGetAreaSize(&ax, &ay); - ecore_x_netwm_desk_size_set(VRoot.xwin, ax * VRoot.w, ay * VRoot.h); + ecore_x_netwm_desk_size_set(WinGetXwin(VROOT), ax * WinGetW(VROOT), + ay * WinGetH(VROOT)); } void @@ -244,11 +246,11 @@ EWMH_SetWorkArea(void) { p_coord[4 * i] = 0; p_coord[4 * i + 1] = 0; - p_coord[4 * i + 2] = VRoot.w; - p_coord[4 * i + 3] = VRoot.h; + p_coord[4 * i + 2] = WinGetW(VROOT); + p_coord[4 * i + 3] = WinGetH(VROOT); } - ecore_x_netwm_desk_workareas_set(VRoot.xwin, p_coord, n_desks); + ecore_x_netwm_desk_workareas_set(WinGetXwin(VROOT), p_coord, n_desks); Efree(p_coord); } @@ -256,7 +258,7 @@ EWMH_SetWorkArea(void) void EWMH_SetCurrentDesktop(void) { - ecore_x_netwm_desk_current_set(VRoot.xwin, DesksGetCurrentNum()); + ecore_x_netwm_desk_current_set(WinGetXwin(VROOT), DesksGetCurrentNum()); } void @@ -275,11 +277,11 @@ EWMH_SetDesktopViewport(void) for (i = 0; i < n_desks; i++) { DeskGetArea(DeskGet(i), &ax, &ay); - p_coord[2 * i] = ax * VRoot.w; - p_coord[2 * i + 1] = ay * VRoot.h; + p_coord[2 * i] = ax * WinGetW(VROOT); + p_coord[2 * i + 1] = ay * WinGetH(VROOT); } - ecore_x_netwm_desk_viewports_set(VRoot.xwin, p_coord, n_desks); + ecore_x_netwm_desk_viewports_set(WinGetXwin(VROOT), p_coord, n_desks); Efree(p_coord); } @@ -287,7 +289,7 @@ EWMH_SetDesktopViewport(void) void EWMH_SetShowingDesktop(int on) { - ecore_x_netwm_showing_desktop_set(VRoot.xwin, on); + ecore_x_netwm_showing_desktop_set(WinGetXwin(VROOT), on); } /* @@ -308,12 +310,12 @@ EWMH_SetClientList(void) wl = EMALLOC(Ecore_X_Window, num); for (i = 0; i < num; i++) wl[i] = EwinGetClientXwin(lst[i]); - ecore_x_netwm_client_list_set(VRoot.xwin, wl, num); + ecore_x_netwm_client_list_set(WinGetXwin(VROOT), wl, num); Efree(wl); } else { - ecore_x_netwm_client_list_set(VRoot.xwin, NULL, 0); + ecore_x_netwm_client_list_set(WinGetXwin(VROOT), NULL, 0); } } @@ -331,12 +333,12 @@ EWMH_SetClientStacking(void) wl = EMALLOC(Ecore_X_Window, num); for (i = 0; i < num; i++) wl[i] = EwinGetClientXwin(lst[num - i - 1]); - ecore_x_netwm_client_list_stacking_set(VRoot.xwin, wl, num); + ecore_x_netwm_client_list_stacking_set(WinGetXwin(VROOT), wl, num); Efree(wl); } else { - ecore_x_netwm_client_list_stacking_set(VRoot.xwin, NULL, 0); + ecore_x_netwm_client_list_stacking_set(WinGetXwin(VROOT), NULL, 0); } } @@ -348,7 +350,7 @@ EWMH_SetActiveWindow(Window win) if (win == win_last_set) return; - ecore_x_netwm_client_active_set(VRoot.xwin, win); + ecore_x_netwm_client_active_set(WinGetXwin(VROOT), win); win_last_set = win; } @@ -1064,7 +1066,8 @@ EWMH_ProcessRootClientMessage(XClientMessageEvent * ev) } if (ev->message_type == ECORE_X_ATOM_NET_DESKTOP_VIEWPORT) { - DeskCurrentGotoArea(ev->data.l[0] / VRoot.w, ev->data.l[1] / VRoot.h); + DeskCurrentGotoArea(ev->data.l[0] / WinGetW(VROOT), + ev->data.l[1] / WinGetH(VROOT)); return 1; } if (ev->message_type == ECORE_X_ATOM_NET_SHOWING_DESKTOP) diff --git a/src/extinitwin.c b/src/extinitwin.c index fa23e19d..6ff47230 100644 --- a/src/extinitwin.c +++ b/src/extinitwin.c @@ -49,26 +49,29 @@ ExtInitWinMain(void) attr.backing_store = NotUseful; attr.override_redirect = True; - attr.colormap = VRoot.cmap; + attr.colormap = WinGetCmap(VROOT); attr.border_pixel = 0; attr.background_pixel = 0; attr.save_under = True; - win = XCreateWindow(disp, VRoot.xwin, 0, 0, VRoot.w, VRoot.h, 0, - CopyFromParent, InputOutput, CopyFromParent, + win = XCreateWindow(disp, WinGetXwin(VROOT), + 0, 0, WinGetW(VROOT), WinGetH(VROOT), + 0, CopyFromParent, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWBackingStore | CWColormap | CWBackPixel | CWBorderPixel, &attr); - pmap = XCreatePixmap(disp, win, VRoot.w, VRoot.h, VRoot.depth); + pmap = XCreatePixmap(disp, win, + WinGetW(VROOT), WinGetH(VROOT), WinGetDepth(VROOT)); gcv.subwindow_mode = IncludeInferiors; gc = XCreateGC(disp, win, GCSubwindowMode, &gcv); - XCopyArea(disp, VRoot.xwin, pmap, gc, 0, 0, VRoot.w, VRoot.h, 0, 0); + XCopyArea(disp, WinGetXwin(VROOT), pmap, gc, + 0, 0, WinGetW(VROOT), WinGetH(VROOT), 0, 0); XSetWindowBackgroundPixmap(disp, win, pmap); XMapRaised(disp, win); XFreePixmap(disp, pmap); XFreeGC(disp, gc); a = XInternAtom(disp, "ENLIGHTENMENT_RESTART_SCREEN", False); - ecore_x_window_prop_window_set(VRoot.xwin, a, &win, 1); + ecore_x_window_prop_window_set(WinGetXwin(VROOT), a, &win, 1); XSelectInput(disp, win, StructureNotifyMask); @@ -171,7 +174,8 @@ ExtInitWinCreate(void) /* Hack to give the child some space. Not foolproof. */ sleep(1); - if (ecore_x_window_prop_window_get(VRoot.xwin, a, &win_ex, 1) > 0) + if (ecore_x_window_prop_window_get + (WinGetXwin(VROOT), a, &win_ex, 1) > 0) break; } diff --git a/src/focus.c b/src/focus.c index 4cf88176..63aea28d 100644 --- a/src/focus.c +++ b/src/focus.c @@ -504,8 +504,8 @@ void FocusNewDeskBegin(void) { /* Freeze keyboard */ - XGrabKeyboard(disp, VRoot.xwin, False, GrabModeAsync, GrabModeSync, - CurrentTime); + XGrabKeyboard(disp, WinGetXwin(VROOT), False, GrabModeAsync, + GrabModeSync, CurrentTime); focus_pending_new = NULL; doFocusToEwin(NULL, FOCUS_DESK_LEAVE); @@ -564,7 +564,7 @@ FocusHandleEnter(EWin * ewin, XEvent * ev) if (!ewin) { /* Entering root may mean entering this screen */ - if (win == VRoot.xwin && + if (win == WinGetXwin(VROOT) && (ev->xcrossing.mode == NotifyNormal && ev->xcrossing.detail != NotifyInferior)) { @@ -599,7 +599,7 @@ FocusHandleLeave(EWin * ewin __UNUSED__, XEvent * ev) Window win = ev->xcrossing.window; /* Leaving root may mean entering other screen */ - if (win == VRoot.xwin && + if (win == WinGetXwin(VROOT) && (ev->xcrossing.mode == NotifyNormal && ev->xcrossing.detail != NotifyInferior)) FocusToEWin(NULL, FOCUS_DESK_LEAVE); diff --git a/src/fx.c b/src/fx.c index 1f080c12..cd9c96bf 100644 --- a/src/fx.c +++ b/src/fx.c @@ -71,7 +71,8 @@ FX_ripple_timeout(int val __UNUSED__, void *data __UNUSED__) fx_ripple_win = DeskGetBackgroundWin(DesksGetCurrent()); fx_ripple_above = - ECreatePixmap(fx_ripple_win, VRoot.w, fx_ripple_waterh * 2, 0); + ECreatePixmap(fx_ripple_win, WinGetW(VROOT), + fx_ripple_waterh * 2, 0); if (gc) EXFreeGC(gc); if (gc1) @@ -83,8 +84,8 @@ FX_ripple_timeout(int val __UNUSED__, void *data __UNUSED__) if (fx_ripple_count == 0) XCopyArea(disp, EoGetXwin(DesksGetCurrent()), fx_ripple_above, gc, 0, - VRoot.h - (fx_ripple_waterh * 3), VRoot.w, fx_ripple_waterh * 2, - 0, 0); + WinGetH(VROOT) - (fx_ripple_waterh * 3), WinGetW(VROOT), + fx_ripple_waterh * 2, 0, 0); fx_ripple_count++; if (fx_ripple_count > 32) @@ -111,7 +112,8 @@ FX_ripple_timeout(int val __UNUSED__, void *data __UNUSED__) aa = p * p * 64 + inch; off = (int)(sin(aa) * 10 * (1 - p)); XCopyArea(disp, fx_ripple_above, WinGetXwin(fx_ripple_win), gc1, 0, yy, - VRoot.w, 1, off, VRoot.h - fx_ripple_waterh + y); + WinGetW(VROOT), 1, off, + WinGetH(VROOT) - fx_ripple_waterh + y); } DoIn("FX_RIPPLE_TIMEOUT", 0.066, FX_ripple_timeout, 0, NULL); } @@ -136,8 +138,8 @@ static void FX_Ripple_Quit(void) { RemoveTimerEvent("FX_RIPPLE_TIMEOUT"); - EClearArea(fx_ripple_win, 0, VRoot.h - fx_ripple_waterh, VRoot.w, - fx_ripple_waterh, False); + EClearArea(fx_ripple_win, 0, WinGetH(VROOT) - fx_ripple_waterh, + WinGetW(VROOT), fx_ripple_waterh, False); } static void @@ -263,19 +265,19 @@ FX_raindrops_timeout(int val __UNUSED__, void *data __UNUSED__) for (j = 0; j < fx_raindrops_number; j++) { fx_raindrops[i].x = - rand() % (VRoot.w - fx_raindrop_size); + rand() % (WinGetW(VROOT) - fx_raindrop_size); fx_raindrops[i].y = - rand() % (VRoot.h - fx_raindrop_size); + rand() % (WinGetH(VROOT) - fx_raindrop_size); if (fx_raindrops[i].x < 0) fx_raindrops[i].x = 0; else if (fx_raindrops[i].x > - (VRoot.w - fx_raindrop_size)) - fx_raindrops[i].x = VRoot.w - fx_raindrop_size; + (WinGetW(VROOT) - fx_raindrop_size)) + fx_raindrops[i].x = WinGetW(VROOT) - fx_raindrop_size; if (fx_raindrops[i].y < 0) fx_raindrops[i].y = 0; else if (fx_raindrops[i].y > - (VRoot.h - fx_raindrop_size)) - fx_raindrops[i].y = VRoot.h - fx_raindrop_size; + (WinGetH(VROOT) - fx_raindrop_size)) + fx_raindrops[i].y = WinGetH(VROOT) - fx_raindrop_size; if (i != j) { if (((fx_raindrops[i].x >= fx_raindrops[j].x) @@ -385,8 +387,8 @@ FX_Raindrops_Init(const char *name __UNUSED__) for (i = 0; i < fx_raindrops_number; i++) { fx_raindrops[i].count = rand() % fx_raindrop_duration; - fx_raindrops[i].x = rand() % (VRoot.w - fx_raindrop_size); - fx_raindrops[i].y = rand() % (VRoot.h - fx_raindrop_size); + fx_raindrops[i].x = rand() % (WinGetW(VROOT) - fx_raindrop_size); + fx_raindrops[i].y = rand() % (WinGetH(VROOT) - fx_raindrop_size); } DoIn("FX_RAINDROPS_TIMEOUT", 0.066, FX_raindrops_timeout, 0, NULL); } @@ -467,7 +469,7 @@ FX_Wave_timeout(int val __UNUSED__, void *data __UNUSED__) fx_wave_win = DeskGetBackgroundWin(DesksGetCurrent()); fx_wave_above = - ECreatePixmap(fx_wave_win, VRoot.w, FX_WAVE_WATERH * 2, 0); + ECreatePixmap(fx_wave_win, WinGetW(VROOT), FX_WAVE_WATERH * 2, 0); if (gc) EXFreeGC(gc); if (gc1) @@ -481,8 +483,8 @@ FX_Wave_timeout(int val __UNUSED__, void *data __UNUSED__) if (fx_wave_count == 0) { XCopyArea(disp, EoGetXwin(DesksGetCurrent()), fx_wave_above, gc, 0, - VRoot.h - (FX_WAVE_WATERH * 3), VRoot.w, FX_WAVE_WATERH * 2, - 0, 0); + WinGetH(VROOT) - (FX_WAVE_WATERH * 3), WinGetW(VROOT), + FX_WAVE_WATERH * 2, 0, 0); } /* Increment and roll the counter */ @@ -507,8 +509,8 @@ FX_Wave_timeout(int val __UNUSED__, void *data __UNUSED__) if (fx_wave_count == 0) { XCopyArea(disp, fx_wave_above, WinGetXwin(fx_wave_win), gc1, 0, - VRoot.h - FX_WAVE_GRABH, VRoot.w, FX_WAVE_DEPTH * 2, 0, - VRoot.h - FX_WAVE_GRABH); + WinGetH(VROOT) - FX_WAVE_GRABH, WinGetW(VROOT), + FX_WAVE_DEPTH * 2, 0, WinGetH(VROOT) - FX_WAVE_GRABH); } /* Go through the bottom couple (FX_WAVE_WATERH) lines of the window */ @@ -531,7 +533,7 @@ FX_Wave_timeout(int val __UNUSED__, void *data __UNUSED__) incx2 = incx; /* Go through the width of the screen, in block sizes */ - for (x = 0; x < VRoot.w; x += FX_WAVE_WATERW) + for (x = 0; x < WinGetW(VROOT); x += FX_WAVE_WATERW) { /* Variables */ int sx; @@ -548,7 +550,7 @@ FX_Wave_timeout(int val __UNUSED__, void *data __UNUSED__) /* Display this block */ XCopyArea(disp, fx_wave_above, WinGetXwin(fx_wave_win), gc1, x, yy, /* x, y */ FX_WAVE_WATERW, 1, /* w, h */ - off + x, VRoot.h - FX_WAVE_WATERH + y + sx /* dx, dy */ + off + x, WinGetH(VROOT) - FX_WAVE_WATERH + y + sx /* dx, dy */ ); } } @@ -576,8 +578,8 @@ static void FX_Waves_Quit(void) { RemoveTimerEvent("FX_WAVE_TIMEOUT"); - EClearArea(fx_wave_win, 0, VRoot.h - FX_WAVE_WATERH, VRoot.w, - FX_WAVE_WATERH, False); + EClearArea(fx_wave_win, 0, WinGetH(VROOT) - FX_WAVE_WATERH, + WinGetW(VROOT), FX_WAVE_WATERH, False); } static void @@ -637,8 +639,8 @@ FX_imagespinner_timeout(int val __UNUSED__, void *data __UNUSED__) EImageGetSize(im, &w, &h); sscanf(fx_imagespinner_params, "%*s %i %i ", &x, &y); - x = ((VRoot.w * x) >> 10) - ((w * x) >> 10); - y = ((VRoot.h * y) >> 10) - ((h * y) >> 10); + x = ((WinGetW(VROOT) * x) >> 10) - ((w * x) >> 10); + y = ((WinGetH(VROOT) * y) >> 10) - ((h * y) >> 10); EImageRenderOnDrawable(im, fx_imagespinner_win, 0, x, y, w, h); EImageFree(im); } @@ -666,7 +668,8 @@ static void FX_ImageSpinner_Quit(void) { RemoveTimerEvent("FX_IMAGESPINNER_TIMEOUT"); - XClearArea(disp, fx_imagespinner_win, 0, 0, VRoot.w, VRoot.h, False); + XClearArea(disp, fx_imagespinner_win, 0, 0, WinGetW(VROOT), + WinGetH(VROOT), False); Efree(fx_imagespinner_params); fx_imagespinner_params = NULL; fx_imagespinner_win = None; diff --git a/src/glwin.c b/src/glwin.c index f3a6691c..19c1a0eb 100644 --- a/src/glwin.c +++ b/src/glwin.c @@ -633,7 +633,7 @@ GlwinCreate(const char *title __UNUSED__, int width, int height) #if 0 win = RROOT; #else - win = VRoot.win; + win = VROOT; #endif x = ((win->w - width) / 2); y = ((win->h - height) / 2); diff --git a/src/gnome.c b/src/gnome.c index 11301de0..26147fc0 100644 --- a/src/gnome.c +++ b/src/gnome.c @@ -549,7 +549,7 @@ GNOME_SetUsedHints(void) list[7] = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False); list[8] = XInternAtom(disp, XA_WIN_WORKSPACE_NAMES, False); list[9] = XInternAtom(disp, XA_WIN_CLIENT_LIST, False); - ecore_x_window_prop_atom_set(VRoot.xwin, atom_set, list, 10); + ecore_x_window_prop_atom_set(WinGetXwin(VROOT), atom_set, list, 10); } void @@ -564,7 +564,7 @@ GNOME_SetCurrentArea(void) DeskCurrentGetArea(&ax, &ay); val[0] = ax; val[1] = ay; - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, val, 2); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, val, 2); } void @@ -576,7 +576,7 @@ GNOME_SetCurrentDesk(void) if (!atom_set) atom_set = XInternAtom(disp, XA_WIN_WORKSPACE, False); val = DesksGetCurrentNum(); - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, &val, 1); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1); } static void @@ -588,7 +588,7 @@ GNOME_SetWMCheck(Window win_wm_check) if (!atom_set) atom_set = XInternAtom(disp, XA_WIN_SUPPORTING_WM_CHECK, False); val = win_wm_check; - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, &val, 1); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1); ecore_x_window_prop_card32_set(win_wm_check, atom_set, &val, 1); } @@ -601,7 +601,7 @@ GNOME_SetDeskCount(void) if (!atom_set) atom_set = XInternAtom(disp, XA_WIN_WORKSPACE_COUNT, False); val = DesksGetNumber(); - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, &val, 1); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1); } void @@ -616,7 +616,7 @@ GNOME_SetAreaCount(void) DesksGetAreaSize(&ax, &ay); val[0] = ax; val[1] = ay; - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, val, 2); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, val, 2); } void @@ -641,7 +641,8 @@ GNOME_SetDeskNames(void) names[i] = Estrdup(s); } - ecore_x_window_prop_string_list_set(VRoot.xwin, atom_set, names, n_desks); + ecore_x_window_prop_string_list_set(WinGetXwin(VROOT), atom_set, names, + n_desks); for (i = 0; i < n_desks; i++) Efree(names[i]); @@ -672,7 +673,7 @@ GNOME_SetClientList(void) wl[j++] = EwinGetClientXwin(lst[i]); } } - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, wl, j); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, wl, j); Efree(wl); } @@ -683,11 +684,11 @@ GNOME_SetWMNameVer(void) if (!atom_set) atom_set = XInternAtom(disp, XA_WIN_WM_NAME, False); - ecore_x_window_prop_string_set(VRoot.xwin, atom_set, e_wm_name); + ecore_x_window_prop_string_set(WinGetXwin(VROOT), atom_set, e_wm_name); if (!atom_set2) atom_set2 = XInternAtom(disp, XA_WIN_WM_VERSION, False); - ecore_x_window_prop_string_set(VRoot.xwin, atom_set2, e_wm_version); + ecore_x_window_prop_string_set(WinGetXwin(VROOT), atom_set2, e_wm_version); } void @@ -741,9 +742,10 @@ GNOME_SetHints(Window win_wm_check) atom_set = XInternAtom(disp, "_WIN_DESKTOP_BUTTON_PROXY", False); Mode.button_proxy_win = - XCreateSimpleWindow(disp, VRoot.xwin, -80, -80, 24, 24, 0, 0, 0); + XCreateSimpleWindow(disp, WinGetXwin(VROOT), -80, -80, 24, 24, 0, + 0, 0); val = Mode.button_proxy_win; - ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, &val, 1); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), atom_set, &val, 1); ecore_x_window_prop_card32_set(Mode.button_proxy_win, atom_set, &val, 1); } } diff --git a/src/grabs.c b/src/grabs.c index 1c33d7ee..9ac5a10c 100644 --- a/src/grabs.c +++ b/src/grabs.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2007 Kim Woelders + * Copyright (C) 2004-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -57,7 +57,7 @@ int GrabPointerSet(Win win, unsigned int csr, int confine) { int ret = -1; - Window confine_to = (confine) ? VRoot.xwin : None; + Window confine_to = (confine) ? WinGetXwin(VROOT) : None; ret = XGrabPointer(disp, WinGetXwin(win), False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | diff --git a/src/hints.c b/src/hints.c index 8bde9bd7..b09e0c59 100644 --- a/src/hints.c +++ b/src/hints.c @@ -85,7 +85,8 @@ HintsInit(void) AtomListIntern(atoms_misc_names, N_ITEMS(atoms_misc_names), atoms_misc); - win = XCreateSimpleWindow(disp, VRoot.xwin, -200, -200, 5, 5, 0, 0, 0); + win = XCreateSimpleWindow(disp, WinGetXwin(VROOT), -200, -200, 5, 5, + 0, 0, 0); ICCCM_Init(); MWM_SetInfo(); @@ -94,15 +95,16 @@ HintsInit(void) #endif EWMH_Init(win); - ecore_x_window_prop_string_set(VRoot.xwin, E16_ATOM_VERSION, e_wm_version); + ecore_x_window_prop_string_set(WinGetXwin(VROOT), E16_ATOM_VERSION, + e_wm_version); if (Mode.wm.window) { - HintsSetWindowName(VRoot.win, "Enlightenment"); - HintsSetWindowClass(VRoot.win, "Virtual-Root", "Enlightenment"); + HintsSetWindowName(VROOT, "Enlightenment"); + HintsSetWindowClass(VROOT, "Virtual-Root", "Enlightenment"); } - Mode.root.ext_pmap = HintsGetRootPixmap(VRoot.win); + Mode.root.ext_pmap = HintsGetRootPixmap(VROOT); Mode.root.ext_pmap_valid = EDrawableCheck(Mode.root.ext_pmap, 0); } @@ -493,19 +495,19 @@ EHintsSetDeskInfo(void) c[(i * 2) + 1] = ay; } - ecore_x_window_prop_card32_set(VRoot.xwin, E16_ATOM_INTERNAL_AREA_DATA, - c, 2 * n_desks); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), + E16_ATOM_INTERNAL_AREA_DATA, c, 2 * n_desks); c[0] = DesksGetCurrentNum(); - ecore_x_window_prop_card32_set(VRoot.xwin, E16_ATOM_INTERNAL_DESK_DATA, c, - 1); + ecore_x_window_prop_card32_set(WinGetXwin(VROOT), + E16_ATOM_INTERNAL_DESK_DATA, c, 1); Efree(c); if (Mode.root.ext_pmap_valid) { - HintsSetRootInfo(VRoot.win, Mode.root.ext_pmap, 0); - ESetWindowBackgroundPixmap(VRoot.win, Mode.root.ext_pmap); + HintsSetRootInfo(VROOT, Mode.root.ext_pmap, 0); + ESetWindowBackgroundPixmap(VROOT, Mode.root.ext_pmap); } } @@ -521,7 +523,8 @@ EHintsGetDeskInfo(void) if (!c) return; - num = ecore_x_window_prop_card32_get(VRoot.xwin, E16_ATOM_INTERNAL_AREA_DATA, + num = ecore_x_window_prop_card32_get(WinGetXwin(VROOT), + E16_ATOM_INTERNAL_AREA_DATA, c, 2 * n_desks); if (num > 0) { @@ -529,8 +532,8 @@ EHintsGetDeskInfo(void) DeskSetArea(DeskGet(i), c[(i * 2)], c[(i * 2) + 1]); } - num = ecore_x_window_prop_card32_get(VRoot.xwin, E16_ATOM_INTERNAL_DESK_DATA, - c, 1); + num = ecore_x_window_prop_card32_get(WinGetXwin(VROOT), + E16_ATOM_INTERNAL_DESK_DATA, c, 1); if (num > 0) { DesksSetCurrent(DeskGet(c[0])); @@ -587,7 +590,7 @@ SelectionAcquire(const char *name, EventCallbackFunc * func, void *data) sel->atom = XInternAtom(disp, buf, False); sel->time = EGetTimestamp(); - sel->win = ECreateEventWindow(VRoot.win, -100, -100, 1, 1); + sel->win = ECreateEventWindow(VROOT, -100, -100, 1, 1); sel->func = func; sel->data = data; @@ -608,7 +611,7 @@ SelectionAcquire(const char *name, EventCallbackFunc * func, void *data) EventCallbackRegister(sel->win, 0, sel->func, sel->data); } - ecore_x_client_message32_send(VRoot.xwin, E_XA_MANAGER, + ecore_x_client_message32_send(WinGetXwin(VROOT), E_XA_MANAGER, StructureNotifyMask, CurrentTime, sel->atom, WinGetXwin(sel->win), 0, 0); diff --git a/src/hiwin.c b/src/hiwin.c index 8b4114c2..17ca6998 100644 --- a/src/hiwin.c +++ b/src/hiwin.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2007 Kim Woelders + * Copyright (C) 2004-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -395,8 +395,8 @@ HiwinShow(Hiwin * phi, EWin * ewin, int zoom, int confine) } else { - x = VRoot.w / 2; - y = VRoot.h / 2; + x = WinGetW(VROOT) / 2; + y = WinGetH(VROOT) / 2; w = zoom * EoGetW(phi->ewin) / 4; h = zoom * EoGetH(phi->ewin) / 4; step = 0; diff --git a/src/icccm.c b/src/icccm.c index 58c37b07..5b51d762 100644 --- a/src/icccm.c +++ b/src/icccm.c @@ -49,7 +49,7 @@ ICCCM_Init(void) Atom wm_props[1]; wm_props[0] = ECORE_X_ATOM_WM_DELETE_WINDOW; - XSetWMProtocols(disp, VRoot.xwin, wm_props, 1); + XSetWMProtocols(disp, WinGetXwin(VROOT), wm_props, 1); } } @@ -283,7 +283,7 @@ ICCCM_Configure(EWin * ewin) ev.xconfigure.y = ewin->client.y; #endif if (Mode.wm.window) - ETranslateCoordinates(VRoot.win, RROOT, + ETranslateCoordinates(VROOT, RROOT, ev.xconfigure.x, ev.xconfigure.y, &ev.xconfigure.x, &ev.xconfigure.y, &child); ev.xconfigure.width = ewin->client.w; @@ -376,7 +376,8 @@ ICCCM_Focus(const EWin * ewin) if (!ewin) { - XSetInputFocus(disp, VRoot.xwin, RevertToPointerRoot, Mode.events.time); + XSetInputFocus(disp, WinGetXwin(VROOT), RevertToPointerRoot, + Mode.events.time); HintsSetActiveWindow(None); return; } @@ -420,7 +421,7 @@ ICCCM_GetGeoms(EWin * ewin) dsk = DesksGetCurrent(); ewin->client.x -= EoGetX(dsk); ewin->client.y -= EoGetY(dsk); - if (ewin->client.x + ewin->client.w >= VRoot.w) + if (ewin->client.x + ewin->client.w >= WinGetW(VROOT)) { ewin->client.x += EoGetX(dsk); } @@ -428,7 +429,7 @@ ICCCM_GetGeoms(EWin * ewin) { ewin->client.x += EoGetX(dsk); } - if (ewin->client.y + ewin->client.h >= VRoot.h) + if (ewin->client.y + ewin->client.h >= WinGetH(VROOT)) { ewin->client.y += EoGetY(dsk); } @@ -775,7 +776,7 @@ ICCCM_SetIconSizes(void) is->max_height = 48; is->width_inc = 1; is->height_inc = 1; - XSetIconSizes(disp, VRoot.xwin, is, 1); + XSetIconSizes(disp, WinGetXwin(VROOT), is, 1); XFree(is); } diff --git a/src/iclass.c b/src/iclass.c index e205f144..218dd1c9 100644 --- a/src/iclass.c +++ b/src/iclass.c @@ -256,11 +256,11 @@ ImagestateColorsAlloc(ImageState * is) if (!is || is->got_colors) return; - EAllocColor(VRoot.cmap, &is->bg); - EAllocColor(VRoot.cmap, &is->hi); - EAllocColor(VRoot.cmap, &is->lo); - EAllocColor(VRoot.cmap, &is->hihi); - EAllocColor(VRoot.cmap, &is->lolo); + EAllocColor(WinGetCmap(VROOT), &is->bg); + EAllocColor(WinGetCmap(VROOT), &is->hi); + EAllocColor(WinGetCmap(VROOT), &is->lo); + EAllocColor(WinGetCmap(VROOT), &is->hihi); + EAllocColor(WinGetCmap(VROOT), &is->lolo); is->got_colors = 1; } @@ -850,8 +850,8 @@ pt_get_bg_image(Window win, int w, int h, int use_root) bg = DeskGetBackgroundPixmap(DesksGetCurrent()); if (use_root || bg == None) { - cr = VRoot.xwin; - bg = VRoot.xwin; + cr = WinGetXwin(VROOT); + bg = WinGetXwin(VROOT); } else { @@ -861,7 +861,7 @@ pt_get_bg_image(Window win, int w, int h, int use_root) #if 0 Eprintf("pt_get_bg_image %#lx %d %d %d %d\n", win, xx, yy, w, h); #endif - if (xx < VRoot.w && yy < VRoot.h && xx + w >= 0 && yy + h >= 0) + if (xx < WinGetW(VROOT) && yy < WinGetH(VROOT) && xx + w >= 0 && yy + h >= 0) { /* Create the background base image */ ii = EImageGrabDrawable(bg, None, xx, yy, w, h, !EServerIsGrabbed()); diff --git a/src/iconify.c b/src/iconify.c index 6a6e19ed..9afdfe1d 100644 --- a/src/iconify.c +++ b/src/iconify.c @@ -62,7 +62,7 @@ IB_Animate_A(char iconify, EWin * ewin, EWin * ibox) double a, aa, spd, t0; int x, y, x1, y1, x2, y2, x3, y3, x4, y4, w, h; int fx, fy, fw, fh, tx, ty, tw, th; - Window root = VRoot.xwin; + Window root = WinGetXwin(VROOT); GC gc; XGCValues gcv; @@ -158,7 +158,7 @@ IB_Animate_B(char iconify, EWin * ewin, EWin * ibox) double a, spd, t0; int x, y, w, h; int fx, fy, fw, fh, tx, ty, tw, th; - Window root = VRoot.xwin; + Window root = WinGetXwin(VROOT); GC gc; XGCValues gcv; @@ -390,7 +390,8 @@ SelectIconboxForEwin(EWin * ewin) dist = (dx * dx) + (dy * dy); if ((!EoIsSticky(ct->ewin)) && (EoGetDesk(ct->ewin) != EoGetDesk(ewin))) - dist += (VRoot.w * VRoot.w) + (VRoot.h * VRoot.h); + dist += (WinGetW(VROOT) * WinGetW(VROOT)) + + (WinGetH(VROOT) * WinGetH(VROOT)); if (dist < min_dist) { min_dist = dist; diff --git a/src/ipc.c b/src/ipc.c index 62bacbbb..17c81f3f 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -144,7 +144,8 @@ IPC_Screen(const char *params) } else if (!strncmp(param, "size", 2)) { - IpcPrintf("Screen %d size %dx%d\n", VRoot.scr, VRoot.w, VRoot.h); + IpcPrintf("Screen %d size %dx%d\n", VRoot.scr, + WinGetW(VROOT), WinGetH(VROOT)); } else if (!strcmp(param, "split")) { @@ -1213,7 +1214,7 @@ IPC_Warp(const char *params) else if (!strncmp(params, "abs", 3)) { sscanf(params, "%*s %i %i", &x, &y); - EXWarpPointer(VRoot.xwin, x, y); + EXWarpPointer(WinGetXwin(VROOT), x, y); } else if (!strncmp(params, "rel", 3)) { diff --git a/src/magwin.c b/src/magwin.c index f00a783c..a8c80848 100644 --- a/src/magwin.c +++ b/src/magwin.c @@ -114,23 +114,23 @@ MagwinRedraw(MagWindow * mw, int paint) mw->scale = 6; scale = pow(2., (double)(mw->scale)); sw = (int)((ww + .999 * scale) / scale); - if (sw > VRoot.w) - scale = (double)ww / (double)VRoot.w; + if (sw > WinGetW(VROOT)) + scale = (double)ww / (double)WinGetW(VROOT); sh = (int)((wh + .999 * scale) / scale); - if (sh > VRoot.h && scale < (double)wh / (double)VRoot.h) - scale = (double)wh / (double)VRoot.h; + if (sh > WinGetH(VROOT) && scale < (double)wh / (double)WinGetH(VROOT)) + scale = (double)wh / (double)WinGetH(VROOT); sw = (int)((ww + .999 * scale) / scale); sh = (int)((wh + .999 * scale) / scale); sx = mw->cx - sw / 2; sy = mw->cy - sh / 2; if (sx < 0) sx = 0; - else if (sx + sw > VRoot.w) - sx = VRoot.w - sw; + else if (sx + sw > WinGetW(VROOT)) + sx = WinGetW(VROOT) - sw; if (sy < 0) sy = 0; - else if (sy + sh > VRoot.h) - sy = VRoot.h - sh; + else if (sy + sh > WinGetH(VROOT)) + sy = WinGetH(VROOT) - sh; mw->sx = sx; mw->sy = sy; @@ -143,8 +143,8 @@ MagwinRedraw(MagWindow * mw, int paint) dw = (int)(sw * scale + .5); dh = (int)(sh * scale + .5); - draw = (VRoot.pmap != None) ? VRoot.pmap : VRoot.xwin; - ScaleRect(VRoot.win, draw, EwinGetClientWin(mw->ewin), + draw = (VRoot.pmap != None) ? VRoot.pmap : WinGetXwin(VROOT); + ScaleRect(VROOT, draw, EwinGetClientWin(mw->ewin), EwinGetClientXwin(mw->ewin), sx, sy, sw, sh, 0, 0, dw, dh, (mw->filter) ? EIMAGE_ANTI_ALIAS : 0); } @@ -166,10 +166,10 @@ MagwinRedraw(MagWindow * mw, int paint) /* Show info about pixel at cursor (if in magnifier) */ qx = (int)(px / scale); qy = (int)(py / scale); - if (qx > VRoot.w - 1) - qx = VRoot.w - 1; - if (qy > VRoot.h - 1) - qy = VRoot.h - 1; + if (qx > WinGetW(VROOT) - 1) + qx = WinGetW(VROOT) - 1; + if (qy > WinGetH(VROOT) - 1) + qy = WinGetH(VROOT) - 1; Esnprintf(buf, sizeof(buf), "%d,%d: pixel=%#08x", sx + qx, sy + qy, pixel); MagwinDrawText(mw, 10, 20, buf); } @@ -265,8 +265,8 @@ MagwinKeyPress(MagWindow * mw, KeySym key) break; case XK_Right: mw->cx += mw->step; - if (mw->cx > VRoot.w - mw->sw / 2) - mw->cx = VRoot.w - mw->sw / 2; + if (mw->cx > WinGetW(VROOT) - mw->sw / 2) + mw->cx = WinGetW(VROOT) - mw->sw / 2; break; case XK_Up: mw->cy -= mw->step; @@ -275,8 +275,8 @@ MagwinKeyPress(MagWindow * mw, KeySym key) break; case XK_Down: mw->cy += mw->step; - if (mw->cy > VRoot.h - mw->sh / 2) - mw->cy = VRoot.h - mw->sh / 2; + if (mw->cy > WinGetH(VROOT) - mw->sh / 2) + mw->cy = WinGetH(VROOT) - mw->sh / 2; break; case XK_r: /* Switch render mode */ @@ -402,13 +402,13 @@ MagwinCreate(const char *title, int width, int height) if (!mw) return NULL; - win = VRoot.win; + win = VROOT; w = width; h = height; x = ((win->w - w) / 2); y = ((win->h - h) / 2); - win = ECreateClientWindow(VRoot.win, x, y, w, h); + win = ECreateClientWindow(VROOT, x, y, w, h); mw->title = title; mw->ewin = AddInternalToFamily(win, NULL, EWIN_TYPE_MISC, &_MagEwinOps, mw); @@ -430,7 +430,7 @@ MagwinCreate(const char *title, int width, int height) EventCallbackRegister(win, 0, MagwinEvent, mw); - EQueryPointer(VRoot.win, &mw->cx, &mw->cy, NULL, NULL); + EQueryPointer(VROOT, &mw->cx, &mw->cy, NULL, NULL); mw->scale = 1; mw->step = 4; @@ -454,7 +454,8 @@ MagwinShow(void) if (MagWin) return; - MagWin = MagwinCreate(_("Magnifier"), VRoot.w / 4, VRoot.h / 4); + MagWin = MagwinCreate(_("Magnifier"), + WinGetW(VROOT) / 4, WinGetH(VROOT) / 4); if (!MagWin) { Eprintf("Failed to create magnifier window\n"); diff --git a/src/main.c b/src/main.c index e5e7486e..d4d9dcbc 100644 --- a/src/main.c +++ b/src/main.c @@ -202,7 +202,7 @@ main(int argc, char **argv) EDebugSet(EDBUG_TYPE_VERBOSE, 1); break; case 'w': - sscanf(eoptarg, "%dx%d", &VRoot.w, &VRoot.h); + sscanf(eoptarg, "%dx%d", &Mode.wm.win_w, &Mode.wm.win_h); Mode.wm.window = 1; Mode.wm.single = 1; Mode.wm.master = 0; @@ -266,7 +266,7 @@ main(int argc, char **argv) ModulesSignal(ESIGNAL_CONFIGURE, NULL); /* Set root window cursor */ - ECsrApply(ECSR_ROOT, VRoot.xwin); + ECsrApply(ECSR_ROOT, WinGetXwin(VROOT)); #ifdef USE_EXT_INIT_WIN /* Kill the E process owning the "init window" */ @@ -274,7 +274,7 @@ main(int argc, char **argv) #endif if (Mode.wm.window) - EMapWindow(VRoot.win); + EMapWindow(VROOT); /* let's make sure we set this up and go to our desk anyways */ DeskGoto(DesksGetCurrent()); @@ -325,7 +325,7 @@ EExit(int exitcode) /* XSetInputFocus(disp, None, RevertToParent, CurrentTime); */ /* I think this is a better way to release the grabs: (felix) */ XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime); - XSelectInput(disp, VRoot.xwin, 0); + XSelectInput(disp, WinGetXwin(VROOT), 0); EDisplayClose(); } diff --git a/src/menus.c b/src/menus.c index c7f48b0f..5ed4052e 100644 --- a/src/menus.c +++ b/src/menus.c @@ -169,7 +169,7 @@ MenuHide(Menu * m) if (ewin) { EUnmapWindow(m->win); - EReparentWindow(m->win, VRoot.win, ewin->client.x, ewin->client.y); + EReparentWindow(m->win, VROOT, ewin->client.x, ewin->client.y); EwinHide(ewin); } m->ewin = NULL; @@ -701,7 +701,7 @@ MenuRealize(Menu * m) if (!m->win) { - m->win = ECreateClientWindow(VRoot.win, 0, 0, 1, 1); + m->win = ECreateClientWindow(VROOT, 0, 0, 1, 1); EventCallbackRegister(m->win, 0, MenuHandleEvents, m); } @@ -808,7 +808,7 @@ MenuRealize(Menu * m) mmw = 0; mmh = 0; - nmaxy = 3 * VRoot.h / (4 * maxh + 1); + nmaxy = 3 * WinGetH(VROOT) / (4 * maxh + 1); if (m->style->maxy && nmaxy > m->style->maxy) nmaxy = m->style->maxy; @@ -1009,8 +1009,9 @@ MenuShowMasker(Menu * m __UNUSED__) if (!eo) { - eo = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, 0, VRoot.w, VRoot.h, 0, - "Masker"); + eo = EobjWindowCreate(EOBJ_TYPE_EVENT, + 0, 0, WinGetW(VROOT), WinGetH(VROOT), + 0, "Masker"); if (!eo) return; @@ -1354,7 +1355,7 @@ MenusHandleMotion(void) xdist = x_org + menu_scroll_dist - (Mode.events.mx); } - if (Mode.events.my > (VRoot.h - (menu_scroll_dist + 1))) + if (Mode.events.my > (WinGetH(VROOT) - (menu_scroll_dist + 1))) { ydist = -(menu_scroll_dist + (Mode.events.my - (y_org + my_height))); diff --git a/src/moveresize.c b/src/moveresize.c index 97058117..2e1b4a37 100644 --- a/src/moveresize.c +++ b/src/moveresize.c @@ -574,7 +574,8 @@ ActionMoveHandleMotion(void) ndy = min_dy; screen_snap_dist = - Mode.constrained ? (VRoot.w + VRoot.h) : Conf.snap.screen_snap_dist; + Mode.constrained ? (WinGetW(VROOT) + + WinGetH(VROOT)) : Conf.snap.screen_snap_dist; for (i = 0; i < num; i++) { @@ -587,10 +588,10 @@ ActionMoveHandleMotion(void) if ((ndx != dx) && (((ewin1->shape_x == 0) && (dd > screen_snap_dist)) || - ((ewin1->shape_x == (VRoot.w - EoGetW(ewin1))) && + ((ewin1->shape_x == (WinGetW(VROOT) - EoGetW(ewin1))) && (dd > screen_snap_dist)) || ((ewin1->shape_x != 0) && - (ewin1->shape_x != (VRoot.w - EoGetW(ewin1)) && + (ewin1->shape_x != (WinGetW(VROOT) - EoGetW(ewin1)) && (dd > Conf.snap.edge_snap_dist))))) { jumpx = 1; @@ -604,10 +605,10 @@ ActionMoveHandleMotion(void) if ((ndy != dy) && (((ewin1->shape_y == 0) && (dd > screen_snap_dist)) || - ((ewin1->shape_y == (VRoot.h - EoGetH(ewin1))) && + ((ewin1->shape_y == (WinGetH(VROOT) - EoGetH(ewin1))) && (dd > screen_snap_dist)) || ((ewin1->shape_y != 0) && - (ewin1->shape_y != (VRoot.h - EoGetH(ewin1)) && + (ewin1->shape_y != (WinGetH(VROOT) - EoGetH(ewin1)) && (dd > Conf.snap.edge_snap_dist))))) { jumpy = 1; diff --git a/src/mwm.c b/src/mwm.c index e7115fb9..60a4d125 100644 --- a/src/mwm.c +++ b/src/mwm.c @@ -185,7 +185,7 @@ MWM_SetInfo(void) a1 = XInternAtom(disp, "_MOTIF_WM_INFO", False); mwminfo.flags = 2; - mwminfo.win = VRoot.xwin; - XChangeProperty(disp, VRoot.xwin, a1, a1, 32, PropModeReplace, + mwminfo.win = WinGetXwin(VROOT); + XChangeProperty(disp, WinGetXwin(VROOT), a1, a1, 32, PropModeReplace, (unsigned char *)&mwminfo, 2); } diff --git a/src/pager.c b/src/pager.c index 9a7f7a2e..13f01eeb 100644 --- a/src/pager.c +++ b/src/pager.c @@ -144,7 +144,7 @@ PagerCreate(void) ecore_list_append(pager_list, p); p->name = NULL; - p->win = ECreateClientWindow(VRoot.win, 0, 0, 1, 1); + p->win = ECreateClientWindow(VROOT, 0, 0, 1, 1); EventCallbackRegister(p->win, 0, PagerEvent, p); p->sel_win = ECreateWindow(p->win, 0, 0, 1, 1, 0); @@ -234,18 +234,18 @@ PagerScanTimeout(int val __UNUSED__, void *data) /* Due to a bug in imlib2 <= 1.2.0 we have to scan left->right in stead * of top->bottom, at least for now. */ y = ((phase & 0xfffffff8) + offsets[phase % 8]) % hh; - y2 = (y * VRoot.h) / hh; + y2 = (y * WinGetH(VROOT)) / hh; - ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), 0, y2, - VRoot.w, VRoot.h / hh, xx, yy + y, ww, 1, HIQ); + ScaleRect(VROOT, WinGetXwin(VROOT), p->win, WinGetPmap(p->win), 0, + y2, WinGetW(VROOT), WinGetH(VROOT) / hh, xx, yy + y, ww, 1, HIQ); EClearArea(p->win, xx, yy + y, ww, 1, False); y2 = p->h; #else y = ((phase & 0xfffffff8) + offsets[phase % 8]) % ww; - y2 = (y * VRoot.w) / ww; + y2 = (y * WinGetW(VROOT)) / ww; - ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), y2, 0, - VRoot.w / ww, VRoot.h, xx + y, yy, 1, hh, HIQ); + ScaleRect(VROOT, WinGetXwin(VROOT), p->win, WinGetPmap(p->win), y2, + 0, WinGetW(VROOT) / ww, WinGetH(VROOT), xx + y, yy, 1, hh, HIQ); EClearArea(p->win, xx + y, yy, 1, hh, False); y2 = p->w; #endif @@ -280,8 +280,8 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin) Drawable draw; int pager_mode = PagersGetMode(); - w = (EoGetW(ewin) * p->dw) / VRoot.w; - h = (EoGetH(ewin) * p->dh) / VRoot.h; + w = (EoGetW(ewin) * p->dw) / WinGetW(VROOT); + h = (EoGetH(ewin) * p->dh) / WinGetH(VROOT); if (w < 1) w = 1; @@ -362,8 +362,8 @@ doPagerUpdate(Pager * p) p->update_phase = 0; DesksGetAreaSize(&ax, &ay); DeskGetArea(p->dsk, &cx, &cy); - vx = cx * VRoot.w; - vy = cy * VRoot.h; + vx = cx * WinGetW(VROOT); + vy = cy * WinGetH(VROOT); update_screen_included = update_screen_only = 0; if (pager_mode == PAGER_MODE_SNAP && p->dsk == DesksGetCurrent() @@ -371,12 +371,12 @@ doPagerUpdate(Pager * p) { /* Update from screen unless update area is entirely off-screen */ if (!(p->x2 <= vx || p->y2 <= vy || - p->x1 >= vx + VRoot.w || p->y1 >= vy + VRoot.h)) + p->x1 >= vx + WinGetW(VROOT) || p->y1 >= vy + WinGetH(VROOT))) update_screen_included = 1; /* Check if update area is entirely on-screen */ if (p->x1 >= vx && p->y1 >= vy && - p->x2 <= vx + VRoot.w && p->y2 <= vy + VRoot.h) + p->x2 <= vx + WinGetW(VROOT) && p->y2 <= vy + WinGetH(VROOT)) update_screen_only = 1; } p->x1 = p->y1 = 99999; @@ -433,10 +433,10 @@ doPagerUpdate(Pager * p) if (!EoIsShown(ewin)) continue; - wx = (EwinGetVX(ewin) * p->dw) / VRoot.w; - wy = (EwinGetVY(ewin) * p->dh) / VRoot.h; - ww = (EoGetW(ewin) * p->dw) / VRoot.w; - wh = (EoGetH(ewin) * p->dh) / VRoot.h; + wx = (EwinGetVX(ewin) * p->dw) / WinGetW(VROOT); + wy = (EwinGetVY(ewin) * p->dh) / WinGetH(VROOT); + ww = (EoGetW(ewin) * p->dw) / WinGetW(VROOT); + wh = (EoGetH(ewin) * p->dh) / WinGetH(VROOT); if (ewin->mini_pmm.pmap) { @@ -468,8 +468,9 @@ doPagerUpdate(Pager * p) do_screen_update: Dprintf("doPagerUpdate %d: Snap screen\n", p->dsk->num); /* Update pager area by snapshotting entire screen */ - ScaleRect(VRoot.win, VRoot.xwin, p->win, pmap, 0, 0, - VRoot.w, VRoot.h, cx * p->dw, cy * p->dh, p->dw, p->dh, HIQ); + ScaleRect(VROOT, WinGetXwin(VROOT), p->win, pmap, 0, 0, + WinGetW(VROOT), WinGetH(VROOT), cx * p->dw, cy * p->dh, + p->dw, p->dh, HIQ); EClearWindow(p->win); @@ -508,7 +509,7 @@ PagerReconfigure(Pager * p, int apply) DesksGetAreaSize(&ax, &ay); - aspect = ((double)VRoot.w) / ((double)VRoot.h); + aspect = ((double)WinGetW(VROOT)) / ((double)WinGetH(VROOT)); dx = 2; for (;;) @@ -526,16 +527,17 @@ PagerReconfigure(Pager * p, int apply) } ICCCM_SetSizeConstraints(p->ewin, - VRoot.w / 64 * ax, VRoot.h / 64 * ay, - VRoot.w / 4 * ax, VRoot.h / 4 * ay, - 0, 0, dx * ax, dy * ay, + WinGetW(VROOT) / 64 * ax, + WinGetH(VROOT) / 64 * ay, + WinGetW(VROOT) / 4 * ax, + WinGetH(VROOT) / 4 * ay, 0, 0, dx * ax, dy * ay, aspect * ((double)ax / (double)ay), aspect * ((double)ax / (double)ay)); if (apply) { - w = (int)((double)ax * (double)VRoot.w / (double)p->scale + .5); - h = (int)((double)ay * (double)VRoot.h / (double)p->scale + .5); + w = (int)((double)ax * (double)WinGetW(VROOT) / (double)p->scale + .5); + h = (int)((double)ay * (double)WinGetH(VROOT) / (double)p->scale + .5); EwinResize(p->ewin, w + (dx * ax) / 2, h + (dy * ay) / 2); EwinReposition(p->ewin); } @@ -592,7 +594,7 @@ PagerUpdateBg(Pager * p) if (pager_mode != PAGER_MODE_SIMPLE && p->dsk->bg.pmap) { - ScaleTile(VRoot.win, p->dsk->bg.pmap, p->win, pmap, + ScaleTile(VROOT, p->dsk->bg.pmap, p->win, pmap, 0, 0, p->dw, p->dh, HIQ); return; } @@ -662,7 +664,8 @@ _PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__) p->dh = h / ay; if (p->scale <= 0. || Mode.op_source == OPSRC_USER) - p->scale = ((float)VRoot.w / p->dw + (float)VRoot.h / p->dh) / 2; + p->scale = ((float)WinGetW(VROOT) / p->dw + + (float)WinGetH(VROOT) / p->dh) / 2; p->do_newbg = 1; PagerCheckUpdate(p, NULL); @@ -712,8 +715,8 @@ PagerShow(Pager * p) if (!ewin) return; - p->screen_w = VRoot.w; - p->screen_h = VRoot.h; + p->screen_w = WinGetW(VROOT); + p->screen_h = WinGetH(VROOT); PagerReconfigure(p, 0); @@ -736,11 +739,11 @@ PagerShow(Pager * p) int ax, ay; DesksGetAreaSize(&ax, &ay); - w = ((48 * VRoot.w) / VRoot.h) * ax; + w = ((48 * WinGetW(VROOT)) / WinGetH(VROOT)) * ax; h = 48 * ay; EwinResize(ewin, w, h); /* Does layout */ - EwinMove(ewin, 0, - VRoot.h - (DesksGetNumber() - p->dsk->num) * EoGetH(ewin)); + EwinMove(ewin, 0, WinGetH(VROOT) - + (DesksGetNumber() - p->dsk->num) * EoGetH(ewin)); } EwinShow(ewin); @@ -874,10 +877,10 @@ PagerEwinUpdateFromPager(Pager * p, EWin * ewin) y = EwinGetVY(ewin); w = EoGetW(ewin); h = EoGetH(ewin); - x = (x * p->dw) / VRoot.w; - y = (y * p->dh) / VRoot.h; - w = (w * p->dw) / VRoot.w; - h = (h * p->dh) / VRoot.h; + x = (x * p->dw) / WinGetW(VROOT); + y = (y * p->dh) / WinGetH(VROOT); + w = (w * p->dw) / WinGetW(VROOT); + h = (h * p->dh) / WinGetH(VROOT); if (w <= 0) w = 1; if (h <= 0) @@ -973,10 +976,10 @@ EwinInPagerAt(Pager * p, int px, int py) if (!EoIsShown(ewin)) continue; - x = (EwinGetVX(ewin) * p->dw) / VRoot.w; - y = (EwinGetVY(ewin) * p->dh) / VRoot.h; - w = (EoGetW(ewin) * p->dw) / VRoot.w; - h = (EoGetH(ewin) * p->dh) / VRoot.h; + x = (EwinGetVX(ewin) * p->dw) / WinGetW(VROOT); + y = (EwinGetVY(ewin) * p->dh) / WinGetH(VROOT); + w = (EoGetW(ewin) * p->dw) / WinGetW(VROOT); + h = (EoGetH(ewin) * p->dh) / WinGetH(VROOT); if (px >= x && py >= y && px < (x + w) && py < (y + h)) return ewin; @@ -1132,11 +1135,11 @@ PagerHiwinInit(Pager * p, EWin * ewin) hiwin = phi; } - wx = (EwinGetVX(ewin) * p->dw) / VRoot.w; - wy = (EwinGetVY(ewin) * p->dh) / VRoot.h; - ww = (EoGetW(ewin) * p->dw) / VRoot.w; - wh = (EoGetH(ewin) * p->dh) / VRoot.h; - ETranslateCoordinates(p->win, VRoot.win, 0, 0, &px, &py, NULL); + wx = (EwinGetVX(ewin) * p->dw) / WinGetW(VROOT); + wy = (EwinGetVY(ewin) * p->dh) / WinGetH(VROOT); + ww = (EoGetW(ewin) * p->dw) / WinGetW(VROOT); + wh = (EoGetH(ewin) * p->dh) / WinGetH(VROOT); + ETranslateCoordinates(p->win, VROOT, 0, 0, &px, &py, NULL); HiwinInit(phi, ewin); HiwinSetGeom(phi, px + wx, py + wy, ww, wh); @@ -1402,10 +1405,10 @@ PagerEwinMove(Pager * p __UNUSED__, Pager * pd, EWin * ewin) HiwinMove(phi, x + dx, y + dy); /* Find real window position */ - ETranslateCoordinates(VRoot.win, pd->win, x, y, &px, &py, NULL); + ETranslateCoordinates(VROOT, pd->win, x, y, &px, &py, NULL); DeskGetArea(pd->dsk, &cx, &cy); - x = (px * VRoot.w) / pd->dw - cx * VRoot.w; - y = (py * VRoot.h) / pd->dh - cy * VRoot.h; + x = (px * WinGetW(VROOT)) / pd->dw - cx * WinGetW(VROOT); + y = (py * WinGetH(VROOT)) / pd->dh - cy * WinGetH(VROOT); /* Move all group members */ EwinGroupMove(ewin, pd->dsk, x, y); @@ -1499,8 +1502,8 @@ PagerHiwinHandleMouseUp(Pager * p, int px, int py, int button) if (!ewin) goto done; - in_vroot = (Mode.events.cx >= 0 && Mode.events.cx < VRoot.w && - Mode.events.cy >= 0 && Mode.events.cy < VRoot.h); + in_vroot = (Mode.events.cx >= 0 && Mode.events.cx < WinGetW(VROOT) && + Mode.events.cy >= 0 && Mode.events.cy < WinGetH(VROOT)); if (button == Conf_pagers.win_button) { diff --git a/src/piximg.c b/src/piximg.c index 59908cd3..ad94daec 100644 --- a/src/piximg.c +++ b/src/piximg.c @@ -64,7 +64,8 @@ ECreatePixImg(Window win, int w, int h) pi->shminfo = EMALLOC(XShmSegmentInfo, 1); if (pi->shminfo) { - pi->xim = XShmCreateImage(disp, VRoot.vis, VRoot.depth, ZPixmap, NULL, + pi->xim = XShmCreateImage(disp, WinGetVisual(VROOT), + WinGetDepth(VROOT), ZPixmap, NULL, pi->shminfo, w, h); if (pi->xim) { @@ -85,7 +86,8 @@ ECreatePixImg(Window win, int w, int h) { pi->pmap = XShmCreatePixmap(disp, win, pi->shminfo->shmaddr, - pi->shminfo, w, h, VRoot.depth); + pi->shminfo, w, h, + WinGetDepth(VROOT)); if (pi->pmap) { gcv.subwindow_mode = IncludeInferiors; @@ -130,7 +132,7 @@ void EBlendRemoveShape(Win win, Pixmap pmap, int x, int y) { static GC gc = 0; - Window root = VRoot.xwin; + Window root = WinGetXwin(VROOT); int w, h; if (!win) @@ -181,7 +183,7 @@ EBlendPixImg(Win win, PixImg * s1, PixImg * s2, PixImg * dst, int x, int y, int w, int h) { static GC gc = 0; - Window root = VRoot.xwin; + Window root = WinGetXwin(VROOT); int i, j, ox, oy; if (!win) @@ -207,18 +209,18 @@ EBlendPixImg(Win win, PixImg * s1, PixImg * s2, PixImg * dst, int x, int y, ox = 0; oy = 0; - if ((x >= VRoot.w) || (y >= VRoot.h)) + if ((x >= WinGetW(VROOT)) || (y >= WinGetH(VROOT))) return; - if (x + w > VRoot.w) - w -= ((x + w) - VRoot.w); + if (x + w > WinGetW(VROOT)) + w -= ((x + w) - WinGetW(VROOT)); if (x < 0) { ox = -x; w -= ox; x = 0; } - if (y + h > VRoot.h) - h -= ((y + h) - VRoot.h); + if (y + h > WinGetH(VROOT)) + h -= ((y + h) - WinGetH(VROOT)); if (y < 0) { oy = -y; diff --git a/src/progress.c b/src/progress.c index bd7f05c4..db73c0b7 100644 --- a/src/progress.c +++ b/src/progress.c @@ -65,7 +65,7 @@ ProgressbarCreate(const char *name, int w, int h) p->h = h; p->value = 0; - x = (VRoot.w - w) / 2; + x = (WinGetW(VROOT) - w) / 2; y = 32 + (pnum * h * 2); p->win = EobjWindowCreate(EOBJ_TYPE_MISC, x, y, w - (h * 5), h, 1, name); diff --git a/src/screen.c b/src/screen.c index 335cfeb5..a4ee0cd0 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2003-2007 Kim Woelders + * Copyright (C) 2003-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -97,8 +97,9 @@ ScreenSplit(unsigned int nx, unsigned int ny) for (i = 0; i < nx; i++) for (j = 0; j < ny; j++) - ScreenAdd(1, VRoot.scr, i * VRoot.w / nx, j * VRoot.h / ny, - VRoot.w / nx, VRoot.h / ny); + ScreenAdd(1, VRoot.scr, + i * WinGetW(VROOT) / nx, j * WinGetH(VROOT) / ny, + WinGetW(VROOT) / nx, WinGetH(VROOT) / ny); } void @@ -144,7 +145,7 @@ ScreenShowInfo(const char *prm __UNUSED__) else { IpcPrintf(" %2d %2d %5d %5d %5d %5d\n", - 0, VRoot.scr, 0, 0, VRoot.w, VRoot.h); + 0, VRoot.scr, 0, 0, WinGetW(VROOT), WinGetH(VROOT)); } } @@ -166,8 +167,8 @@ ScreenGetGeometryByHead(int head, int *px, int *py, int *pw, int *ph) { x = 0; y = 0; - w = VRoot.w; - h = VRoot.h; + w = WinGetW(VROOT); + h = WinGetH(VROOT); } *px = x; @@ -237,8 +238,8 @@ VRootGetAvailableArea(int *px, int *py, int *pw, int *ph) *px = l; *py = t; - *pw = VRoot.w - (l + r); - *ph = VRoot.h - (t + b); + *pw = WinGetW(VROOT) - (l + r); + *ph = WinGetH(VROOT) - (t + b); } int diff --git a/src/session.c b/src/session.c index 146a4fc6..8c4b24a6 100644 --- a/src/session.c +++ b/src/session.c @@ -514,7 +514,7 @@ doSMExit(int mode, const char *params) { /* We may get here from HandleXIOError */ EwinsSetFree(); - XSelectInput(disp, VRoot.xwin, 0); + XSelectInput(disp, WinGetXwin(VROOT), 0); ExtInitWinKill(); ESync(0); @@ -553,7 +553,8 @@ doSMExit(int mode, const char *params) l += Esnprintf(s + l, sizeof(s) - l, " -m %d", Mode.wm.master_screen); if (Mode.wm.window) - l += Esnprintf(s + l, sizeof(s) - l, " -w %dx%d", VRoot.w, VRoot.h); + l += Esnprintf(s + l, sizeof(s) - l, " -w %dx%d", + WinGetW(VROOT), WinGetH(VROOT)); #if USE_SM if (sm_client_id) l += Esnprintf(s + l, sizeof(s) - l, " -S %s", sm_client_id); diff --git a/src/setup.c b/src/setup.c index b04182af..a71f90b4 100644 --- a/src/setup.c +++ b/src/setup.c @@ -121,26 +121,18 @@ SetupX(const char *dstr) /* Root defaults */ RROOT = ERegisterWindow(DefaultRootWindow(disp), NULL); - VRoot.xwin = WinGetXwin(RROOT); - VRoot.vis = WinGetVisual(RROOT); - VRoot.depth = WinGetDepth(RROOT); - VRoot.cmap = WinGetCmap(RROOT); - if (Mode.wm.window) { - VRoot.win = ECreateWindow(RROOT, 0, 0, VRoot.w, VRoot.h, 0); - VRoot.xwin = WinGetXwin(VRoot.win); + VROOT = ECreateWindow(RROOT, 0, 0, Mode.wm.win_w, Mode.wm.win_h, 0); /* Enable eesh and edox to pix up the virtual root */ - Esnprintf(buf, sizeof(buf), "%#lx", VRoot.xwin); + Esnprintf(buf, sizeof(buf), "%#lx", WinGetXwin(VROOT)); Esetenv("ENL_WM_ROOT", buf); } else { /* Running E normally on the root window */ - VRoot.win = RROOT; - VRoot.w = WinGetW(RROOT); - VRoot.h = WinGetH(RROOT); + VROOT = RROOT; } /* Initialise event handling */ @@ -150,7 +142,7 @@ SetupX(const char *dstr) Mode.events.last_error_code = 0; mask = StructureNotifyMask | SubstructureNotifyMask | SubstructureRedirectMask; - ESelectInput(VRoot.win, mask); + ESelectInput(VROOT, mask); ESync(0); if (Mode.events.last_error_code) { diff --git a/src/size.c b/src/size.c index 026dad47..8b6abba5 100644 --- a/src/size.c +++ b/src/size.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2003-2007 Kim Woelders + * Copyright (C) 2003-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -86,13 +86,13 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction) if (direction & MAX_HOR) { x = 0; - w = VRoot.w; + w = WinGetW(VROOT); ewin->state.maximized_horz = 1; } if (direction & MAX_VER) { y = 0; - h = VRoot.h; + h = WinGetH(VROOT); ewin->state.maximized_vert = 1; } break; diff --git a/src/slideout.c b/src/slideout.c index 0f742dd6..c8f08840 100644 --- a/src/slideout.c +++ b/src/slideout.c @@ -96,7 +96,7 @@ SlideoutShow(Slideout * s, EWin * ewin, Win win) SlideoutCalcSize(s); EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL); - ETranslateCoordinates(win, VRoot.win, 0, 0, &x, &y, NULL); + ETranslateCoordinates(win, VROOT, 0, 0, &x, &y, NULL); sw = EoGetW(s); sh = EoGetH(s); @@ -107,7 +107,7 @@ SlideoutShow(Slideout * s, EWin * ewin, Win win) case 2: xx = x + ((w - sw) >> 1); yy = y - sh; - if ((yy < 0) && (sh < VRoot.h)) + if ((yy < 0) && (sh < WinGetH(VROOT))) { pdir = s->direction; s->direction = 1; @@ -119,7 +119,7 @@ SlideoutShow(Slideout * s, EWin * ewin, Win win) case 3: xx = x + ((w - sw) >> 1); yy = y + h; - if (((yy + sh) > VRoot.h) && (sh < VRoot.h)) + if (((yy + sh) > WinGetH(VROOT)) && (sh < WinGetH(VROOT))) { pdir = s->direction; s->direction = 0; @@ -131,7 +131,7 @@ SlideoutShow(Slideout * s, EWin * ewin, Win win) case 0: xx = x - sw; yy = y + ((h - sh) >> 1); - if ((xx < 0) && (sw < VRoot.w)) + if ((xx < 0) && (sw < WinGetW(VROOT))) { pdir = s->direction; s->direction = 1; @@ -143,7 +143,7 @@ SlideoutShow(Slideout * s, EWin * ewin, Win win) case 1: xx = x + w; yy = y + ((h - sh) >> 1); - if (((xx + sw) > VRoot.w) && (sw < VRoot.w)) + if (((xx + sw) > WinGetW(VROOT)) && (sw < WinGetW(VROOT))) { pdir = s->direction; s->direction = 0; diff --git a/src/snaps.c b/src/snaps.c index d7006acb..b1b3c22f 100644 --- a/src/snaps.c +++ b/src/snaps.c @@ -336,8 +336,8 @@ SnapEwinLocation(Snapshot * sn, const EWin * ewin) if (!EoIsSticky(ewin)) { DeskGetArea(EoGetDesk(ewin), &ax, &ay); - sn->x += ((ax - sn->area_x) * VRoot.w); - sn->y += ((ay - sn->area_y) * VRoot.h); + sn->x += ((ax - sn->area_x) * WinGetW(VROOT)); + sn->y += ((ay - sn->area_y) * WinGetH(VROOT)); } } @@ -1123,7 +1123,7 @@ Real_SaveSnapInfo(int dumval __UNUSED__, void *dumdat __UNUSED__) if (sn->use_flags & SNAP_USE_DESK) fprintf(f, "DESKTOP: %i\n", sn->desktop); if (sn->use_flags & SNAP_USE_POS) - fprintf(f, "RES: %i %i\n", VRoot.w, VRoot.h); + fprintf(f, "RES: %i %i\n", WinGetW(VROOT), WinGetH(VROOT)); if (sn->use_flags & SNAP_USE_SIZE) fprintf(f, "WH: %i %i\n", sn->w, sn->h); if (sn->use_flags & SNAP_USE_POS) @@ -1199,8 +1199,8 @@ LoadSnapInfo(void) if (!f) return; - res_w = VRoot.w; - res_h = VRoot.h; + res_w = WinGetW(VROOT); + res_h = WinGetH(VROOT); while (fgets(buf, sizeof(buf), f)) { s = strchr(buf, ':'); @@ -1212,8 +1212,8 @@ LoadSnapInfo(void) continue; if (!strcmp(buf, "NEW")) { - res_w = VRoot.w; - res_h = VRoot.h; + res_w = WinGetW(VROOT); + res_h = WinGetH(VROOT); sn = SnapshotCreate(s); } else if (sn) @@ -1288,7 +1288,7 @@ LoadSnapInfo(void) sn->x = a; sn->y = b; /* we changed reses since we last used this snapshot file */ - if (res_w != VRoot.w) + if (res_w != WinGetW(VROOT)) { if (sn->use_flags & SNAP_USE_SIZE) { @@ -1296,15 +1296,16 @@ LoadSnapInfo(void) sn->x = 0; else sn->x = - (sn->x * (VRoot.w - sn->w)) / (res_w - sn->w); + (sn->x * (WinGetW(VROOT) - sn->w)) / + (res_w - sn->w); } else { - if (sn->x >= VRoot.w) - sn->x = VRoot.w - 32; + if (sn->x >= WinGetW(VROOT)) + sn->x = WinGetW(VROOT) - 32; } } - if (res_h != VRoot.h) + if (res_h != WinGetH(VROOT)) { if (sn->use_flags & SNAP_USE_SIZE) { @@ -1312,12 +1313,13 @@ LoadSnapInfo(void) sn->y = 0; else sn->y = - (sn->y * (VRoot.h - sn->h)) / (res_h - sn->h); + (sn->y * (WinGetH(VROOT) - sn->h)) / + (res_h - sn->h); } else { - if (sn->y >= VRoot.h) - sn->y = VRoot.h - 32; + if (sn->y >= WinGetH(VROOT)) + sn->y = WinGetH(VROOT) - 32; } } sn->area_x = c; @@ -1445,8 +1447,8 @@ SnapshotEwinApply(EWin * ewin) if (!EoIsSticky(ewin)) { DeskGetArea(EoGetDesk(ewin), &ax, &ay); - ewin->client.x += ((sn->area_x - ax) * VRoot.w); - ewin->client.y += ((sn->area_y - ay) * VRoot.h); + ewin->client.x += ((sn->area_x - ax) * WinGetW(VROOT)); + ewin->client.y += ((sn->area_y - ay) * WinGetH(VROOT)); } EMoveResizeWindow(EwinGetClientWin(ewin), ewin->client.x, ewin->client.y, ewin->client.w, ewin->client.h); diff --git a/src/startup.c b/src/startup.c index f4b8d7a9..6c1d73ef 100644 --- a/src/startup.c +++ b/src/startup.c @@ -57,38 +57,40 @@ StartupWindowsCreate(void) if (bg_sideways) { - x = VRoot.w / 2; + x = WinGetW(VROOT) / 2; y = 0; - bx = VRoot.w - Conf.desks.dragbar_width; + bx = WinGetW(VROOT) - Conf.desks.dragbar_width; by = 0; bw = Conf.desks.dragbar_width; - bh = VRoot.h; + bh = WinGetH(VROOT); } else { x = 0; - y = VRoot.h / 2; + y = WinGetH(VROOT) / 2; bx = 0; - by = VRoot.h - Conf.desks.dragbar_width; - bw = VRoot.w; + by = WinGetH(VROOT) - Conf.desks.dragbar_width; + bw = WinGetW(VROOT); bh = Conf.desks.dragbar_width; } - eo = EobjWindowCreate(EOBJ_TYPE_MISC, -x, -y, VRoot.w, VRoot.h, 1, "Init-1"); + eo = EobjWindowCreate(EOBJ_TYPE_MISC, + -x, -y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-1"); if (!eo) return; init_win1 = eo; w1 = eo->win; eo->fade = eo->shadow = 0; - win1 = ECreateWindow(w1, x, y, VRoot.w, VRoot.h, 0); + win1 = ECreateWindow(w1, x, y, WinGetW(VROOT), WinGetH(VROOT), 0); - eo = EobjWindowCreate(EOBJ_TYPE_MISC, x, y, VRoot.w, VRoot.h, 1, "Init-2"); + eo = EobjWindowCreate(EOBJ_TYPE_MISC, + x, y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-2"); if (!eo) return; init_win2 = eo; w2 = eo->win; eo->fade = eo->shadow = 0; - win2 = ECreateWindow(w2, -x, -y, VRoot.w, VRoot.h, 0); + win2 = ECreateWindow(w2, -x, -y, WinGetW(VROOT), WinGetH(VROOT), 0); EMapWindow(win1); EMapWindow(win2); @@ -104,8 +106,8 @@ StartupWindowsCreate(void) ImageclassApply(ic, b2, 0, 0, 0, ST_SOLID); } - BackgroundSet(bg, win1, VRoot.w, VRoot.h); - BackgroundSet(bg, win2, VRoot.w, VRoot.h); + BackgroundSet(bg, win1, WinGetW(VROOT), WinGetH(VROOT)); + BackgroundSet(bg, win2, WinGetW(VROOT), WinGetH(VROOT)); BackgroundDestroyByName("STARTUP_BACKGROUND_SIDEWAYS"); BackgroundDestroyByName("STARTUP_BACKGROUND"); @@ -125,7 +127,7 @@ doStartupWindowsOpen(void *data __UNUSED__) if (bg_sideways) { /* so we can have two different slide methods */ - ty = (VRoot.w / 2); + ty = (WinGetW(VROOT) / 2); xOffset = (ty * k) >> 10; x = ty; yOffset = 0; @@ -133,7 +135,7 @@ doStartupWindowsOpen(void *data __UNUSED__) } else { - ty = (VRoot.h / 2); + ty = (WinGetH(VROOT) / 2); xOffset = 0; x = 0; yOffset = (ty * k) >> 10; diff --git a/src/systray.c b/src/systray.c index 323a3bb6..8653de1c 100644 --- a/src/systray.c +++ b/src/systray.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Kim Woelders + * Copyright (C) 2004-2008 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -141,7 +141,7 @@ SystrayObjUnmanage(Container * ct __UNUSED__, Win win, int gone) { ESelectInput(win, NoEventMask); EUnmapWindow(win); - EReparentWindow(win, VRoot.win, 0, 0); + EReparentWindow(win, VROOT, 0, 0); XRemoveFromSaveSet(disp, WinGetXwin(win)); } EventCallbackUnregister(win, 0, SystrayItemEvent, ct); diff --git a/src/tooltips.c b/src/tooltips.c index 8a4105b0..7a320a39 100644 --- a/src/tooltips.c +++ b/src/tooltips.c @@ -437,8 +437,8 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y) else EUnmapWindow(tt->iwin); - dx = x - VRoot.w / 2; - dy = y - VRoot.h / 2; + dx = x - WinGetW(VROOT) / 2; + dy = y - WinGetH(VROOT) / 2; if ((dy == 0) && (dx == 0)) dy = -1; @@ -470,38 +470,38 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y) if (tt->win[0]) { yy = y - ((ady * 10 * dist) / 100); - xx = x - (dist * 10 * dx) / (100 * VRoot.w / 2); + xx = x - (dist * 10 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[0], xx - 4, yy - 4); } if (tt->win[1]) { yy = y - ((ady * 30 * dist) / 100); - xx = x - (dist * 30 * dx) / (100 * VRoot.w / 2); + xx = x - (dist * 30 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[1], xx - 8, yy - 8); } if (tt->win[2]) { yy = y - ((ady * 50 * dist) / 100); - xx = x - (dist * 50 * dx) / (100 * VRoot.w / 2); + xx = x - (dist * 50 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[2], xx - 12, yy - 12); } if (tt->win[3]) { yy = y - ((ady * 80 * dist) / 100); - xx = x - (dist * 80 * dx) / (100 * VRoot.w / 2); + xx = x - (dist * 80 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[3], xx - 16, yy - 16); } yy = y - ((ady * 100 * dist) / 100); - xx = x - (dist * 100 * dx) / (100 * VRoot.w / 2); + xx = x - (dist * 100 * dx) / (100 * WinGetW(VROOT) / 2); if (ady < 0) hh = 0; else hh = h; - ww = (w / 2) + ((dx * w) / (VRoot.w / 2)); + ww = (w / 2) + ((dx * w) / (WinGetW(VROOT) / 2)); } else /* +-------+ */ @@ -524,38 +524,38 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y) if (tt->win[0]) { xx = x - ((adx * 10 * dist) / 100); - yy = y - (dist * 10 * dy) / (100 * VRoot.h / 2); + yy = y - (dist * 10 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[0], xx - 4, yy - 4); } if (tt->win[1]) { xx = x - ((adx * 30 * dist) / 100); - yy = y - (dist * 30 * dy) / (100 * VRoot.h / 2); + yy = y - (dist * 30 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[1], xx - 8, yy - 8); } if (tt->win[2]) { xx = x - ((adx * 50 * dist) / 100); - yy = y - (dist * 50 * dy) / (100 * VRoot.h / 2); + yy = y - (dist * 50 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[2], xx - 12, yy - 12); } if (tt->win[3]) { xx = x - ((adx * 80 * dist) / 100); - yy = y - (dist * 80 * dy) / (100 * VRoot.h / 2); + yy = y - (dist * 80 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[3], xx - 16, yy - 16); } xx = x - ((adx * 100 * dist) / 100); - yy = y - (dist * 100 * dy) / (100 * VRoot.h / 2); + yy = y - (dist * 100 * dy) / (100 * WinGetH(VROOT) / 2); if (adx < 0) ww = 0; else ww = w; - hh = (h / 2) + ((dy * h) / (VRoot.h / 2)); + hh = (h / 2) + ((dy * h) / (WinGetH(VROOT) / 2)); } EobjMoveResize(tt->TTWIN, xx - ww, yy - hh, w, h); @@ -736,7 +736,7 @@ ToolTipTimeout(int val __UNUSED__, void *data __UNUSED__) return; /* In case this is a virtual root */ - if (x < 0 || y < 0 || x >= VRoot.w || y >= VRoot.h) + if (x < 0 || y < 0 || x >= WinGetW(VROOT) || y >= WinGetH(VROOT)) return; /* dont pop up tooltip is mouse button down */ @@ -779,7 +779,7 @@ TooltipsSetPending(int type, CB_GetAclass * func, void *data) if (!Mode_tooltips.root_motion_mask_set) { Mode_tooltips.root_motion_mask_set = 1; - ESelectInputChange(VRoot.win, PointerMotionMask, 0); + ESelectInputChange(VROOT, PointerMotionMask, 0); } } else @@ -787,7 +787,7 @@ TooltipsSetPending(int type, CB_GetAclass * func, void *data) if (Mode_tooltips.root_motion_mask_set) { Mode_tooltips.root_motion_mask_set = 0; - ESelectInputChange(VRoot.win, 0, PointerMotionMask); + ESelectInputChange(VROOT, 0, PointerMotionMask); } } diff --git a/src/x.c b/src/x.c index 0131696f..8e5214fa 100644 --- a/src/x.c +++ b/src/x.c @@ -391,7 +391,8 @@ ECreateArgbWindow(Win parent, int x, int y, int w, int h, Win cwin) { argb_visual = EVisualFindARGB(); argb_cmap = - XCreateColormap(disp, VRoot.xwin, argb_visual, AllocNone); + XCreateColormap(disp, WinGetXwin(VROOT), argb_visual, + AllocNone); } depth = 32; vis = argb_visual; @@ -411,7 +412,7 @@ ECreateWindowVD(Win parent, int x, int y, int w, int h, if (!vis || depth == 0) return 0; - cmap = XCreateColormap(disp, VRoot.xwin, vis, AllocNone); + cmap = XCreateColormap(disp, WinGetXwin(VROOT), vis, AllocNone); return ECreateWindowVDC(parent, x, y, w, h, vis, depth, cmap); } @@ -504,7 +505,7 @@ ECreateFocusWindow(Win parent, int x, int y, int w, int h) attr.backing_store = NotUseful; attr.override_redirect = False; - attr.colormap = VRoot.cmap; + attr.colormap = WinGetCmap(VROOT); attr.border_pixel = 0; attr.background_pixel = 0; attr.save_under = False; @@ -728,8 +729,8 @@ ECreateWinFromXwin(Window xwin) win->w = w; win->h = h; win->depth = depth; - win->visual = VRoot.vis; - win->cmap = VRoot.cmap; + win->visual = WinGetVisual(VROOT); + win->cmap = WinGetCmap(VROOT); return win; } @@ -935,7 +936,7 @@ EGetGeometry(Win win, Window * root_return, int *x, int *y, if (depth) *depth = win->depth; if (root_return) - *root_return = VRoot.xwin; + *root_return = WinGetXwin(VROOT); return 1; } @@ -1092,7 +1093,7 @@ EXQueryPointer(Window xwin, int *px, int *py, Window * pchild, unsigned int mask; if (xwin == None) - xwin = VRoot.xwin; + xwin = WinGetXwin(VROOT); if (!px) px = &root_x; @@ -1112,7 +1113,7 @@ EQueryPointer(Win win, int *px, int *py, Window * pchild, unsigned int *pmask) { Window xwin; - xwin = (win) ? win->xwin : VRoot.xwin; + xwin = (win) ? win->xwin : WinGetXwin(VROOT); return EXQueryPointer(xwin, px, py, pchild, pmask); } @@ -1861,7 +1862,7 @@ EGetTimestamp(void) if (win_ts == None) { attr.override_redirect = False; - win_ts = XCreateWindow(disp, VRoot.xwin, -100, -100, 1, 1, 0, + win_ts = XCreateWindow(disp, WinGetXwin(VROOT), -100, -100, 1, 1, 0, CopyFromParent, InputOnly, CopyFromParent, CWOverrideRedirect, &attr); XSelectInput(disp, win_ts, PropertyChangeMask); diff --git a/src/zoom.c b/src/zoom.c index adac20f7..77c28e70 100644 --- a/src/zoom.c +++ b/src/zoom.c @@ -186,7 +186,7 @@ ZoomMask(int x, int y, int w, int h) if (x < 0 || y < 0 || w <= 0 || h <= 0) return 0; - win = ECreateWindow(VRoot.win, x, y, w, h, 0); + win = ECreateWindow(VROOT, x, y, w, h, 0); ESetWindowBackground(win, BlackPixel(disp, VRoot.scr)); ERaiseWindow(win); EMapWindow(win);