[X2Go-Dev] Xinerama buggy?

Ulrich Sibiller ulrich.sibiller at gmail.com
Tue May 16 00:20:52 CEST 2017


Hi,

in x2goclient's ONMainWindow::slotConfigXinerama you can find the
following code that calculates the values for xinerama.conf. We see a
race condition here where sometimes (well, quite often) this leads to
negative x/y coordinates in xinerama.conf (size is ok) for new
sessions when run from the thinclient setup. The code below contains
annotations by me in [] with the variables' values that lead to the
wrong xinerama.conf. I believe x2goclient sometimes catches the
nxagent window too early before it is resized accordingly (maybe the
window manager is too slow) thus getting a window of size 1x1 in the
center of the screen (line 12):

     1  void ONMainWindow::slotConfigXinerama()
     2  {
     3      QRect newGeometry=proxyWinGeometry();     [1x1 at 511,393]
     4      if (newGeometry.isNull())
     5      {
     6          x2goWarningf(7)<< tr("Error getting window geometry.
(Did you close the window?)");
     7          xineramaTimer->stop();
     8          return;
     9      }
    10      if (newGeometry==lastDisplayGeometry)
    11          return;
    12      lastDisplayGeometry=newGeometry;   [1x1 at 511,393]

    13      QString geoStr =
    14          "(x: " + QString("%1").arg(lastDisplayGeometry.x()) +
    15          ", y: "+ QString("%1").arg(lastDisplayGeometry.y()) +
    16          ", w: "+ QString("%1").arg(lastDisplayGeometry.width()) +
    17          ", h: "+ QString("%1").arg(lastDisplayGeometry.height());
    18      x2goDebug<<"New proxy geometry: " + geoStr;

    19      QDesktopWidget* root=QApplication::desktop();
    20      QList<QRect> newXineramaScreens;
    21      for (int i=0; i< root->numScreens(); ++i)
    22      {
    23          QRect intersection;
    24          if (resumingSession.fullscreen)
    25              intersection=root->screenGeometry(i);  [1024x768 at 0,0]
    26          else
    27
intersection=root->screenGeometry(i).intersected(lastDisplayGeometry);
 [ not executed ]
    28          if (!intersection.isNull())
    29          {
    30              //            x2goDebug<<"intersected with
"<<i<<": "<<intersection<<endl;
    31
intersection.moveLeft(intersection.x()-lastDisplayGeometry.x());
[1024x768 at -511,0]    <-  [0]-[511]
    32
intersection.moveTop(intersection.y()-lastDisplayGeometry.y());
[1024x768 at -511,-393] <-  [0]-[393]

    33              //            x2goDebug<<"xinerama screen:
"<<intersection<<endl;
    34              newXineramaScreens<<intersection;
    35          }
    36      }
    37      if (xineramaScreens != newXineramaScreens)
    38      {
    39          xineramaScreens=newXineramaScreens;
    40          //        x2goDebug<<"xinerama screen changed, new
screens: "<<xineramaScreens<<endl;

    41          xineramaTimer->stop();
    42          QStringList screens;
    43          foreach (QRect disp, xineramaScreens)
    44              screens<<QString::number(disp.x())+"
"+QString::number(disp.y())+" "+QString::number(disp.width())+
    45                     " "+QString::number(disp.height());
                    ["-511 -393 1024 768"]
    46          QString cmd="export
DISPLAY=:"+resumingSession.display+" ;printf %b
'\\''"+screens.join("\\n")+"'\\'' >  $HOME/.x2go/C-"+
    47                      resumingSession.sessionId+"/xinerama.conf";

    48          sshConnection->executeCommand(cmd, this,
SLOT(slotXineramaConfigured()));
    49      }
    50  }

I am not really sure about the intentions behind this code. It looks
to me that the if block (lines 28-35} should not run for the
fullscreen case. Can anyone confirm this?

Uli


More information about the x2go-dev mailing list