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
Plasma Mobile
Commits
84440498
Commit
84440498
authored
Apr 11, 2022
by
Devin Lin
🎨
Browse files
taskswitcher: Fix double KWin & containment animation with windows
Fixes
#136
parent
e120f196
Pipeline
#162822
passed with stages
in 1 minute and 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
components/mobileshell/qml/taskswitcher/TaskSwitcher.qml
View file @
84440498
...
...
@@ -18,6 +18,9 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import
"
../components
"
as
Components
/**
* Component that provides a task switcher.
*/
Item
{
id
:
root
visible
:
false
...
...
@@ -28,15 +31,27 @@ Item {
taskSwitcher
:
root
}
// task list model
/**
* The task manager model to use for the tasks switcher.
*/
property
TaskManager.TasksModel
tasksModel
/**
* The number of tasks in the given task manager model.
*/
readonly
property
int
tasksCount
:
tasksModel
.
count
/**
* The screen model to be used for moving windows between screens.
*/
property
var
displaysModel
:
MobileShell.DisplaysModel
{}
// if a window has popped up in front, close the task switcher
/**
* Whether the window is active.
*/
property
bool
windowActive
:
Window
.
active
onWindowActiveChanged
:
{
// if a window has popped up in front, close the task switcher
if
(
visible
&&
!
windowActive
)
{
hide
();
}
...
...
@@ -126,12 +141,7 @@ Item {
}
function
minimizeAll
()
{
for
(
var
i
=
0
;
i
<
tasksModel
.
count
;
i
++
)
{
var
idx
=
tasksModel
.
makeModelIndex
(
i
);
if
(
!
tasksModel
.
data
(
idx
,
TaskManager
.
AbstractTasksModel
.
IsMinimized
))
{
tasksModel
.
requestToggleMinimized
(
idx
);
}
}
MobileShell
.
WindowUtil
.
minimizeAll
(
root
);
}
//END functions
...
...
components/mobileshell/windowutil.cpp
View file @
84440498
...
...
@@ -54,6 +54,7 @@ bool WindowUtil::activeWindowIsShell() const
void
WindowUtil
::
initWayland
()
{
if
(
!
QGuiApplication
::
platformName
().
startsWith
(
QLatin1String
(
"wayland"
),
Qt
::
CaseInsensitive
))
{
qWarning
()
<<
"Plasma Mobile must use wayland! The current platform detected is:"
<<
QGuiApplication
::
platformName
();
return
;
}
...
...
@@ -150,6 +151,31 @@ void WindowUtil::requestShowingDesktop(bool showingDesktop)
m_windowManagement
->
setShowingDesktop
(
showingDesktop
);
}
void
WindowUtil
::
minimizeAll
(
QQuickItem
*
parent
)
{
if
(
!
m_windowManagement
)
{
qWarning
()
<<
"Ignoring request for minimizing all windows since window management hasn't been announced yet!"
;
return
;
}
KWayland
::
Client
::
Surface
*
surface
=
nullptr
;
if
(
parent
)
{
QWindow
*
window
=
parent
->
window
();
if
(
window
)
{
surface
=
KWayland
::
Client
::
Surface
::
fromWindow
(
window
);
}
}
for
(
auto
*
w
:
m_windowManagement
->
windows
())
{
if
(
!
w
->
isMinimized
())
{
if
(
surface
)
{
w
->
unsetMinimizedGeometry
(
surface
);
}
w
->
requestToggleMinimized
();
}
}
}
void
WindowUtil
::
updateShowingDesktop
(
bool
showing
)
{
if
(
showing
!=
m_showingDesktop
)
{
...
...
components/mobileshell/windowutil.h
View file @
84440498
...
...
@@ -9,6 +9,8 @@
#include
<QObject>
#include
<QPointer>
#include
<QQuickItem>
#include
<QQuickWindow>
#include
<QTimer>
#include
<KConfigWatcher>
...
...
@@ -77,6 +79,13 @@ public:
*/
Q_INVOKABLE
void
requestShowingDesktop
(
bool
showingDesktop
);
/**
* Minimize all windows, while also unsetting their respective minimized geometries of the window given.
*
* @param parent The parent item, which is of the same window that will have geometries unset.
*/
Q_INVOKABLE
void
minimizeAll
(
QQuickItem
*
parent
);
Q_SIGNALS:
void
windowCreated
(
KWayland
::
Client
::
PlasmaWindow
*
window
);
void
showingDesktopChanged
(
bool
showingDesktop
);
...
...
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