diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 24 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 67 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.h | 9 |
5 files changed, 66 insertions, 39 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e8fab31480..43c73671a9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -80,6 +80,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices") +Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen") #ifdef XCB_USE_XLIB static const char * const xcbConnectionErrors[] = { @@ -185,15 +186,11 @@ void QXcbConnection::updateScreens() if (output == NULL) continue; -#ifdef Q_XCB_DEBUG - QString outputName = QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output), - xcb_randr_get_output_info_name_length(output)); -#endif if (output->crtc == XCB_NONE) { -#ifdef Q_XCB_DEBUG - qDebug("Screen output %s is not connected", qPrintable(outputName)); -#endif + qCDebug(lcQpaScreen, "output %s is not connected", qPrintable( + QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output), + xcb_randr_get_output_info_name_length(output)))); continue; } @@ -209,9 +206,6 @@ void QXcbConnection::updateScreens() if (!primaryScreen || (primary && outputs[i] == primary->output)) { primaryScreen = screen; siblings.prepend(siblings.takeLast()); -#ifdef Q_XCB_DEBUG - qDebug("Primary output is %d: %s", primary->output, qPrintable(outputName)); -#endif } } free(output); @@ -224,9 +218,7 @@ void QXcbConnection::updateScreens() // If there's no randr extension, or there was some error above, or the screen // doesn't have outputs for some other reason (e.g. on VNC or ssh -X), just assume there is one screen. if (connectedOutputCount == 0) { -#ifdef Q_XCB_DEBUG - qDebug("Found a screen with zero outputs"); -#endif + qCDebug(lcQpaScreen, "found a screen with zero outputs"); QXcbScreen *screen = findOrCreateScreen(newScreens, xcbScreenNumber, xcbScreen); siblings << screen; activeScreens << screen; @@ -259,18 +251,21 @@ void QXcbConnection::updateScreens() if (newScreens.contains(primaryScreen)) { newScreens.removeOne(primaryScreen); m_screens.prepend(primaryScreen); + qCDebug(lcQpaScreen) << "adding as primary" << primaryScreen; integration->screenAdded(primaryScreen, true); } // Add the remaining new screens foreach (QXcbScreen* screen, newScreens) { m_screens.append(screen); + qCDebug(lcQpaScreen) << "adding" << screen; integration->screenAdded(screen); } // Delete the old screens, now that the new ones were added // and we are sure that there is at least one screen available foreach (QXcbScreen* screen, screensToDelete) { + qCDebug(lcQpaScreen) << "removing" << screen; integration->destroyScreen(screen); } @@ -284,6 +279,9 @@ void QXcbConnection::updateScreens() m_screens.prepend(primaryScreen); } } + + if (!m_screens.isEmpty()) + qCDebug(lcQpaScreen) << "primary output is" << m_screens.first()->name(); } QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, const char *displayName) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 90b859e612..391d4c10cc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -77,6 +77,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQpaXInput) Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputDevices) +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen) class QXcbScreen; class QXcbWindow; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 3f497996d8..1676035f6b 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -170,9 +170,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, displayName); for (int i = 0; i < parameters.size() - 1; i += 2) { -#ifdef Q_XCB_DEBUG - qDebug() << "QXcbIntegration: Connecting to additional display: " << parameters.at(i) << parameters.at(i+1); -#endif + qCDebug(lcQpaScreen) << "connecting to additional display: " << parameters.at(i) << parameters.at(i+1); QString display = parameters.at(i) + QLatin1Char(':') + parameters.at(i+1); m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, display.toLatin1().constData()); } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index e43652ab37..58a364848a 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -93,25 +93,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, if (dpr_scaling_enabled) m_noFontHinting = true; -#ifdef Q_XCB_DEBUG - qDebug(); - qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number); - qDebug(" width..........: %lf", m_sizeMillimeters.width()); - qDebug(" height.........: %lf", m_sizeMillimeters.height()); - qDebug(" geometry.......: %d x %d +%d +%d", m_geometry.width(), m_geometry.height(), m_geometry.x(), m_geometry.y()); - qDebug(" virtual width..: %lf", m_virtualSizeMillimeters.width()); - qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height()); - qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height()); - qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y()); - qDebug(" orientation....: %d", m_orientation); - qDebug(" pixel ratio....: %d", m_devicePixelRatio); - qDebug(" depth..........: %d", screen()->root_depth); - qDebug(" white pixel....: %x", screen()->white_pixel); - qDebug(" black pixel....: %x", screen()->black_pixel); - qDebug(" refresh rate...: %d", m_refreshRate); - qDebug(" root ID........: %x", screen()->root); -#endif - QScopedPointer<xcb_get_window_attributes_reply_t, QScopedPointerPodDeleter> rootAttribs( xcb_get_window_attributes_reply(xcb_connection(), xcb_get_window_attributes_unchecked(xcb_connection(), screen()->root), NULL)); @@ -146,10 +127,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, atom(QXcbAtom::UTF8_STRING), 0, 1024), NULL); if (windowManagerReply && windowManagerReply->format == 8 && windowManagerReply->type == atom(QXcbAtom::UTF8_STRING)) { m_windowManagerName = QString::fromUtf8((const char *)xcb_get_property_value(windowManagerReply), xcb_get_property_value_length(windowManagerReply)); -#ifdef Q_XCB_DEBUG - qDebug(" window manager.: %s", qPrintable(m_windowManagerName)); - qDebug(); -#endif } free(windowManagerReply); @@ -709,4 +686,48 @@ QXcbXSettings *QXcbScreen::xSettings() const } return m_xSettings; } + +static inline void formatRect(QDebug &debug, const QRect r) +{ + debug << r.width() << 'x' << r.height() + << forcesign << r.x() << r.y() << noforcesign; +} + +static inline void formatSizeF(QDebug &debug, const QSizeF s) +{ + debug << s.width() << 'x' << s.height() << "mm"; +} + +Q_XCB_EXPORT QDebug operator<<(QDebug debug, const QXcbScreen *screen) +{ + const QDebugStateSaver saver(debug); + debug.nospace(); + debug << "QXcbScreen(" << (void *)screen; + if (screen) { + debug << fixed << qSetRealNumberPrecision(1); + debug << ", name=" << screen->name(); + debug << ", geometry="; + formatRect(debug, screen->geometry()); + debug << ", availableGeometry="; + formatRect(debug, screen->availableGeometry()); + debug << ", devicePixelRatio=" << screen->devicePixelRatio(); + debug << ", logicalDpi=" << screen->logicalDpi(); + debug << ", physicalSize="; + formatSizeF(debug, screen->physicalSize()); + // TODO 5.6 if (debug.verbosity() > 2) { + debug << ", screenNumber=" << screen->screenNumber(); + debug << ", virtualSize=" << screen->virtualSize().width() << "x" << screen->virtualSize().height() << " ("; + formatSizeF(debug, screen->virtualSize()); + debug << "), nativeGeometry="; + formatRect(debug, screen->nativeGeometry()); + debug << ", orientation=" << screen->orientation(); + debug << ", depth=" << screen->depth(); + debug << ", refreshRate=" << screen->refreshRate(); + debug << ", root=" << hex << screen->root(); + debug << ", windowManagerName=" << screen->windowManagerName(); + } + debug << ')'; + return debug; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index f327eb31b0..53ad413541 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -50,6 +50,9 @@ QT_BEGIN_NAMESPACE class QXcbConnection; class QXcbCursor; class QXcbXSettings; +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +#endif class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen { @@ -68,6 +71,8 @@ public: int depth() const Q_DECL_OVERRIDE { return m_screen->root_depth; } QImage::Format format() const Q_DECL_OVERRIDE; QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_sizeMillimeters; } + QSize virtualSize() const { return m_virtualSize; } + QSizeF physicalVirtualSize() const { return m_virtualSizeMillimeters; } QDpi logicalDpi() const Q_DECL_OVERRIDE; qreal devicePixelRatio() const Q_DECL_OVERRIDE; QPlatformCursor *cursor() const Q_DECL_OVERRIDE; @@ -140,6 +145,10 @@ private: QXcbXSettings *m_xSettings; }; +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QXcbScreen *); +#endif + QT_END_NAMESPACE #endif |