aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-05-19 20:59:02 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-10-17 22:38:05 +0200
commit8deda7bd4f1ada976010c2edcd7cab9a4bdf8140 (patch)
tree57e5843d2307812aada89e3d105014040dc1366c /nx-X11
parentabe5e8479aca9f53ed4778336978bf7bd623c56a (diff)
downloadnx-libs-8deda7bd4f1ada976010c2edcd7cab9a4bdf8140.tar.gz
nx-libs-8deda7bd4f1ada976010c2edcd7cab9a4bdf8140.tar.bz2
nx-libs-8deda7bd4f1ada976010c2edcd7cab9a4bdf8140.zip
nxagent: Prevent resize loop
This only happened with certain window managers like mutter. Fixes ArcticaProject/nx-libs#925
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c19
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Extensions.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c21
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.h4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c4
6 files changed, 35 insertions, 19 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 847d40918..bf6e20e20 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -588,7 +588,7 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_ENABLE_DESKTOP_RESIZE_MODE);
- nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height));
+ nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height), True);
if (nxagentOption(ClientOs) == ClientOsWinnt)
{
@@ -2082,7 +2082,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
X.xmap.window == nxagentDefaultWindows[nxagentScreen(X.xmap.window)->myNum])
{
nxagentChangeScreenConfig(nxagentScreen(X.xmap.window)->myNum, nxagentOption(Width),
- nxagentOption(Height));
+ nxagentOption(Height), True);
}
break;
@@ -3412,9 +3412,16 @@ int nxagentHandleConfigureNotify(XEvent* X)
fprintf(stderr,"%s: Width %d Height %d.\n", __func__,
nxagentOption(Width), nxagentOption(Height));
#endif
-
+ /*
+ * we are processing a ConfigureNotifyEvent that brought us
+ * the current window size. If we issue a XResizeWindow()
+ * again with these values we might end up in loop if the
+ * window manager adjusts the size, which is perfectly
+ * legal for it to do. So we prevent the XResizeWindow call
+ * from happening.
+ */
nxagentChangeScreenConfig(0, nxagentOption(Width),
- nxagentOption(Height));
+ nxagentOption(Height), False);
}
}
@@ -3435,7 +3442,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
nxagentChangeOption(RootHeight, X -> xconfigure.height);
nxagentChangeScreenConfig(0, nxagentOption(Width),
- nxagentOption(Height));
+ nxagentOption(Height), True);
return 1;
}
@@ -4310,7 +4317,7 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X)
#endif
nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height,
- Xr -> mwidth, Xr -> mheight);
+ Xr -> mwidth, Xr -> mheight, True);
nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root,
Xr -> width, Xr -> height);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c
index 239d84b85..52c3b0375 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c
@@ -378,7 +378,7 @@ int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
*/
int r = nxagentResizeScreen(pScreen, pSize -> width, pSize -> height,
- pSize -> mmWidth, pSize -> mmHeight);
+ pSize -> mmWidth, pSize -> mmHeight, True);
nxagentMoveViewport(pScreen, 0, 0);
@@ -448,7 +448,7 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
nxagentChangeOption(Height, height);
}
- int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight);
+ int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight, True);
if (result == 1 && nxagentOption(DesktopResize) == 1 &&
nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index 90e796772..602351d10 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -633,7 +633,7 @@ Bool nxagentReconnectSession(void)
if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True || nxagentOption(Xinerama) == True)
{
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
- nxagentOption(RootHeight));
+ nxagentOption(RootHeight), True);
nxagentResizeDesktopAtStartup = False;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 4654bbfcd..52ecea854 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -2243,7 +2243,7 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
}
Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
- int mmWidth, int mmHeight)
+ int mmWidth, int mmHeight, Bool doresize)
{
#ifdef TEST
nxagentPrintAgentGeometry("Before Resize Screen", "nxagentResizeScreen:");
@@ -2365,10 +2365,19 @@ FIXME: We should try to restore the previously
{
nxagentSetWMNormalHints(pScreen->myNum, width, height);
- XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height);
+ if (doresize)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: resizing DefaultWindow to [%d]x[%d]\n", __func__, width, height);
+ #endif
+ XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height);
+ }
if (nxagentOption(Rootless) == 0)
{
+ #ifdef DEBUG
+ fprintf(stderr, "%s: resizing InputWindow to [%d]x[%d]\n", __func__, width, height);
+ #endif
XResizeWindow(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], width, height);
}
}
@@ -2691,7 +2700,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
AddResource(accessWindowID, RT_WINDOW, (void *)nxagentShadowWindowPtr);
- nxagentResizeScreen(pScreen, nxagentShadowWidth, nxagentShadowHeight, pScreen -> mmWidth, pScreen -> mmHeight);
+ nxagentResizeScreen(pScreen, nxagentShadowWidth, nxagentShadowHeight, pScreen -> mmWidth, pScreen -> mmHeight, True);
nxagentShadowCreateMainWindow(pScreen, pWin, nxagentShadowWidth, nxagentShadowHeight);
@@ -3646,10 +3655,10 @@ void nxagentAdjustCustomMode(ScreenPtr pScreen)
RRScreenSizeNotify(pScreen);
}
-int nxagentChangeScreenConfig(int screen, int width, int height)
+int nxagentChangeScreenConfig(int screen, int width, int height, Bool doresize)
{
#ifdef DEBUG
- fprintf(stderr, "nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d]\n", screen, width, height);
+ fprintf(stderr, "nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d] doresize [%d]\n", screen, width, height, doresize);
#endif
#ifdef TEST
@@ -3697,7 +3706,7 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %d x %d\n", width, height);
#endif
- int r = nxagentResizeScreen(pScreen, width, height, 0, 0);
+ int r = nxagentResizeScreen(pScreen, width, height, 0, 0, doresize);
if (r != 0)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h
index 6d775e1cc..3eb16ea3c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h
@@ -110,9 +110,9 @@ Window nxagentCreateIconWindow(void);
Bool nxagentMagicPixelZone(int x, int y);
Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
- int mmWidth, int mmHeight);
+ int mmWidth, int mmHeight, Bool doresize);
-int nxagentChangeScreenConfig(int screen, int width, int height);
+int nxagentChangeScreenConfig(int screen, int width, int height, Bool doresize);
int nxagentAdjustRandRXinerama(ScreenPtr pScreen);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index e6b9c03df..56ca30c4e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -891,7 +891,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(Shadow) == 0)
{
nxagentChangeScreenConfig(0, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
- HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
+ HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), True);
}
else
{
@@ -945,7 +945,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(Shadow) == 0)
{
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
- nxagentOption(RootHeight));
+ nxagentOption(RootHeight), True);
}
}