Commit Graph

17 Commits (697ea3ae0057a58f68b50bf761971a472d08289a)

Author SHA1 Message Date
Martin Gräßlin 72a25aa9ff Add Cursor::cursorAlternativeNames
Make the internal hash of cursor names available.
2016-02-22 13:33:21 +01:00
Thomas Lübking f918bc3367 fix build of rules kcm
REVIEW: 126733
2016-01-14 23:40:44 +01:00
Martin Gräßlin 5a31618461 Use XInput for "polling" the mouse positing
Replaces the timer based polling approach. If XInput is available we
listen for the RawMotion event on the root window and use this to
trigger a mouse pointer position.

BUG: 357692
FIXED-IN: 5.6.0
REVIEW: 126733
2016-01-14 17:25:04 +01:00
Martin Gräßlin 7dcd69fdcc Fix mouseChanged signal arguments in InputRedirectionCursor
The button state was not represented correctly which was very visible
when using the MouseClickEffect. Now MouseClickEffect on Wayland works
as expected.
2015-10-28 09:18:26 +01:00
Martin Gräßlin 2220ae44c4 Create a plugin for each of the wayland backends
Each of the backends becomes a plugin. This allows kwin_wayland to load
the requested plugin and kwin itself doesn't need to link all the
libraries needed. E.g. libdrm is no longer linked if running kwin_x11.
Also this allows to create backends for the non-standard EGL platforms
(examples could be raspberrypi or Android devices).
2015-05-06 10:31:39 +02:00
Martin Gräßlin 820af0ce4a Guard X11 usage in InputRedirectionCursor
In kwin_wayland the InputRedirectionCursor is created before the X11
connection is established. Because of that possible usage needs to
be guarded. This is only in cursorTracking so far. The parent class
exposes whether the cursor is tracked and the doStartCursorTracking
gets invoked again when the x11Connection becomes available.
2015-03-17 10:20:19 +01:00
Martin Gräßlin e5d0e1a339 Support getting XCursor by name
So far all cursors were only resolved through Qt::CursorShape, but
Qt::CursorShape is not a complete mapping of all cursors used inside
KWin. E.g. killwindow uses the "pirate" cursor.

This change keeps the cursors by name instead of Qt::CursorShape and
thus allows us to use Cursor for resolving XCursors everywhere.
2015-01-29 09:02:23 +01:00
Martin Gräßlin 7dc2baf74d Update cursor theme when it changes at runtime
Connecting to the DBus signal emitted on KGlobalAccels by the
cursor kcm and forcing a reload of all cursors. For runtime
config change we need to take the config value and need to ignore
the now outdated environment variables.

REVIEW: 121928
BUG: 325763
FIXED-IN: 5.2.0
2015-01-14 08:45:22 +01:00
Martin Gräßlin ab4b1ba25a First try getting cursor theme from environment variable
If XCURSOR_THEME and XCURSOR_SIZE are set they are preferred over
reading the values from kcminputrc.

REVIEW: 121923
BUG: 334954
FIXED-IN: 5.2.0
2015-01-14 08:33:33 +01:00
Martin Gräßlin b274fb9297 InputRedirection emits a signal when the modifiers change
Used by Cursor to properly emit the mouseChanged signal which for
historic reasons includes the keyboard modifiers.

Again some fiddling around with the autotests and kcmrules needed to
make it compile. This needs improvement!
2014-03-19 14:14:56 +01:00
Martin Gräßlin e18bb1006a Make mapping between Qt::CursorShape and theme name public
It's of general interest as Wayland cursor uses the same theme name.
2014-03-18 09:00:49 +01:00
Martin Gräßlin d3c4a46c59 Track used cursor theme and size in Cursor
Reads the settings from kcminputrc. Unfortunately there is no update when
the settings change. This needs fixing in the cursors KCM first.
2014-03-18 09:00:49 +01:00
Martin Gräßlin 7523c1e7d7 Integrate KWin::Cursor with InputRedirection
New inheriting class which uses the InputRedirection to track the cursor
position. It doesn't support warping of cursor.

This introduces a slight dependency loop in the startup. Cursor needs to
be created after the WaylandBackend to ensure that the operation mode is
set correctly. But the WaylandBackend itself is accessing Cursor. It
should be safe as inside the WaylandBackend it's only accessed after
callbacks.
2014-03-18 09:00:49 +01:00
Martin Gräßlin 1d2c2d5982 Use Q_SLOTS and Q_SIGNALS instead of slots and signals
Fixes compilation with Qt5/KF5 setup.
2013-07-24 09:46:54 +02:00
Martin Gräßlin 8b2a5f9936 Support for cursor change tracking in KWin::Cursor
KWin::Cursor can track changes to the cursor image. It supports a
start/stop tracking to not handle these events if nobody is interested in
them. When enabled and the cursor image changes a signal is emitted with
the serial number of the new cursor image.

To track cursor image changes xcb_xfixes_select_cursor_input is used (see
XFixes Version 5.0 protocol, section 7).

This could be useful for the zoom effect when it replaces the cursor.

REVIEW: 110519
2013-05-28 08:02:59 +02:00
Martin Gräßlin 0fb27fd12e Defines to create the boilerplate code for KWin's singleton classes
The define KWIN_SINGLETON adds to a class definition:

public:
    static Foo *create(QObject *parent = 0);
    static Foo *self() { return s_self; }
protected:
    explicit Foo(QObject *parent = 0);
private:
    static Foo *s_self;

There is an additional define KWIN_SINGLETON_VARIABLE to set a different
name than s_self.

The define KWIN_SINGLETON_FACTORY can be used to generate the create
method. It expands to:

Foo *Foo::s_self = 0;
Foo *Foo::create(QObject *parent)
{
    Q_ASSERT(!s_self);
    s_self = new Foo(parent);
    return s_self;
}

In addition there are defines to again set a different variable name and
to create an object of another inheriting class.

All the classes currently using this pattern are adjusted to use these
new defines. In a few places the name was adjusted. E.g. in Compositor
the factory method was called createCompositor instead of create.

REVIEW: 109865
2013-04-15 09:57:25 +02:00
Martin Gräßlin f12cf0efba Replacement class for QCursor
With Qt5 QCursor does no longer provide ::handle() which was used to
set a cursor on a native XWindow for which we do not have a QWidget.

Also KWin has had for quite some time an optimized version to get the
cursor position without doing XQueryPointer each time ::pos() is called.

These two features are merged into a new class Cursor providing more or
less the same API as QCursor.

In addition the new class provides a facility to perform mouse polling
replacing the implementations in Compositor and ScreenEdges.

For more information about the new class see the documentation for the
new class in cursor.h.
2013-02-25 13:35:14 +01:00