winrt: add logging to platform plugin
Task-number: QTBUG-38114 Change-Id: I24c96bb2e29e1bbfe93dfe45aa764451aa9ddde8 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
parent
e7a06c9843
commit
5b727576b1
@ -47,6 +47,9 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaBackingStore, "qt.qpa.backingstore")
|
||||
Q_LOGGING_CATEGORY(lcQpaBackingStoreVerbose, "qt.qpa.backingstore.verbose")
|
||||
|
||||
class QWinRTBackingStorePrivate
|
||||
{
|
||||
public:
|
||||
@ -62,6 +65,7 @@ QWinRTBackingStore::QWinRTBackingStore(QWindow *window)
|
||||
: QPlatformBackingStore(window), d_ptr(new QWinRTBackingStorePrivate)
|
||||
{
|
||||
Q_D(QWinRTBackingStore);
|
||||
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window;
|
||||
|
||||
d->initialized = false;
|
||||
d->screen = static_cast<QWinRTScreen*>(window->screen()->handle());
|
||||
@ -73,6 +77,7 @@ QWinRTBackingStore::QWinRTBackingStore(QWindow *window)
|
||||
bool QWinRTBackingStore::initialize()
|
||||
{
|
||||
Q_D(QWinRTBackingStore);
|
||||
qCDebug(lcQpaBackingStoreVerbose) << __FUNCTION__ << d->initialized;
|
||||
|
||||
if (d->initialized)
|
||||
return true;
|
||||
@ -94,6 +99,7 @@ bool QWinRTBackingStore::initialize()
|
||||
|
||||
QWinRTBackingStore::~QWinRTBackingStore()
|
||||
{
|
||||
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this;
|
||||
}
|
||||
|
||||
QPaintDevice *QWinRTBackingStore::paintDevice()
|
||||
@ -107,6 +113,8 @@ void QWinRTBackingStore::flush(QWindow *window, const QRegion ®ion, const QPo
|
||||
Q_D(QWinRTBackingStore);
|
||||
Q_UNUSED(offset)
|
||||
|
||||
qCDebug(lcQpaBackingStoreVerbose) << __FUNCTION__ << this << window << region;
|
||||
|
||||
if (d->size.isEmpty())
|
||||
return;
|
||||
|
||||
@ -140,6 +148,8 @@ void QWinRTBackingStore::resize(const QSize &size, const QRegion &staticContents
|
||||
Q_D(QWinRTBackingStore);
|
||||
Q_UNUSED(staticContents)
|
||||
|
||||
qCDebug(lcQpaBackingStoreVerbose) << __FUNCTION__ << this << size;
|
||||
|
||||
if (!initialize())
|
||||
return;
|
||||
|
||||
@ -169,11 +179,14 @@ QImage QWinRTBackingStore::toImage() const
|
||||
|
||||
void QWinRTBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
qCDebug(lcQpaBackingStoreVerbose) << __FUNCTION__ << this << region;
|
||||
|
||||
resize(window()->size(), region);
|
||||
}
|
||||
|
||||
void QWinRTBackingStore::endPaint()
|
||||
{
|
||||
qCDebug(lcQpaBackingStoreVerbose) << __FUNCTION__ << this;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -39,9 +39,13 @@
|
||||
|
||||
#include <qpa/qplatformbackingstore.h>
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaBackingStore)
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaBackingStoreVerbose)
|
||||
|
||||
class QWinRTScreen;
|
||||
|
||||
class QWinRTBackingStorePrivate;
|
||||
|
@ -47,6 +47,20 @@ using namespace Microsoft::WRL;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts")
|
||||
|
||||
QDebug operator<<(QDebug d, const QFontDef &def)
|
||||
{
|
||||
QDebugStateSaver saver(d);
|
||||
d.nospace();
|
||||
d << "Family=" << def.family << " Stylename=" << def.styleName
|
||||
<< " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize
|
||||
<< " styleHint=" << def.styleHint << " weight=" << def.weight
|
||||
<< " stretch=" << def.stretch << " hintingPreference="
|
||||
<< def.hintingPreference;
|
||||
return d;
|
||||
}
|
||||
|
||||
// Based on unicode range tables at http://www.microsoft.com/typography/otspec/os2.htm#ur
|
||||
static QFontDatabase::WritingSystem writingSystemFromUnicodeRange(const DWRITE_UNICODE_RANGE &range)
|
||||
{
|
||||
@ -114,6 +128,7 @@ static QFontDatabase::WritingSystem writingSystemFromUnicodeRange(const DWRITE_U
|
||||
|
||||
QString QWinRTFontDatabase::fontDir() const
|
||||
{
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__;
|
||||
QString fontDirectory = QBasicFontDatabase::fontDir();
|
||||
if (!QFile::exists(fontDirectory)) {
|
||||
// Fall back to app directory + fonts, and just app directory after that
|
||||
@ -130,6 +145,8 @@ QString QWinRTFontDatabase::fontDir() const
|
||||
|
||||
QWinRTFontDatabase::~QWinRTFontDatabase()
|
||||
{
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__;
|
||||
|
||||
foreach (IDWriteFontFile *fontFile, m_fonts.keys())
|
||||
fontFile->Release();
|
||||
|
||||
@ -149,6 +166,8 @@ bool QWinRTFontDatabase::fontsAlwaysScalable() const
|
||||
|
||||
void QWinRTFontDatabase::populateFontDatabase()
|
||||
{
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__;
|
||||
|
||||
ComPtr<IDWriteFactory1> factory;
|
||||
HRESULT hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory1), &factory);
|
||||
if (FAILED(hr)) {
|
||||
@ -204,6 +223,8 @@ void QWinRTFontDatabase::populateFontDatabase()
|
||||
|
||||
void QWinRTFontDatabase::populateFamily(const QString &familyName)
|
||||
{
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << familyName;
|
||||
|
||||
IDWriteFontFamily *fontFamily = m_fontFamilies.value(familyName);
|
||||
if (!fontFamily) {
|
||||
qWarning("The font family %s was not found.", qPrintable(familyName));
|
||||
@ -367,6 +388,8 @@ void QWinRTFontDatabase::populateFamily(const QString &familyName)
|
||||
|
||||
QFontEngine *QWinRTFontDatabase::fontEngine(const QFontDef &fontDef, void *handle)
|
||||
{
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << handle;
|
||||
|
||||
if (!handle) // Happens if a font family population failed
|
||||
return 0;
|
||||
|
||||
@ -436,6 +459,8 @@ QStringList QWinRTFontDatabase::fallbacksForFamily(const QString &family, QFont:
|
||||
Q_UNUSED(styleHint)
|
||||
Q_UNUSED(script)
|
||||
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << family;
|
||||
|
||||
QStringList result;
|
||||
if (family == QLatin1String("Helvetica"))
|
||||
result.append(QStringLiteral("Arial"));
|
||||
@ -445,6 +470,8 @@ QStringList QWinRTFontDatabase::fallbacksForFamily(const QString &family, QFont:
|
||||
|
||||
void QWinRTFontDatabase::releaseHandle(void *handle)
|
||||
{
|
||||
qCDebug(lcQpaFonts) << __FUNCTION__ << handle;
|
||||
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
|
@ -38,12 +38,15 @@
|
||||
#define QWINRTFONTDATABASE_H
|
||||
|
||||
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
struct IDWriteFontFile;
|
||||
struct IDWriteFontFamily;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts)
|
||||
|
||||
struct FontDescription
|
||||
{
|
||||
quint32 index;
|
||||
|
@ -54,6 +54,8 @@ typedef ITypedEventHandler<InputPane*, InputPaneVisibilityEventArgs*> InputPaneV
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods")
|
||||
|
||||
inline QRectF getInputPaneRect(IInputPane *pane, qreal scaleFactor)
|
||||
{
|
||||
Rect rect;
|
||||
@ -78,6 +80,8 @@ inline QRectF getInputPaneRect(IInputPane *pane, qreal scaleFactor)
|
||||
QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen)
|
||||
: m_screen(screen)
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << __FUNCTION__ << screen;
|
||||
|
||||
IInputPaneStatics *statics;
|
||||
if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(),
|
||||
&statics))) {
|
||||
@ -114,6 +118,7 @@ bool QWinRTInputContext::isInputPanelVisible() const
|
||||
|
||||
HRESULT QWinRTInputContext::onShowing(IInputPane *pane, IInputPaneVisibilityEventArgs *)
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane;
|
||||
m_isInputPanelVisible = true;
|
||||
emitInputPanelVisibleChanged();
|
||||
return handleVisibilityChange(pane);
|
||||
@ -121,6 +126,7 @@ HRESULT QWinRTInputContext::onShowing(IInputPane *pane, IInputPaneVisibilityEven
|
||||
|
||||
HRESULT QWinRTInputContext::onHiding(IInputPane *pane, IInputPaneVisibilityEventArgs *)
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane;
|
||||
m_isInputPanelVisible = false;
|
||||
emitInputPanelVisibleChanged();
|
||||
return handleVisibilityChange(pane);
|
||||
@ -128,6 +134,7 @@ HRESULT QWinRTInputContext::onHiding(IInputPane *pane, IInputPaneVisibilityEvent
|
||||
|
||||
HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane)
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane;
|
||||
const QRectF keyboardRect = getInputPaneRect(pane, m_screen->scaleFactor());
|
||||
if (m_keyboardRect != keyboardRect) {
|
||||
m_keyboardRect = keyboardRect;
|
||||
@ -165,6 +172,8 @@ static HRESULT getInputPane(ComPtr<IInputPane2> *inputPane2)
|
||||
|
||||
void QWinRTInputContext::showInputPanel()
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << __FUNCTION__;
|
||||
|
||||
QEventDispatcherWinRT::runOnXamlThread([&]() {
|
||||
ComPtr<IInputPane2> inputPane;
|
||||
HRESULT hr = getInputPane(&inputPane);
|
||||
@ -180,6 +189,8 @@ void QWinRTInputContext::showInputPanel()
|
||||
|
||||
void QWinRTInputContext::hideInputPanel()
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << __FUNCTION__;
|
||||
|
||||
QEventDispatcherWinRT::runOnXamlThread([&]() {
|
||||
ComPtr<IInputPane2> inputPane;
|
||||
HRESULT hr = getInputPane(&inputPane);
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include <qpa/qplatforminputcontext.h>
|
||||
#include <QtCore/QRectF>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
#include <wrl.h>
|
||||
|
||||
@ -58,6 +59,8 @@ namespace ABI {
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaInputMethods)
|
||||
|
||||
class QWinRTScreen;
|
||||
class QWinRTInputContext : public QPlatformInputContext
|
||||
{
|
||||
|
@ -56,6 +56,8 @@ using namespace ABI::Windows::UI::ViewManagement;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaTheme, "qt.qpa.theme")
|
||||
|
||||
static IUISettings *uiSettings()
|
||||
{
|
||||
static ComPtr<IUISettings> settings;
|
||||
@ -285,12 +287,14 @@ QWinRTTheme::QWinRTTheme()
|
||||
: d_ptr(new QWinRTThemePrivate)
|
||||
{
|
||||
Q_D(QWinRTTheme);
|
||||
qCDebug(lcQpaTheme) << __FUNCTION__;
|
||||
|
||||
nativeColorSettings(d->palette);
|
||||
}
|
||||
|
||||
bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const
|
||||
{
|
||||
qCDebug(lcQpaTheme) << __FUNCTION__ << type;
|
||||
static bool useNativeDialogs = qEnvironmentVariableIsSet("QT_USE_WINRT_NATIVE_DIALOGS")
|
||||
? qEnvironmentVariableIntValue("QT_USE_WINRT_NATIVE_DIALOGS") : true;
|
||||
|
||||
@ -301,6 +305,7 @@ bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const
|
||||
|
||||
QPlatformDialogHelper *QWinRTTheme::createPlatformDialogHelper(DialogType type) const
|
||||
{
|
||||
qCDebug(lcQpaTheme) << __FUNCTION__ << type;
|
||||
switch (type) {
|
||||
case FileDialog:
|
||||
return new QWinRTFileDialogHelper;
|
||||
@ -314,6 +319,7 @@ QPlatformDialogHelper *QWinRTTheme::createPlatformDialogHelper(DialogType type)
|
||||
|
||||
QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
|
||||
{
|
||||
qCDebug(lcQpaTheme) << __FUNCTION__ << hint;
|
||||
HRESULT hr;
|
||||
switch (hint) {
|
||||
case QPlatformIntegration::CursorFlashTime: {
|
||||
@ -363,6 +369,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
|
||||
const QPalette *QWinRTTheme::palette(Palette type) const
|
||||
{
|
||||
Q_D(const QWinRTTheme);
|
||||
qCDebug(lcQpaTheme) << __FUNCTION__ << type;
|
||||
if (type == SystemPalette)
|
||||
return &d->palette;
|
||||
return QPlatformTheme::palette(type);
|
||||
|
@ -39,9 +39,12 @@
|
||||
|
||||
#include <qpa/qplatformtheme.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaTheme)
|
||||
|
||||
class QWinRTThemePrivate;
|
||||
class QWinRTTheme : public QPlatformTheme
|
||||
{
|
||||
|
@ -69,6 +69,8 @@ using namespace ABI::Windows::UI::Xaml::Controls;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaWindows, "qt.qpa.windows");
|
||||
|
||||
static void setUIElementVisibility(IUIElement *uiElement, bool visibility)
|
||||
{
|
||||
Q_ASSERT(uiElement);
|
||||
@ -101,6 +103,7 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
|
||||
, d_ptr(new QWinRTWindowPrivate)
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this;
|
||||
|
||||
d->surface = EGL_NO_SURFACE;
|
||||
d->display = EGL_NO_DISPLAY;
|
||||
@ -161,6 +164,7 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
|
||||
QWinRTWindow::~QWinRTWindow()
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this;
|
||||
|
||||
HRESULT hr;
|
||||
hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
|
||||
@ -187,6 +191,8 @@ QWinRTWindow::~QWinRTWindow()
|
||||
if (!d->surface)
|
||||
return;
|
||||
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << ": Destroying surface";
|
||||
|
||||
EGLBoolean value = eglDestroySurface(d->display, d->surface);
|
||||
d->surface = EGL_NO_SURFACE;
|
||||
if (value == EGL_FALSE)
|
||||
@ -214,12 +220,15 @@ bool QWinRTWindow::isExposed() const
|
||||
void QWinRTWindow::setGeometry(const QRect &rect)
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this << rect;
|
||||
|
||||
const Qt::WindowFlags windowFlags = window()->flags();
|
||||
const Qt::WindowFlags windowType = windowFlags & Qt::WindowType_Mask;
|
||||
if (window()->isTopLevel() && (windowType == Qt::Window || windowType == Qt::Dialog)) {
|
||||
QPlatformWindow::setGeometry(windowFlags & Qt::MaximizeUsingFullscreenGeometryHint
|
||||
? d->screen->geometry() : d->screen->availableGeometry());
|
||||
const QRect screenRect = windowFlags & Qt::MaximizeUsingFullscreenGeometryHint
|
||||
? d->screen->geometry() : d->screen->availableGeometry();
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << "top-level, overwrite" << screenRect;
|
||||
QPlatformWindow::setGeometry(screenRect);
|
||||
QWindowSystemInterface::handleGeometryChange(window(), geometry());
|
||||
} else {
|
||||
QPlatformWindow::setGeometry(rect);
|
||||
@ -243,6 +252,8 @@ void QWinRTWindow::setGeometry(const QRect &rect)
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = frameworkElement->put_Height(size.height());
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << "(setGeometry Xaml)" << this
|
||||
<< topLeft << size;
|
||||
return S_OK;
|
||||
});
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
@ -251,6 +262,8 @@ void QWinRTWindow::setGeometry(const QRect &rect)
|
||||
void QWinRTWindow::setVisible(bool visible)
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this << visible;
|
||||
|
||||
if (!window()->isTopLevel())
|
||||
return;
|
||||
if (visible) {
|
||||
@ -272,6 +285,7 @@ void QWinRTWindow::setWindowTitle(const QString &title)
|
||||
void QWinRTWindow::raise()
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this;
|
||||
if (!window()->isTopLevel())
|
||||
return;
|
||||
d->screen->raise(window());
|
||||
@ -280,6 +294,7 @@ void QWinRTWindow::raise()
|
||||
void QWinRTWindow::lower()
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this;
|
||||
if (!window()->isTopLevel())
|
||||
return;
|
||||
d->screen->lower(window());
|
||||
@ -299,6 +314,8 @@ qreal QWinRTWindow::devicePixelRatio() const
|
||||
void QWinRTWindow::setWindowState(Qt::WindowState state)
|
||||
{
|
||||
Q_D(QWinRTWindow);
|
||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this << state;
|
||||
|
||||
if (d->state == state)
|
||||
return;
|
||||
|
||||
|
@ -37,12 +37,15 @@
|
||||
#ifndef QWINRTWINDOW_H
|
||||
#define QWINRTWINDOW_H
|
||||
|
||||
#include <QtCore/QLoggingCategory>
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaWindows)
|
||||
|
||||
class QWinRTWindowPrivate;
|
||||
class QWinRTWindow : public QPlatformWindow
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user