Port Windows QPA plugin to new logger API.

Introduce logging categories and change most debug statements
to qCDebug().

Retrieve the filter rules from the environment variable
QT_QPA_VERBOSE (should be removed once the logging framework
offers a more convenient way of configuring).

Replace the old per-category variables controlling verboseness
of the output by a single variable which can be set on the command
line.

Change-Id: Iae55ecdb0e150efd165b7d3e90b371f72853f194
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2014-01-10 17:17:12 +01:00 committed by The Qt Project
parent a5c288ea56
commit db51ffc0d1
27 changed files with 352 additions and 541 deletions

View File

@ -59,10 +59,10 @@ HRESULT STDMETHODCALLTYPE AccessibleApplication::QueryInterface(REFIID id, LPVOI
{
*iface = 0;
if (id == IID_IUnknown) {
accessibleDebug("AccessibleApplication::QI(): IID_IUnknown");
qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IUnknown";
*iface = (IUnknown*)this;
} else if (id == IID_IAccessibleApplication) {
accessibleDebug("AccessibleApplication::QI(): IID_IAccessibleApplication");
qCDebug(lcQpaAccessibility) << "AccessibleApplication::QI(): IID_IAccessibleApplication";
*iface = static_cast<IAccessibleApplication*>(this);
}
@ -476,7 +476,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_uniqueID(long *outUniqueID)
if (!accessible)
return E_FAIL;
accessibleDebug("uniqueID: %08x", id);
qCDebug(lcQpaAccessibility) << "uniqueID: " << showbase << hex << id;
*outUniqueID = (long)id;
return int(id) < 0 ? S_OK : S_FALSE;
@ -841,7 +841,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_cellAt( long row, long colu
*cell = QWindowsAccessibility::wrap(qtCell);
}
}
accessibleDebug("found cell? %p", *cell);
qCDebug(lcQpaAccessibility) << "found cell? " << *cell;
return *cell ? S_OK : S_FALSE;
}
@ -1574,7 +1574,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic
return E_POINTER;
Q_UNUSED(guidService);
*iface = 0;
accessibleDebug("QWindowsIA2Accessible::QS(): %s", IIDToString(riid).constData());
qCDebug(lcQpaAccessibility) << "QWindowsIA2Accessible::QS(): " << IIDToString(riid);
if (guidService == IID_IAccessible) {

View File

@ -185,23 +185,10 @@ HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Skip(unsigned long celt)
return S_OK;
}
#ifndef QT_NO_DEBUG
bool debug_accessibility()
{
static int debugging = -1;
if (debugging == -1)
debugging = qgetenv("QT_DEBUG_ACCESSIBILITY").toInt();
return !!debugging;
}
#endif
#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface)
{
QString str;
QDebug dbg(&str);
dbg << iface << QLatin1String(funcName);
accessibleDebug("%s", qPrintable(str));
qCDebug(lcQpaAccessibility) << iface << funcName;
}
#endif
@ -216,10 +203,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::QueryInterface(REFIID id, LPVO
QByteArray strIID = IIDToString(id);
if (!strIID.isEmpty()) {
QString ss;
QDebug dbg(&ss);
dbg << accessibleInterface();
accessibleDebug("QWindowsIA2Accessible::QI() - IID:%s, iface:%s ", strIID.constData(), qPrintable(ss));
qCDebug(lcQpaAccessibility) << "QWindowsIA2Accessible::QI() - IID:"
<< strIID << ", iface:" << accessibleInterface();
}
if (id == IID_IUnknown) {
*iface = (IUnknown*)(IDispatch*)this;
@ -1057,7 +1042,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BS
}
*pszValue = 0;
accessibleDebug("return S_FALSE");
qCDebug(lcQpaAccessibility) << "return S_FALSE";
return S_FALSE;
}
@ -1196,7 +1181,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
Q_ASSERT(platform);
*phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
accessibleDebug("QWindowsAccessible::GetWindow(): %p", *phwnd);
qCDebug(lcQpaAccessibility) << "QWindowsAccessible::GetWindow(): " << *phwnd;
return S_OK;
}

View File

@ -59,13 +59,6 @@
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_OUTPUT)
bool debug_accessibility();
# define accessibleDebug !debug_accessibility() ? (void)0 : qDebug
#else
# define accessibleDebug while (false) qDebug
#endif
#ifndef QT_NO_DEBUG_OUTPUT
#define DEBUG_SHOW_ATCLIENT_COMMANDS
#endif

View File

@ -61,14 +61,12 @@ QT_BEGIN_NAMESPACE
QWindowsBackingStore::QWindowsBackingStore(QWindow *window) :
QPlatformBackingStore(window)
{
if (QWindowsContext::verboseBackingStore)
qDebug() << __FUNCTION__ << this << window;
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window;
}
QWindowsBackingStore::~QWindowsBackingStore()
{
if (QWindowsContext::verboseBackingStore)
qDebug() << __FUNCTION__ << this;
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this;
}
QPaintDevice *QWindowsBackingStore::paintDevice()
@ -83,8 +81,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
Q_ASSERT(window);
const QRect br = region.boundingRect();
if (QWindowsContext::verboseBackingStore > 1)
qDebug() << __FUNCTION__ << window << offset << br;
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window << offset << br;
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
#ifndef Q_OS_WINCE
@ -128,12 +126,12 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
#endif
// Write image for debug purposes.
if (QWindowsContext::verboseBackingStore > 2) {
if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) {
static int n = 0;
const QString fileName = QString::fromLatin1("win%1_%2.png").
arg(rw->winId()).arg(n++);
m_image->image().save(fileName);
qDebug() << "Wrote " << m_image->image().size() << fileName;
qCDebug(lcQpaBackingStore) << "Wrote " << m_image->image().size() << fileName;
}
}
@ -141,12 +139,10 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion &region)
{
if (m_image.isNull() || m_image->image().size() != size) {
#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseBackingStore) {
QDebug nsp = qDebug().nospace();
nsp << __FUNCTION__ << ' ' << rasterWindow()->window()
<< ' ' << size << ' ' << region;
if (!m_image.isNull())
nsp << " from: " << m_image->image().size();
if (QWindowsContext::verbose && lcQpaBackingStore().isDebugEnabled()) {
qCDebug(lcQpaBackingStore)
<< __FUNCTION__ << ' ' << rasterWindow()->window() << ' ' << size << ' ' << region
<< " from: " << (m_image.isNull() ? QSize() : m_image->image().size());
}
#endif
QImage::Format format = QWindowsNativeImage::systemFormat();
@ -188,8 +184,8 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy)
void QWindowsBackingStore::beginPaint(const QRegion &region)
{
if (QWindowsContext::verboseBackingStore > 1)
qDebug() << __FUNCTION__;
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaBackingStore) <<__FUNCTION__ << region;
if (m_image->image().hasAlphaChannel()) {
QPainter p(&m_image->image());

View File

@ -164,9 +164,7 @@ void QWindowsClipboard::registerViewer()
qClipboardViewerWndProc, WS_OVERLAPPED);
m_nextClipboardViewer = SetClipboardViewer(m_clipboardViewer);
if (QWindowsContext::verboseOLE)
qDebug("%s m_clipboardViewer: %p next=%p", __FUNCTION__,
m_clipboardViewer, m_nextClipboardViewer);
qCDebug(lcQpaMime) << __FUNCTION__ << "m_clipboardViewer: " << m_clipboardViewer << "next: " << m_nextClipboardViewer;
}
void QWindowsClipboard::unregisterViewer()
@ -219,9 +217,8 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L
bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
{
*result = 0;
if (QWindowsContext::verboseOLE)
qDebug("%s HWND=%p 0x%x %s", __FUNCTION__, hwnd, message,
QWindowsGuiEventDispatcher::windowsMessageName(message));
if (QWindowsContext::verbose)
qCDebug(lcQpaMime) << __FUNCTION__ << hwnd << message << QWindowsGuiEventDispatcher::windowsMessageName(message);
switch (message) {
case WM_CHANGECBCHAIN: {
@ -235,8 +232,7 @@ bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM w
return true;
case WM_DRAWCLIPBOARD: {
const bool owned = ownsClipboard();
if (QWindowsContext::verboseOLE)
qDebug("Clipboard changed owned %d", owned);
qCDebug(lcQpaMime) << "Clipboard changed owned " << owned;
emitChanged(QClipboard::Clipboard);
// clean up the clipboard object if we no longer own the clipboard
if (!owned && m_data)
@ -247,8 +243,7 @@ bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM w
case WM_DESTROY:
// Recommended shutdown
if (ownsClipboard()) {
if (QWindowsContext::verboseOLE)
qDebug("Clipboard owner on shutdown, releasing.");
qCDebug(lcQpaMime) << "Clipboard owner on shutdown, releasing.";
OleFlushClipboard();
releaseIData();
}
@ -259,8 +254,7 @@ bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM w
QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode)
{
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << mode;
qCDebug(lcQpaMime) << __FUNCTION__ << mode;
if (mode != QClipboard::Clipboard)
return 0;
if (ownsClipboard())
@ -270,8 +264,7 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode)
void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode)
{
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << mode << *mimeData;
qCDebug(lcQpaMime) << __FUNCTION__ << mode << *mimeData;
if (mode != QClipboard::Clipboard)
return;
@ -316,8 +309,7 @@ bool QWindowsClipboard::ownsMode(QClipboard::Mode mode) const
{
const bool result = mode == QClipboard::Clipboard ?
ownsClipboard() : false;
if (QWindowsContext::verboseOLE)
qDebug("%s %d returns %d", __FUNCTION__, mode, result);
qCDebug(lcQpaMime) << __FUNCTION__ << mode << result;
return result;
}

View File

@ -79,16 +79,18 @@
QT_BEGIN_NAMESPACE
// Verbosity of components
int QWindowsContext::verboseWindows = 0;
int QWindowsContext::verboseEvents = 0;
int QWindowsContext::verboseBackingStore = 0;
int QWindowsContext::verboseFonts = 0;
int QWindowsContext::verboseGL = 0;
int QWindowsContext::verboseOLE = 0;
int QWindowsContext::verboseInputMethods = 0;
int QWindowsContext::verboseDialogs = 0;
int QWindowsContext::verboseTablet = 0;
Q_LOGGING_CATEGORY(lcQpaWindows, "qt.qpa.windows")
Q_LOGGING_CATEGORY(lcQpaBackingStore, "qt.qpa.backingstore")
Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events")
Q_LOGGING_CATEGORY(lcQpaFonts, "qt.qpa.fonts")
Q_LOGGING_CATEGORY(lcQpaGl, "qt.qpa.gl")
Q_LOGGING_CATEGORY(lcQpaMime, "qt.qpa.mime")
Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.inputmethods")
Q_LOGGING_CATEGORY(lcQpaDialogs, "qt.qpa.dialogs")
Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.tabletsupport")
Q_LOGGING_CATEGORY(lcQpaAccessibility, "qt.qpa.accessibility")
int QWindowsContext::verbose = 0;
// Get verbosity of components from "foo:2,bar:3"
static inline int componentVerbose(const char *v, const char *keyWord)
@ -316,23 +318,13 @@ QWindowsContext::QWindowsContext() :
# pragma warning( disable : 4996 )
#endif
m_instance = this;
// ### FIXME: Remove this once the logging system has other options of configurations.
const QByteArray bv = qgetenv("QT_QPA_VERBOSE");
if (!bv.isEmpty()) {
const char *v = bv.data();
QWindowsContext::verboseWindows = componentVerbose(v, "windows");
QWindowsContext::verboseEvents = componentVerbose(v, "events");
QWindowsContext::verboseBackingStore = componentVerbose(v, "backingstore");
QWindowsContext::verboseFonts = componentVerbose(v, "fonts");
QWindowsContext::verboseGL = componentVerbose(v, "gl");
QWindowsContext::verboseOLE = componentVerbose(v, "ole");
QWindowsContext::verboseInputMethods = componentVerbose(v, "im");
QWindowsContext::verboseDialogs = componentVerbose(v, "dialogs");
QWindowsContext::verboseTablet = componentVerbose(v, "tablet");
}
if (!bv.isEmpty())
QLoggingCategory::setFilterRules(QString::fromLocal8Bit(bv));
#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
d->m_tabletSupport.reset(QWindowsTabletSupport::create());
if (QWindowsContext::verboseTablet)
qDebug() << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description());
qCDebug(lcQpaTablet) << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description());
#endif
}
@ -515,8 +507,7 @@ QString QWindowsContext::registerWindowClass(QString cname,
qPrintable(cname));
d->m_registeredWindowClassNames.insert(cname);
if (QWindowsContext::verboseWindows)
qDebug().nospace() << __FUNCTION__ << ' ' << cname
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << ' ' << cname
<< " style=0x" << QString::number(style, 16)
<< " brush=" << brush << " icon=" << icon << " atom=" << atom;
return cname;
@ -827,8 +818,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
// Suppress events sent during DestroyWindow() for native children.
if (platformWindow->testFlag(QWindowsWindow::WithinDestroy))
return false;
if (QWindowsContext::verboseEvents > 1)
qDebug().nospace() << "Event window: " << platformWindow->window();
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaEvents) << "Event window: " << platformWindow->window();
} else {
qWarning("%s: No Qt Window found for event 0x%x (%s), hwnd=0x%p.",
__FUNCTION__, message,
@ -1074,11 +1065,13 @@ extern "C" LRESULT QT_WIN_CALLBACK qWindowsWndProc(HWND hwnd, UINT message, WPAR
LRESULT result;
const QtWindows::WindowsEventType et = windowsEventType(message, wParam);
const bool handled = QWindowsContext::instance()->windowsProc(hwnd, message, et, wParam, lParam, &result);
if (QWindowsContext::verboseEvents > 1)
if (const char *eventName = QWindowsGuiEventDispatcher::windowsMessageName(message))
qDebug("EVENT: hwd=%p %s msg=0x%x et=0x%x wp=%d at %d,%d handled=%d",
hwnd, eventName, message, et, int(wParam),
GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), handled);
if (QWindowsContext::verbose > 1 && lcQpaEvents().isDebugEnabled()) {
if (const char *eventName = QWindowsGuiEventDispatcher::windowsMessageName(message)) {
qCDebug(lcQpaEvents) << "EVENT: hwd=" << hwnd << eventName << hex << "msg=0x" << message
<< "et=0x" << et << dec << "wp=" << int(wParam) << "at"
<< GET_X_LPARAM(lParam) << GET_Y_LPARAM(lParam) << "handled=" << handled;
}
}
if (!handled)
result = DefWindowProc(hwnd, message, wParam, lParam);
return result;

View File

@ -47,12 +47,24 @@
#include <QtCore/QScopedPointer>
#include <QtCore/QSharedPointer>
#include <QtCore/QLoggingCategory>
struct IBindCtx;
struct _SHSTOCKICONINFO;
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQpaWindows)
Q_DECLARE_LOGGING_CATEGORY(lcQpaBackingStore)
Q_DECLARE_LOGGING_CATEGORY(lcQpaEvents)
Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts)
Q_DECLARE_LOGGING_CATEGORY(lcQpaGl)
Q_DECLARE_LOGGING_CATEGORY(lcQpaMime)
Q_DECLARE_LOGGING_CATEGORY(lcQpaInputMethods)
Q_DECLARE_LOGGING_CATEGORY(lcQpaDialogs)
Q_DECLARE_LOGGING_CATEGORY(lcQpaTablet)
Q_DECLARE_LOGGING_CATEGORY(lcQpaAccessibility)
class QWindow;
class QPlatformScreen;
class QWindowsScreenManager;
@ -128,15 +140,7 @@ public:
};
// Verbose flag set by environment variable QT_QPA_VERBOSE
static int verboseWindows;
static int verboseBackingStore;
static int verboseEvents;
static int verboseFonts;
static int verboseGL;
static int verboseOLE;
static int verboseInputMethods;
static int verboseDialogs;
static int verboseTablet;
static int verbose;
explicit QWindowsContext();
~QWindowsContext();

View File

@ -441,9 +441,6 @@ QWindowsWindowCursor QWindowsCursor::pixmapWindowCursor(const QCursor &c)
void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window)
{
if (QWindowsContext::verboseWindows > 1)
qDebug() << __FUNCTION__ << cursorIn << window;
if (!window)
return;
if (!cursorIn) {
@ -470,8 +467,6 @@ QPoint QWindowsCursor::mousePosition()
void QWindowsCursor::setPos(const QPoint &pos)
{
if (QWindowsContext::verboseWindows)
qDebug("%s %d,%d", __FUNCTION__, pos.x(), pos.y());
SetCursorPos(pos.x(), pos.y());
}

View File

@ -422,8 +422,7 @@ void eatMouseMove()
;
if (msg.message == WM_MOUSEMOVE)
PostMessage(msg.hwnd, msg.message, 0, msg.lParam);
if (QWindowsContext::verboseDialogs)
qDebug("%s triggered=%d" , __FUNCTION__, msg.message == WM_MOUSEMOVE);
qCDebug(lcQpaDialogs) << __FUNCTION__ << "triggered=" << (msg.message == WM_MOUSEMOVE);
}
} // namespace QWindowsDialogs
@ -558,12 +557,10 @@ private:
void QWindowsDialogThread::run()
{
if (QWindowsContext::verboseDialogs)
qDebug(">%s" , __FUNCTION__);
qCDebug(lcQpaDialogs) << '>' << __FUNCTION__;
m_dialog->exec(m_owner);
deleteLater();
if (QWindowsContext::verboseDialogs)
qDebug("<%s" , __FUNCTION__);
qCDebug(lcQpaDialogs) << '<' << __FUNCTION__;
}
template <class BaseClass>
@ -579,9 +576,9 @@ bool QWindowsDialogHelperBase<BaseClass>::show(Qt::WindowFlags,
} else {
m_ownerWindow = 0;
}
if (QWindowsContext::verboseDialogs)
qDebug("%s modal=%d modal supported? %d native=%p parent=%p" ,
__FUNCTION__, modal, supportsNonModalDialog(parent), m_nativeDialog.data(), m_ownerWindow);
qCDebug(lcQpaDialogs) << __FUNCTION__ << "modal=" << modal
<< " modal supported? " << supportsNonModalDialog(parent)
<< "native=" << m_nativeDialog.data() << "owner" << m_ownerWindow;
if (!modal && !supportsNonModalDialog(parent))
return false; // Was it changed in-between?
if (!ensureNativeDialog())
@ -665,8 +662,7 @@ void QWindowsDialogHelperBase<BaseClass>::hide()
template <class BaseClass>
void QWindowsDialogHelperBase<BaseClass>::exec()
{
if (QWindowsContext::verboseDialogs)
qDebug("%s" , __FUNCTION__);
qCDebug(lcQpaDialogs) << __FUNCTION__;
stopTimer();
if (QWindowsNativeDialogBase *nd = nativeDialog()) {
nd->exec(m_ownerWindow);
@ -956,8 +952,7 @@ bool QWindowsNativeFileDialogBase::init(const CLSID &clsId, const IID &iid)
qErrnoWarning("IFileDialog::Advise failed");
return false;
}
if (QWindowsContext::verboseDialogs)
qDebug("%s %p %p cookie=%lu" , __FUNCTION__, m_fileDialog, m_dialogEvents, m_cookie);
qCDebug(lcQpaDialogs) << __FUNCTION__ << m_fileDialog << m_dialogEvents << m_cookie;
return true;
}
@ -1008,14 +1003,12 @@ QString QWindowsNativeFileDialogBase::directory() const
void QWindowsNativeFileDialogBase::doExec(HWND owner)
{
if (QWindowsContext::verboseDialogs)
qDebug(">%s on %p", __FUNCTION__, (void *)owner);
qCDebug(lcQpaDialogs) << '>' << __FUNCTION__;
// Show() blocks until the user closes the dialog, the dialog window
// gets a WM_CLOSE or the parent window is destroyed.
const HRESULT hr = m_fileDialog->Show(owner);
QWindowsDialogs::eatMouseMove();
if (QWindowsContext::verboseDialogs)
qDebug("<%s returns 0x%lx", __FUNCTION__, hr);
qCDebug(lcQpaDialogs) << '<' << __FUNCTION__ << " returns " << hex << hr;
if (hr == S_OK) {
emit accepted();
} else {
@ -1045,10 +1038,8 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, QF
flags |= FOS_FILEMUSTEXIST | FOS_ALLOWMULTISELECT;
break;
}
if (QWindowsContext::verboseDialogs)
qDebug().nospace()
<< __FUNCTION__ << " mode=" << mode << " options"
<< options << " results in 0x" << flags;
qCDebug(lcQpaDialogs) << __FUNCTION__ << " mode=" << mode << " options"
<< options << " results in 0x" << flags;
if (FAILED(m_fileDialog->SetOptions(flags)))
qErrnoWarning("%s: SetOptions() failed", __FUNCTION__);
@ -1352,8 +1343,7 @@ void QWindowsNativeFileDialogBase::close()
// IFileDialog::Close() does not work unless invoked from a callback.
// Try to find the window and send it a WM_CLOSE in addition.
const HWND hwnd = findDialogWindow(m_title);
if (QWindowsContext::verboseDialogs)
qDebug() << __FUNCTION__ << "closing" << hwnd;
qCDebug(lcQpaDialogs) << __FUNCTION__ << "closing" << hwnd;
if (hwnd && IsWindowVisible(hwnd))
PostMessageW(hwnd, WM_CLOSE, 0, 0);
#endif // !Q_OS_WINCE
@ -1617,8 +1607,7 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
void QWindowsFileDialogHelper::setDirectory(const QUrl &directory)
{
if (QWindowsContext::verboseDialogs)
qDebug("%s %s" , __FUNCTION__, qPrintable(directory.toString()));
qCDebug(lcQpaDialogs) << __FUNCTION__ << directory.toString();
m_data.setDirectory(directory);
if (hasNativeDialog())
@ -1632,8 +1621,7 @@ QUrl QWindowsFileDialogHelper::directory() const
void QWindowsFileDialogHelper::selectFile(const QUrl &fileName)
{
if (QWindowsContext::verboseDialogs)
qDebug("%s %s" , __FUNCTION__, qPrintable(fileName.toString()));
qCDebug(lcQpaDialogs) << __FUNCTION__ << fileName.toString();
if (hasNativeDialog()) // Might be invoked from the QFileDialog constructor.
nativeFileDialog()->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists
@ -1646,8 +1634,7 @@ QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const
void QWindowsFileDialogHelper::setFilter()
{
if (QWindowsContext::verboseDialogs)
qDebug("%s" , __FUNCTION__);
qCDebug(lcQpaDialogs) << __FUNCTION__;
}
void QWindowsFileDialogHelper::selectNameFilter(const QString &filter)
@ -2039,8 +2026,6 @@ void QWindowsNativeColorDialog::doExec(HWND owner)
typedef BOOL (WINAPI *ChooseColorWType)(LPCHOOSECOLORW);
CHOOSECOLOR chooseColor;
if (QWindowsContext::verboseDialogs)
qDebug() << '>' << __FUNCTION__ << " on " << owner;
ZeroMemory(&chooseColor, sizeof(chooseColor));
chooseColor.lStructSize = sizeof(chooseColor);
chooseColor.hwndOwner = owner;
@ -2069,8 +2054,6 @@ void QWindowsNativeColorDialog::doExec(HWND owner)
for (int c= 0; c < customColorCount; ++c)
qCustomColors[c] = COLORREFToQColor(m_customColors[c]).rgb();
emit accepted();
if (QWindowsContext::verboseDialogs)
qDebug() << '<' << __FUNCTION__ << *m_color;
} else {
emit rejected();
}

View File

@ -322,15 +322,13 @@ QWindowsOleDropSource::QWindowsOleDropSource(QWindowsDrag *drag) :
m_drag(drag), m_currentButtons(Qt::NoButton),
m_refs(1)
{
if (QWindowsContext::verboseOLE)
qDebug("%s", __FUNCTION__);
qCDebug(lcQpaMime) << __FUNCTION__;
}
QWindowsOleDropSource::~QWindowsOleDropSource()
{
m_cursors.clear();
if (QWindowsContext::verboseOLE)
qDebug("%s", __FUNCTION__);
qCDebug(lcQpaMime) << __FUNCTION__;
}
/*!
@ -394,8 +392,7 @@ void QWindowsOleDropSource::createCursors()
m_cursors.insert(action, QSharedPointer<DragCursorHandle>(new DragCursorHandle(sysCursor, cpm.cacheKey())));
}
}
if (QWindowsContext::verboseOLE)
qDebug("%s %d cursors", __FUNCTION__, m_cursors.size());
qCDebug(lcQpaMime) << __FUNCTION__ << m_cursors.size() << "cursors";
}
//---------------------------------------------------------------------
@ -468,11 +465,11 @@ QWindowsOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
} while (false);
if (QWindowsContext::verboseOLE
&& (QWindowsContext::verboseOLE > 1 || hr != S_OK))
qDebug("%s fEscapePressed=%d, grfKeyState=%lu buttons=%d returns 0x%x",
__FUNCTION__, fEscapePressed,grfKeyState, int(m_currentButtons),
int(hr));
if (QWindowsContext::verbose > 1 || hr != S_OK) {
qCDebug(lcQpaMime) << __FUNCTION__ << "fEscapePressed=" << fEscapePressed
<< "grfKeyState=" << grfKeyState << "buttons" << m_currentButtons
<< "returns 0x" << hex <<int(hr) << dec;
}
return hr;
}
@ -486,8 +483,8 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
const Qt::DropAction action = translateToQDragDropAction(dwEffect);
m_drag->updateAction(action);
if (QWindowsContext::verboseOLE > 2)
qDebug("%s dwEffect=%lu, action=%d", __FUNCTION__, dwEffect, action);
if (QWindowsContext::verbose > 2)
qCDebug(lcQpaMime) << __FUNCTION__ << "dwEffect=" << dwEffect << "action=" << action;
QSharedPointer<DragCursorHandle> cursorHandler = m_cursors.value(action);
qint64 currentCacheKey = m_drag->currentDrag()->dragCursor(action).cacheKey();
@ -519,14 +516,12 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
QWindowsOleDropTarget::QWindowsOleDropTarget(QWindow *w) :
m_refs(1), m_window(w), m_chosenEffect(0), m_lastKeyState(0)
{
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << this << w;
qCDebug(lcQpaMime) << __FUNCTION__ << this << w;
}
QWindowsOleDropTarget::~QWindowsOleDropTarget()
{
if (QWindowsContext::verboseOLE)
qDebug("%s %p", __FUNCTION__, this);
qCDebug(lcQpaMime) << __FUNCTION__ << this;
}
STDMETHODIMP
@ -588,13 +583,12 @@ void QWindowsOleDropTarget::handleDrag(QWindow *window, DWORD grfKeyState,
m_chosenEffect = DROPEFFECT_NONE;
}
*pdwEffect = m_chosenEffect;
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << m_window
<< windowsDrag->dropData() << " supported actions=" << actions
<< " mods=" << QGuiApplicationPrivate::modifier_buttons
<< " mouse=" << QGuiApplicationPrivate::mouse_buttons
<< " accepted: " << response.isAccepted() << action
<< m_answerRect << " effect" << *pdwEffect;
qCDebug(lcQpaMime) << __FUNCTION__ << m_window
<< windowsDrag->dropData() << " supported actions=" << actions
<< " mods=" << QGuiApplicationPrivate::modifier_buttons
<< " mouse=" << QGuiApplicationPrivate::mouse_buttons
<< " accepted: " << response.isAccepted() << action
<< m_answerRect << " effect" << *pdwEffect;
}
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
@ -604,8 +598,8 @@ QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState,
if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
dh->DragEnter(reinterpret_cast<HWND>(m_window->winId()), pDataObj, reinterpret_cast<POINT*>(&pt), *pdwEffect);
if (QWindowsContext::verboseOLE)
qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, m_window, grfKeyState, pt.x, pt.y);
qCDebug(lcQpaMime) << __FUNCTION__ << "widget=" << m_window << " key=" << grfKeyState
<< "pt=" << pt.x << pt.y;
QWindowsDrag::instance()->setDropDataObject(pDataObj);
pDataObj->AddRef();
@ -621,15 +615,14 @@ QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
dh->DragOver(reinterpret_cast<POINT*>(&pt), *pdwEffect);
QWindow *dragOverWindow = findDragOverWindow(pt);
if (QWindowsContext::verboseOLE)
qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, dragOverWindow, grfKeyState, pt.x, pt.y);
qCDebug(lcQpaMime) << __FUNCTION__ << "widget=" << dragOverWindow << " key=" << grfKeyState
<< "pt=" << pt.x << pt.y;
const QPoint tmpPoint = QWindowsGeometryHint::mapFromGlobal(dragOverWindow, QPoint(pt.x,pt.y));
// see if we should compress this event
if ((tmpPoint == m_lastPoint || m_answerRect.contains(tmpPoint))
&& m_lastKeyState == grfKeyState) {
*pdwEffect = m_chosenEffect;
if (QWindowsContext::verboseOLE)
qDebug("%s: compressed event", __FUNCTION__);
qCDebug(lcQpaMime) << __FUNCTION__ << "compressed event";
return NOERROR;
}
@ -643,8 +636,7 @@ QWindowsOleDropTarget::DragLeave()
if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
dh->DragLeave();
if (QWindowsContext::verboseOLE)
qDebug().nospace() <<__FUNCTION__ << ' ' << m_window;
qCDebug(lcQpaMime) << __FUNCTION__ << ' ' << m_window;
QWindowSystemInterface::handleDrag(m_window, 0, QPoint(), Qt::IgnoreAction);
QWindowsDrag::instance()->releaseDropDataObject();
@ -663,11 +655,8 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QWindow *dropWindow = findDragOverWindow(pt);
if (QWindowsContext::verboseOLE)
qDebug().nospace() << __FUNCTION__ << ' ' << m_window
<< " on " << dropWindow
<< " keys=" << grfKeyState << " pt="
<< pt.x << ',' << pt.y;
qCDebug(lcQpaMime) << __FUNCTION__ << ' ' << m_window
<< " on " << dropWindow << " keys=" << grfKeyState << " pt=" << pt.x << ',' << pt.y;
m_lastPoint = QWindowsGeometryHint::mapFromGlobal(dropWindow, QPoint(pt.x,pt.y));
// grfKeyState does not all ways contain button state in the drop so if
@ -796,9 +785,8 @@ Qt::DropAction QWindowsDrag::drag(QDrag *drag)
QWindowsOleDataObject *dropDataObject = new QWindowsOleDataObject(dropData);
const Qt::DropActions possibleActions = drag->supportedActions();
const DWORD allowedEffects = translateToWinDragEffects(possibleActions);
if (QWindowsContext::verboseOLE)
qDebug(">%s possible Actions=%x, effects=0x%lx", __FUNCTION__,
int(possibleActions), allowedEffects);
qCDebug(lcQpaMime) << '>' << __FUNCTION__ << "possible Actions=0x"
<< hex << int(possibleActions) << "effects=0x" << allowedEffects << dec;
const HRESULT r = DoDragDrop(dropDataObject, windowDropSource, allowedEffects, &resultEffect);
const DWORD reportedPerformedEffect = dropDataObject->reportedPerformedEffect();
if (r == DRAGDROP_S_DROP) {
@ -819,10 +807,9 @@ Qt::DropAction QWindowsDrag::drag(QDrag *drag)
dropDataObject->releaseQt();
dropDataObject->Release(); // Will delete obj if refcount becomes 0
windowDropSource->Release(); // Will delete src if refcount becomes 0
if (QWindowsContext::verboseOLE)
qDebug("<%s allowedEffects=0x%lx, reportedPerformedEffect=0x%lx, resultEffect=0x%lx, hr=0x%x, dropAction=%d",
__FUNCTION__, allowedEffects, reportedPerformedEffect,
resultEffect, int(r), dragResult);
qCDebug(lcQpaMime) << '<' << __FUNCTION__ << hex << "allowedEffects=0x" << allowedEffects
<< "reportedPerformedEffect=0x" << reportedPerformedEffect
<< " resultEffect=0x" << resultEffect << "hr=0x" << int(r) << dec << "dropAction=" << dragResult;
return dragResult;
}
@ -833,8 +820,7 @@ QWindowsDrag *QWindowsDrag::instance()
void QWindowsDrag::releaseDropDataObject()
{
if (QWindowsContext::verboseOLE)
qDebug("%s %p", __FUNCTION__, m_dropDataObject);
qCDebug(lcQpaMime) << __FUNCTION__ << m_dropDataObject;
if (m_dropDataObject) {
m_dropDataObject->Release();
m_dropDataObject = 0;

View File

@ -89,16 +89,14 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create()
Q_FUNC_INFO, eglGetError());
return 0;
}
if (QWindowsContext::verboseGL)
qDebug("%s: Created EGL display %p v%d.%d",
__FUNCTION__, display, major, minor);
qCDebug(lcQpaGl) << __FUNCTION__ << "Created EGL display" << display << 'v' <<major << '.' << minor;
return new QWindowsEGLStaticContext(display, (major << 8) | minor);
}
QWindowsEGLStaticContext::~QWindowsEGLStaticContext()
{
if (QWindowsContext::verboseGL)
qDebug("%s: Releasing EGL display %p", __FUNCTION__, m_display);
qCDebug(lcQpaGl) << __FUNCTION__ << "Releasing EGL display " << m_display;
eglTerminate(m_display);
}

View File

@ -857,19 +857,20 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
const QFont::Stretch stretch = QFont::Unstretched;
#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseFonts > 2) {
QDebug nospace = qDebug().nospace();
nospace << __FUNCTION__ << familyName << charSet
<< "TTF=" << ttf;
if (QWindowsContext::verbose > 2) {
QString message;
QTextStream str(&message);
str << __FUNCTION__ << ' ' << familyName << ' ' << charSet << " TTF=" << ttf;
if (type & DEVICE_FONTTYPE)
nospace << " DEVICE";
str << " DEVICE";
if (type & RASTER_FONTTYPE)
nospace << " RASTER";
str << " RASTER";
if (type & TRUETYPE_FONTTYPE)
nospace << " TRUETYPE";
nospace << " scalable=" << scalable << " Size=" << size
str << " TRUETYPE";
str << " scalable=" << scalable << " Size=" << size
<< " Style=" << style << " Weight=" << weight
<< " stretch=" << stretch;
qCDebug(lcQpaFonts) << message;
}
#endif
@ -973,8 +974,7 @@ void QWindowsFontDatabase::populateFontDatabase()
void QWindowsFontDatabase::populate(const QString &family)
{
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << m_families.size() << family;
qCDebug(lcQpaFonts) << __FUNCTION__ << m_families.size() << family;
HDC dummy = GetDC(0);
LOGFONT lf;
@ -1026,11 +1026,10 @@ QWindowsFontDatabase::QWindowsFontDatabase()
Q_UNUSED(hfontMetaTypeId)
Q_UNUSED(logFontMetaTypeId)
if (QWindowsContext::verboseFonts) {
if (lcQpaFonts().isDebugEnabled()) {
const QWindowsFontEngineDataPtr data = sharedFontData();
qDebug() << __FUNCTION__ << "Clear type: "
<< data->clearTypeEnabled << "gamma: "
<< data->fontSmoothingGamma;
qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: "
<< data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma;
}
}
@ -1044,8 +1043,7 @@ QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, QChar::S
QFontEngine *fe = QWindowsFontDatabase::createEngine(script, fontDef,
0, QWindowsContext::instance()->defaultDPI(), false,
QStringList(), sharedFontData());
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << "FONTDEF" << fontDef << script << fe << handle;
qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << script << fe << handle;
return fe;
}
@ -1200,8 +1198,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
}
}
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine;
qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine;
return fontEngine;
}
@ -1361,17 +1358,14 @@ void QWindowsFontDatabase::removeApplicationFonts()
m_applicationFonts.clear();
}
void QWindowsFontDatabase::releaseHandle(void *handle)
void QWindowsFontDatabase::releaseHandle(void * /* handle */)
{
if (handle && QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << handle;
}
QString QWindowsFontDatabase::fontDir() const
{
const QString result = QPlatformFontDatabase::fontDir();
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << result;
qCDebug(lcQpaFonts) << __FUNCTION__ << result;
return result;
}
@ -1623,9 +1617,8 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon
if (script == QChar::Script_Common || script == QChar::Script_Han)
result.append(extraTryFontsForFamily(family));
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << family << style << styleHint
<< script << result << m_families.size();
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
<< script << result << m_families.size();
return result;
}
@ -1811,8 +1804,7 @@ QFont QWindowsFontDatabase::systemDefaultFont()
// "MS Shell Dlg 2" is the correct system font >= Win2k
if (systemFont.family() == QStringLiteral("MS Shell Dlg"))
systemFont.setFamily(QStringLiteral("MS Shell Dlg 2"));
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << systemFont;
qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
return systemFont;
}

View File

@ -151,19 +151,20 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
const QFont::Stretch stretch = QFont::Unstretched;
#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseFonts > 2) {
QDebug nospace = qDebug().nospace();
nospace << __FUNCTION__ << familyName << faceName << fullName << charSet
<< "TTF=" << ttf;
if (QWindowsContext::verbose > 2) {
QString message;
QTextStream str(&message);
str << __FUNCTION__ << ' ' << familyName << ' ' << charSet << " TTF=" << ttf;
if (type & DEVICE_FONTTYPE)
nospace << " DEVICE";
str << " DEVICE";
if (type & RASTER_FONTTYPE)
nospace << " RASTER";
str << " RASTER";
if (type & TRUETYPE_FONTTYPE)
nospace << " TRUETYPE";
nospace << " scalable=" << scalable << " Size=" << size
str << " TRUETYPE";
str << " scalable=" << scalable << " Size=" << size
<< " Style=" << style << " Weight=" << weight
<< " stretch=" << stretch;
qCDebug(lcQpaFonts) << message;
}
#endif
@ -403,8 +404,7 @@ void QWindowsFontDatabaseFT::populateFontDatabase()
void QWindowsFontDatabaseFT::populate(const QString &family)
{
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << m_families.size() << family;
qCDebug(lcQpaFonts) << __FUNCTION__ << m_families.size() << family;
HDC dummy = GetDC(0);
LOGFONT lf;
@ -425,16 +425,14 @@ void QWindowsFontDatabaseFT::populate(const QString &family)
QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, QChar::Script script, void *handle)
{
QFontEngine *fe = QBasicFontDatabase::fontEngine(fontDef, script, handle);
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << "FONTDEF" << /*fontDef <<*/ script << fe << handle;
qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef.family << script << fe << handle;
return fe;
}
QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
{
QFontEngine *fe = QBasicFontDatabase::fontEngine(fontData, pixelSize, hintingPreference);
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fe;
qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fe;
return fe;
}
@ -566,16 +564,14 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF
}
#endif
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << family << style << styleHint
<< script << result << m_families;
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
<< script << result << m_families;
return result;
}
QString QWindowsFontDatabaseFT::fontDir() const
{
const QString result = QLatin1String(qgetenv("windir")) + QLatin1String("/Fonts");//QPlatformFontDatabase::fontDir();
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << result;
qCDebug(lcQpaFonts) << __FUNCTION__ << result;
return result;
}

View File

@ -325,8 +325,7 @@ QWindowsFontEngine::QWindowsFontEngine(const QString &name,
designAdvances(0),
designAdvancesSize(0)
{
if (QWindowsContext::verboseFonts)
qDebug("%s: font='%s', size=%ld", __FUNCTION__, qPrintable(name), lf.lfHeight);
qCDebug(lcQpaFonts) << __FUNCTION__ << name << lf.lfHeight;
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
fontDef.pixelSize = -lf.lfHeight;
@ -366,9 +365,7 @@ QWindowsFontEngine::~QWindowsFontEngine()
if (!DeleteObject(hfont))
qErrnoWarning("%s: QFontEngineWin: failed to delete non-stock font... failed", __FUNCTION__);
}
if (QWindowsContext::verboseFonts)
if (QWindowsContext::verboseFonts)
qDebug("%s: font='%s", __FUNCTION__, qPrintable(_name));
qCDebug(lcQpaFonts) << __FUNCTION__ << _name;
if (!uniqueFamilyName.isEmpty()) {
QPlatformFontDatabase *pfdb = QWindowsIntegration::instance()->fontDatabase();
@ -1347,8 +1344,7 @@ QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *first, const QStri
: QFontEngineMulti(fallbacks.size()+1),
fallbacks(fallbacks)
{
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << engines.size() << first << first->fontDef.family << fallbacks;
qCDebug(lcQpaFonts) << __FUNCTION__ << engines.size() << first << first->fontDef.family << fallbacks;
engines[0] = first;
first->ref.ref();
fontDef = engines[0]->fontDef;
@ -1357,8 +1353,7 @@ QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *first, const QStri
QWindowsMultiFontEngine::~QWindowsMultiFontEngine()
{
if (QWindowsContext::verboseFonts)
qDebug("%s", __FUNCTION__);
qCDebug(lcQpaFonts) << __FUNCTION__;
}
void QWindowsMultiFontEngine::loadEngine(int at)
@ -1409,9 +1404,7 @@ void QWindowsMultiFontEngine::loadEngine(int at)
fedw->ref.ref();
engines[at] = fedw;
if (QWindowsContext::verboseFonts)
qDebug("%s %d %s", __FUNCTION__, at, qPrintable(fam));
qCDebug(lcQpaFonts) << __FUNCTION__ << at << fam;
return;
} else {
qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__);
@ -1433,9 +1426,7 @@ void QWindowsMultiFontEngine::loadEngine(int at)
engines[at] = new QWindowsFontEngine(fam, hfont, stockFont, lf, data);
engines[at]->ref.ref();
engines[at]->fontDef = fontDef;
if (QWindowsContext::verboseFonts)
qDebug("%s %d %s", __FUNCTION__, at, qPrintable(fam));
qCDebug(lcQpaFonts) << __FUNCTION__ << at << fam;
// TODO: increase cost in QFontCache for the font engine loaded here
}

View File

@ -212,8 +212,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di
, m_xHeight(-1)
, m_lineGap(-1)
{
if (QWindowsContext::verboseFonts)
qDebug("%s %g", __FUNCTION__, pixelSize);
qCDebug(lcQpaFonts) << __FUNCTION__ << pixelSize;
Q_ASSERT(m_directWriteFontFace);
@ -227,8 +226,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di
QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite()
{
if (QWindowsContext::verboseFonts)
qDebug("%s", __FUNCTION__);
qCDebug(lcQpaFonts) << __FUNCTION__;
m_fontEngineData->directWriteFactory->Release();
m_directWriteFontFace->Release();

View File

@ -223,7 +223,7 @@ static void describeFormats(HDC hdc)
PIXELFORMATDESCRIPTOR pfd;
initPixelFormatDescriptor(&pfd);
DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
qDebug() << '#' << i << '/' << pfiMax << ':' << pfd;
qCDebug(lcQpaGl) << '#' << i << '/' << pfiMax << ':' << pfd;
}
}
@ -341,10 +341,8 @@ static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format,
bestPfi = pfi;
*obtainedPfd = checkPfd;
}
if (QWindowsContext::verboseGL)
qDebug() << __FUNCTION__ << " checking " << pfi << '/' << pfiMax
<< " score=" << score << " (best " << bestPfi << '/' << bestScore
<< ") " << checkPfd;
qCDebug(lcQpaGl) << __FUNCTION__ << " checking " << pfi << '/' << pfiMax
<< " score=" << score << " (best " << bestPfi << '/' << bestScore << ") " << checkPfd;
}
} // for
if (bestPfi > 0)
@ -471,15 +469,15 @@ static int choosePixelFormat(HDC hdc,
initPixelFormatDescriptor(obtainedPfd);
DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd);
if (!isAcceptableFormat(additional, *obtainedPfd, true)) {
if (QWindowsContext::verboseGL)
qDebug() << __FUNCTION__ << " obtained px #" << pixelFormat
<< " not acceptable=" << *obtainedPfd;
qCDebug(lcQpaGl) << __FUNCTION__ << " obtained px #" << pixelFormat
<< " not acceptable=" << *obtainedPfd;
pixelFormat = 0;
}
#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseGL) {
QDebug nsp = qDebug().nospace();
if (lcQpaGl().isDebugEnabled()) {
QString message;
QDebug nsp(&message);
nsp << __FUNCTION__;
if (sampleBuffersRequested)
nsp << " samples=" << iAttributes[samplesValuePosition];
@ -488,6 +486,7 @@ static int choosePixelFormat(HDC hdc,
nsp << iAttributes[ii] << ',';
nsp << noshowbase << dec << "\n obtained px #" << pixelFormat
<< " of " << numFormats << "\n " << *obtainedPfd;
qCDebug(lcQpaGl) << message;
} // Debug
#endif
@ -611,9 +610,8 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext,
break;
}
}
if (QWindowsContext::verboseGL)
qDebug("%s: Creating context version %d.%d with %d attributes",
__FUNCTION__, majorVersion, minorVersion, attribIndex / 2);
qCDebug(lcQpaGl) << __FUNCTION__ << "Creating context version"
<< majorVersion << '.' << minorVersion << attribIndex / 2 << "attributes";
const HGLRC result =
staticContext.wglCreateContextAttribsARB(hdc, shared, attributes);
@ -842,8 +840,7 @@ QOpenGLStaticContext *QOpenGLStaticContext::create()
if (!wglGetCurrentContext())
temporaryContext.reset(new QOpenGLTemporaryContext);
QOpenGLStaticContext *result = new QOpenGLStaticContext;
if (QWindowsContext::verboseGL)
qDebug() << __FUNCTION__ << *result;
qCDebug(lcQpaGl) << __FUNCTION__ << *result;
return result;
}
@ -857,7 +854,7 @@ QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
if (s.hasExtensions())
nsp << ", Extension-API present";
nsp << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
if (QWindowsContext::verboseGL > 1)
if (QWindowsContext::verbose > 1)
nsp << s.extensionNames;
return d;
}
@ -917,7 +914,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
if (!hdc)
break;
if (QWindowsContext::verboseGL > 1)
if (QWindowsContext::verbose > 1)
describeFormats(hdc);
// Preferably use direct rendering and ARB extensions (unless pixmap
// or explicitly turned off on command line).
@ -991,14 +988,12 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
if (dummyWindow)
DestroyWindow(dummyWindow);
if (QWindowsContext::verboseGL)
qDebug() << __FUNCTION__ << this << (tryExtensions ? "ARB" : "GDI")
<< " requested: " << context->format()
<< "\n obtained #" << m_pixelFormat << (m_extensionsUsed ? "ARB" : "GDI")
<< m_obtainedFormat << "\n " << m_obtainedPixelFormatDescriptor
<< " swap interval: " << obtainedSwapInternal
<< "\n default: " << m_staticContext->defaultFormat
<< "\n HGLRC=" << m_renderingContext;
qCDebug(lcQpaGl()) << __FUNCTION__ << this << (tryExtensions ? "ARB" : "GDI")
<< " requested: " << context->format()
<< "\n obtained #" << m_pixelFormat << (m_extensionsUsed ? "ARB" : "GDI") << m_obtainedFormat
<< "\n " << m_obtainedPixelFormatDescriptor << " swap interval: " << obtainedSwapInternal
<< "\n default: " << m_staticContext->defaultFormat
<< "\n HGLRC=" << m_renderingContext;
}
QWindowsGLContext::~QWindowsGLContext()
@ -1039,8 +1034,8 @@ static inline const QOpenGLContextData *
void QWindowsGLContext::swapBuffers(QPlatformSurface *surface)
{
if (QWindowsContext::verboseGL > 1)
qDebug() << __FUNCTION__ << surface;
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaGl) << __FUNCTION__ << surface;
if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, handleOf(surface))) {
SwapBuffers(contextData->hdc);
} else {
@ -1051,8 +1046,8 @@ void QWindowsGLContext::swapBuffers(QPlatformSurface *surface)
bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface)
{
#ifdef DEBUG_GL
if (QWindowsContext::verboseGL > 1)
qDebug("%s context=%p contexts=%d", __FUNCTION__, this, m_windowContexts.size());
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts";
#endif // DEBUG_GL
Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
@ -1105,8 +1100,8 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface)
void QWindowsGLContext::doneCurrent()
{
#ifdef DEBUG_GL
if (QWindowsContext::verboseGL > 1)
qDebug("%s context=%p %d contexts", __FUNCTION__, this, m_windowContexts.size());
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts";
#endif // DEBUG_GL
wglMakeCurrent(0, 0);
releaseDCs();
@ -1116,10 +1111,8 @@ QWindowsGLContext::GL_Proc QWindowsGLContext::getProcAddress(const QByteArray &p
{
// TODO: Will that work with the calling conventions?
GL_Proc procAddress = reinterpret_cast<GL_Proc>(wglGetProcAddress(procName.constData()));
if (QWindowsContext::verboseGL > 1)
qDebug("%s('%s') with current_hglrc=%p returns %p",
__FUNCTION__, procName.constData(),
wglGetCurrentContext(), procAddress);
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaGl) << __FUNCTION__ << procName << wglGetCurrentContext() << "returns" << procAddress;
if (!procAddress)
qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName.constData());
return procAddress;

View File

@ -75,11 +75,11 @@ QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) :
bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
{
m_flags = flags;
if (QWindowsContext::verboseEvents > 2)
qDebug(">%s %s %d", __FUNCTION__, qPrintable(objectName()), int(flags));
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
qCDebug(lcQpaEvents) << '>' << __FUNCTION__ << objectName() << flags;
const bool rc = QEventDispatcherWin32::processEvents(flags);
if (QWindowsContext::verboseEvents > 2)
qDebug("<%s %s returns %d", __FUNCTION__, qPrintable(objectName()), rc);
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
qCDebug(lcQpaEvents) << '<' << __FUNCTION__ << "returns" << rc;
return rc;
}

View File

@ -188,8 +188,7 @@ void QWindowsInputContext::reset()
if (!m_compositionContext.hwnd)
return;
QObject *fo = qApp->focusObject();
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__<< fo;
qCDebug(lcQpaInputMethods) << __FUNCTION__<< fo;
if (!fo)
return;
if (m_compositionContext.isComposing) {
@ -221,8 +220,7 @@ void QWindowsInputContext::cursorRectChanged()
if (!cursorRectangle.isValid())
return;
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__<< cursorRectangle;
qCDebug(lcQpaInputMethods) << __FUNCTION__<< cursorRectangle;
const HIMC himc = ImmGetContext(m_compositionContext.hwnd);
if (!himc)
@ -259,8 +257,7 @@ void QWindowsInputContext::invokeAction(QInputMethod::Action action, int cursorP
return;
}
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__ << cursorPosition << action;
qCDebug(lcQpaInputMethods) << __FUNCTION__ << cursorPosition << action;
if (cursorPosition < 0 || cursorPosition > m_compositionContext.composition.size())
reset();
@ -339,8 +336,7 @@ bool QWindowsInputContext::startComposition(HWND hwnd)
QWindow *window = qApp->focusWindow();
if (!window)
return false;
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__ << fo << window;
qCDebug(lcQpaInputMethods) << __FUNCTION__ << fo << window;
if (!fo || QWindowsWindow::handleOf(window) != hwnd)
return false;
initContext(hwnd);
@ -402,9 +398,8 @@ bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
{
QObject *fo = qApp->focusObject();
const int lParam = int(lParamIn);
if (QWindowsContext::verboseInputMethods)
qDebug() << '>' << __FUNCTION__ << fo << debugComposition(lParam)
<< " composing=" << m_compositionContext.isComposing;
qCDebug(lcQpaInputMethods) << '>' << __FUNCTION__ << fo << debugComposition(lParam)
<< " composing=" << m_compositionContext.isComposing;
if (!fo || m_compositionContext.hwnd != hwnd || !lParam)
return false;
const HIMC himc = ImmGetContext(m_compositionContext.hwnd);
@ -443,11 +438,9 @@ bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
endContextComposition();
}
const bool result = QCoreApplication::sendEvent(fo, event.data());
if (QWindowsContext::verboseInputMethods)
qDebug() << '<' << __FUNCTION__ << "sending markup="
<< event->attributes().size()
<< " commit=" << event->commitString()
<< " to " << fo << " returns " << result;
qCDebug(lcQpaInputMethods) << '<' << __FUNCTION__ << "sending markup="
<< event->attributes().size() << " commit=" << event->commitString()
<< " to " << fo << " returns " << result;
update(Qt::ImQueryAll);
ImmReleaseContext(m_compositionContext.hwnd, himc);
return result;
@ -455,8 +448,7 @@ bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
bool QWindowsInputContext::endComposition(HWND hwnd)
{
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__ << m_endCompositionRecursionGuard << hwnd;
qCDebug(lcQpaInputMethods) << __FUNCTION__ << m_endCompositionRecursionGuard << hwnd;
// Googles Pinyin Input Method likes to call endComposition again
// when we call notifyIME with CPS_CANCEL, so protect ourselves
// against that.
@ -549,10 +541,8 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
return -1;
const DWORD memSize = sizeof(RECONVERTSTRING)
+ (surroundingText.length() + 1) * sizeof(ushort);
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__ << " reconv=" << reconv
<< " surroundingText=" << surroundingText
<< " size=" << memSize;
qCDebug(lcQpaInputMethods) << __FUNCTION__ << " reconv=" << reconv
<< " surroundingText=" << surroundingText << " size=" << memSize;
// If memory is not allocated, return the required size.
if (!reconv)
return surroundingText.isEmpty() ? -1 : int(memSize);
@ -567,8 +557,7 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
const int startPos = bounds.position();
bounds.toNextBoundary();
const int endPos = bounds.position();
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__ << " boundary=" << startPos << endPos;
qCDebug(lcQpaInputMethods) << __FUNCTION__ << " boundary=" << startPos << endPos;
// Select the text, this will be overwritten by following IME events.
QList<QInputMethodEvent::Attribute> attributes;
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, startPos, endPos-startPos, QVariant());

View File

@ -175,6 +175,8 @@ static inline unsigned parseOptions(const QStringList &paramList)
options |= QWindowsIntegration::DisableArb;
} else if (param == QLatin1String("nomousefromtouch")) {
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
} else if (param.startsWith(QLatin1String("verbose="))) {
QWindowsContext::verbose = param.right(param.size() - 8).toInt();
}
}
return options;
@ -244,17 +246,14 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
const QWindowsWindow::WindowData obtained
= QWindowsWindow::WindowData::create(window, requested, window->title());
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< __FUNCTION__ << '<' << window << '\n'
<< " Requested: " << requested.geometry << "frame incl.: "
<< QWindowsGeometryHint::positionIncludesFrame(window)
<< " Flags="
<< QWindowsWindow::debugWindowFlags(requested.flags) << '\n'
<< " Obtained : " << obtained.geometry << " Margins "
<< obtained.frame << " Flags="
<< QWindowsWindow::debugWindowFlags(obtained.flags)
<< " Handle=" << obtained.hwnd << '\n';
qCDebug(lcQpaWindows).nospace()
<< __FUNCTION__ << '<' << window
<< "\n Requested: " << requested.geometry << "frame incl.: "
<< QWindowsGeometryHint::positionIncludesFrame(window)
<< " Flags=" << QWindowsWindow::debugWindowFlags(requested.flags)
<< "\n Obtained : " << obtained.geometry << " Margins "<< obtained.frame
<< " Flags=" << QWindowsWindow::debugWindowFlags(obtained.flags)
<< " Handle=" << obtained.hwnd << '\n';
if (!obtained.hwnd)
return 0;
if (requested.flags != obtained.flags)
@ -269,8 +268,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
QPlatformOpenGLContext
*QWindowsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
if (QWindowsContext::verboseGL)
qDebug() << __FUNCTION__ << context->format();
qCDebug(lcQpaGl) << __FUNCTION__ << context->format();
#ifdef QT_OPENGL_ES_2
if (d->m_staticEGLContext.isNull()) {
QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create();
@ -324,9 +322,7 @@ QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
d->m_fontDatabase = new QWindowsFontDatabase;
#else
if (isQMLApplication()) {
if (QWindowsContext::verboseFonts) {
qDebug() << "QML application detected, using FreeType rendering";
}
qCDebug(lcQpaFonts) << "QML application detected, using FreeType rendering";
d->m_fontDatabase = new QWindowsFontDatabaseFT;
}
else

View File

@ -75,8 +75,7 @@ bool QWindowsInternalMimeData::hasFormat_sys(const QString &mime) const
const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter();
const bool has = mc.converterToMime(mime, pDataObj) != 0;
releaseDataObject(pDataObj);
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << mime << has;
qCDebug(lcQpaMime) << __FUNCTION__ << mime << has;
return has;
}
@ -89,8 +88,7 @@ QStringList QWindowsInternalMimeData::formats_sys() const
const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter();
const QStringList fmts = mc.allMimesForFormats(pDataObj);
releaseDataObject(pDataObj);
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << fmts;
qCDebug(lcQpaMime) << __FUNCTION__ << fmts;
return fmts;
}
@ -106,12 +104,10 @@ QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
if (const QWindowsMime *converter = mc.converterToMime(mimeType, pDataObj))
result = converter->convertToMime(mimeType, pDataObj, type);
releaseDataObject(pDataObj);
if (QWindowsContext::verboseOLE) {
QDebug nospace = qDebug().nospace();
nospace << __FUNCTION__ << ' ' << mimeType << ' ' << type
<< " returns " << result.type();
if (result.type() != QVariant::ByteArray)
nospace << ' ' << result;
if (QWindowsContext::verbose) {
qCDebug(lcQpaMime) <<__FUNCTION__ << ' ' << mimeType << ' ' << type
<< " returns " << result.type()
<< (result.type() != QVariant::ByteArray ? result.toString() : QStringLiteral("<data>"));
}
return result;
}

View File

@ -653,16 +653,20 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
::ToAscii(VK_SPACE, 0, emptyBuffer, reinterpret_cast<LPWORD>(&buffer), 0);
::ToAscii(vk_key, scancode, kbdBuffer, reinterpret_cast<LPWORD>(&buffer), 0);
}
if (QWindowsContext::verboseEvents > 1) {
qDebug("updatePossibleKeyCodes for virtual key = 0x%02x!", vk_key);
if (QWindowsContext::verbose > 1 && lcQpaEvents().isDebugEnabled()) {
QString message;
QDebug debug(&message);
debug <<__FUNCTION__ << " for virtual key = 0x" << hex << vk_key << dec<< '\n';
for (size_t i = 0; i < NumMods; ++i) {
qDebug(" [%d] (%d,0x%02x,'%c') %s", int(i),
keyLayout[vk_key].qtKey[i],
keyLayout[vk_key].qtKey[i],
keyLayout[vk_key].qtKey[i] ? keyLayout[vk_key].qtKey[i] : 0x03,
keyLayout[vk_key].deadkeys & (1<<i) ? "deadkey" : "");
const quint32 qtKey = keyLayout[vk_key].qtKey[i];
debug << " [" << i << "] (" << qtKey << ','
<< hex << showbase << qtKey << noshowbase << dec
<< ",'" << char(qtKey ? qtKey : 0x03) << "')";
if (keyLayout[vk_key].deadkeys & (1<<i))
debug << " deadkey";
debug << '\n';
}
qCDebug(lcQpaEvents) << message;
}
}

View File

@ -675,8 +675,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
else
ret = str.toUtf8();
}
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << ret;
qCDebug(lcQpaMime) << __FUNCTION__ << ret;
return ret;
}
@ -1490,8 +1489,7 @@ QStringList QWindowsMimeConverter::allMimesForFormats(IDataObject *pDataObj) con
}
fmtenum->Release();
}
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << pDataObj << formats;
qCDebug(lcQpaMime) << __FUNCTION__ << pDataObj << formats;
return formats;
}
@ -1541,9 +1539,8 @@ QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes,
if (converter->canConvertToMime(format, pDataObj)) {
const QVariant dataV = converter->convertToMime(format, pDataObj, preferredType);
if (dataV.isValid()) {
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << mimeTypes << "\nFormat: "
<< format << pDataObj << " returns " << dataV;
qCDebug(lcQpaMime) << __FUNCTION__ << mimeTypes << "\nFormat: "
<< format << pDataObj << " returns " << dataV;
if (formatIn)
*formatIn = format;
return dataV;
@ -1551,8 +1548,7 @@ QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes,
}
}
}
if (QWindowsContext::verboseOLE)
qDebug() << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType;
qCDebug(lcQpaMime) << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType;
return QVariant();
}

View File

@ -199,16 +199,14 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
*result = 0;
if (msg.message == WM_MOUSELEAVE) {
if (QWindowsContext::verboseEvents)
qDebug() << "WM_MOUSELEAVE for " << window << " previous window under mouse = " << m_windowUnderMouse << " tracked window =" << m_trackedWindow;
qCDebug(lcQpaEvents) << "WM_MOUSELEAVE for " << window << " previous window under mouse = " << m_windowUnderMouse << " tracked window =" << m_trackedWindow;
// When moving out of a window, WM_MOUSEMOVE within the moved-to window is received first,
// so if m_trackedWindow is not the window here, it means the cursor has left the
// application.
if (window == m_trackedWindow) {
QWindow *leaveTarget = m_windowUnderMouse ? m_windowUnderMouse : m_trackedWindow;
if (QWindowsContext::verboseEvents)
qDebug() << "Generating leave event for " << leaveTarget;
qCDebug(lcQpaEvents) << "Generating leave event for " << leaveTarget;
QWindowSystemInterface::handleLeaveEvent(leaveTarget);
m_trackedWindow = 0;
m_windowUnderMouse = 0;
@ -237,8 +235,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
QWindowsWindow::baseWindowOf(window)->applyCursor();
platformWindow->setMouseGrabEnabled(true);
platformWindow->setFlag(QWindowsWindow::AutoMouseCapture);
if (QWindowsContext::verboseEvents)
qDebug() << "Automatic mouse capture for missing buttondown event" << window;
qCDebug(lcQpaEvents) << "Automatic mouse capture for missing buttondown event" << window;
}
m_previousCaptureWindow = window;
return true;
@ -263,8 +260,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
|| msg.message == WM_RBUTTONDBLCLK || msg.message == WM_XBUTTONDBLCLK)) {
platformWindow->setMouseGrabEnabled(true);
platformWindow->setFlag(QWindowsWindow::AutoMouseCapture);
if (QWindowsContext::verboseEvents)
qDebug() << "Automatic mouse capture " << window;
qCDebug(lcQpaEvents) << "Automatic mouse capture " << window;
// Implement "Click to focus" for native child windows (unless it is a native widget window).
if (!window->isTopLevel() && !window->inherits("QWidgetWindow") && QGuiApplication::focusWindow() != window)
window->requestActivate();
@ -274,8 +270,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
|| msg.message == WM_RBUTTONUP || msg.message == WM_XBUTTONUP)
&& !buttons) {
platformWindow->setMouseGrabEnabled(false);
if (QWindowsContext::verboseEvents)
qDebug() << "Releasing automatic mouse capture " << window;
qCDebug(lcQpaEvents) << "Releasing automatic mouse capture " << window;
}
const bool hasCapture = platformWindow->hasMouseCapture();
@ -307,8 +302,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
&& (!hasCapture || window == m_windowUnderMouse))
|| (hasCapture && m_previousCaptureWindow != window && m_windowUnderMouse
&& m_windowUnderMouse != window)) {
if (QWindowsContext::verboseEvents)
qDebug() << "Synthetic leave for " << m_windowUnderMouse;
qCDebug(lcQpaEvents) << "Synthetic leave for " << m_windowUnderMouse;
QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse);
if (currentNotCapturing) {
// Clear tracking if capturing and current window is not the capturing window
@ -327,8 +321,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
&& (!hasCapture || currentWindowUnderMouse == window))
|| (m_previousCaptureWindow && window != m_previousCaptureWindow && currentWindowUnderMouse
&& currentWindowUnderMouse != m_previousCaptureWindow)) {
if (QWindowsContext::verboseEvents)
qDebug() << "Entering " << currentWindowUnderMouse;
qCDebug(lcQpaEvents) << "Entering " << currentWindowUnderMouse;
QWindowsWindow::baseWindowOf(currentWindowUnderMouse)->applyCursor();
QWindowSystemInterface::handleEnterEvent(currentWindowUnderMouse,
currentWindowUnderMouse->mapFromGlobal(globalPosition),

View File

@ -80,14 +80,11 @@ QWindowsOleDataObject::QWindowsOleDataObject(QMimeData *mimeData) :
CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT)),
performedEffect(DROPEFFECT_NONE)
{
if (QWindowsContext::verboseOLE)
qDebug("%s '%s'", __FUNCTION__, qPrintable(mimeData->formats().join(QStringLiteral(", "))));
qCDebug(lcQpaMime) << __FUNCTION__ << mimeData->formats();
}
QWindowsOleDataObject::~QWindowsOleDataObject()
{
if (QWindowsContext::verboseOLE)
qDebug("%s", __FUNCTION__);
}
void QWindowsOleDataObject::releaseQt()
@ -143,10 +140,10 @@ QWindowsOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
{
HRESULT hr = ResultFromScode(DATA_E_FORMATETC);
if (QWindowsContext::verboseOLE) {
if (lcQpaMime().isDebugEnabled()) {
wchar_t buf[256] = {0};
GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
qDebug("%s CF = %d : %s", __FUNCTION__, pformatetc->cfFormat, qPrintable(QString::fromWCharArray(buf)));
qCDebug(lcQpaMime) <<__FUNCTION__ << "CF = " << pformatetc->cfFormat << QString::fromWCharArray(buf);
}
if (data) {
@ -156,11 +153,10 @@ QWindowsOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
hr = ResultFromScode(S_OK);
}
if (QWindowsContext::verboseOLE) {
if (QWindowsContext::verbose > 1) {
wchar_t buf[256] = {0};
GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
qDebug("%s CF = %d : %s returns 0x%x", __FUNCTION__, pformatetc->cfFormat,
qPrintable(QString::fromWCharArray(buf)), int(hr));
qCDebug(lcQpaMime) <<__FUNCTION__ << "CF = " << pformatetc->cfFormat << " returns 0x" << int(hr) << dec;
}
return hr;
@ -177,16 +173,16 @@ QWindowsOleDataObject::QueryGetData(LPFORMATETC pformatetc)
{
HRESULT hr = ResultFromScode(DATA_E_FORMATETC);
if (QWindowsContext::verboseOLE > 1)
qDebug("%s", __FUNCTION__);
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__;
if (data) {
const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter();
hr = mc.converterFromMime(*pformatetc, data) ?
ResultFromScode(S_OK) : ResultFromScode(S_FALSE);
}
if (QWindowsContext::verboseOLE > 1)
qDebug("%s returns 0x%x", __FUNCTION__, int(hr));
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__ << " returns 0x" << hex << int(hr);
return hr;
}
@ -200,8 +196,8 @@ QWindowsOleDataObject::GetCanonicalFormatEtc(LPFORMATETC, LPFORMATETC pformatetc
STDMETHODIMP
QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL fRelease)
{
if (QWindowsContext::verboseOLE > 1)
qDebug("%s", __FUNCTION__);
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__;
HRESULT hr = ResultFromScode(E_NOTIMPL);
@ -213,8 +209,8 @@ QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL
ReleaseStgMedium(pMedium);
hr = ResultFromScode(S_OK);
}
if (QWindowsContext::verboseOLE > 1)
qDebug("%s returns 0x%x", __FUNCTION__, int(hr));
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__ << " returns 0x" << hex << int(hr);
return hr;
}
@ -222,8 +218,8 @@ QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL
STDMETHODIMP
QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc)
{
if (QWindowsContext::verboseOLE > 1)
qDebug("%s", __FUNCTION__);
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__;
if (!data)
return ResultFromScode(DATA_E_FORMATETC);
@ -285,8 +281,8 @@ QWindowsOleDataObject::EnumDAdvise(LPENUMSTATDATA FAR*)
QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs) :
m_dwRefs(1), m_nIndex(0), m_isNull(false)
{
if (QWindowsContext::verboseOLE > 1)
qDebug("%s", __FUNCTION__);
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__;
m_lpfmtetcs.reserve(fmtetcs.count());
for (int idx = 0; idx < fmtetcs.count(); ++idx) {
LPFORMATETC destetc = new FORMATETC();
@ -303,8 +299,8 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs)
QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<LPFORMATETC> &lpfmtetcs) :
m_dwRefs(1), m_nIndex(0), m_isNull(false)
{
if (QWindowsContext::verboseOLE > 1)
qDebug("%s", __FUNCTION__);
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaMime) << __FUNCTION__;
m_lpfmtetcs.reserve(lpfmtetcs.count());
for (int idx = 0; idx < lpfmtetcs.count(); ++idx) {
LPFORMATETC srcetc = lpfmtetcs.at(idx);

View File

@ -241,8 +241,7 @@ QWindow *QWindowsScreen::findTopLevelAt(const QPoint &point, unsigned flags)
if (QPlatformWindow *bw = QWindowsContext::instance()->
findPlatformWindowAt(GetDesktopWindow(), point, flags))
result = QWindowsWindow::topLevelOf(bw->window());
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << point << flags << result;
qCDebug(lcQpaWindows) <<__FUNCTION__ << point << flags << result;
return result;
}
@ -252,8 +251,7 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags)
if (QPlatformWindow *bw = QWindowsContext::instance()->
findPlatformWindowAt(GetDesktopWindow(), screenPoint, flags))
result = bw->window();
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << screenPoint << " returns " << result;
qCDebug(lcQpaWindows) <<__FUNCTION__ << screenPoint << " returns " << result;
return result;
}
@ -364,9 +362,8 @@ bool QWindowsScreenManager::handleDisplayChange(WPARAM wParam, LPARAM lParam)
m_lastDepth = newDepth;
m_lastHorizontalResolution = newHorizontalResolution;
m_lastVerticalResolution = newVerticalResolution;
if (QWindowsContext::verboseWindows)
qDebug("%s: Depth=%d, resolution=%hux%hu",
__FUNCTION__, newDepth, newHorizontalResolution, newVerticalResolution);
qCDebug(lcQpaWindows) << __FUNCTION__ << "Depth=" << newDepth
<< ", resolution " << newHorizontalResolution << 'x' << newVerticalResolution;
handleScreenChanges();
}
return false;
@ -408,8 +405,7 @@ bool QWindowsScreenManager::handleScreenChanges()
QWindowsScreen *newScreen = new QWindowsScreen(newData);
m_screens.push_back(newScreen);
QWindowsIntegration::instance()->emitScreenAdded(newScreen);
if (QWindowsContext::verboseWindows)
qDebug() << "New Monitor: " << newData;
qCDebug(lcQpaWindows) << "New Monitor: " << newData;
} // exists
} // for new screens.
// Remove deleted ones but keep main monitors if we get only the
@ -417,8 +413,7 @@ bool QWindowsScreenManager::handleScreenChanges()
if (!lockScreen) {
for (int i = m_screens.size() - 1; i >= 0; --i) {
if (indexOfMonitor(newDataList, m_screens.at(i)->data().name) == -1) {
if (QWindowsContext::verboseWindows)
qDebug() << "Removing Monitor: " << m_screens.at(i) ->data();
qCDebug(lcQpaWindows) << "Removing Monitor: " << m_screens.at(i) ->data();
delete m_screens.takeAt(i);
} // not found
} // for existing screens

View File

@ -182,8 +182,7 @@ QWindowsTabletSupport *QWindowsTabletSupport::create()
L"TabletDummyWindow",
qWindowsTabletSupportWndProc);
if (!window) {
if (QWindowsContext::verboseTablet)
qWarning() << __FUNCTION__ << "Unable to create window for tablet.";
qCWarning(lcQpaTablet) << __FUNCTION__ << "Unable to create window for tablet.";
return 0;
}
LOGCONTEXT lcMine;
@ -199,8 +198,7 @@ QWindowsTabletSupport *QWindowsTabletSupport::create()
lcMine.lcOutExtY = -lcMine.lcInExtY;
const HCTX context = QWindowsTabletSupport::m_winTab32DLL.wTOpen(window, &lcMine, true);
if (!context) {
if (QWindowsContext::verboseTablet)
qWarning() << __FUNCTION__ << "Unable to open tablet.";
qCDebug(lcQpaTablet) << __FUNCTION__ << "Unable to open tablet.";
DestroyWindow(window);
return 0;
@ -217,9 +215,9 @@ QWindowsTabletSupport *QWindowsTabletSupport::create()
} // cannot restore old size
} // cannot set
} // mismatch
if (QWindowsContext::verboseTablet)
qDebug("Opened tablet context %p on window %p, changed packet queue size %d -> %d",
context, window, currentQueueSize, TabletPacketQSize);
qCDebug(lcQpaTablet) << "Opened tablet context " << context << " on window "
<< window << "changed packet queue size " << currentQueueSize
<< "->" << TabletPacketQSize;
return new QWindowsTabletSupport(window, context);
}
@ -261,8 +259,7 @@ void QWindowsTabletSupport::notifyActivate()
// Cooperate with other tablet applications, but when we get focus, I want to use the tablet.
const bool result = QWindowsTabletSupport::m_winTab32DLL.wTEnable(m_context, true)
&& QWindowsTabletSupport::m_winTab32DLL.wTOverlap(m_context, true);
if (QWindowsContext::verboseTablet)
qDebug() << __FUNCTION__ << result;
qCDebug(lcQpaTablet) << __FUNCTION__ << result;
}
static inline int indexOfDevice(const QVector<QWindowsTabletDeviceData> &devices, qint64 uniqueId)
@ -369,10 +366,8 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
m_devices.push_back(tabletInit(uniqueId, cursorType));
}
m_devices[m_currentDevice].currentPointerType = pointerType(currentCursor);
if (QWindowsContext::verboseTablet)
qDebug() << __FUNCTION__ << (enteredProximity ? "enter" : "leave")
<< " proximity for device #"
<< m_currentDevice << m_devices.at(m_currentDevice);
qCDebug(lcQpaTablet) << __FUNCTION__ << (enteredProximity ? "enter" : "leave")
<< " proximity for device #" << m_currentDevice << m_devices.at(m_currentDevice);
if (enteredProximity) {
QWindowSystemInterface::handleTabletEnterProximityEvent(m_devices.at(m_currentDevice).currentDevice,
m_devices.at(m_currentDevice).currentPointerType,
@ -410,9 +405,8 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
enum { absoluteRange = 20 };
const QRect virtualDesktopArea = QGuiApplication::primaryScreen()->virtualGeometry();
if (QWindowsContext::verboseTablet)
qDebug() << __FUNCTION__ << "processing " << packetCount
<< "target:" << QGuiApplicationPrivate::tabletPressTarget;
qCDebug(lcQpaTablet) << __FUNCTION__ << "processing " << packetCount
<< "target:" << QGuiApplicationPrivate::tabletPressTarget;
const Qt::KeyboardModifiers keyboardModifiers = QWindowsKeyMapper::queryKeyboardModifiers();
@ -474,8 +468,8 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
rotation = packet.pkOrientation.orTwist;
}
if (QWindowsContext::verboseTablet > 1) {
qDebug()
if (QWindowsContext::verbose > 1) {
qCDebug(lcQpaTablet)
<< "Packet #" << i << '/' << packetCount << "button:" << packet.pkButtons
<< globalPosF << z << "to:" << target << localPos << "(packet" << packet.pkX
<< packet.pkY << ") dev:" << currentDevice << "pointer:"

View File

@ -546,8 +546,7 @@ QWindowsWindow::WindowData
result.hwnd = GetDesktopWindow();
result.geometry = frameGeometry(result.hwnd, true);
result.embedded = false;
if (QWindowsContext::verboseWindows)
qDebug().nospace() << "Created desktop window " << w << result.hwnd;
qCDebug(lcQpaWindows) << "Created desktop window " << w << result.hwnd;
return result;
}
if ((flags & Qt::WindowType_Mask) == Qt::ForeignWindow) {
@ -558,8 +557,7 @@ QWindowsWindow::WindowData
result.geometry = frameGeometry(result.hwnd, !GetParent(result.hwnd));
result.frame = QWindowsGeometryHint::frame(style, exStyle);
result.embedded = false;
if (QWindowsContext::verboseWindows)
qDebug() << "Foreign window: " << w << result.hwnd << result.geometry << result.frame;
qCDebug(lcQpaWindows) << "Foreign window: " << w << result.hwnd << result.geometry << result.frame;
return result;
}
@ -580,24 +578,21 @@ QWindowsWindow::WindowData
const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, data.customMargins, style, exStyle));
QWindowsContext::instance()->setWindowCreationContext(context);
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< "CreateWindowEx: " << w << *this
<< " class=" <<windowClassName << " title=" << title
<< "\nrequested: " << rect << ": "
<< context->frameWidth << 'x' << context->frameHeight
<< '+' << context->frameX << '+' << context->frameY
<< " custom margins: " << context->customMargins;
qCDebug(lcQpaWindows).nospace()
<< "CreateWindowEx: " << w << *this << " class=" <<windowClassName << " title=" << title
<< "\nrequested: " << rect << ": "
<< context->frameWidth << 'x' << context->frameHeight
<< '+' << context->frameX << '+' << context->frameY
<< " custom margins: " << context->customMargins;
result.hwnd = CreateWindowEx(exStyle, classNameUtf16, titleUtf16,
style,
context->frameX, context->frameY,
context->frameWidth, context->frameHeight,
parentHandle, NULL, appinst, NULL);
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
<< context->obtainedGeometry << context->margins;
qCDebug(lcQpaWindows).nospace()
<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
<< context->obtainedGeometry << context->margins;
if (!result.hwnd) {
qErrnoWarning("%s: CreateWindowEx failed", __FUNCTION__);
@ -627,8 +622,7 @@ void WindowCreationData::applyWindowFlags(HWND hwnd) const
const LONG_PTR newExStyle = exStyle;
if (newExStyle != oldExStyle)
SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle);
if (QWindowsContext::verboseWindows)
qDebug().nospace() << __FUNCTION__ << hwnd << *this
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << hwnd << *this
<< "\n Style from " << debugWinStyle(oldStyle) << "\n to "
<< debugWinStyle(newStyle) << "\n ExStyle from "
<< debugWinExStyle(oldExStyle) << " to "
@ -705,10 +699,8 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle)
qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__);
const QMargins result(qAbs(rect.left), qAbs(rect.top),
qAbs(rect.right), qAbs(rect.bottom));
if (QWindowsContext::verboseWindows)
qDebug().nospace() << __FUNCTION__ << " style= 0x"
<< QString::number(style, 16)
<< " exStyle=0x" << QString::number(exStyle, 16) << ' ' << rect << ' ' << result;
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style= 0x"
<< QString::number(style, 16) << " exStyle=0x" << QString::number(exStyle, 16) << ' ' << rect << ' ' << result;
return result;
}
@ -727,10 +719,9 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co
ncp->rgrc[0].right -= customMargins.right();
ncp->rgrc[0].bottom -= customMargins.bottom();
result = 0;
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << oldClientArea << '+' << customMargins << "-->"
<< ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2]
<< ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy;
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << oldClientArea << '+' << customMargins << "-->"
<< ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2]
<< ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy;
return true;
#else
Q_UNUSED(customMargins)
@ -749,11 +740,10 @@ void QWindowsGeometryHint::applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const
void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const
{
if (QWindowsContext::verboseWindows)
qDebug().nospace() << '>' << __FUNCTION__ << '<' << " min="
<< minimumSize.width() << ',' << minimumSize.height()
<< " max=" << maximumSize.width() << ',' << maximumSize.height()
<< " in " << *mmi;
qCDebug(lcQpaWindows).nospace() << '>' << __FUNCTION__ << '<' << " min="
<< minimumSize.width() << ',' << minimumSize.height()
<< " max=" << maximumSize.width() << ',' << maximumSize.height()
<< " in " << *mmi;
const QMargins margins = QWindowsGeometryHint::frame(style, exStyle);
const int frameWidth = margins.left() + margins.right() + customMargins.left() + customMargins.right();
@ -770,10 +760,9 @@ void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXI
// windows with title bar have an implicit size limit of 112 pixels
if (maximumHeight < QWINDOWSIZE_MAX)
mmi->ptMaxTrackSize.y = qMax(maximumHeight + frameHeight, 112);
if (QWindowsContext::verboseWindows)
qDebug().nospace() << '<' << __FUNCTION__
<< " frame=" << margins << ' ' << frameWidth << ',' << frameHeight
<< " out " << *mmi;
qCDebug(lcQpaWindows).nospace() << '<' << __FUNCTION__
<< " frame=" << margins << ' ' << frameWidth << ',' << frameHeight
<< " out " << *mmi;
}
#endif // !Q_OS_WINCE
@ -831,15 +820,13 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
}
}
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< __FUNCTION__ << ' ' << w << geometry
<< " pos incl. frame" << QWindowsGeometryHint::positionIncludesFrame(w)
<< " frame: " << frameWidth << 'x' << frameHeight << '+'
<< frameX << '+' << frameY
<< " min" << geometryHint.minimumSize
<< " max" << geometryHint.maximumSize
<< " custom margins " << customMargins;
qCDebug(lcQpaWindows).nospace()
<< __FUNCTION__ << ' ' << w << geometry
<< " pos incl. frame" << QWindowsGeometryHint::positionIncludesFrame(w)
<< " frame: " << frameWidth << 'x' << frameHeight << '+'
<< frameX << '+' << frameY
<< " min" << geometryHint.minimumSize << " max" << geometryHint.maximumSize
<< " custom margins " << customMargins;
}
/*!
@ -949,8 +936,7 @@ void QWindowsWindow::fireExpose(const QRegion &region, bool force)
void QWindowsWindow::destroyWindow()
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() << m_data.hwnd;
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd;
if (m_data.hwnd) { // Stop event dispatching before Window is destroyed.
setFlag(WithinDestroy);
QWindowsContext *context = QWindowsContext::instance();
@ -961,9 +947,7 @@ void QWindowsWindow::destroyWindow()
unregisterDropSite();
#ifdef QT_OPENGL_ES_2
if (m_eglSurface) {
if (QWindowsContext::verboseGL)
qDebug("%s: Freeing EGL surface %p, this = %p",
__FUNCTION__, m_eglSurface, this);
qCDebug(lcQpaGl) << __FUNCTION__ << "Freeing EGL surface " << m_eglSurface << window();
eglDestroySurface(m_staticEglContext->display(), m_eglSurface);
m_eglSurface = 0;
}
@ -1048,8 +1032,7 @@ QWindowsWindow::WindowData
void QWindowsWindow::setVisible(bool visible)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() << m_data.hwnd << visible;
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd << visible;
if (m_data.hwnd) {
if (visible) {
show_sys();
@ -1199,8 +1182,7 @@ void QWindowsWindow::hide_sys() const
void QWindowsWindow::setParent(const QPlatformWindow *newParent)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << window() << newParent;
qCDebug(lcQpaWindows) << __FUNCTION__ << window() << newParent;
if (m_data.hwnd)
setParent_sys(newParent);
@ -1350,8 +1332,7 @@ void QWindowsWindow::handleGeometryChange()
if (testFlag(SynchronousGeometryChangeEvent))
QWindowSystemInterface::flushWindowSystemEvents();
if (QWindowsContext::verboseEvents || QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() << m_data.geometry;
qCDebug(lcQpaEvents) << __FUNCTION__ << this << window() << m_data.geometry;
}
void QWindowsWindow::setGeometry_sys(const QRect &rect) const
@ -1359,17 +1340,15 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const
const QMargins margins = frameMargins();
const QRect frameGeometry = rect + margins;
if (QWindowsContext::verboseWindows)
qDebug() << '>' << __FUNCTION__ << this << window()
qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window()
<< " \n from " << geometry_sys() << " frame: "
<< margins << " to " <<rect
<< " new frame: " << frameGeometry;
const bool rc = MoveWindow(m_data.hwnd, frameGeometry.x(), frameGeometry.y(),
frameGeometry.width(), frameGeometry.height(), true);
if (QWindowsContext::verboseWindows)
qDebug() << '<' << __FUNCTION__ << this << window()
<< " \n resulting " << rc << geometry_sys();
qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window()
<< " \n resulting " << rc << geometry_sys();
}
QRect QWindowsWindow::frameGeometry_sys() const
@ -1442,8 +1421,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
void QWindowsWindow::setWindowTitle(const QString &title)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() <<title;
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() <<title;
if (m_data.hwnd) {
const QString fullTitle = formatWindowTitle(title, QStringLiteral(" - "));
SetWindowText(m_data.hwnd, (const wchar_t*)fullTitle.utf16());
@ -1452,10 +1430,9 @@ void QWindowsWindow::setWindowTitle(const QString &title)
void QWindowsWindow::setWindowFlags(Qt::WindowFlags flags)
{
if (QWindowsContext::verboseWindows)
qDebug() << '>' << __FUNCTION__ << this << window() << "\n from: "
<< QWindowsWindow::debugWindowFlags(m_data.flags)
<< "\n to: " << QWindowsWindow::debugWindowFlags(flags);
qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window() << "\n from: "
<< QWindowsWindow::debugWindowFlags(m_data.flags)
<< "\n to: " << QWindowsWindow::debugWindowFlags(flags);
const QRect oldGeometry = geometry();
if (m_data.flags != flags) {
m_data.flags = flags;
@ -1470,10 +1447,9 @@ void QWindowsWindow::setWindowFlags(Qt::WindowFlags flags)
if (oldGeometry != newGeometry)
handleGeometryChange();
if (QWindowsContext::verboseWindows)
qDebug() << '<' << __FUNCTION__ << "\n returns: "
<< QWindowsWindow::debugWindowFlags(m_data.flags)
<< " geometry " << oldGeometry << "->" << newGeometry;
qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << "\n returns: "
<< QWindowsWindow::debugWindowFlags(m_data.flags)
<< " geometry " << oldGeometry << "->" << newGeometry;
}
QWindowsWindow::WindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt,
@ -1493,8 +1469,7 @@ QWindowsWindow::WindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt
void QWindowsWindow::handleWindowStateChange(Qt::WindowState state)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window()
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window()
<< "\n from " << debugWindowStates(m_windowState)
<< " to " << debugWindowStates(state);
setFlag(FrameDirty);
@ -1577,10 +1552,8 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
const Qt::WindowState oldState = m_windowState;
if (oldState == newState)
return;
if (QWindowsContext::verboseWindows)
qDebug() << '>' << __FUNCTION__ << this << window()
<< " from " << debugWindowStates(oldState)
<< " to " << debugWindowStates(newState);
qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window()
<< " from " << debugWindowStates(oldState) << " to " << debugWindowStates(newState);
const bool visible = isVisible();
@ -1677,15 +1650,12 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
ShowWindow(m_data.hwnd, (newState == Qt::WindowMinimized) ? SW_MINIMIZE :
(newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
}
if (QWindowsContext::verboseWindows)
qDebug() << '<' << __FUNCTION__ << this << window()
<< debugWindowStates(newState);
qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() << debugWindowStates(newState);
}
void QWindowsWindow::setStyle(unsigned s) const
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() << debugWinStyle(s);
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << debugWinStyle(s);
setFlag(WithinSetStyle);
setFlag(FrameDirty);
SetWindowLongPtr(m_data.hwnd, GWL_STYLE, s);
@ -1694,8 +1664,7 @@ void QWindowsWindow::setStyle(unsigned s) const
void QWindowsWindow::setExStyle(unsigned s) const
{
if (QWindowsContext::verboseWindows)
qDebug().nospace() << __FUNCTION__ << ' ' << this << ' ' << window()
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << ' ' << this << ' ' << window()
<< " 0x" << QByteArray::number(s, 16);
setFlag(FrameDirty);
SetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE, s);
@ -1703,15 +1672,13 @@ void QWindowsWindow::setExStyle(unsigned s) const
void QWindowsWindow::raise()
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window();
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window();
SetWindowPos(m_data.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
void QWindowsWindow::lower()
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window();
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window();
if (m_data.hwnd)
SetWindowPos(m_data.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
@ -1734,8 +1701,7 @@ void QWindowsWindow::windowEvent(QEvent *event)
void QWindowsWindow::propagateSizeHints()
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window();
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window();
}
QMargins QWindowsWindow::frameMargins() const
@ -1753,8 +1719,7 @@ QMargins QWindowsWindow::frameMargins() const
void QWindowsWindow::setOpacity(qreal level)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << level;
qCDebug(lcQpaWindows) << __FUNCTION__ << level;
if (m_opacity != level) {
m_opacity = level;
if (m_data.hwnd)
@ -1816,8 +1781,7 @@ void QWindowsWindow::setMask(const QRegion &region)
void QWindowsWindow::requestActivateWindow()
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window();
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window();
// 'Active' state handling is based in focus since it needs to work for
// child windows as well.
if (m_data.hwnd) {
@ -1832,8 +1796,7 @@ bool QWindowsWindow::setKeyboardGrabEnabled(bool grab)
qWarning("%s: No handle", __FUNCTION__);
return false;
}
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() << grab;
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << grab;
QWindowsContext *context = QWindowsContext::instance();
if (grab) {
@ -1847,8 +1810,7 @@ bool QWindowsWindow::setKeyboardGrabEnabled(bool grab)
bool QWindowsWindow::setMouseGrabEnabled(bool grab)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << window() << grab;
qCDebug(lcQpaWindows) << __FUNCTION__ << window() << grab;
if (!m_data.hwnd) {
qWarning("%s: No handle", __FUNCTION__);
return false;
@ -1930,8 +1892,7 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
}
}
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << window() << *mmi;
qCDebug(lcQpaWindows) << __FUNCTION__ << window() << *mmi;
}
bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const
@ -2031,9 +1992,8 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
#ifndef QT_NO_CURSOR
if (c.handle() != m_cursor.handle()) {
const bool apply = applyNewCursor(window());
if (QWindowsContext::verboseWindows)
qDebug() << window() << __FUNCTION__ << "Shape=" << c.cursor().shape()
<< " doApply=" << apply;
qCDebug(lcQpaWindows) <<window() << __FUNCTION__
<< "Shape=" << c.cursor().shape() << " doApply=" << apply;
m_cursor = c;
if (apply)
applyCursor();
@ -2131,9 +2091,7 @@ EGLSurface QWindowsWindow::ensureEglSurfaceHandle(const QWindowsWindow::QWindows
Q_FUNC_INFO, window()->metaObject()->className(),
qPrintable(window()->objectName()), eglGetError());
if (QWindowsContext::verboseGL)
qDebug("%s: Created EGL surface %p, this = %p",
__FUNCTION__, m_eglSurface, this);
qCDebug(lcQpaGl) << __FUNCTION__<<"Created EGL surface "<< m_eglSurface <<window();
}
return m_eglSurface;
}
@ -2244,9 +2202,8 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins)
QRect newFrame = currentFrameGeometry.marginsRemoved(oldCustomMargins) + m_data.customMargins;
newFrame.moveTo(topLeft);
setFlag(FrameDirty);
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << oldCustomMargins << "->" << newCustomMargins
<< currentFrameGeometry << "->" << newFrame;
qCDebug(lcQpaWindows) << __FUNCTION__ << oldCustomMargins << "->" << newCustomMargins
<< currentFrameGeometry << "->" << newFrame;
SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED);
}
}