Adjust tablet input stuff to kwayland-server changes
This commit is contained in:
parent
2dee622d82
commit
823e5b02ea
3 changed files with 33 additions and 33 deletions
56
input.cpp
56
input.cpp
|
@ -45,7 +45,7 @@
|
|||
#include <KWaylandServer/seat_interface.h>
|
||||
#include <KWaylandServer/buffer_interface.h>
|
||||
#include <KWaylandServer/surface_interface.h>
|
||||
#include <KWaylandServer/tablet_interface.h>
|
||||
#include <KWaylandServer/tablet_v2_interface.h>
|
||||
#include <decorations/decoratedclient.h>
|
||||
|
||||
//screenlocker
|
||||
|
@ -1560,20 +1560,20 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
static KWaylandServer::TabletSeatInterface *findTabletSeat()
|
||||
static KWaylandServer::TabletSeatV2Interface *findTabletSeat()
|
||||
{
|
||||
auto server = waylandServer();
|
||||
if (!server) {
|
||||
return nullptr;
|
||||
}
|
||||
KWaylandServer::TabletManagerInterface *manager = server->tabletManager();
|
||||
KWaylandServer::TabletManagerV2Interface *manager = server->tabletManagerV2();
|
||||
return manager->seat(findSeat());
|
||||
}
|
||||
|
||||
void integrateDevice(LibInput::Device *device)
|
||||
{
|
||||
if (device->isTabletTool()) {
|
||||
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat();
|
||||
KWaylandServer::TabletSeatV2Interface *tabletSeat = findTabletSeat();
|
||||
if (!tabletSeat) {
|
||||
qCCritical(KWIN_CORE) << "Could not find tablet manager";
|
||||
return;
|
||||
|
@ -1585,7 +1585,7 @@ public:
|
|||
}
|
||||
void removeDevice(const QString &sysname)
|
||||
{
|
||||
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat();
|
||||
KWaylandServer::TabletSeatV2Interface *tabletSeat = findTabletSeat();
|
||||
if (tabletSeat)
|
||||
tabletSeat->removeTablet(sysname);
|
||||
else
|
||||
|
@ -1598,7 +1598,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat();
|
||||
KWaylandServer::TabletSeatV2Interface *tabletSeat = findTabletSeat();
|
||||
if (!tabletSeat) {
|
||||
qCCritical(KWIN_CORE) << "Could not find tablet manager";
|
||||
return false;
|
||||
|
@ -1611,52 +1611,52 @@ public:
|
|||
const auto f = [](InputRedirection::Capability cap) {
|
||||
switch (cap) {
|
||||
case InputRedirection::Tilt:
|
||||
return TabletToolInterface::Tilt;
|
||||
return TabletToolV2Interface::Tilt;
|
||||
case InputRedirection::Pressure:
|
||||
return TabletToolInterface::Pressure;
|
||||
return TabletToolV2Interface::Pressure;
|
||||
case InputRedirection::Distance:
|
||||
return TabletToolInterface::Distance;
|
||||
return TabletToolV2Interface::Distance;
|
||||
case InputRedirection::Rotation:
|
||||
return TabletToolInterface::Rotation;
|
||||
return TabletToolV2Interface::Rotation;
|
||||
case InputRedirection::Slider:
|
||||
return TabletToolInterface::Slider;
|
||||
return TabletToolV2Interface::Slider;
|
||||
case InputRedirection::Wheel:
|
||||
return TabletToolInterface::Wheel;
|
||||
return TabletToolV2Interface::Wheel;
|
||||
}
|
||||
return TabletToolInterface::Wheel;
|
||||
return TabletToolV2Interface::Wheel;
|
||||
};
|
||||
QVector<TabletToolInterface::Capability> ifaceCapabilities;
|
||||
QVector<TabletToolV2Interface::Capability> ifaceCapabilities;
|
||||
ifaceCapabilities.resize(capabilities.size());
|
||||
std::transform(capabilities.constBegin(), capabilities.constEnd(), ifaceCapabilities.begin(), f);
|
||||
|
||||
TabletToolInterface::Type toolType = TabletToolInterface::Type::Pen;
|
||||
TabletToolV2Interface::Type toolType = TabletToolV2Interface::Type::Pen;
|
||||
switch (event->toolType()) {
|
||||
case InputRedirection::Pen:
|
||||
toolType = TabletToolInterface::Type::Pen;
|
||||
toolType = TabletToolV2Interface::Type::Pen;
|
||||
break;
|
||||
case InputRedirection::Eraser:
|
||||
toolType = TabletToolInterface::Type::Eraser;
|
||||
toolType = TabletToolV2Interface::Type::Eraser;
|
||||
break;
|
||||
case InputRedirection::Brush:
|
||||
toolType = TabletToolInterface::Type::Brush;
|
||||
toolType = TabletToolV2Interface::Type::Brush;
|
||||
break;
|
||||
case InputRedirection::Pencil:
|
||||
toolType = TabletToolInterface::Type::Pencil;
|
||||
toolType = TabletToolV2Interface::Type::Pencil;
|
||||
break;
|
||||
case InputRedirection::Airbrush:
|
||||
toolType = TabletToolInterface::Type::Airbrush;
|
||||
toolType = TabletToolV2Interface::Type::Airbrush;
|
||||
break;
|
||||
case InputRedirection::Finger:
|
||||
toolType = TabletToolInterface::Type::Finger;
|
||||
toolType = TabletToolV2Interface::Type::Finger;
|
||||
break;
|
||||
case InputRedirection::Mouse:
|
||||
toolType = TabletToolInterface::Type::Mouse;
|
||||
toolType = TabletToolV2Interface::Type::Mouse;
|
||||
break;
|
||||
case InputRedirection::Lens:
|
||||
toolType = TabletToolInterface::Type::Lens;
|
||||
toolType = TabletToolV2Interface::Type::Lens;
|
||||
break;
|
||||
case InputRedirection::Totem:
|
||||
toolType = TabletToolInterface::Type::Totem;
|
||||
toolType = TabletToolV2Interface::Type::Totem;
|
||||
break;
|
||||
}
|
||||
tool = tabletSeat->addTool(toolType, event->serialId(), event->uniqueId(), ifaceCapabilities);
|
||||
|
@ -1665,8 +1665,8 @@ public:
|
|||
Cursors::self()->addCursor(cursor);
|
||||
m_cursorByTool[tool] = cursor;
|
||||
|
||||
connect(tool, &TabletToolInterface::cursorChanged, cursor, &Cursor::cursorChanged);
|
||||
connect(tool, &TabletToolInterface::cursorChanged, cursor, [cursor] (TabletCursor* tcursor) {
|
||||
connect(tool, &TabletToolV2Interface::cursorChanged, cursor, &Cursor::cursorChanged);
|
||||
connect(tool, &TabletToolV2Interface::cursorChanged, cursor, [cursor] (TabletCursorV2 *tcursor) {
|
||||
static const auto createDefaultCursor = [] {
|
||||
WaylandCursorImage defaultCursor;
|
||||
WaylandCursorImage::Image ret;
|
||||
|
@ -1698,7 +1698,7 @@ public:
|
|||
emit cursor->cursorChanged();
|
||||
}
|
||||
|
||||
KWaylandServer::TabletInterface *tablet = tabletSeat->tabletByName(event->tabletSysName());
|
||||
KWaylandServer::TabletV2Interface *tablet = tabletSeat->tabletByName(event->tabletSysName());
|
||||
|
||||
Toplevel *toplevel = input()->findToplevel(event->globalPos());
|
||||
if (!toplevel || !toplevel->surface()) {
|
||||
|
@ -1773,7 +1773,7 @@ public:
|
|||
waylandServer()->simulateUserActivity();
|
||||
return true;
|
||||
}
|
||||
QHash<KWaylandServer::TabletToolInterface*, Cursor*> m_cursorByTool;
|
||||
QHash<KWaylandServer::TabletToolV2Interface*, Cursor*> m_cursorByTool;
|
||||
};
|
||||
|
||||
class DragAndDropInputFilter : public InputEventFilter
|
||||
|
|
|
@ -370,7 +370,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags
|
|||
}
|
||||
);
|
||||
|
||||
m_tabletManager = m_display->createTabletManagerInterface(m_display);
|
||||
m_tabletManagerV2 = m_display->createTabletManagerV2(m_display);
|
||||
m_keyboardShortcutsInhibitManager = m_display->createKeyboardShortcutsInhibitManagerV1(m_display);
|
||||
|
||||
auto inputPanelV1Integration = new InputPanelV1Integration(this);
|
||||
|
|
|
@ -56,7 +56,7 @@ class XdgOutputManagerV1Interface;
|
|||
class KeyStateInterface;
|
||||
class LinuxDmabufUnstableV1Interface;
|
||||
class LinuxDmabufUnstableV1Buffer;
|
||||
class TabletManagerInterface;
|
||||
class TabletManagerV2Interface;
|
||||
class KeyboardShortcutsInhibitManagerV1Interface;
|
||||
class XdgDecorationManagerV1Interface;
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ public:
|
|||
{
|
||||
return m_seat;
|
||||
}
|
||||
KWaylandServer::TabletManagerInterface *tabletManager() const
|
||||
KWaylandServer::TabletManagerV2Interface *tabletManagerV2() const
|
||||
{
|
||||
return m_tabletManager;
|
||||
return m_tabletManagerV2;
|
||||
}
|
||||
KWaylandServer::DataDeviceManagerInterface *dataDeviceManager() const
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ private:
|
|||
KWaylandServer::Display *m_display = nullptr;
|
||||
KWaylandServer::CompositorInterface *m_compositor = nullptr;
|
||||
KWaylandServer::SeatInterface *m_seat = nullptr;
|
||||
KWaylandServer::TabletManagerInterface *m_tabletManager = nullptr;
|
||||
KWaylandServer::TabletManagerV2Interface *m_tabletManagerV2 = nullptr;
|
||||
KWaylandServer::DataDeviceManagerInterface *m_dataDeviceManager = nullptr;
|
||||
KWaylandServer::PlasmaShellInterface *m_plasmaShell = nullptr;
|
||||
KWaylandServer::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
|
||||
|
|
Loading…
Reference in a new issue