InputMethod: only activate virtual keyboard when used with touch
This commit is contained in:
parent
f1e99e971f
commit
5b9deafa14
8 changed files with 35 additions and 0 deletions
|
@ -2950,6 +2950,11 @@ QWindow *InputDeviceHandler::internalWindow() const
|
||||||
return m_focus.internalWindow;
|
return m_focus.internalWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t InputDeviceHandler::lastEventTime() const
|
||||||
|
{
|
||||||
|
return m_lastEventTime;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#include "input.moc"
|
#include "input.moc"
|
||||||
|
|
|
@ -462,6 +462,8 @@ public:
|
||||||
void setDecoration(Decoration::DecoratedClientImpl *decoration);
|
void setDecoration(Decoration::DecoratedClientImpl *decoration);
|
||||||
void setInternalWindow(QWindow *window);
|
void setInternalWindow(QWindow *window);
|
||||||
|
|
||||||
|
uint32_t lastEventTime() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void atChanged(Toplevel *old, Toplevel *now);
|
void atChanged(Toplevel *old, Toplevel *now);
|
||||||
void decorationChanged();
|
void decorationChanged();
|
||||||
|
@ -493,6 +495,8 @@ protected:
|
||||||
m_inited = set;
|
m_inited = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t m_lastEventTime = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setAt(Toplevel *toplevel);
|
bool setAt(Toplevel *toplevel);
|
||||||
void updateFocus();
|
void updateFocus();
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "screenlockerwatcher.h"
|
#include "screenlockerwatcher.h"
|
||||||
#include "deleted.h"
|
#include "deleted.h"
|
||||||
|
#include "touch_input.h"
|
||||||
|
#include "pointer_input.h"
|
||||||
|
|
||||||
#include <KWaylandServer/display.h>
|
#include <KWaylandServer/display.h>
|
||||||
#include <KWaylandServer/keyboard_interface.h>
|
#include <KWaylandServer/keyboard_interface.h>
|
||||||
|
@ -118,6 +120,9 @@ void InputMethod::hide()
|
||||||
|
|
||||||
void InputMethod::setActive(bool active)
|
void InputMethod::setActive(bool active)
|
||||||
{
|
{
|
||||||
|
active &= input()->touch()
|
||||||
|
&& input()->touch()->lastEventTime() > input()->keyboard()->lastEventTime()
|
||||||
|
&& input()->touch()->lastEventTime() > input()->pointer()->lastEventTime();
|
||||||
const bool wasActive = waylandServer()->inputMethod()->context();
|
const bool wasActive = waylandServer()->inputMethod()->context();
|
||||||
if (wasActive && !active) {
|
if (wasActive && !active) {
|
||||||
waylandServer()->inputMethod()->sendDeactivate();
|
waylandServer()->inputMethod()->sendDeactivate();
|
||||||
|
|
|
@ -218,6 +218,7 @@ void KeyboardInputRedirection::processKey(uint32_t key, InputRedirection::Keyboa
|
||||||
if (!m_inited) {
|
if (!m_inited) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_lastEventTime = time;
|
||||||
m_input->processFilters(std::bind(&InputEventFilter::keyEvent, std::placeholders::_1, &event));
|
m_input->processFilters(std::bind(&InputEventFilter::keyEvent, std::placeholders::_1, &event));
|
||||||
|
|
||||||
m_xkb->forwardModifiers();
|
m_xkb->forwardModifiers();
|
||||||
|
|
|
@ -76,6 +76,10 @@ public:
|
||||||
return m_xkb->modifiersRelevantForGlobalShortcuts();
|
return m_xkb->modifiersRelevantForGlobalShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t lastEventTime() const {
|
||||||
|
return m_lastEventTime;
|
||||||
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void ledsChanged(KWin::LEDs);
|
void ledsChanged(KWin::LEDs);
|
||||||
|
|
||||||
|
@ -86,6 +90,7 @@ private:
|
||||||
QMetaObject::Connection m_activeClientSurfaceChangedConnection;
|
QMetaObject::Connection m_activeClientSurfaceChangedConnection;
|
||||||
ModifiersChangedSpy *m_modifiersChangedSpy = nullptr;
|
ModifiersChangedSpy *m_modifiersChangedSpy = nullptr;
|
||||||
KeyboardLayout *m_keyboardLayout = nullptr;
|
KeyboardLayout *m_keyboardLayout = nullptr;
|
||||||
|
uint32_t m_lastEventTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,6 +249,7 @@ QVector<PositionUpdateBlocker::ScheduledPosition> PositionUpdateBlocker::s_sched
|
||||||
|
|
||||||
void PointerInputRedirection::processMotion(const QPointF &pos, const QSizeF &delta, const QSizeF &deltaNonAccelerated, uint32_t time, quint64 timeUsec, LibInput::Device *device)
|
void PointerInputRedirection::processMotion(const QPointF &pos, const QSizeF &delta, const QSizeF &deltaNonAccelerated, uint32_t time, quint64 timeUsec, LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -271,6 +272,7 @@ void PointerInputRedirection::processMotion(const QPointF &pos, const QSizeF &de
|
||||||
|
|
||||||
void PointerInputRedirection::processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time, LibInput::Device *device)
|
void PointerInputRedirection::processButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time, LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
QEvent::Type type;
|
QEvent::Type type;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case InputRedirection::PointerButtonReleased:
|
case InputRedirection::PointerButtonReleased:
|
||||||
|
@ -308,6 +310,7 @@ void PointerInputRedirection::processButton(uint32_t button, InputRedirection::P
|
||||||
void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, qint32 discreteDelta,
|
void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, qint32 discreteDelta,
|
||||||
InputRedirection::PointerAxisSource source, uint32_t time, LibInput::Device *device)
|
InputRedirection::PointerAxisSource source, uint32_t time, LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
update();
|
update();
|
||||||
|
|
||||||
Q_EMIT input()->pointerAxisChanged(axis, delta);
|
Q_EMIT input()->pointerAxisChanged(axis, delta);
|
||||||
|
@ -327,6 +330,7 @@ void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qr
|
||||||
|
|
||||||
void PointerInputRedirection::processSwipeGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processSwipeGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -338,6 +342,7 @@ void PointerInputRedirection::processSwipeGestureBegin(int fingerCount, quint32
|
||||||
|
|
||||||
void PointerInputRedirection::processSwipeGestureUpdate(const QSizeF &delta, quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processSwipeGestureUpdate(const QSizeF &delta, quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -350,6 +355,7 @@ void PointerInputRedirection::processSwipeGestureUpdate(const QSizeF &delta, qui
|
||||||
|
|
||||||
void PointerInputRedirection::processSwipeGestureEnd(quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processSwipeGestureEnd(quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -362,6 +368,7 @@ void PointerInputRedirection::processSwipeGestureEnd(quint32 time, KWin::LibInpu
|
||||||
|
|
||||||
void PointerInputRedirection::processSwipeGestureCancelled(quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processSwipeGestureCancelled(quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -374,6 +381,7 @@ void PointerInputRedirection::processSwipeGestureCancelled(quint32 time, KWin::L
|
||||||
|
|
||||||
void PointerInputRedirection::processPinchGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processPinchGestureBegin(int fingerCount, quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -386,6 +394,7 @@ void PointerInputRedirection::processPinchGestureBegin(int fingerCount, quint32
|
||||||
|
|
||||||
void PointerInputRedirection::processPinchGestureUpdate(qreal scale, qreal angleDelta, const QSizeF &delta, quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processPinchGestureUpdate(qreal scale, qreal angleDelta, const QSizeF &delta, quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -398,6 +407,7 @@ void PointerInputRedirection::processPinchGestureUpdate(qreal scale, qreal angle
|
||||||
|
|
||||||
void PointerInputRedirection::processPinchGestureEnd(quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processPinchGestureEnd(quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
@ -410,6 +420,7 @@ void PointerInputRedirection::processPinchGestureEnd(quint32 time, KWin::LibInpu
|
||||||
|
|
||||||
void PointerInputRedirection::processPinchGestureCancelled(quint32 time, KWin::LibInput::Device *device)
|
void PointerInputRedirection::processPinchGestureCancelled(quint32 time, KWin::LibInput::Device *device)
|
||||||
{
|
{
|
||||||
|
m_lastEventTime = time;
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -53,6 +53,7 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
|
||||||
if (!inited()) {
|
if (!inited()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_lastEventTime = time;
|
||||||
m_lastPosition = pos;
|
m_lastPosition = pos;
|
||||||
|
|
||||||
QEvent::Type t;
|
QEvent::Type t;
|
||||||
|
|
|
@ -147,6 +147,7 @@ void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 t
|
||||||
if (m_activeTouchPoints.count() == 1) {
|
if (m_activeTouchPoints.count() == 1) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
m_lastEventTime = time;
|
||||||
input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time));
|
input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time));
|
||||||
input()->processFilters(std::bind(&InputEventFilter::touchDown, std::placeholders::_1, id, pos, time));
|
input()->processFilters(std::bind(&InputEventFilter::touchDown, std::placeholders::_1, id, pos, time));
|
||||||
m_windowUpdatedInCycle = false;
|
m_windowUpdatedInCycle = false;
|
||||||
|
@ -161,6 +162,7 @@ void TouchInputRedirection::processUp(qint32 id, quint32 time, LibInput::Device
|
||||||
if (!m_activeTouchPoints.remove(id)) {
|
if (!m_activeTouchPoints.remove(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_lastEventTime = time;
|
||||||
m_windowUpdatedInCycle = false;
|
m_windowUpdatedInCycle = false;
|
||||||
input()->processSpies(std::bind(&InputEventSpy::touchUp, std::placeholders::_1, id, time));
|
input()->processSpies(std::bind(&InputEventSpy::touchUp, std::placeholders::_1, id, time));
|
||||||
input()->processFilters(std::bind(&InputEventFilter::touchUp, std::placeholders::_1, id, time));
|
input()->processFilters(std::bind(&InputEventFilter::touchUp, std::placeholders::_1, id, time));
|
||||||
|
@ -179,6 +181,7 @@ void TouchInputRedirection::processMotion(qint32 id, const QPointF &pos, quint32
|
||||||
if (!m_activeTouchPoints.contains(id)) {
|
if (!m_activeTouchPoints.contains(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_lastEventTime = time;
|
||||||
m_lastPosition = pos;
|
m_lastPosition = pos;
|
||||||
m_windowUpdatedInCycle = false;
|
m_windowUpdatedInCycle = false;
|
||||||
input()->processSpies(std::bind(&InputEventSpy::touchMotion, std::placeholders::_1, id, pos, time));
|
input()->processSpies(std::bind(&InputEventSpy::touchMotion, std::placeholders::_1, id, pos, time));
|
||||||
|
|
Loading…
Reference in a new issue