Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
823e5b02
Commit
823e5b02
authored
Nov 04, 2020
by
Vlad Zahorodnii
Browse files
Adjust tablet input stuff to kwayland-server changes
parent
2dee622d
Changes
3
Hide whitespace changes
Inline
Side-by-side
input.cpp
View file @
823e5b02
...
...
@@ -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
::
TabletSeat
V2
Interface
*
findTabletSeat
()
{
auto
server
=
waylandServer
();
if
(
!
server
)
{
return
nullptr
;
}
KWaylandServer
::
TabletManagerInterface
*
manager
=
server
->
tabletManager
();
KWaylandServer
::
TabletManager
V2
Interface
*
manager
=
server
->
tabletManager
V2
();
return
manager
->
seat
(
findSeat
());
}
void
integrateDevice
(
LibInput
::
Device
*
device
)
{
if
(
device
->
isTabletTool
())
{
KWaylandServer
::
TabletSeatInterface
*
tabletSeat
=
findTabletSeat
();
KWaylandServer
::
TabletSeat
V2
Interface
*
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
::
TabletSeat
V2
Interface
*
tabletSeat
=
findTabletSeat
();
if
(
tabletSeat
)
tabletSeat
->
removeTablet
(
sysname
);
else
...
...
@@ -1598,7 +1598,7 @@ public:
return
false
;
}
KWaylandServer
::
TabletSeatInterface
*
tabletSeat
=
findTabletSeat
();
KWaylandServer
::
TabletSeat
V2
Interface
*
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
TabletTool
V2
Interface
::
Tilt
;
case
InputRedirection
::
Pressure
:
return
TabletToolInterface
::
Pressure
;
return
TabletTool
V2
Interface
::
Pressure
;
case
InputRedirection
::
Distance
:
return
TabletToolInterface
::
Distance
;
return
TabletTool
V2
Interface
::
Distance
;
case
InputRedirection
::
Rotation
:
return
TabletToolInterface
::
Rotation
;
return
TabletTool
V2
Interface
::
Rotation
;
case
InputRedirection
::
Slider
:
return
TabletToolInterface
::
Slider
;
return
TabletTool
V2
Interface
::
Slider
;
case
InputRedirection
::
Wheel
:
return
TabletToolInterface
::
Wheel
;
return
TabletTool
V2
Interface
::
Wheel
;
}
return
TabletToolInterface
::
Wheel
;
return
TabletTool
V2
Interface
::
Wheel
;
};
QVector
<
TabletToolInterface
::
Capability
>
ifaceCapabilities
;
QVector
<
TabletTool
V2
Interface
::
Capability
>
ifaceCapabilities
;
ifaceCapabilities
.
resize
(
capabilities
.
size
());
std
::
transform
(
capabilities
.
constBegin
(),
capabilities
.
constEnd
(),
ifaceCapabilities
.
begin
(),
f
);
TabletToolInterface
::
Type
toolType
=
TabletToolInterface
::
Type
::
Pen
;
TabletTool
V2
Interface
::
Type
toolType
=
TabletTool
V2
Interface
::
Type
::
Pen
;
switch
(
event
->
toolType
())
{
case
InputRedirection
::
Pen
:
toolType
=
TabletToolInterface
::
Type
::
Pen
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Pen
;
break
;
case
InputRedirection
::
Eraser
:
toolType
=
TabletToolInterface
::
Type
::
Eraser
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Eraser
;
break
;
case
InputRedirection
::
Brush
:
toolType
=
TabletToolInterface
::
Type
::
Brush
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Brush
;
break
;
case
InputRedirection
::
Pencil
:
toolType
=
TabletToolInterface
::
Type
::
Pencil
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Pencil
;
break
;
case
InputRedirection
::
Airbrush
:
toolType
=
TabletToolInterface
::
Type
::
Airbrush
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Airbrush
;
break
;
case
InputRedirection
::
Finger
:
toolType
=
TabletToolInterface
::
Type
::
Finger
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Finger
;
break
;
case
InputRedirection
::
Mouse
:
toolType
=
TabletToolInterface
::
Type
::
Mouse
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Mouse
;
break
;
case
InputRedirection
::
Lens
:
toolType
=
TabletToolInterface
::
Type
::
Lens
;
toolType
=
TabletTool
V2
Interface
::
Type
::
Lens
;
break
;
case
InputRedirection
::
Totem
:
toolType
=
TabletToolInterface
::
Type
::
Totem
;
toolType
=
TabletTool
V2
Interface
::
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
,
&
TabletTool
V2
Interface
::
cursorChanged
,
cursor
,
&
Cursor
::
cursorChanged
);
connect
(
tool
,
&
TabletTool
V2
Interface
::
cursorChanged
,
cursor
,
[
cursor
]
(
TabletCursor
V2
*
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
::
Tablet
V2
Interface
*
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
::
TabletTool
V2
Interface
*
,
Cursor
*>
m_cursorByTool
;
};
class
DragAndDropInputFilter
:
public
InputEventFilter
...
...
wayland_server.cpp
View file @
823e5b02
...
...
@@ -370,7 +370,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags
}
);
m_tabletManager
=
m_display
->
createTabletManager
Interface
(
m_display
);
m_tabletManager
V2
=
m_display
->
createTabletManager
V2
(
m_display
);
m_keyboardShortcutsInhibitManager
=
m_display
->
createKeyboardShortcutsInhibitManagerV1
(
m_display
);
auto
inputPanelV1Integration
=
new
InputPanelV1Integration
(
this
);
...
...
wayland_server.h
View file @
823e5b02
...
...
@@ -56,7 +56,7 @@ class XdgOutputManagerV1Interface;
class
KeyStateInterface
;
class
LinuxDmabufUnstableV1Interface
;
class
LinuxDmabufUnstableV1Buffer
;
class
TabletManagerInterface
;
class
TabletManager
V2
Interface
;
class
KeyboardShortcutsInhibitManagerV1Interface
;
class
XdgDecorationManagerV1Interface
;
}
...
...
@@ -103,9 +103,9 @@ public:
{
return
m_seat
;
}
KWaylandServer
::
TabletManagerInterface
*
tabletManager
()
const
KWaylandServer
::
TabletManager
V2
Interface
*
tabletManager
V2
()
const
{
return
m_tabletManager
;
return
m_tabletManager
V2
;
}
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
::
TabletManager
V2
Interface
*
m_tabletManager
V2
=
nullptr
;
KWaylandServer
::
DataDeviceManagerInterface
*
m_dataDeviceManager
=
nullptr
;
KWaylandServer
::
PlasmaShellInterface
*
m_plasmaShell
=
nullptr
;
KWaylandServer
::
PlasmaWindowManagementInterface
*
m_windowManagement
=
nullptr
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment