Commit Graph

16 Commits (de573edd1d625664bf487ae2d14e1a0fc75f17c1)

Author SHA1 Message Date
Martin Gräßlin 6e67badfab Handle case that XCURSOR_SIZE environment variable is not set
In a default startup startkde does not set XCURSOR_SIZE environment
variable. Only XCURSOR_THEME is set. The size should be DPI dependent.
With this patch Cursor is able to handle this situation and does not
fall back to loading the config from file. Logic is taken from
KHintsSettings in frameworkintegration which in turn is from
KApplication.

REVIEW: 122139
2015-01-21 09:24:01 +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 3204342809 Port XQueryPointer usage to XCB
Introduces new XCB::Pointer wrapper and is used in
Client::leaveNotifyEvent and in Cursor and KillWindow to simplify
the usage.

CCBUG: 333836
2014-05-05 08:09:09 +02:00
Martin Gräßlin c64ad6b640 [kwin] KWinrules needs the X11Cursor
Fixes crash when trying to detect the window properties.
2014-03-29 10:49:14 +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 7ca25ac703 [kwin] Suppress unused variable warning when building KCMRULES
This really needs to be improved. It cannot be that the kcm rules
includes more and more parts of KWin core!
2014-03-19 08:04:20 +01:00
Martin Gräßlin 18a37d7ee8 [kwin] Fix includes of kde4support headers
* drop unused headers
* use QExplicitlySharedDataPointer instead of KSharedPointer
* drop KDE/ from includes
2014-03-18 14:34:36 +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
Michael Chang f62162eb41 Correctly detect mouseChanged between polls.
REVIEW: 112392
BUG: 323979
FIXED-IN: 4.11.2
2013-09-04 14:39:44 +02:00
Thomas Lübking 5c207e9a15 poll mouse at 20Hz
required until there's a dynamic poll rate, because 10Hz is too
low for magnifiers (lag), mousemark (paints too edgy), mouseclick
(often fails because it's easy to cycle the button state within 100ms)
- and the bouncing icon lags behind the mouse as well ;-)

REVIEW: 111909
2013-08-06 23:26:51 +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