workspace: unify active screen modes
Instead of the active screen being purely defined by the mouse position, or purely defined by the active window and keyboard shortcuts, this changes it to make the active screen all about the last user interaction. This should work for most workflows without needing a setting to choose between two flawed approaches. BUG: 482865 BUG: 484902 BUG: 484902
This commit is contained in:
parent
336b2fd2f6
commit
354a71855e
10 changed files with 12 additions and 94 deletions
|
@ -100,9 +100,6 @@
|
|||
<entry name="SeparateScreenFocus" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="ActiveMouseScreen" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="RollOverDesktops" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
|
|
|
@ -310,6 +310,8 @@ void ApplicationX11::performStartup()
|
|||
|
||||
notifyKSplash();
|
||||
notifyStarted();
|
||||
|
||||
connect(Cursors::self()->mouse(), &Cursor::posChanged, this, qOverload<const QPointF &>(&Workspace::setActiveOutput));
|
||||
});
|
||||
// we need to do an XSync here, otherwise the QPA might crash us later on
|
||||
Xcb::sync();
|
||||
|
|
|
@ -41,7 +41,6 @@ Options::Options(QObject *parent)
|
|||
, m_shadeHover(false)
|
||||
, m_shadeHoverInterval(0)
|
||||
, m_separateScreenFocus(false)
|
||||
, m_activeMouseScreen(false)
|
||||
, m_placement(PlacementNone)
|
||||
, m_activationDesktopPolicy(Options::defaultActivationDesktopPolicy())
|
||||
, m_borderSnapZone(0)
|
||||
|
@ -248,15 +247,6 @@ void Options::setSeparateScreenFocus(bool separateScreenFocus)
|
|||
Q_EMIT separateScreenFocusChanged(m_separateScreenFocus);
|
||||
}
|
||||
|
||||
void Options::setActiveMouseScreen(bool activeMouseScreen)
|
||||
{
|
||||
if (m_activeMouseScreen == activeMouseScreen) {
|
||||
return;
|
||||
}
|
||||
m_activeMouseScreen = activeMouseScreen;
|
||||
Q_EMIT activeMouseScreenChanged();
|
||||
}
|
||||
|
||||
void Options::setPlacement(PlacementPolicy placement)
|
||||
{
|
||||
if (m_placement == placement) {
|
||||
|
@ -836,7 +826,6 @@ void Options::syncFromKcfgc()
|
|||
setFocusPolicy(m_settings->focusPolicy());
|
||||
setNextFocusPrefersMouse(m_settings->nextFocusPrefersMouse());
|
||||
setSeparateScreenFocus(m_settings->separateScreenFocus());
|
||||
setActiveMouseScreen(m_settings->activeMouseScreen());
|
||||
setRollOverDesktops(m_settings->rollOverDesktops());
|
||||
setFocusStealingPreventionLevel(m_settings->focusStealingPreventionLevel());
|
||||
setActivationDesktopPolicy(m_settings->activationDesktopPolicy());
|
||||
|
|
|
@ -107,7 +107,6 @@ class KWIN_EXPORT Options : public QObject
|
|||
* Whether to see Xinerama screens separately for focus (in Alt+Tab, when activating next client)
|
||||
*/
|
||||
Q_PROPERTY(bool separateScreenFocus READ isSeparateScreenFocus WRITE setSeparateScreenFocus NOTIFY separateScreenFocusChanged)
|
||||
Q_PROPERTY(bool activeMouseScreen READ activeMouseScreen WRITE setActiveMouseScreen NOTIFY activeMouseScreenChanged)
|
||||
Q_PROPERTY(PlacementPolicy placement READ placement WRITE setPlacement NOTIFY placementChanged)
|
||||
Q_PROPERTY(ActivationDesktopPolicy activationDesktopPolicy READ activationDesktopPolicy WRITE setActivationDesktopPolicy NOTIFY activationDesktopPolicyChanged)
|
||||
Q_PROPERTY(bool focusPolicyIsReasonable READ focusPolicyIsReasonable NOTIFY focusPolicyIsResonableChanged)
|
||||
|
@ -332,11 +331,6 @@ public:
|
|||
return m_separateScreenFocus;
|
||||
}
|
||||
|
||||
bool activeMouseScreen() const
|
||||
{
|
||||
return m_activeMouseScreen;
|
||||
}
|
||||
|
||||
PlacementPolicy placement() const
|
||||
{
|
||||
return m_placement;
|
||||
|
@ -728,7 +722,6 @@ public:
|
|||
void setShadeHover(bool shadeHover);
|
||||
void setShadeHoverInterval(int shadeHoverInterval);
|
||||
void setSeparateScreenFocus(bool separateScreenFocus);
|
||||
void setActiveMouseScreen(bool activeMouseScreen);
|
||||
void setPlacement(PlacementPolicy placement);
|
||||
void setActivationDesktopPolicy(ActivationDesktopPolicy activationDesktopPolicy);
|
||||
void setBorderSnapZone(int borderSnapZone);
|
||||
|
@ -931,7 +924,6 @@ Q_SIGNALS:
|
|||
void shadeHoverChanged();
|
||||
void shadeHoverIntervalChanged();
|
||||
void separateScreenFocusChanged(bool);
|
||||
void activeMouseScreenChanged();
|
||||
void placementChanged();
|
||||
void activationDesktopPolicyChanged();
|
||||
void borderSnapZoneChanged();
|
||||
|
@ -995,7 +987,6 @@ private:
|
|||
bool m_shadeHover;
|
||||
int m_shadeHoverInterval;
|
||||
bool m_separateScreenFocus;
|
||||
bool m_activeMouseScreen;
|
||||
PlacementPolicy m_placement;
|
||||
ActivationDesktopPolicy m_activationDesktopPolicy;
|
||||
int m_borderSnapZone;
|
||||
|
|
|
@ -846,7 +846,7 @@ void PointerInputRedirection::updatePosition(const QPointF &pos, std::chrono::mi
|
|||
|
||||
m_pos = p;
|
||||
|
||||
workspace()->setActiveCursorOutput(m_pos);
|
||||
workspace()->setActiveOutput(m_pos);
|
||||
m_cursor->updateCursorOutputs(m_pos);
|
||||
|
||||
Q_EMIT input()->globalPointerChanged(m_pos);
|
||||
|
|
|
@ -70,7 +70,7 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
|
|||
}
|
||||
|
||||
update();
|
||||
workspace()->setActiveCursorOutput(pos);
|
||||
workspace()->setActiveOutput(pos);
|
||||
|
||||
const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton;
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, std::chro
|
|||
m_activeTouchPoints.insert(id);
|
||||
if (m_activeTouchPoints.count() == 1) {
|
||||
update();
|
||||
workspace()->setActiveCursorOutput(pos);
|
||||
workspace()->setActiveOutput(pos);
|
||||
}
|
||||
input()->setLastInputHandler(this);
|
||||
input()->processSpies(std::bind(&InputEventSpy::touchDown, std::placeholders::_1, id, pos, time));
|
||||
|
|
|
@ -1255,66 +1255,39 @@ void Workspace::slotWindowToDesktop(VirtualDesktop *desktop)
|
|||
}
|
||||
}
|
||||
|
||||
static bool screenSwitchImpossible()
|
||||
{
|
||||
if (!options->activeMouseScreen()) {
|
||||
return false;
|
||||
}
|
||||
QStringList args;
|
||||
args << QStringLiteral("--passivepopup") << i18n("The window manager is configured to consider the screen with the mouse on it as active one.\n"
|
||||
"Therefore it is not possible to switch to a screen explicitly.")
|
||||
<< QStringLiteral("20");
|
||||
KProcess::startDetached(QStringLiteral("kdialog"), args);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToScreen(Output *output)
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(output);
|
||||
}
|
||||
switchToOutput(output);
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToLeftScreen()
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionWest, true));
|
||||
}
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionWest, true));
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToRightScreen()
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionEast, true));
|
||||
}
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionEast, true));
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToAboveScreen()
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionNorth, true));
|
||||
}
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionNorth, true));
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToBelowScreen()
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionSouth, true));
|
||||
}
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionSouth, true));
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToPrevScreen()
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionPrev, true));
|
||||
}
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionPrev, true));
|
||||
}
|
||||
|
||||
void Workspace::slotSwitchToNextScreen()
|
||||
{
|
||||
if (!screenSwitchImpossible()) {
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionNext, true));
|
||||
}
|
||||
switchToOutput(findOutput(activeOutput(), Direction::DirectionNext, true));
|
||||
}
|
||||
|
||||
void Workspace::slotWindowToScreen(Output *output)
|
||||
|
|
|
@ -1348,9 +1348,6 @@ void Workspace::updateOutputs(const QList<Output *> &outputOrder)
|
|||
if (!m_activeOutput || !m_outputs.contains(m_activeOutput)) {
|
||||
setActiveOutput(m_outputs[0]);
|
||||
}
|
||||
if (!m_outputs.contains(m_activeCursorOutput)) {
|
||||
m_activeCursorOutput = nullptr;
|
||||
}
|
||||
|
||||
if (!outputOrder.empty()) {
|
||||
setOutputOrder(outputOrder);
|
||||
|
@ -1776,12 +1773,6 @@ QString Workspace::supportInformation() const
|
|||
}
|
||||
support.append(QStringLiteral("\nScreens\n"));
|
||||
support.append(QStringLiteral("=======\n"));
|
||||
support.append(QStringLiteral("Active screen follows mouse: "));
|
||||
if (options->activeMouseScreen()) {
|
||||
support.append(QStringLiteral(" yes\n"));
|
||||
} else {
|
||||
support.append(QStringLiteral(" no\n"));
|
||||
}
|
||||
const QList<Output *> outputs = kwinApp()->outputBackend()->outputs();
|
||||
support.append(QStringLiteral("Number of Screens: %1\n\n").arg(outputs.count()));
|
||||
for (int i = 0; i < outputs.count(); ++i) {
|
||||
|
@ -2614,18 +2605,6 @@ QList<Output *> Workspace::outputOrder() const
|
|||
|
||||
Output *Workspace::activeOutput() const
|
||||
{
|
||||
if (options->activeMouseScreen()) {
|
||||
if (m_activeCursorOutput) {
|
||||
return m_activeCursorOutput;
|
||||
} else {
|
||||
return outputAt(Cursors::self()->mouse()->pos());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_activeWindow && !m_activeWindow->isOnOutput(m_activeOutput)) {
|
||||
return m_activeWindow->output();
|
||||
}
|
||||
|
||||
return m_activeOutput;
|
||||
}
|
||||
|
||||
|
@ -2639,16 +2618,6 @@ void Workspace::setActiveOutput(const QPointF &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
|
||||
* workspace the opportunity to interveniate and to implement
|
||||
|
|
|
@ -184,8 +184,6 @@ public:
|
|||
Output *activeOutput() const;
|
||||
void setActiveOutput(Output *output);
|
||||
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
|
||||
|
@ -673,7 +671,6 @@ private:
|
|||
|
||||
QList<Output *> m_outputs;
|
||||
Output *m_activeOutput = nullptr;
|
||||
Output *m_activeCursorOutput = nullptr;
|
||||
QList<Output *> m_outputOrder;
|
||||
|
||||
Window *m_activeWindow;
|
||||
|
|
Loading…
Reference in a new issue