From 40a4fae660b21de943c8f23a77a9ab7bef78180d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2019 11:59:12 +0200 Subject: NXwindow.c: call upstream version UnmapWindow() --- nx-X11/programs/Xserver/dix/window.c | 6 ++- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 57 +-------------------------- 2 files changed, 5 insertions(+), 58 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index ee146d783..80f572a10 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -2988,9 +2988,12 @@ UnrealizeTree( * generated. Cannot unmap a root window. *****/ -#ifndef NXAGENT_SERVER int +#ifdef NXAGENT_SERVER +xorg_UnmapWindow(register WindowPtr pWin, Bool fromConfigure) +#else UnmapWindow(register WindowPtr pWin, Bool fromConfigure) +#endif { register WindowPtr pParent; xEvent event; @@ -3042,7 +3045,6 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure) WindowsRestructured (); return(Success); } -#endif /* NXAGENT_SERVER */ /***** * UnmapSubwindows diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 88e68e463..c682efb10 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -857,23 +857,9 @@ MapWindow(register WindowPtr pWin, ClientPtr client) return(Success); } -/***** - * UnmapWindow - * If the window is already unmapped, this request has no effect. - * Otherwise, the window is unmapped and an UnMapNotify event is - * generated. Cannot unmap a root window. - *****/ - int UnmapWindow(register WindowPtr pWin, Bool fromConfigure) { - register WindowPtr pParent; - xEvent event; - Bool wasRealized = (Bool)pWin->realized; - Bool wasViewable = (Bool)pWin->viewable; - ScreenPtr pScreen = pWin->drawable.pScreen; - WindowPtr pLayerWin = pWin; - #ifdef TEST if (nxagentWindowTopLevel(pWin)) { @@ -882,48 +868,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure) } #endif - if ((!pWin->mapped) || (!(pParent = pWin->parent))) - return(Success); - if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) - { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = UnmapNotify; - event.u.unmapNotify.window = pWin->drawable.id; - event.u.unmapNotify.fromConfigure = fromConfigure; - DeliverEvents(pWin, &event, 1, NullWindow); - } - if (wasViewable && !fromConfigure) - { - pWin->valdata = UnmapValData; - (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin); - (*pScreen->MarkWindow)(pLayerWin->parent); - } - pWin->mapped = FALSE; - if (wasRealized) - UnrealizeTree(pWin, fromConfigure); - if (wasViewable) - { - if (!fromConfigure) - { - (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap); - (*pScreen->HandleExposures)(pLayerWin->parent); - } -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib) ) - { - (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); - } - } - pWin->DIXsaveUnder = FALSE; -#endif /* DO_SAVE_UNDERS */ - if (!fromConfigure && pScreen->PostValidateTree) - (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap); - } - if (wasRealized && !fromConfigure) - WindowsRestructured (); - return(Success); + return xorg_UnmapWindow(pWin, fromConfigure); } void -- cgit v1.2.3 From aab723eab22914e65e5fd16a2a252e597b10028a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 28 Oct 2019 14:06:47 +0100 Subject: NXwindow.c: drop own UnmapWindow() The only difference to the dix version was a fprintf if compiled with -D TEST. --- nx-X11/programs/Xserver/dix/window.c | 4 ---- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 14 -------------- 2 files changed, 18 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 80f572a10..a35e79c11 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -2989,11 +2989,7 @@ UnrealizeTree( *****/ int -#ifdef NXAGENT_SERVER -xorg_UnmapWindow(register WindowPtr pWin, Bool fromConfigure) -#else UnmapWindow(register WindowPtr pWin, Bool fromConfigure) -#endif { register WindowPtr pParent; xEvent event; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index c682efb10..a34ca862a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -857,20 +857,6 @@ MapWindow(register WindowPtr pWin, ClientPtr client) return(Success); } -int -UnmapWindow(register WindowPtr pWin, Bool fromConfigure) -{ - #ifdef TEST - if (nxagentWindowTopLevel(pWin)) - { - fprintf(stderr, "UnmapWindow: pWin [%p] fromConfigure [%d]\n", pWin, - fromConfigure); - } - #endif - - return xorg_UnmapWindow(pWin, fromConfigure); -} - void SaveScreens(int on, int mode) { -- cgit v1.2.3 From 5327a85b777f87bdf8e57fdd6df5dc0350a1df2f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 28 Oct 2019 14:30:07 +0100 Subject: NXwindow.c: mark NX changes many functions are almost identical to dix. Mark the minimal changes. --- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index a34ca862a..77ee97f8a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -308,6 +308,7 @@ ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh) SetWinSize (pSib); SetBorderSize (pSib); +#ifdef NXAGENT_SERVER /* * Don't force X to move children. It will position them * according with gravity. @@ -320,6 +321,9 @@ ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh) */ nxagentAddConfiguredWindow(pSib, CW_Update); +#else + (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y); +#endif if ( (pChild = pSib->firstChild) ) { @@ -460,6 +464,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP /* Figure out if the window should be moved. Doesn't make the changes to the window if event sent */ +#ifdef NXAGENT_SERVER #ifdef TEST if (nxagentWindowTopLevel(pWin)) { @@ -481,6 +486,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP return Success; } +#endif if (mask & CWStackMode) pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x, @@ -624,7 +630,9 @@ ActuallyDoSomething: if (action != RESTACK_WIN) CheckCursorConfinement(pWin); +#ifdef NXAGENT_SERVER nxagentFlushConfigureWindow(); +#endif return(Success); #undef RESTACK_WIN @@ -687,10 +695,12 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, pWin->parent = pParent; pPrev = RealChildHead(pParent); +#ifdef NXAGENT_SERVER if (pWin->parent == screenInfo.screens[0]->root) { nxagentSetTopLevelEventMask(pWin); } +#endif if (pPrev) { @@ -756,12 +766,14 @@ MapWindow(register WindowPtr pWin, ClientPtr client) #endif WindowPtr pLayerWin; +#ifdef NXAGENT_SERVER #ifdef TEST if (nxagentWindowTopLevel(pWin)) { fprintf(stderr, "MapWindow: pWin [%p] client [%p]\n", pWin, client); } #endif +#endif if (pWin->mapped) return(Success); @@ -852,7 +864,9 @@ MapWindow(register WindowPtr pWin, ClientPtr client) RegionUninit(&temp); } +#ifdef NXAGENT_SERVER nxagentFlushConfigureWindow(); +#endif return(Success); } @@ -885,6 +899,7 @@ SaveScreens(int on, int mode) (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on); if (savedScreenInfo[i].ExternalScreenSaver) { +#ifdef NXAGENT_SERVER if (nxagentOption(Timeout) != 0) { #ifdef TEST @@ -893,6 +908,7 @@ SaveScreens(int on, int mode) #endif } else +#endif { if ((*savedScreenInfo[i].ExternalScreenSaver) (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER)) -- cgit v1.2.3 From cf0571bb49b255cb8056da1ea5f6d41e37eb834c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 1 Sep 2019 14:57:27 +0200 Subject: NXwindow.c: call InitRootWindow from dix --- nx-X11/programs/Xserver/dix/window.c | 6 ++- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 57 +++++---------------------- nx-X11/programs/Xserver/hw/nxagent/Window.c | 4 ++ 3 files changed, 18 insertions(+), 49 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index a35e79c11..04e0a2d05 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -497,9 +497,12 @@ CreateRootWindow(ScreenPtr pScreen) return TRUE; } -#ifndef NXAGENT_SERVER void +#ifdef NXAGENT_SERVER +xorg_InitRootWindow(WindowPtr pWin) +#else InitRootWindow(WindowPtr pWin) +#endif { ScreenPtr pScreen = pWin->drawable.pScreen; int backFlag = CWBorderPixel | CWCursor | CWBackingStore; @@ -531,7 +534,6 @@ InitRootWindow(WindowPtr pWin) MapWindow(pWin, serverClient); } -#endif /* NXAGENT_SERVER */ /* Set the region to the intersection of the rectangle and the * window's winSize. The window is typically the parent of the diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 77ee97f8a..bf1466e68 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -132,24 +132,6 @@ extern void nxagentSetVersionProperty(WindowPtr pWin); void InitRootWindow(WindowPtr pWin) { - ScreenPtr pScreen = pWin->drawable.pScreen; - int backFlag = CWBorderPixel | CWCursor | CWBackingStore; - - #ifdef TEST - fprintf(stderr, "InitRootWindow: Called for window at [%p][%ld] with parent [%p].\n", - (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent); - #endif - - if (nxagentOption(Rootless)) - { - #ifdef TEST - fprintf(stderr, "InitRootWindow: Assigned agent root to window at [%p][%ld] with parent [%p].\n", - (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent); - #endif - - nxagentRootlessWindow = pWin; - } - /* * A root window is created for each screen by main * and the pointer is saved in screenInfo.screens as @@ -164,36 +146,17 @@ InitRootWindow(WindowPtr pWin) * if you prefer) fits in the big picture. */ - #ifdef TEST - fprintf(stderr, "InitRootWindow: Going to create window as root at [%p][%ld] with parent [%p].\n", - (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent); - #endif - - if (!(*pScreen->CreateWindow)(pWin)) - return; /* XXX */ - - #ifdef TEST - fprintf(stderr, "InitRootWindow: Created window as root at [%p][%ld] with parent [%p].\n", - (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent); - #endif - - (*pScreen->PositionWindow)(pWin, 0, 0); - - pWin->cursorIsNone = FALSE; - pWin->optional->cursor = rootCursor; - rootCursor->refcnt++; - - if (blackRoot) - pWin->background.pixel = pScreen->blackPixel; - else - pWin->background.pixel = pScreen->whitePixel; - backFlag |= CWBackPixel; + if (nxagentOption(Rootless)) + { + #ifdef TEST + fprintf(stderr, "InitRootWindow: Assigned agent root to window at [%p][%ld] with parent [%p].\n", + (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent); + #endif - pWin->backingStore = defaultBackingStore; - pWin->forcedBS = (defaultBackingStore != NotUseful); + nxagentRootlessWindow = pWin; + } - /* We SHOULD check for an error value here XXX */ - (*pScreen->ChangeWindowAttributes)(pWin, backFlag); + xorg_InitRootWindow(pWin); /* * Map both the root and the default agent window. @@ -214,7 +177,7 @@ InitRootWindow(WindowPtr pWin) char artsd_port[10]; short int nPort = atoi(display) + 7000; sprintf(artsd_port,"%d", nPort); - nxagentPropagateArtsdProperties(pScreen, artsd_port); + nxagentPropagateArtsdProperties(pWin->drawable.pScreen, artsd_port); } #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 88110e7dc..ecf662f90 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2538,6 +2538,10 @@ void nxagentMapDefaultWindows(void) WindowPtr pWin = screenInfo.screens[i]->root; ScreenPtr pScreen = pWin -> drawable.pScreen; + /* + * InitRootWindow does that already, but as MapWindow() is + * idempotent we keep it here, too + */ MapWindow(pWin, serverClient); if (nxagentOption(Rootless) == 0) -- cgit v1.2.3 From 7675af8e1323925badd313adf3ec8333984d7ee1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2019 14:10:17 +0200 Subject: NXwindow.c: use upstream function DeleteWindow() DeleteWindow() is calling FreeWindowResources() which is calling DisposeWindowOptional() which sets pWin->optional to NULL. So the now removed code was never called. After removal DeleteWindow() is identical to the dix version, so we use that one. --- nx-X11/programs/Xserver/dix/window.c | 2 -- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 50 --------------------------- 2 files changed, 52 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 04e0a2d05..d294e139d 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -915,7 +915,6 @@ CrushTree(WindowPtr pWin) * If wid is None, don't send any events *****/ -#ifndef NXAGENT_SERVER int DeleteWindow(void * value, XID wid) { @@ -951,7 +950,6 @@ DeleteWindow(void * value, XID wid) free(pWin); return Success; } -#endif /* NXAGENT_SERVER */ void DestroySubwindows(register WindowPtr pWin, ClientPtr client) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index bf1466e68..a29dff384 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -184,56 +184,6 @@ InitRootWindow(WindowPtr pWin) nxagentSetVersionProperty(pWin); } -/***** - * DeleteWindow - * Deletes child of window then window itself - * If wid is None, don't send any events - *****/ - -int -DeleteWindow(void * value, XID wid) - { - register WindowPtr pParent; - register WindowPtr pWin = (WindowPtr)value; - xEvent event; - - UnmapWindow(pWin, FALSE); - - CrushTree(pWin); - - pParent = pWin->parent; - if (wid && pParent && SubStrSend(pWin, pParent)) - { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = DestroyNotify; - event.u.destroyNotify.window = pWin->drawable.id; - DeliverEvents(pWin, &event, 1, NullWindow); - } - - FreeWindowResources(pWin); - if (pParent) - { - if (pParent->firstChild == pWin) - pParent->firstChild = pWin->nextSib; - if (pParent->lastChild == pWin) - pParent->lastChild = pWin->prevSib; - if (pWin->nextSib) - pWin->nextSib->prevSib = pWin->prevSib; - if (pWin->prevSib) - pWin->prevSib->nextSib = pWin->nextSib; - } - - if (pWin -> optional && - pWin -> optional -> colormap && - pWin -> parent) - { - nxagentSetInstalledColormapWindows(pWin -> drawable.pScreen); - } - - free(pWin); - return Success; -} - /* XXX need to retile border on each window with ParentRelative origin */ void ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh) -- cgit v1.2.3