From unknown Wed May 20 05:35:42 2026
MIME-Version: 1.0
X-Mailer: MIME-tools 5.502 (Entity 5.502)
X-Loop: owner@bugs.x2go.org
From: owner@bugs.x2go.org (X2Go Bug Tracking System)
Subject: Bug#330 closed by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 (X2Go issue (in src:python-x2go) has been marked as closed)
Message-ID: <handler.330.c.138919143130438.notifdone@bugs.x2go.org>
References: <20140108142934.7AD6F5DCD9@ymir>
X-X2go-PR-Keywords: pending patch
X-X2go-PR-Message: they-closed 330
X-X2go-PR-Package: python-x2go
X-X2go-PR-Source: python-x2go
Date: Wed, 08 Jan 2014 14:35:03 +0000
Content-Type: multipart/mixed; boundary="----------=_1389191703-782-0"

This is a multi-part message in MIME format...

------------=_1389191703-782-0
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8

This is an automatic notification regarding your Bug report
which was filed against the python-x2go package:

#330: Incorrect detection of color depth on Windows

It has been closed by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Mike Gabriel <mike.gab=
riel@das-netzwerkteam.de> by
replying to this email.


--=20
X2Go Bug Tracking System
Contact owner@bugs.x2go.org with problems

------------=_1389191703-782-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at control) by bugs.x2go.org; 8 Jan 2014 14:30:31 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RELAYS
	autolearn=unavailable version=3.3.2
Received: by ymir (Postfix, from userid 1005)
	id 7AD6F5DCD9; Wed,  8 Jan 2014 15:29:34 +0100 (CET)
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
To: 330-submitter@bugs.x2go.org
Cc: control@bugs.x2go.org, 330@bugs.x2go.org
Subject: X2Go issue (in src:python-x2go) has been marked as closed
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Message-Id: <20140108142934.7AD6F5DCD9@ymir>
Date: Wed,  8 Jan 2014 15:29:34 +0100 (CET)

close #330
thanks

Hello,

we are very hopeful that X2Go issue #330 reported by you
has been resolved in the new release (0.4.0.9) of the
X2Go source project »src:python-x2go«.

You can view the complete changelog entry of src:python-x2go (0.4.0.9)
below, and you can use the following link to view all the code changes
between this and the last release of src:python-x2go.

    http://code.x2go.org/gitweb?p=python-x2go.git;a=commitdiff;h=62f82b9324d1ed8240af1ad0bf0e5ff82f08ee49;hp=000e5e38e26713f485314365486d05b93100a189

If you feel that the issue has not been resolved satisfyingly, feel
free to reopen this bug report or submit a follow-up report with
further observations described based on the new released version
of src:python-x2go.

Thanks a lot for contributing to X2Go!!!

light+love
X2Go Git Admin (on behalf of the sender of this mail)

---
X2Go Component: src:python-x2go
Version: 0.4.0.9-0x2go1
Status: RELEASE
Date: Wed, 08 Jan 2014 15:14:16 +0100
Fixes: 329 330 335
Changes: 
 python-x2go (0.4.0.9-0x2go1) RELEASED; urgency=low
 .
   [ Mike Gabriel ]
   * New upstream version (0.4.0.9):
     - Agent channels in Paramiko can raise an EOFError if the connection
       has got disrupted. Ignoring this.
     - Store the session password in base64 encoded string in order to make
       it harder spotting the long term stored (for the duration of the session)
       plain text password.
     - Support encryption passphrases on SSH private key files (X2Go SSH
       connections as well as SSH proxy connections).
     - Invalidate SSH private keys (filename, pkey object) when look_for_keys is
       requested.
     - Keep private key information even if force_password_auth is set in the
       control session's connect() method.
     - Fix parameter handling in X2GoSession.connect().
     - Rewrite passwords that are not string/unicode to an empty string.
     - No Unicode chars in log messages. Eliminated one more in checkhosts.py.
     - Implement two-factor authentication.
     - Compat fix in _paramiko monkey patch module to also work with early
       Paramiko versions.
     - Handle echoing ~/.*shrc files gracefully via SSH client connections. Do
       not allow data injections via ~/.*shrc files. (Fixes: #335).
     - Properly handle (=expand) the "~" character in key filenames. (Brought to
       attention by Eldamir on IRC. Thanks!).
     - Differentiate between desktop sharing errors and desktop sharing access
       that gets denied by the other/remote user.
     - Report about found session window / session window retitling in debug
       mode.
     - Fix session window detection when local session manager is the i3 session
       manager (which uses _NET_CLIENT_LIST_STACKING instead of
       _NET_CLIENT_LIST).
     - Check for pulse cookie file in old (~/.pulse-cookie) and new
       (~/.config/pulse/cookie) location.
     - Import python-x2go-py3.patch from Fedora. Thanks to Orion!!!
     - Improve setup.py script: make it run with Python3 and older Python2
       versions.
     - Fix tests for two-factor authentication in control session and SSH proxy
       code.
     - Fix regression: Make password logins with PyHoca-CLI succeed again.
     - Make channel compression to all authentication methods.
     - Set keepalive on proxy channel.
     - Only use [<host>]:<port> if <port> is not 22.
     - Handle host key checks for hosts that do not have a port specified.
   * debian/source/format:
     + Switch to format 1.0.
   * python-x2go.spec:
     + Ship python-x2go.spec (RPM package definitions) in upstream project.
       (Thanks to the Fedora package maintainers).
     + Clear (Fedora package) changelog.
     + Drop dependency on python-cups.
 .
   [ Orion Poplawski ]
   * debian/control:
     + Drop python-cups from Depends: field. Python CUPS is no dependency if
       Python X2Go. (Fixes: #329).
 .
   [ Kenneth Pedersen ]
   * New upstream version (0.4.0.9):
     - Color depth detection: Stop using win32api.GetSystemMetrics(2) which actually
       returns the width of a vertical scroll bar in pixels. Instead, create a screen
       display context and query it for the color depth. (Fixes: #330).


------------=_1389191703-782-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at submit) by bugs.x2go.org; 22 Oct 2013 05:29:22 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED
	autolearn=ham version=3.3.2
X-Greylist: delayed 935 seconds by postgrey-1.34 at ymir; Tue, 22 Oct 2013 07:29:21 CEST
Received: from sender1.zohomail.com (sender1.zohomail.com [72.5.230.103])
	by ymir (Postfix) with ESMTP id 3974F5DB16
	for <submit@bugs.x2go.org>; Tue, 22 Oct 2013 07:29:21 +0200 (CEST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; 
  s=zoho; d=wangpedersen.com; 
  h=date:from:to:message-id:subject:mime-version:content-type:user-agent; 
  b=c9zlUIIIU3V3ldZpO4KweXw4L+NTOopZKYBVrDc5YjDJwVnoOOPLVgtiMCpdiMZfrr1BmYWimb3Z
    E6IWKIu3z0TIFt/X4J72d1OTj4NDB71qke/8HI6A6ggSFNyLwhMOpopn5i15YokD+FPxsYcfGA8e
    6BsQ9uZPhQoTPMRRpFc=  
Received: from mail.zoho.com by mx.zohomail.com
	with SMTP id 13824188241111001.6217835969067; Mon, 21 Oct 2013 22:13:44 -0700 (PDT)
Date: Mon, 21 Oct 2013 22:13:44 -0700
From: kenneth <kenneth@wangpedersen.com>
To:  <submit@bugs.x2go.org>
Message-ID: <1878608620.350326.1382418824063.JavaMail.sas1@[172.29.249.242]>
Subject: Incorrect detection of color depth on Windows
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Priority: Medium
User-Agent: Zoho Mail
X-Mailer: Zoho Mail

Package: python-x2go
Version: 0.4.0.8
Tags: patch

The following code is used when detecting color depth on Windows (in x2go/utils.py):

  return win32api.GetSystemMetrics(2)

The following constant actually has the numeric value 2: 
SM_CXVSCROLL - The width of a vertical scroll bar, in pixels. 
See e.g. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85).aspx

At least on my system (Windows 7), this value is 17, causing python-x2go to incorrectly identify the display
as having 17 bits-per-pixel.

The attached patch fixes this issue by creating a screen display context and querying it for the color depth.

Regards,
Kenneth Pedersen

>From aba9e380f1a26299042a7f075217c9ad99505f73 Mon Sep 17 00:00:00 2001
From: Kenneth Pedersen <kenneth@wangpedersen.com>
Date: Mon, 21 Oct 2013 22:07:53 +0200
Subject: [PATCH] Detect color depth correctly on Windows

---
 x2go/utils.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/x2go/utils.py b/x2go/utils.py
index e8d80bc..8ecbf2c 100644
--- a/x2go/utils.py
+++ b/x2go/utils.py
@@ -48,6 +48,8 @@ if _X2GOCLIENT_OS != 'Windows':
 if _X2GOCLIENT_OS == 'Windows':
     import win32api
     import win32gui
+    import win32print
+    import win32con
 
 def is_in_nx3packmethods(method):
 
@@ -555,8 +557,10 @@ def local_color_depth():
             return 24
 
     else:
-        return win32api.GetSystemMetrics(2)
-
+        # This gets the color depth of the primary monitor. All monitors need not have the same color depth.
+        dc = win32gui.GetDC(None)
+        _depth = win32print.GetDeviceCaps(dc, win32con.BITSPIXEL) * win32print.GetDeviceCaps(dc, win32con.PLANES)
+        win32gui.ReleaseDC(None, dc)
 
 def is_color_depth_ok(depth_session, depth_local):
     """\
-- 
1.8.4.msysgit.0

------------=_1389191703-782-0--
