aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-11-02 11:40:04 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-11-02 11:40:04 +0100
commiteb8c16ef9d24add2e0912269775d586d7d4061e4 (patch)
tree75a0ce4167c351512b1226cefc5630297f1b4384 /nx-X11
parent5f806ddfdb46c9a727b00ac96a6b939c447ca488 (diff)
parent7675af8e1323925badd313adf3ec8333984d7ee1 (diff)
downloadnx-libs-eb8c16ef9d24add2e0912269775d586d7d4061e4.tar.gz
nx-libs-eb8c16ef9d24add2e0912269775d586d7d4061e4.tar.bz2
nx-libs-eb8c16ef9d24add2e0912269775d586d7d4061e4.zip
Merge branch 'uli42-pr/simplify_nxwindow' into 3.6.x
Attributes GH PR #866: https://github.com/ArcticaProject/nx-libs/pull/866
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/dix/window.c10
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXwindow.c192
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c4
3 files changed, 34 insertions, 172 deletions
diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c
index ee146d783..d294e139d 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
@@ -913,7 +915,6 @@ CrushTree(WindowPtr pWin)
* If wid is None, don't send any events
*****/
-#ifndef NXAGENT_SERVER
int
DeleteWindow(void * value, XID wid)
{
@@ -949,7 +950,6 @@ DeleteWindow(void * value, XID wid)
free(pWin);
return Success;
}
-#endif /* NXAGENT_SERVER */
void
DestroySubwindows(register WindowPtr pWin, ClientPtr client)
@@ -2988,7 +2988,6 @@ UnrealizeTree(
* generated. Cannot unmap a root window.
*****/
-#ifndef NXAGENT_SERVER
int
UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
{
@@ -3042,7 +3041,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..a29dff384 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,63 +177,13 @@ 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
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)
@@ -308,6 +221,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 +234,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 +377,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 +399,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 +543,9 @@ ActuallyDoSomething:
if (action != RESTACK_WIN)
CheckCursorConfinement(pWin);
+#ifdef NXAGENT_SERVER
nxagentFlushConfigureWindow();
+#endif
return(Success);
#undef RESTACK_WIN
@@ -687,10 +608,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 +679,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,80 +777,13 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
RegionUninit(&temp);
}
+#ifdef NXAGENT_SERVER
nxagentFlushConfigureWindow();
+#endif
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))
- {
- fprintf(stderr, "UnmapWindow: pWin [%p] fromConfigure [%d]\n", pWin,
- 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);
-}
-
void
SaveScreens(int on, int mode)
{
@@ -954,6 +812,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
@@ -962,6 +821,7 @@ SaveScreens(int on, int mode)
#endif
}
else
+#endif
{
if ((*savedScreenInfo[i].ExternalScreenSaver)
(screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
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)