X2Go Bug report logs - #330
Incorrect detection of color depth on Windows

version graph

Package: python-x2go; Maintainer for python-x2go is X2Go Developers <x2go-dev@lists.x2go.org>; Source for python-x2go is src:python-x2go.

Reported by: kenneth <kenneth@wangpedersen.com>

Date: Tue, 22 Oct 2013 05:33:01 UTC

Severity: normal

Tags: patch, pending

Found in version 0.4.0.8

Fixed in version 0.4.0.9

Done: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to x2go-dev@lists.berlios.de, X2Go Developers <x2go-dev@lists.berlios.de>:
Bug#330; Package python-x2go. (Tue, 22 Oct 2013 05:33:01 GMT) (full text, mbox, link).


Acknowledgement sent to kenneth <kenneth@wangpedersen.com>:
New Bug report received and forwarded. Copy sent to X2Go Developers <x2go-dev@lists.berlios.de>. (Tue, 22 Oct 2013 05:33:02 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.x2go.org (full text, mbox, reply):

From: kenneth <kenneth@wangpedersen.com>
To: <submit@bugs.x2go.org>
Subject: Incorrect detection of color depth on Windows
Date: Mon, 21 Oct 2013 22:13:44 -0700
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


Information forwarded to x2go-dev@lists.berlios.de, X2Go Developers <x2go-dev@lists.berlios.de>:
Bug#330; Package python-x2go. (Thu, 24 Oct 2013 08:03:02 GMT) (full text, mbox, link).


Acknowledgement sent to Mike Gabriel <mike.gabriel@das-netzwerkteam.de>:
Extra info received and forwarded to list. Copy sent to X2Go Developers <x2go-dev@lists.berlios.de>. (Thu, 24 Oct 2013 08:03:02 GMT) (full text, mbox, link).


Message #10 received at 330@bugs.x2go.org (full text, mbox, reply):

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 pending for release
Date: Thu, 24 Oct 2013 09:51:15 +0200 (CEST)
tag #330 pending
fixed #330 0.4.0.9
thanks

Hello,

X2Go issue #330 (src:python-x2go) reported by you has been
fixed in X2Go Git. You can see the changelog below, and you can
check the diff of the fix at:

    http://code.x2go.org/gitweb?p=python-x2go.git;a=commitdiff;h=732635e

The issue will most likely be fixed in src:python-x2go (0.4.0.9).

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

---
commit 732635efb177910d23b544d2e05e09559c8af5ff
Author: Kenneth Pedersen <kenneth@wangpedersen.com>
Date:   Thu Oct 24 09:50:00 2013 +0200

    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).

diff --git a/debian/changelog b/debian/changelog
index 8c6ee9e..de471fb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 python-x2go (0.4.0.9-0~x2go1) UNRELEASED; 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.
@@ -16,6 +17,12 @@ python-x2go (0.4.0.9-0~x2go1) UNRELEASED; urgency=low
     - Rewrite passwords that are not string/unicode to an empty string.
     - No Unicode chars in log messages. Eliminated one more in checkhosts.py.
 
+  [ 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).
+
  -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de>  Wed, 07 Aug 2013 12:18:46 +0200
 
 python-x2go (0.4.0.8-0~x2go1) unstable; urgency=low


Added tag(s) pending. Request was from Mike Gabriel <mike.gabriel@das-netzwerkteam.de> to control@bugs.x2go.org. (Thu, 24 Oct 2013 08:03:03 GMT) (full text, mbox, link).


Marked as fixed in versions 0.4.0.9. Request was from Mike Gabriel <mike.gabriel@das-netzwerkteam.de> to control@bugs.x2go.org. (Thu, 24 Oct 2013 08:03:03 GMT) (full text, mbox, link).


Message sent on to kenneth <kenneth@wangpedersen.com>:
Bug#330. (Thu, 24 Oct 2013 08:03:04 GMT) (full text, mbox, link).


Message sent on to kenneth <kenneth@wangpedersen.com>:
Bug#330. (Wed, 08 Jan 2014 14:30:03 GMT) (full text, mbox, link).


Message #20 received at 330-submitter@bugs.x2go.org (full text, mbox, reply):

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
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).


Information forwarded to x2go-dev@lists.berlios.de, X2Go Developers <x2go-dev@lists.berlios.de>:
Bug#330; Package python-x2go. (Wed, 08 Jan 2014 14:35:02 GMT) (full text, mbox, link).


Acknowledgement sent to Mike Gabriel <mike.gabriel@das-netzwerkteam.de>:
Extra info received and forwarded to list. Copy sent to X2Go Developers <x2go-dev@lists.berlios.de>. (Wed, 08 Jan 2014 14:35:02 GMT) (full text, mbox, link).


Marked Bug as done Request was from Mike Gabriel <mike.gabriel@das-netzwerkteam.de> to control@bugs.x2go.org. (Wed, 08 Jan 2014 14:35:03 GMT) (full text, mbox, link).


Notification sent to kenneth <kenneth@wangpedersen.com>:
Bug acknowledged by developer. (Wed, 08 Jan 2014 14:35:03 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.x2go.org> to internal_control@bugs.x2go.org. (Thu, 06 Feb 2014 06:24:01 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


X2Go Developers <owner@bugs.x2go.org>. Last modified: Fri Jan 24 13:57:30 2020; Machine Name: ymir.das-netzwerkteam.de

X2Go Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.