Commit 823e5b02 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Adjust tablet input stuff to kwayland-server changes

parent 2dee622d
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include <KWaylandServer/seat_interface.h> #include <KWaylandServer/seat_interface.h>
#include <KWaylandServer/buffer_interface.h> #include <KWaylandServer/buffer_interface.h>
#include <KWaylandServer/surface_interface.h> #include <KWaylandServer/surface_interface.h>
#include <KWaylandServer/tablet_interface.h> #include <KWaylandServer/tablet_v2_interface.h>
#include <decorations/decoratedclient.h> #include <decorations/decoratedclient.h>
//screenlocker //screenlocker
...@@ -1560,20 +1560,20 @@ public: ...@@ -1560,20 +1560,20 @@ public:
{ {
} }
static KWaylandServer::TabletSeatInterface *findTabletSeat() static KWaylandServer::TabletSeatV2Interface *findTabletSeat()
{ {
auto server = waylandServer(); auto server = waylandServer();
if (!server) { if (!server) {
return nullptr; return nullptr;
} }
KWaylandServer::TabletManagerInterface *manager = server->tabletManager(); KWaylandServer::TabletManagerV2Interface *manager = server->tabletManagerV2();
return manager->seat(findSeat()); return manager->seat(findSeat());
} }
void integrateDevice(LibInput::Device *device) void integrateDevice(LibInput::Device *device)
{ {
if (device->isTabletTool()) { if (device->isTabletTool()) {
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat(); KWaylandServer::TabletSeatV2Interface *tabletSeat = findTabletSeat();
if (!tabletSeat) { if (!tabletSeat) {
qCCritical(KWIN_CORE) << "Could not find tablet manager"; qCCritical(KWIN_CORE) << "Could not find tablet manager";
return; return;
...@@ -1585,7 +1585,7 @@ public: ...@@ -1585,7 +1585,7 @@ public:
} }
void removeDevice(const QString &sysname) void removeDevice(const QString &sysname)
{ {
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat(); KWaylandServer::TabletSeatV2Interface *tabletSeat = findTabletSeat();
if (tabletSeat) if (tabletSeat)
tabletSeat->removeTablet(sysname); tabletSeat->removeTablet(sysname);
else else
...@@ -1598,7 +1598,7 @@ public: ...@@ -1598,7 +1598,7 @@ public:
return false; return false;
} }
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat(); KWaylandServer::TabletSeatV2Interface *tabletSeat = findTabletSeat();
if (!tabletSeat) { if (!tabletSeat) {
qCCritical(KWIN_CORE) << "Could not find tablet manager"; qCCritical(KWIN_CORE) << "Could not find tablet manager";
return false; return false;
...@@ -1611,52 +1611,52 @@ public: ...@@ -1611,52 +1611,52 @@ public:
const auto f = [](InputRedirection::Capability cap) { const auto f = [](InputRedirection::Capability cap) {
switch (cap) { switch (cap) {
case InputRedirection::Tilt: case InputRedirection::Tilt:
return TabletToolInterface::Tilt; return TabletToolV2Interface::Tilt;
case InputRedirection::Pressure: case InputRedirection::Pressure:
return TabletToolInterface::Pressure; return TabletToolV2Interface::Pressure;
case InputRedirection::Distance: case InputRedirection::Distance:
return TabletToolInterface::Distance; return TabletToolV2Interface::Distance;
case InputRedirection::Rotation: case InputRedirection::Rotation:
return TabletToolInterface::Rotation; return TabletToolV2Interface::Rotation;
case InputRedirection::Slider: case InputRedirection::Slider:
return TabletToolInterface::Slider; return TabletToolV2Interface::Slider;
case InputRedirection::Wheel: 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()); ifaceCapabilities.resize(capabilities.size());
std::transform(capabilities.constBegin(), capabilities.constEnd(), ifaceCapabilities.begin(), f); std::transform(capabilities.constBegin(), capabilities.constEnd(), ifaceCapabilities.begin(), f);
TabletToolInterface::Type toolType = TabletToolInterface::Type::Pen; TabletToolV2Interface::Type toolType = TabletToolV2Interface::Type::Pen;
switch (event->toolType()) { switch (event->toolType()) {
case InputRedirection::Pen: case InputRedirection::Pen:
toolType = TabletToolInterface::Type::Pen; toolType = TabletToolV2Interface::Type::Pen;
break; break;
case InputRedirection::Eraser: case InputRedirection::Eraser:
toolType = TabletToolInterface::Type::Eraser; toolType = TabletToolV2Interface::Type::Eraser;
break; break;
case InputRedirection::Brush: case InputRedirection::Brush:
toolType = TabletToolInterface::Type::Brush; toolType = TabletToolV2Interface::Type::Brush;
break; break;
case InputRedirection::Pencil: case InputRedirection::Pencil:
toolType = TabletToolInterface::Type::Pencil; toolType = TabletToolV2Interface::Type::Pencil;
break; break;
case InputRedirection::Airbrush: case InputRedirection::Airbrush:
toolType = TabletToolInterface::Type::Airbrush; toolType = TabletToolV2Interface::Type::Airbrush;
break; break;
case InputRedirection::Finger: case InputRedirection::Finger:
toolType = TabletToolInterface::Type::Finger; toolType = TabletToolV2Interface::Type::Finger;
break; break;
case InputRedirection::Mouse: case InputRedirection::Mouse:
toolType = TabletToolInterface::Type::Mouse; toolType = TabletToolV2Interface::Type::Mouse;
break; break;
case InputRedirection::Lens: case InputRedirection::Lens:
toolType = TabletToolInterface::Type::Lens; toolType = TabletToolV2Interface::Type::Lens;
break; break;
case InputRedirection::Totem: case InputRedirection::Totem:
toolType = TabletToolInterface::Type::Totem; toolType = TabletToolV2Interface::Type::Totem;
break; break;
} }
tool = tabletSeat->addTool(toolType, event->serialId(), event->uniqueId(), ifaceCapabilities); tool = tabletSeat->addTool(toolType, event->serialId(), event->uniqueId(), ifaceCapabilities);
...@@ -1665,8 +1665,8 @@ public: ...@@ -1665,8 +1665,8 @@ public:
Cursors::self()->addCursor(cursor); Cursors::self()->addCursor(cursor);
m_cursorByTool[tool] = cursor; m_cursorByTool[tool] = cursor;
connect(tool, &TabletToolInterface::cursorChanged, cursor, &Cursor::cursorChanged); connect(tool, &TabletToolV2Interface::cursorChanged, cursor, &Cursor::cursorChanged);
connect(tool, &TabletToolInterface::cursorChanged, cursor, [cursor] (TabletCursor* tcursor) { connect(tool, &TabletToolV2Interface::cursorChanged, cursor, [cursor] (TabletCursorV2 *tcursor) {
static const auto createDefaultCursor = [] { static const auto createDefaultCursor = [] {
WaylandCursorImage defaultCursor; WaylandCursorImage defaultCursor;
WaylandCursorImage::Image ret; WaylandCursorImage::Image ret;
...@@ -1698,7 +1698,7 @@ public: ...@@ -1698,7 +1698,7 @@ public:
emit cursor->cursorChanged(); emit cursor->cursorChanged();
} }
KWaylandServer::TabletInterface *tablet = tabletSeat->tabletByName(event->tabletSysName()); KWaylandServer::TabletV2Interface *tablet = tabletSeat->tabletByName(event->tabletSysName());
Toplevel *toplevel = input()->findToplevel(event->globalPos()); Toplevel *toplevel = input()->findToplevel(event->globalPos());
if (!toplevel || !toplevel->surface()) { if (!toplevel || !toplevel->surface()) {
...@@ -1773,7 +1773,7 @@ public: ...@@ -1773,7 +1773,7 @@ public:
waylandServer()->simulateUserActivity(); waylandServer()->simulateUserActivity();
return true; return true;
} }
QHash<KWaylandServer::TabletToolInterface*, Cursor*> m_cursorByTool; QHash<KWaylandServer::TabletToolV2Interface*, Cursor*> m_cursorByTool;
}; };
class DragAndDropInputFilter : public InputEventFilter class DragAndDropInputFilter : public InputEventFilter
......
...@@ -370,7 +370,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags ...@@ -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); m_keyboardShortcutsInhibitManager = m_display->createKeyboardShortcutsInhibitManagerV1(m_display);
auto inputPanelV1Integration = new InputPanelV1Integration(this); auto inputPanelV1Integration = new InputPanelV1Integration(this);
......
...@@ -56,7 +56,7 @@ class XdgOutputManagerV1Interface; ...@@ -56,7 +56,7 @@ class XdgOutputManagerV1Interface;
class KeyStateInterface; class KeyStateInterface;
class LinuxDmabufUnstableV1Interface; class LinuxDmabufUnstableV1Interface;
class LinuxDmabufUnstableV1Buffer; class LinuxDmabufUnstableV1Buffer;
class TabletManagerInterface; class TabletManagerV2Interface;
class KeyboardShortcutsInhibitManagerV1Interface; class KeyboardShortcutsInhibitManagerV1Interface;
class XdgDecorationManagerV1Interface; class XdgDecorationManagerV1Interface;
} }
...@@ -103,9 +103,9 @@ public: ...@@ -103,9 +103,9 @@ public:
{ {
return m_seat; return m_seat;
} }
KWaylandServer::TabletManagerInterface *tabletManager() const KWaylandServer::TabletManagerV2Interface *tabletManagerV2() const
{ {
return m_tabletManager; return m_tabletManagerV2;
} }
KWaylandServer::DataDeviceManagerInterface *dataDeviceManager() const KWaylandServer::DataDeviceManagerInterface *dataDeviceManager() const
{ {
...@@ -263,7 +263,7 @@ private: ...@@ -263,7 +263,7 @@ private:
KWaylandServer::Display *m_display = nullptr; KWaylandServer::Display *m_display = nullptr;
KWaylandServer::CompositorInterface *m_compositor = nullptr; KWaylandServer::CompositorInterface *m_compositor = nullptr;
KWaylandServer::SeatInterface *m_seat = nullptr; KWaylandServer::SeatInterface *m_seat = nullptr;
KWaylandServer::TabletManagerInterface *m_tabletManager = nullptr; KWaylandServer::TabletManagerV2Interface *m_tabletManagerV2 = nullptr;
KWaylandServer::DataDeviceManagerInterface *m_dataDeviceManager = nullptr; KWaylandServer::DataDeviceManagerInterface *m_dataDeviceManager = nullptr;
KWaylandServer::PlasmaShellInterface *m_plasmaShell = nullptr; KWaylandServer::PlasmaShellInterface *m_plasmaShell = nullptr;
KWaylandServer::PlasmaWindowManagementInterface *m_windowManagement = nullptr; KWaylandServer::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment