Subject: Bug#872: [X2Go-Dev] Bug#872: Turn xinerama.conf file related code inside X2Go Client into legacy code (for NX agents << 3.6)

From: Ulrich Sibiller <[email-masked]>
Date: Mon, 18 May 2015 13:28:49 +0200

On Mon, May 18, 2015 at 11:23 AM, Oleksandr Shneyder
<[email-masked]> wrote:
> ok, let's wait till this feature is available in nxagent and I'll put
> support for it in x2go client.

Ok. But can you please explain the reason for that off-by-one window
size code I found (see below)?

>>>> On  Do 14 Mai 2015 23:32:03 CEST, Ulrich Sibiller wrote:
>>>>
>>>>> while testing my xinerama re-implementation I noticed that x2goclient
>>>>> reports a wrong width sometimes when simply moving the window without
>>>>> changing the size. The reported size differs by one pixel  (too much
>>>>> or too little). When running x2goclient --debug you can see this:
>>>>>
>>>>> x2go-DEBUG-../src/onmainwindow.cpp:10160> "New proxy geometry: (x:
>>>>> 329, y: 214, w: 1440, h: 900"
>>>>> x2go-DEBUG-../src/onmainwindow.cpp:10160> "New proxy geometry: (x:
>>>>> 365, y: 213, w: 1440, h: 900"
>>>>> x2go-DEBUG-../src/onmainwindow.cpp:10160> "New proxy geometry: (x:
>>>>> 825, y: 190, w: 1440, h: 900"
>>>>> x2go-DEBUG-../src/sshprocess.cpp:189> executing remote command via
>>>>> SshProcess object (24): "export DISPLAY=:50;printf '\''1095 0 345
>>>>> 900\n0 0 1095 900'\'' >
>>>>> $HOME/.x2go/C-uli-50-1431636769_stDKDE_dp24/xinerama.conf"
>>>>>
>>>>> -> here the 345 should have been a 344.
>>>>>
>>>>> Interestingly my patched x2goagent (that completely ignores
>>>>> xinerama.conf) sees that value. So I conclude that x2goclient is
>>>>> manipulating the nxproxy window size by one pixel itself. Disabling
>>>>> xinerama in the session's configuration fixes the problem.
>>>>>
>>>>> That off-by-one behaviour is caused by this code in onmainwindow.cpp:
>>>>>
>>>>> void ONMainWindow::slotXineramaConfigured()
>>>>> {
>>>>>     if (resumingSession.fullscreen)
>>>>>         return;
>>>>>     if (xinSizeInc == -1)
>>>>>         xinSizeInc=1;
>>>>>     else
>>>>>         xinSizeInc=-1;
>>>>> #ifdef Q_OS_LINUX
>>>>>
>>>>> lastDisplayGeometry.setWidth(lastDisplayGeometry.width()+xinSizeInc);
>>>>>     XSync(QX11Info::display(),false);
>>>>>     XResizeWindow(QX11Info::display(), proxyWinId,
>>>>>
>>>>> lastDisplayGeometry.width(),lastDisplayGeometry.height());
>>>>>     XSync(QX11Info::display(),false);
>>>>> #endif
>>>>> #ifdef Q_OS_WIN
>>>>>     QRect geom;
>>>>>     wapiWindowRect ( (HWND) proxyWinId, geom );
>>>>>     wapiMoveWindow( (HWND) proxyWinId, geom.x(), geom.y(),
>>>>> geom.width()+xinSizeInc, geom.height(),true);
>>>>>     lastDisplayGeometry=proxyWinGeometry();
>>>>> #endif
>>>>>     xineramaTimer->start(500);
>>>>> }
>>>>>
>>>>> If I set xinSizeInc to zero in all cases the off-by-one behaviour is
>>>>> completely gone. Why does xinSizeInc exist at all?

Uli