FreeRDP/FreeRDP — Issue #465: Problem Running xfreerdp inside x2goagen ( aka nxagen )
Author: hteles
Created: 2012-02-27 17:05:05+00:00
State: open

Hello dear developers.,
i firstly tried to submit this problem to the x2godevel ML, but got no answers.

Firstly, thanks for xfreerdp, the fastest and best open Remote Desktop Client.

Now to what it matters.

Hello Dear Dennis, and Xfrerdp Developers.

I'm forwarding you a email from one of the X2GO developers.
The problem lies when you try to run a xfreerdp session within a x2goagent ( aka nxagent ), it errors with a BadMatch (invalid parameter attributes)
Mr. Oleksandr Shneyder proposes a patch that i pasted here with the complete email in the bottom of this email.

I Kindly regard your attention to this matter.

sincerily yours,
Helmer Teles.

[...............]

MAIL==============

Hello Developers,

I'm forwarding you a email from one of the X2GO developers.
The problem lies when you try to run a xfreerdp session within a x2goagent ( aka nxagent ), it errors with a BadMatch (invalid parameter attributes)

The error is:

Warning xf_GetWindowProperty (140): Property 353 does not exist
connected to 192.168.200.114:3389
null server certificate
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 1 (X_CreateWindow)
Serial number of failed request: 27
Current serial number in output stream: 34

===========================
Full paste of x2godev email below
===========================

MAIL==============

Hello Developers,

one of X2Go users in our mailing list have reported, that there is a
issue running xfreerdp on such X-Servers as nxagent or x2goagent. I
spent some time for investigations, and found, that the way how xfreerdp
searching for visual to create desktop window, working not for all
X-Servers.

in FreeRDP/client/X11/xfreerdp.c:395

if (vi->depth == xfi->depth)
{
xfi->visual = vi->visual;
break;
}

As we can see, the first visual, which have the same colour depth as our
screen will be chosen here. Unfortunately, such behaviour is not for
every X-Server correct. Choosing wrong visual make function
XCreateWindow() in FreeRDP/client/X11/xf_window.c:280 fail with error
message:

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 1 (X_CreateWindow)
Serial number of failed request: 31
Current serial number in output stream: 35

To avoid this, I propose to get correct visual from properties of a root
window.

patch is attached.

Regards,
Alex
=====================
PATCH================

diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c
index de58122..ddd8e5b 100644
--- a/client/X11/xfreerdp.c
+++ b/client/X11/xfreerdp.c
@@ -353,6 +353,7 @@ boolean xf_get_pixmap_info(xfInfo* xfi)
XVisualInfo template;
XPixmapFormatValues* pf;
XPixmapFormatValues* pfs;
+ XWindowAttributes window_attributes_return;

pfs = XListPixmapFormats(xfi->display, &pf_count);

@@ -379,6 +380,13 @@ boolean xf_get_pixmap_info(xfInfo* xfi)
template.class = TrueColor;
template.screen = xfi->screen_number;

+
if(XGetWindowAttributes(xfi->display,RootWindowOfScreen(xfi->screen),&window_attributes_return)==0)
+ {
+ printf("xf_get_pixmap_info: XGetWindowAttributes failed\n");
+ return false;
+ }
+
+
vis = XGetVisualInfo(xfi->display, VisualClassMask | VisualScreenMask,
&template, &vi_count);

if (vis == NULL)
@@ -392,7 +400,7 @@ boolean xf_get_pixmap_info(xfInfo* xfi)
{
vi = vis + i;

- if (vi->depth == xfi->depth)
+ if (vi->visual == window_attributes_return.visual)
{
xfi->visual = vi->visual;
break;

============================

regards,
Alex
--
Oleksandr Shneyder
Dipl. Informatik
X2go Core Developer Team

email: oleksandr.shneyder@obviously-nice.de
web: www.obviously-nice.de

--> X2go - everywhere@home