workspace: take touch and tablet into account for active output follows mouse
While not technically fitting for the name of the option, the behavior is what a user would expect and it also matches with X11 (where the cursor goes to the touch position).
This commit is contained in:
parent
fb1a6ecd8d
commit
6e13e21a08
5 changed files with 24 additions and 1 deletions
|
@ -766,6 +766,7 @@ void PointerInputRedirection::updatePosition(const QPointF &pos)
|
||||||
|
|
||||||
m_pos = p;
|
m_pos = p;
|
||||||
|
|
||||||
|
workspace()->setActiveCursorOutput(m_pos);
|
||||||
updateCursorOutputs();
|
updateCursorOutputs();
|
||||||
|
|
||||||
Q_EMIT input()->globalPointerChanged(m_pos);
|
Q_EMIT input()->globalPointerChanged(m_pos);
|
||||||
|
|
|
@ -70,6 +70,7 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
workspace()->setActiveCursorOutput(pos);
|
||||||
|
|
||||||
const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton;
|
const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton;
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, std::chro
|
||||||
m_activeTouchPoints.insert(id);
|
m_activeTouchPoints.insert(id);
|
||||||
if (m_activeTouchPoints.count() == 1) {
|
if (m_activeTouchPoints.count() == 1) {
|
||||||
update();
|
update();
|
||||||
|
workspace()->setActiveCursorOutput(pos);
|
||||||
}
|
}
|
||||||
input()->setLastInputHandler(this);
|
input()->setLastInputHandler(this);
|
||||||
input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time));
|
input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time));
|
||||||
|
|
|
@ -1566,6 +1566,9 @@ void Workspace::updateOutputs(const QVector<Output *> &outputOrder)
|
||||||
if (!m_activeOutput || !m_outputs.contains(m_activeOutput)) {
|
if (!m_activeOutput || !m_outputs.contains(m_activeOutput)) {
|
||||||
setActiveOutput(m_outputs[0]);
|
setActiveOutput(m_outputs[0]);
|
||||||
}
|
}
|
||||||
|
if (!m_outputs.contains(m_activeCursorOutput)) {
|
||||||
|
m_activeCursorOutput = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (!outputOrder.empty()) {
|
if (!outputOrder.empty()) {
|
||||||
setOutputOrder(outputOrder);
|
setOutputOrder(outputOrder);
|
||||||
|
@ -2772,7 +2775,11 @@ QVector<Output *> Workspace::outputOrder() const
|
||||||
Output *Workspace::activeOutput() const
|
Output *Workspace::activeOutput() const
|
||||||
{
|
{
|
||||||
if (options->activeMouseScreen()) {
|
if (options->activeMouseScreen()) {
|
||||||
return outputAt(Cursors::self()->mouse()->pos());
|
if (m_activeCursorOutput) {
|
||||||
|
return m_activeCursorOutput;
|
||||||
|
} else {
|
||||||
|
return outputAt(Cursors::self()->mouse()->pos());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_activeWindow && !m_activeWindow->isOnOutput(m_activeOutput)) {
|
if (m_activeWindow && !m_activeWindow->isOnOutput(m_activeOutput)) {
|
||||||
|
@ -2792,6 +2799,16 @@ void Workspace::setActiveOutput(const QPointF &pos)
|
||||||
setActiveOutput(outputAt(pos));
|
setActiveOutput(outputAt(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Workspace::setActiveCursorOutput(Output *output)
|
||||||
|
{
|
||||||
|
m_activeCursorOutput = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Workspace::setActiveCursorOutput(const QPointF &pos)
|
||||||
|
{
|
||||||
|
setActiveCursorOutput(outputAt(pos));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \a window is moved around to position \a pos. This gives the
|
* \a window is moved around to position \a pos. This gives the
|
||||||
* workspace the opportunity to interveniate and to implement
|
* workspace the opportunity to interveniate and to implement
|
||||||
|
|
|
@ -182,6 +182,8 @@ public:
|
||||||
Output *activeOutput() const;
|
Output *activeOutput() const;
|
||||||
void setActiveOutput(Output *output);
|
void setActiveOutput(Output *output);
|
||||||
void setActiveOutput(const QPointF &pos);
|
void setActiveOutput(const QPointF &pos);
|
||||||
|
void setActiveCursorOutput(Output *output);
|
||||||
|
void setActiveCursorOutput(const QPointF &pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the active window, i.e. the window that has the focus (or None
|
* Returns the active window, i.e. the window that has the focus (or None
|
||||||
|
@ -678,6 +680,7 @@ private:
|
||||||
|
|
||||||
QList<Output *> m_outputs;
|
QList<Output *> m_outputs;
|
||||||
Output *m_activeOutput = nullptr;
|
Output *m_activeOutput = nullptr;
|
||||||
|
Output *m_activeCursorOutput = nullptr;
|
||||||
QString m_outputsHash;
|
QString m_outputsHash;
|
||||||
QVector<Output *> m_outputOrder;
|
QVector<Output *> m_outputOrder;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue