kwin/kcmkwin/kwinrules/kwinsrc.cpp
Martin Gräßlin c044ad98be Split out pointer related handling from InputRedirection
All pointer related code is moved into a new class called
PointerInputRedirection.

The main idea is to simplify the code and make it easier to maintain.
Therefore also a few changes in the setup were performed:
* before init() is called, no processing is performed
* init() is only called on Wayland and after Workspace is created
* init property is set to false once Workspace or WaylandServer is
  destroyed

Thus code can operate on the following assumptions:
* Workspace is valid
* WaylandServer is valid
* ScreenLocker integration is used

The various checks whether there is a waylandServer() and whether
there is a seat are no longer needed.

Some of the checks have been reordered to be faster in the most common
use case of using libinput. E.g. whether warping is supported is first
evaluated by the variable bound to whether we have libinput and only if
that is false the backend is checked.

The new class doesn't have signals but invokes the signals provided
by InputRedirection. I didn't want to add new signals as I consider
them as not needed. The areas in KWin needing those signals should
be ported to InputEventFilters.
2016-02-12 13:38:26 +01:00

54 lines
1.5 KiB
C++

/*
* Copyright (c) 2004 Lubos Lunak <l.lunak@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Include some code from kwin core in order to avoid
// double implementation.
#include "ruleslist.h"
#include "../../cursor.cpp"
#include "../../rules.cpp"
#include "../../placement.cpp"
#include "../../options.cpp"
#include "../../utils.cpp"
#include "../../client_machine.cpp"
KWin::InputRedirection *KWin::InputRedirection::s_self = nullptr;
Qt::MouseButtons KWin::InputRedirection::qtButtonStates() const
{
return Qt::NoButton;
}
Qt::KeyboardModifiers KWin::InputRedirection::keyboardModifiers() const
{
return Qt::NoModifier;
}
void KWin::InputRedirection::warpPointer(const QPointF&)
{
}
bool KWin::InputRedirection::supportsPointerWarping() const
{
return false;
}
QPointF KWin::InputRedirection::globalPointer() const
{
return QPointF();
}