ibus: use logging category for im debug
Pick-to: 6.8 6.5 Change-Id: I5397f1fb14273b77833979d3e66056a7110fd2b0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io> (cherry picked from commit 5c9fd486ae82056614bdb9e685c825b586bb9809) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
775d56f01d
commit
4be258fd13
@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
enum { debug = 0 };
|
Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods");
|
||||||
|
|
||||||
class QIBusPlatformInputContextPrivate
|
class QIBusPlatformInputContextPrivate
|
||||||
{
|
{
|
||||||
@ -247,8 +247,7 @@ void QIBusPlatformInputContext::cursorRectChanged()
|
|||||||
r.translate(margins.left(), margins.top());
|
r.translate(margins.left(), margins.top());
|
||||||
qreal scale = inputWindow->devicePixelRatio();
|
qreal scale = inputWindow->devicePixelRatio();
|
||||||
QRect newRect = QRect(r.x() * scale, r.y() * scale, r.width() * scale, r.height() * scale);
|
QRect newRect = QRect(r.x() * scale, r.y() * scale, r.width() * scale, r.height() * scale);
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "microFocus" << newRect;
|
||||||
qDebug() << "microFocus" << newRect;
|
|
||||||
d->context->SetCursorLocationRelative(newRect.x(), newRect.y(),
|
d->context->SetCursorLocationRelative(newRect.x(), newRect.y(),
|
||||||
newRect.width(), newRect.height());
|
newRect.width(), newRect.height());
|
||||||
return;
|
return;
|
||||||
@ -260,8 +259,7 @@ void QIBusPlatformInputContext::cursorRectChanged()
|
|||||||
qreal scale = inputWindow->devicePixelRatio();
|
qreal scale = inputWindow->devicePixelRatio();
|
||||||
auto native = (point - screenGeometry.topLeft()) * scale + screenGeometry.topLeft();
|
auto native = (point - screenGeometry.topLeft()) * scale + screenGeometry.topLeft();
|
||||||
QRect newRect(native, r.size() * scale);
|
QRect newRect(native, r.size() * scale);
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "microFocus" << newRect;
|
||||||
qDebug() << "microFocus" << newRect;
|
|
||||||
d->context->SetCursorLocation(newRect.x(), newRect.y(),
|
d->context->SetCursorLocation(newRect.x(), newRect.y(),
|
||||||
newRect.width(), newRect.height());
|
newRect.width(), newRect.height());
|
||||||
}
|
}
|
||||||
@ -277,8 +275,7 @@ void QIBusPlatformInputContext::setFocusObject(QObject *object)
|
|||||||
if (object && !inputMethodAccepted())
|
if (object && !inputMethodAccepted())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "setFocusObject" << object;
|
||||||
qDebug() << "setFocusObject" << object;
|
|
||||||
if (object)
|
if (object)
|
||||||
d->context->FocusIn();
|
d->context->FocusIn();
|
||||||
else
|
else
|
||||||
@ -294,11 +291,9 @@ void QIBusPlatformInputContext::commitText(const QDBusVariant &text)
|
|||||||
const QDBusArgument arg = qvariant_cast<QDBusArgument>(text.variant());
|
const QDBusArgument arg = qvariant_cast<QDBusArgument>(text.variant());
|
||||||
|
|
||||||
QIBusText t;
|
QIBusText t;
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << arg.currentSignature();
|
||||||
qDebug() << arg.currentSignature();
|
|
||||||
arg >> t;
|
arg >> t;
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "commit text:" << t.text;
|
||||||
qDebug() << "commit text:" << t.text;
|
|
||||||
|
|
||||||
QInputMethodEvent event;
|
QInputMethodEvent event;
|
||||||
event.setCommitString(t.text);
|
event.setCommitString(t.text);
|
||||||
@ -321,8 +316,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint
|
|||||||
|
|
||||||
QIBusText t;
|
QIBusText t;
|
||||||
arg >> t;
|
arg >> t;
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "preedit text:" << t.text;
|
||||||
qDebug() << "preedit text:" << t.text;
|
|
||||||
|
|
||||||
d->attributes = t.attributes.imAttributes();
|
d->attributes = t.attributes.imAttributes();
|
||||||
if (!t.text.isEmpty())
|
if (!t.text.isEmpty())
|
||||||
@ -372,8 +366,7 @@ void QIBusPlatformInputContext::forwardKeyEvent(uint keyval, uint keycode, uint
|
|||||||
int qtcode = QXkbCommon::keysymToQtKey(keyval, modifiers);
|
int qtcode = QXkbCommon::keysymToQtKey(keyval, modifiers);
|
||||||
QString text = QXkbCommon::lookupStringNoKeysymTransformations(keyval);
|
QString text = QXkbCommon::lookupStringNoKeysymTransformations(keyval);
|
||||||
|
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "forwardKeyEvent" << keyval << keycode << state << modifiers << qtcode << text;
|
||||||
qDebug() << "forwardKeyEvent" << keyval << keycode << state << modifiers << qtcode << text;
|
|
||||||
|
|
||||||
QKeyEvent event(type, qtcode, modifiers, keycode, keyval, state, text);
|
QKeyEvent event(type, qtcode, modifiers, keycode, keyval, state, text);
|
||||||
QCoreApplication::sendEvent(input, &event);
|
QCoreApplication::sendEvent(input, &event);
|
||||||
@ -381,8 +374,7 @@ void QIBusPlatformInputContext::forwardKeyEvent(uint keyval, uint keycode, uint
|
|||||||
|
|
||||||
void QIBusPlatformInputContext::surroundingTextRequired()
|
void QIBusPlatformInputContext::surroundingTextRequired()
|
||||||
{
|
{
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "surroundingTextRequired";
|
||||||
qDebug("surroundingTextRequired");
|
|
||||||
d->needsSurroundingText = true;
|
d->needsSurroundingText = true;
|
||||||
update(Qt::ImSurroundingText);
|
update(Qt::ImSurroundingText);
|
||||||
}
|
}
|
||||||
@ -393,8 +385,7 @@ void QIBusPlatformInputContext::deleteSurroundingText(int offset, uint n_chars)
|
|||||||
if (!input)
|
if (!input)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "deleteSurroundingText" << offset << n_chars;
|
||||||
qDebug() << "deleteSurroundingText" << offset << n_chars;
|
|
||||||
|
|
||||||
QInputMethodEvent event;
|
QInputMethodEvent event;
|
||||||
event.setCommitString("", offset, n_chars);
|
event.setCommitString("", offset, n_chars);
|
||||||
@ -640,8 +631,7 @@ QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()
|
|||||||
{
|
{
|
||||||
if (usePortal) {
|
if (usePortal) {
|
||||||
valid = true;
|
valid = true;
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "use IBus portal";
|
||||||
qDebug() << "use IBus portal";
|
|
||||||
} else {
|
} else {
|
||||||
valid = !QStandardPaths::findExecutable(QString::fromLocal8Bit("ibus-daemon"), QStringList()).isEmpty();
|
valid = !QStandardPaths::findExecutable(QString::fromLocal8Bit("ibus-daemon"), QStringList()).isEmpty();
|
||||||
}
|
}
|
||||||
@ -720,8 +710,7 @@ void QIBusPlatformInputContextPrivate::createBusProxy()
|
|||||||
|
|
||||||
context->setClientCommitPreedit(QIBusPropTypeClientCommitPreedit(true));
|
context->setClientCommitPreedit(QIBusPropTypeClientCommitPreedit(true));
|
||||||
|
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << ">>>> bus connected!";
|
||||||
qDebug(">>>> bus connected!");
|
|
||||||
busConnected = true;
|
busConnected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,8 +743,7 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()
|
|||||||
displayNumber = display.mid(pos);
|
displayNumber = display.mid(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "host=" << host << "displayNumber" << displayNumber;
|
||||||
qDebug() << "host=" << host << "displayNumber" << displayNumber;
|
|
||||||
|
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
|
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
|
||||||
"/ibus/bus/"_L1 +
|
"/ibus/bus/"_L1 +
|
||||||
@ -789,8 +777,7 @@ void QIBusPlatformInputContextPrivate::createConnection()
|
|||||||
pid = line.mid(sizeof("IBUS_DAEMON_PID=") - 1).toInt();
|
pid = line.mid(sizeof("IBUS_DAEMON_PID=") - 1).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
qCDebug(lcQpaInputMethods) << "IBUS_ADDRESS=" << address << "PID=" << pid;
|
||||||
qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid;
|
|
||||||
if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
|
if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qpointer.h>
|
#include <QtCore/qpointer.h>
|
||||||
#include <QtCore/QLocale>
|
#include <QtCore/QLocale>
|
||||||
|
#include <QtCore/QLoggingCategory>
|
||||||
#include <QtDBus/qdbuspendingreply.h>
|
#include <QtDBus/qdbuspendingreply.h>
|
||||||
#if QT_CONFIG(filesystemwatcher)
|
#if QT_CONFIG(filesystemwatcher)
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
@ -18,6 +19,8 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(lcQpaInputMethods);
|
||||||
|
|
||||||
class QIBusPlatformInputContextPrivate;
|
class QIBusPlatformInputContextPrivate;
|
||||||
class QDBusVariant;
|
class QDBusVariant;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user