summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-03-04 15:22:23 (GMT)
committerLuboš Luňák <l.lunak@suse.cz>2011-03-04 15:22:23 (GMT)
commitc24ea2b4aac214ce29afc013cc037c110a24aa12 (patch)
tree0b0b8e9fa61388589f3bfcc45836c1212eeec3d4
parent711a4af84a3c449d85ea0e9d5caf9fa30a408d54 (diff)
do not show hostname in titlebar if it's FQDN of localhost
-rw-r--r--kwin/utils.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/kwin/utils.cpp b/kwin/utils.cpp
index 20d2ad0..92a89e5 100644
--- a/kwin/utils.cpp
+++ b/kwin/utils.cpp
@@ -421,6 +421,13 @@ bool isLocalMachine(const QByteArray& host)
*dot = '\0';
if (host == hostnamebuf)
return true;
+ } else { // e.g. LibreOffice likes to give FQDN, even if gethostname() doesn't include domain
+ QByteArray h = hostnamebuf;
+ if( getdomainname( hostnamebuf, sizeof hostnamebuf ) >= 0 ) {
+ hostnamebuf[sizeof(hostnamebuf)-1] = 0;
+ if( host == h + '.' + QByteArray( hostnamebuf ))
+ return true;
+ }
}
}
return false;