Subject: Set DPI to same as local display by default

From: Orion Poplawski <[email-masked]>
Date: Wed, 10 Apr 2013 12:16:45 -0600

Package: x2goclient
Version: 4.0.1.0
Tags: patch

I think it would be nice to have sessions set the DPI to that of the local 
display by default.

I'm not entirely sure if physicalDpiX or logicalDpiX is better here.

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       [email-masked]
Boulder, CO 80301                   http://www.nwra.com
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 31dbc17..5f37cc1 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -61,8 +61,6 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
     showHaltBtn=false;
     defaultUseSound=true;
     defaultSetKbd=true;
-    defaultSetDPI=false;
-    defaultDPI=96;
     extStarted=false;
     cmdAutologin=false;
     defaultLink=2;
@@ -107,6 +105,16 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
     cmdAutologin=false;

+// Try to determine the native DPI and use it for the default
+    int dpix = QApplication::desktop()->physicalDpiX();
+    int dpiy = QApplication::desktop()->physicalDpiY();
+    if ( dpix >0 && dpiy >0) {
+        defaultSetDPI=true;
+        defaultDPI=(dpix+dpiy)/2;
+    } else {
+        defaultSetDPI=false;
+        defaultDPI=96;
+    }
 
 #ifdef Q_OS_WIN
     clientSshPort="7022";
@@ -6661,7 +6669,7 @@ void ONMainWindow::showHelp()
         "--user=<username>\t\t select user 'username'\n"
         "--geomerty=<W>x<H>|fullscreen\t set default geometry, default "
         "value '800x600'\n"
-        "--dpi=<dpi>\t\t\t set dpi of x2goagent to dpi, default not set\n"
+        "--dpi=<dpi>\t\t\t set dpi of x2goagent to dpi, default set to same as local display\n"
         "--link=<modem|isdn|adsl|wan|lan> set default link type, "
         "default 'adsl'\n"
         "--pack=<packmethod>\t\t set default pack method, default "

---

From: Ricardo Díaz Martín <[email-masked]>
Date: Wed, 10 Apr 2013 20:58:54 +0200

Please, be carefully with mac client and retina display ppi...

2013/4/10 Orion Poplawski <[email-masked]>:
> _______________________________________________
> X2Go-Dev mailing list
> [email-masked]
> https://lists.berlios.de/mailman/listinfo/x2go-dev