From 63e56b90c57578b0fe1d2143a3fec08ba4d08fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 22 Mar 2012 14:14:39 +0100 Subject: [PATCH] Fixed QScreen::name() return value on xcb. Previously the primary sceen number wasn't stripped before adding the actual screen number, resulting in names such as ":0.0.0". Change-Id: Ifbcf12dcf1c200fd6bc5e4b95a5d82483957e0d2 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbscreen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8b66ef4603..a076dd4282 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -367,7 +367,11 @@ QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) QString QXcbScreen::name() const { - return connection()->displayName() + QLatin1String(".") + QString::number(screenNumber()); + QByteArray displayName = connection()->displayName(); + int dotPos = displayName.lastIndexOf('.'); + if (dotPos != -1) + displayName.truncate(dotPos); + return displayName + QLatin1Char('.') + QString::number(screenNumber()); } QT_END_NAMESPACE