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
2ff90936
Commit
2ff90936
authored
Feb 16, 2022
by
Vlad Zahorodnii
Browse files
effects/desktopgrid: Port to QStyleHints
Let's us avoid making the desktop grid effect depend on qtwidgets.
CCBUG: 450359
parent
d6b3b57b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/effects/desktopgrid/desktopgrid.cpp
View file @
2ff90936
...
...
@@ -17,12 +17,13 @@
#include
"../presentwindows/presentwindows_proxy.h"
#include
<QAction>
#include
<QApplication>
#include
<Q
Gui
Application>
#include
<KGlobalAccel>
#include
<KLocalizedString>
#include
<netwm_def.h>
#include
<QEvent>
#include
<QMouseEvent>
#include
<QStyleHints>
#include
<QTimer>
#include
<QVector2D>
#include
<QMatrix4x4>
...
...
@@ -129,7 +130,7 @@ DesktopGridEffect::DesktopGridEffect()
}
});
windowMoveElevateTimer
->
setInterval
(
QApplication
::
startDragTime
());
windowMoveElevateTimer
->
setInterval
(
Q
Gui
Application
::
styleHints
()
->
startDragTime
());
windowMoveElevateTimer
->
setSingleShot
(
true
);
connect
(
windowMoveElevateTimer
,
&
QTimer
::
timeout
,
this
,
[
this
]()
{
effects
->
setElevatedWindow
(
windowMove
,
true
);
...
...
@@ -503,7 +504,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
if
(
e
->
type
()
==
QEvent
::
MouseMove
)
{
int
d
=
posToDesktop
(
me
->
pos
());
if
(
windowMove
!=
nullptr
&&
(
me
->
pos
()
-
dragStartPos
).
manhattanLength
()
>
QApplication
::
startDragDistance
())
{
(
me
->
pos
()
-
dragStartPos
).
manhattanLength
()
>
Q
Gui
Application
::
styleHints
()
->
startDragDistance
())
{
// Handle window moving
if
(
windowMoveElevateTimer
->
isActive
())
{
// Window started moving, but is not elevated yet!
windowMoveElevateTimer
->
stop
();
...
...
@@ -561,7 +562,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
effects
->
addRepaintFull
();
}
}
else
if
((
me
->
buttons
()
&
Qt
::
LeftButton
)
&&
!
wasDesktopMove
&&
(
me
->
pos
()
-
dragStartPos
).
manhattanLength
()
>
QApplication
::
startDragDistance
())
{
(
me
->
pos
()
-
dragStartPos
).
manhattanLength
()
>
Q
Gui
Application
::
styleHints
()
->
startDragDistance
())
{
wasDesktopMove
=
true
;
effects
->
defineCursor
(
Qt
::
ClosedHandCursor
);
}
...
...
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