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
59262615
Commit
59262615
authored
Nov 03, 2020
by
Vlad Zahorodnii
Browse files
Adjust kwin to pointer constraints changes in kws
parent
a62a8213
Changes
2
Hide whitespace changes
Inline
Side-by-side
pointer_input.cpp
View file @
59262615
...
...
@@ -25,7 +25,7 @@
#include
<KWaylandServer/buffer_interface.h>
#include
<KWaylandServer/datadevice_interface.h>
#include
<KWaylandServer/display.h>
#include
<KWaylandServer/pointerconstraints_interface.h>
#include
<KWaylandServer/pointerconstraints_
v1_
interface.h>
#include
<KWaylandServer/seat_interface.h>
#include
<KWaylandServer/surface_interface.h>
// screenlocker
...
...
@@ -659,11 +659,11 @@ void PointerInputRedirection::updatePointerConstraints()
}
return
;
}
const
QRegion
r
=
getConstraintRegion
(
focus
(),
cf
.
data
()
);
const
QRegion
r
=
getConstraintRegion
(
focus
(),
cf
);
if
(
canConstrain
&&
r
.
contains
(
m_pos
.
toPoint
()))
{
cf
->
setConfined
(
true
);
m_confined
=
true
;
m_confinedPointerRegionConnection
=
connect
(
cf
.
data
()
,
&
KWaylandServer
::
ConfinedPointerInterface
::
regionChanged
,
this
,
m_confinedPointerRegionConnection
=
connect
(
cf
,
&
KWaylandServer
::
ConfinedPointer
V1
Interface
::
regionChanged
,
this
,
[
this
]
{
if
(
!
focus
())
{
return
;
...
...
@@ -673,7 +673,7 @@ void PointerInputRedirection::updatePointerConstraints()
return
;
}
const
auto
cf
=
s
->
confinedPointer
();
if
(
!
getConstraintRegion
(
focus
(),
cf
.
data
()
).
contains
(
m_pos
.
toPoint
()))
{
if
(
!
getConstraintRegion
(
focus
(),
cf
).
contains
(
m_pos
.
toPoint
()))
{
// pointer no longer in confined region, break the confinement
cf
->
setConfined
(
false
);
m_confined
=
false
;
...
...
@@ -705,14 +705,14 @@ void PointerInputRedirection::updatePointerConstraints()
}
return
;
}
const
QRegion
r
=
getConstraintRegion
(
focus
(),
lock
.
data
()
);
const
QRegion
r
=
getConstraintRegion
(
focus
(),
lock
);
if
(
canConstrain
&&
r
.
contains
(
m_pos
.
toPoint
()))
{
lock
->
setLocked
(
true
);
m_locked
=
true
;
// The client might cancel pointer locking from its side by unbinding the LockedPointerInterface.
// In this case the cached cursor position hint must be fetched before the resource goes away
m_lockedPointerAboutToBeUnboundConnection
=
connect
(
lock
.
data
()
,
&
KWaylandServer
::
LockedPointerInterface
::
aboutToBe
Unboun
d
,
this
,
m_lockedPointerAboutToBeUnboundConnection
=
connect
(
lock
,
&
KWaylandServer
::
LockedPointer
V1
Interface
::
aboutToBe
Destroye
d
,
this
,
[
this
,
lock
]()
{
const
auto
hint
=
lock
->
cursorPositionHint
();
if
(
hint
.
x
()
<
0
||
hint
.
y
()
<
0
||
!
focus
())
{
...
...
@@ -721,7 +721,7 @@ void PointerInputRedirection::updatePointerConstraints()
auto
globalHint
=
focus
()
->
pos
()
-
focus
()
->
clientContentPos
()
+
hint
;
// When the resource finally goes away, reposition the cursor according to the hint
connect
(
lock
.
data
()
,
&
KWaylandServer
::
LockedPointerInterface
::
unboun
d
,
this
,
connect
(
lock
,
&
KWaylandServer
::
LockedPointer
V1
Interface
::
destroye
d
,
this
,
[
this
,
globalHint
]()
{
processMotion
(
globalHint
,
waylandServer
()
->
seat
()
->
timestamp
());
});
...
...
@@ -781,7 +781,7 @@ QPointF PointerInputRedirection::applyPointerConfinement(const QPointF &pos) con
return
pos
;
}
const
QRegion
confinementRegion
=
getConstraintRegion
(
focus
(),
cf
.
data
()
);
const
QRegion
confinementRegion
=
getConstraintRegion
(
focus
(),
cf
);
if
(
confinementRegion
.
contains
(
pos
.
toPoint
()))
{
return
pos
;
}
...
...
wayland_server.cpp
View file @
59262615
...
...
@@ -42,7 +42,7 @@
#include
<KWaylandServer/plasmashell_interface.h>
#include
<KWaylandServer/plasmavirtualdesktop_interface.h>
#include
<KWaylandServer/plasmawindowmanagement_interface.h>
#include
<KWaylandServer/pointerconstraints_interface.h>
#include
<KWaylandServer/pointerconstraints_
v1_
interface.h>
#include
<KWaylandServer/pointergestures_v1_interface.h>
#include
<KWaylandServer/seat_interface.h>
#include
<KWaylandServer/server_decoration_interface.h>
...
...
@@ -386,7 +386,7 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags
m_seat
=
m_display
->
createSeat
(
m_display
);
m_seat
->
create
();
m_display
->
createPointerGesturesV1
(
m_display
);
m_display
->
createPointerConstraints
(
PointerConstraintsInterfaceVersion
::
UnstableV1
,
m_display
)
->
create
(
);
m_display
->
createPointerConstraints
V1
(
m_display
);
m_dataDeviceManager
=
m_display
->
createDataDeviceManager
(
m_display
);
m_display
->
createDataControlDeviceManagerV1
(
m_display
);
m_display
->
createPrimarySelectionDeviceManagerV1
(
m_display
);
...
...
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