Also redirect tablet events to the effects infrastructure
This commit is contained in:
parent
184cddda4c
commit
324b172a26
5 changed files with 195 additions and 0 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include "pointer_input.h"
|
#include "pointer_input.h"
|
||||||
#include "renderbackend.h"
|
#include "renderbackend.h"
|
||||||
#include "unmanaged.h"
|
#include "unmanaged.h"
|
||||||
|
#include "input_event.h"
|
||||||
#ifdef KWIN_BUILD_TABBOX
|
#ifdef KWIN_BUILD_TABBOX
|
||||||
#include "tabbox.h"
|
#include "tabbox.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -735,6 +736,62 @@ bool EffectsHandlerImpl::touchUp(qint32 id, quint32 time)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EffectsHandlerImpl::tabletToolEvent(TabletEvent *event)
|
||||||
|
{
|
||||||
|
// TODO: reverse call order?
|
||||||
|
for (auto it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
|
||||||
|
if (it->second->tabletToolEvent(event)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EffectsHandlerImpl::tabletToolButtonEvent(uint button, bool pressed, const TabletToolId &tabletToolId)
|
||||||
|
{
|
||||||
|
// TODO: reverse call order?
|
||||||
|
for (auto it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
|
||||||
|
if (it->second->tabletToolButtonEvent(button, pressed, tabletToolId.m_uniqueId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EffectsHandlerImpl::tabletPadButtonEvent(uint button, bool pressed, const TabletPadId &tabletPadId)
|
||||||
|
{
|
||||||
|
// TODO: reverse call order?
|
||||||
|
for (auto it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
|
||||||
|
if (it->second->tabletPadButtonEvent(button, pressed, tabletPadId.data)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EffectsHandlerImpl::tabletPadStripEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId)
|
||||||
|
{
|
||||||
|
// TODO: reverse call order?
|
||||||
|
for (auto it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
|
||||||
|
if (it->second->tabletPadStripEvent(number, position, isFinger, tabletPadId.data)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EffectsHandlerImpl::tabletPadRingEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId)
|
||||||
|
{
|
||||||
|
// TODO: reverse call order?
|
||||||
|
for (auto it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {
|
||||||
|
if (it->second->tabletPadRingEvent(number, position, isFinger, tabletPadId.data)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EffectsHandlerImpl::registerGlobalShortcut(const QKeySequence &shortcut, QAction *action)
|
void EffectsHandlerImpl::registerGlobalShortcut(const QKeySequence &shortcut, QAction *action)
|
||||||
{
|
{
|
||||||
input()->registerShortcut(shortcut, action);
|
input()->registerShortcut(shortcut, action);
|
||||||
|
|
|
@ -46,6 +46,9 @@ class Group;
|
||||||
class Toplevel;
|
class Toplevel;
|
||||||
class Unmanaged;
|
class Unmanaged;
|
||||||
class WindowPropertyNotifyX11Filter;
|
class WindowPropertyNotifyX11Filter;
|
||||||
|
class TabletEvent;
|
||||||
|
class TabletPadId;
|
||||||
|
class TabletToolId;
|
||||||
|
|
||||||
class KWIN_EXPORT EffectsHandlerImpl : public EffectsHandler
|
class KWIN_EXPORT EffectsHandlerImpl : public EffectsHandler
|
||||||
{
|
{
|
||||||
|
@ -239,6 +242,12 @@ public:
|
||||||
bool touchMotion(qint32 id, const QPointF &pos, quint32 time);
|
bool touchMotion(qint32 id, const QPointF &pos, quint32 time);
|
||||||
bool touchUp(qint32 id, quint32 time);
|
bool touchUp(qint32 id, quint32 time);
|
||||||
|
|
||||||
|
bool tabletToolEvent(KWin::TabletEvent *event);
|
||||||
|
bool tabletToolButtonEvent(uint button, bool pressed, const KWin::TabletToolId &tabletToolId);
|
||||||
|
bool tabletPadButtonEvent(uint button, bool pressed, const KWin::TabletPadId &tabletPadId);
|
||||||
|
bool tabletPadStripEvent(int number, int position, bool isFinger, const KWin::TabletPadId &tabletPadId);
|
||||||
|
bool tabletPadRingEvent(int number, int position, bool isFinger, const KWin::TabletPadId &tabletPadId);
|
||||||
|
|
||||||
void highlightWindows(const QVector<EffectWindow *> &windows);
|
void highlightWindows(const QVector<EffectWindow *> &windows);
|
||||||
|
|
||||||
bool isPropertyTypeRegistered(xcb_atom_t atom) const {
|
bool isPropertyTypeRegistered(xcb_atom_t atom) const {
|
||||||
|
|
|
@ -561,6 +561,36 @@ public:
|
||||||
}
|
}
|
||||||
return static_cast< EffectsHandlerImpl* >(effects)->touchUp(id, time);
|
return static_cast< EffectsHandlerImpl* >(effects)->touchUp(id, time);
|
||||||
}
|
}
|
||||||
|
bool tabletToolEvent(TabletEvent *event) override {
|
||||||
|
if (!effects) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return static_cast< EffectsHandlerImpl* >(effects)->tabletToolEvent(event);
|
||||||
|
}
|
||||||
|
bool tabletToolButtonEvent(uint button, bool pressed, const TabletToolId &tabletToolId) override {
|
||||||
|
if (!effects) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return static_cast< EffectsHandlerImpl* >(effects)->tabletToolButtonEvent(button, pressed, tabletToolId);
|
||||||
|
}
|
||||||
|
bool tabletPadButtonEvent(uint button, bool pressed, const TabletPadId &tabletPadId) override {
|
||||||
|
if (!effects) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return static_cast< EffectsHandlerImpl* >(effects)->tabletPadButtonEvent(button, pressed, tabletPadId);
|
||||||
|
}
|
||||||
|
bool tabletPadStripEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId) override {
|
||||||
|
if (!effects) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return static_cast< EffectsHandlerImpl* >(effects)->tabletPadStripEvent(number, position, isFinger, tabletPadId);
|
||||||
|
}
|
||||||
|
bool tabletPadRingEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId) override {
|
||||||
|
if (!effects) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return static_cast< EffectsHandlerImpl* >(effects)->tabletPadRingEvent(number, position, isFinger, tabletPadId);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoveResizeFilter : public InputEventFilter {
|
class MoveResizeFilter : public InputEventFilter {
|
||||||
|
|
|
@ -684,6 +684,46 @@ bool Effect::perform(Feature feature, const QVariantList &arguments)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Effect::tabletToolEvent(QTabletEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Effect::tabletToolButtonEvent(uint button, bool pressed, quint64 tabletToolId)
|
||||||
|
{
|
||||||
|
Q_UNUSED(button)
|
||||||
|
Q_UNUSED(pressed)
|
||||||
|
Q_UNUSED(tabletToolId)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Effect::tabletPadButtonEvent(uint button, bool pressed, void *tabletPadId)
|
||||||
|
{
|
||||||
|
Q_UNUSED(button)
|
||||||
|
Q_UNUSED(pressed)
|
||||||
|
Q_UNUSED(tabletPadId)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Effect::tabletPadStripEvent(int number, int position, bool isFinger, void *tabletPadId)
|
||||||
|
{
|
||||||
|
Q_UNUSED(number)
|
||||||
|
Q_UNUSED(position)
|
||||||
|
Q_UNUSED(isFinger)
|
||||||
|
Q_UNUSED(tabletPadId)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Effect::tabletPadRingEvent(int number, int position, bool isFinger, void *tabletPadId)
|
||||||
|
{
|
||||||
|
Q_UNUSED(number)
|
||||||
|
Q_UNUSED(position)
|
||||||
|
Q_UNUSED(isFinger)
|
||||||
|
Q_UNUSED(tabletPadId)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Effect::blocksDirectScanout() const
|
bool Effect::blocksDirectScanout() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -46,6 +46,7 @@ class QFont;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QMatrix4x4;
|
class QMatrix4x4;
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QTabletEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging category to be used inside the KWin effects.
|
* Logging category to be used inside the KWin effects.
|
||||||
|
@ -603,6 +604,64 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool touchUp(qint32 id, quint32 time);
|
virtual bool touchUp(qint32 id, quint32 time);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There has been an event from a drawing tablet tool
|
||||||
|
*
|
||||||
|
* i.e. a pen and the likes.
|
||||||
|
*
|
||||||
|
* @param event the event information
|
||||||
|
* @see QTabletEvent
|
||||||
|
*
|
||||||
|
* @since 5.25
|
||||||
|
*/
|
||||||
|
virtual bool tabletToolEvent(QTabletEvent *event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There has been an event from a button on a drawing tablet tool
|
||||||
|
*
|
||||||
|
* @param button which button
|
||||||
|
* @param pressed true if pressed, false when released
|
||||||
|
* @param tabletToolId the identifier of the tool id
|
||||||
|
*
|
||||||
|
* @since 5.25
|
||||||
|
*/
|
||||||
|
virtual bool tabletToolButtonEvent(uint button, bool pressed, quint64 tabletToolId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There has been an event from a button on a drawing tablet pad
|
||||||
|
*
|
||||||
|
* @param button which button
|
||||||
|
* @param pressed true if pressed, false when released
|
||||||
|
* @param tabletPadId the identifier of the tool id
|
||||||
|
*
|
||||||
|
* @since 5.25
|
||||||
|
*/
|
||||||
|
virtual bool tabletPadButtonEvent(uint button, bool pressed, void *tabletPadId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There has been an event from a input strip on a drawing tablet pad
|
||||||
|
*
|
||||||
|
* @param number which strip
|
||||||
|
* @param position the value within the strip that was selected
|
||||||
|
* @param isFinger if it was activated with a finger
|
||||||
|
* @param tabletPadId the identifier of the tool id
|
||||||
|
*
|
||||||
|
* @since 5.25
|
||||||
|
*/
|
||||||
|
virtual bool tabletPadStripEvent(int number, int position, bool isFinger, void *tabletPadId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There has been an event from a input ring on a drawing tablet pad
|
||||||
|
*
|
||||||
|
* @param number which ring
|
||||||
|
* @param position the value within the ring that was selected
|
||||||
|
* @param isFinger if it was activated with a finger
|
||||||
|
* @param tabletPadId the identifier of the tool id
|
||||||
|
*
|
||||||
|
* @since 5.25
|
||||||
|
*/
|
||||||
|
virtual bool tabletPadRingEvent(int number, int position, bool isFinger, void *tabletPadId);
|
||||||
|
|
||||||
static QPoint cursorPos();
|
static QPoint cursorPos();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue