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
d146a3d1
Commit
d146a3d1
authored
Apr 14, 2022
by
Nils Fenner
Committed by
Vlad Zahorodnii
Apr 14, 2022
Browse files
Use Toplevel::isClient() to resolve AbstractClient type.
parent
47904084
Pipeline
#164038
passed with stage
in 15 minutes and 2 seconds
Changes
19
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/abstract_client.cpp
View file @
d146a3d1
...
...
@@ -1787,7 +1787,7 @@ bool AbstractClient::performMouseCommand(Options::MouseCommand cmd, const QPoint
auto
it
=
workspace
()
->
stackingOrder
().
constEnd
(),
begin
=
workspace
()
->
stackingOrder
().
constBegin
();
while
(
mustReplay
&&
--
it
!=
begin
&&
*
it
!=
this
)
{
AbstractClient
*
c
=
qobject
_cast
<
AbstractClient
*>
(
*
it
);
auto
c
=
static
_cast
<
AbstractClient
*>
(
(
*
it
)
->
isClient
()
?
*
it
:
nullptr
)
;
if
(
!
c
||
(
c
->
keepAbove
()
&&
!
keepAbove
())
||
(
keepBelow
()
&&
!
c
->
keepBelow
()))
{
continue
;
// can never raise above "it"
}
...
...
src/activation.cpp
View file @
d146a3d1
...
...
@@ -424,7 +424,8 @@ AbstractClient *Workspace::clientUnderMouse(AbstractOutput *output) const
{
auto
it
=
stackingOrder
().
constEnd
();
while
(
it
!=
stackingOrder
().
constBegin
())
{
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
*
(
--
it
));
auto
t
=
*
(
--
it
);
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
client
)
{
continue
;
}
...
...
src/dbusinterface.cpp
View file @
d146a3d1
...
...
@@ -235,7 +235,7 @@ QVariantMap DBusInterface::queryWindowInfo()
setDelayedReply
(
true
);
kwinApp
()
->
platform
()
->
startInteractiveWindowSelection
(
[
this
](
Toplevel
*
t
)
{
if
(
auto
c
=
qobject
_cast
<
AbstractClient
*>
(
t
))
{
if
(
auto
c
=
static
_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
))
{
QDBusConnection
::
sessionBus
().
send
(
m_replyQueryWindowInfo
.
createReply
(
clientToVariantMap
(
c
)));
}
else
if
(
qobject_cast
<
Unmanaged
*>
(
t
))
{
QDBusConnection
::
sessionBus
().
send
(
m_replyQueryWindowInfo
.
createErrorReply
(
...
...
src/effects.cpp
View file @
d146a3d1
...
...
@@ -515,8 +515,8 @@ void EffectsHandlerImpl::slotOpacityChanged(Toplevel *t, qreal oldOpacity)
void
EffectsHandlerImpl
::
slotClientShown
(
KWin
::
Toplevel
*
t
)
{
Q_ASSERT
(
qobject_cast
<
Abstract
Client
*>
(
t
));
AbstractClient
*
c
=
static_cast
<
AbstractClient
*>
(
t
);
Q_ASSERT
(
t
->
is
Client
(
));
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
disconnect
(
c
,
&
Toplevel
::
windowShown
,
this
,
&
EffectsHandlerImpl
::
slotClientShown
);
setupClientConnections
(
c
);
Q_EMIT
windowAdded
(
c
->
effectWindow
());
...
...
@@ -904,7 +904,8 @@ QByteArray EffectsHandlerImpl::readRootProperty(long atom, long type, int format
void
EffectsHandlerImpl
::
activateWindow
(
EffectWindow
*
c
)
{
if
(
auto
cl
=
qobject_cast
<
AbstractClient
*>
(
static_cast
<
EffectWindowImpl
*>
(
c
)
->
window
()))
{
auto
t
=
static_cast
<
EffectWindowImpl
*>
(
c
)
->
window
();
if
(
auto
cl
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
))
{
Workspace
::
self
()
->
activateClient
(
cl
,
true
);
}
}
...
...
@@ -916,7 +917,8 @@ EffectWindow *EffectsHandlerImpl::activeWindow() const
void
EffectsHandlerImpl
::
moveWindow
(
EffectWindow
*
w
,
const
QPoint
&
pos
,
bool
snap
,
double
snapAdjust
)
{
auto
cl
=
qobject_cast
<
AbstractClient
*>
(
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
());
auto
t
=
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
();
auto
cl
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
cl
||
!
cl
->
isMovable
())
{
return
;
}
...
...
@@ -930,7 +932,8 @@ void EffectsHandlerImpl::moveWindow(EffectWindow *w, const QPoint &pos, bool sna
void
EffectsHandlerImpl
::
windowToDesktop
(
EffectWindow
*
w
,
int
desktop
)
{
auto
cl
=
qobject_cast
<
AbstractClient
*>
(
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
());
auto
t
=
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
();
auto
cl
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
cl
&&
!
cl
->
isDesktop
()
&&
!
cl
->
isDock
())
{
Workspace
::
self
()
->
sendClientToDesktop
(
cl
,
desktop
,
true
);
}
...
...
@@ -938,7 +941,8 @@ void EffectsHandlerImpl::windowToDesktop(EffectWindow *w, int desktop)
void
EffectsHandlerImpl
::
windowToDesktops
(
EffectWindow
*
w
,
const
QVector
<
uint
>
&
desktopIds
)
{
AbstractClient
*
cl
=
qobject_cast
<
AbstractClient
*>
(
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
());
auto
t
=
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
();
auto
cl
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
cl
||
cl
->
isDesktop
()
||
cl
->
isDock
())
{
return
;
}
...
...
@@ -960,7 +964,8 @@ void EffectsHandlerImpl::windowToDesktops(EffectWindow *w, const QVector<uint> &
void
EffectsHandlerImpl
::
windowToScreen
(
EffectWindow
*
w
,
EffectScreen
*
screen
)
{
auto
cl
=
qobject_cast
<
AbstractClient
*>
(
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
());
auto
t
=
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
();
auto
cl
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
cl
&&
!
cl
->
isDesktop
()
&&
!
cl
->
isDock
())
{
EffectScreenImpl
*
screenImpl
=
static_cast
<
EffectScreenImpl
*>
(
screen
);
Workspace
::
self
()
->
sendClientToOutput
(
cl
,
screenImpl
->
platformOutput
());
...
...
@@ -1155,7 +1160,8 @@ void EffectsHandlerImpl::setElevatedWindow(KWin::EffectWindow *w, bool set)
void
EffectsHandlerImpl
::
setTabBoxWindow
(
EffectWindow
*
w
)
{
#if KWIN_BUILD_TABBOX
if
(
auto
c
=
qobject_cast
<
AbstractClient
*>
(
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
()))
{
auto
t
=
static_cast
<
EffectWindowImpl
*>
(
w
)
->
window
();
if
(
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
))
{
TabBox
::
TabBox
::
self
()
->
setCurrentClient
(
c
);
}
#else
...
...
@@ -2058,18 +2064,18 @@ TOPLEVEL_HELPER(QUuid, internalId, internalId)
#undef TOPLEVEL_HELPER
#define CLIENT_HELPER_WITH_DELETED(rettype, prototype, propertyname, defaultValue) \
rettype EffectWindowImpl::prototype() const \
{ \
auto client =
qobject
_cast<AbstractClient *>(toplevel
);
\
if (client) { \
return client->propertyname(); \
} \
auto deleted = qobject_cast<Deleted *>(toplevel); \
if (deleted) { \
return deleted->propertyname(); \
} \
return defaultValue; \
#define CLIENT_HELPER_WITH_DELETED(rettype, prototype, propertyname, defaultValue)
\
rettype EffectWindowImpl::prototype() const
\
{
\
auto client =
static
_cast<AbstractClient *>(toplevel
->isClient() ? toplevel : nullptr);
\
if (client) {
\
return client->propertyname();
\
}
\
auto deleted = qobject_cast<Deleted *>(toplevel);
\
if (deleted) {
\
return deleted->propertyname();
\
}
\
return defaultValue;
\
}
CLIENT_HELPER_WITH_DELETED
(
bool
,
isMinimized
,
isMinimized
,
false
)
...
...
@@ -2103,14 +2109,14 @@ NET::WindowType EffectWindowImpl::windowType() const
return
toplevel
->
windowType
();
}
#define CLIENT_HELPER(rettype, prototype, propertyname, defaultValue) \
rettype EffectWindowImpl::prototype() const \
{ \
auto client =
qobject
_cast<AbstractClient *>(toplevel
);
\
if (client) { \
return client->propertyname(); \
} \
return defaultValue; \
#define CLIENT_HELPER(rettype, prototype, propertyname, defaultValue)
\
rettype EffectWindowImpl::prototype() const
\
{
\
auto client =
static
_cast<AbstractClient *>(toplevel
->isClient() ? toplevel : nullptr);
\
if (client) {
\
return client->propertyname();
\
}
\
return defaultValue;
\
}
CLIENT_HELPER
(
bool
,
isMovable
,
isMovable
,
false
)
...
...
@@ -2153,7 +2159,7 @@ QRect EffectWindowImpl::decorationInnerRect() const
KDecoration2
::
Decoration
*
EffectWindowImpl
::
decoration
()
const
{
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
!
client
)
{
return
nullptr
;
}
...
...
@@ -2178,7 +2184,7 @@ void EffectWindowImpl::deleteProperty(long int atom) const
EffectWindow
*
EffectWindowImpl
::
findModal
()
{
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
!
client
)
{
return
nullptr
;
}
...
...
@@ -2193,7 +2199,7 @@ EffectWindow *EffectWindowImpl::findModal()
EffectWindow
*
EffectWindowImpl
::
transientFor
()
{
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
!
client
)
{
return
nullptr
;
}
...
...
@@ -2231,7 +2237,7 @@ EffectWindowList getMainWindows(T *c)
EffectWindowList
EffectWindowImpl
::
mainWindows
()
const
{
if
(
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
return
getMainWindows
(
client
);
}
if
(
auto
deleted
=
qobject_cast
<
Deleted
*>
(
toplevel
))
{
...
...
@@ -2275,21 +2281,21 @@ void EffectWindowImpl::elevate(bool elevate)
void
EffectWindowImpl
::
minimize
()
{
if
(
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
client
->
minimize
();
}
}
void
EffectWindowImpl
::
unminimize
()
{
if
(
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
client
->
unminimize
();
}
}
void
EffectWindowImpl
::
closeWindow
()
{
if
(
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
client
->
closeWindow
();
}
}
...
...
src/input.cpp
View file @
d146a3d1
...
...
@@ -350,7 +350,8 @@ public:
return
false
;
}
auto
client
=
qobject_cast
<
AbstractClient
*>
(
input
()
->
findToplevel
(
event
->
globalPos
()));
auto
t
=
input
()
->
findToplevel
(
event
->
globalPos
());
auto
client
=
static_cast
<
AbstractClient
*>
(
t
&&
t
->
isClient
()
?
t
:
nullptr
);
if
(
client
&&
client
->
isLockScreen
())
{
workspace
()
->
activateClient
(
client
);
}
...
...
@@ -2383,7 +2384,7 @@ public:
const
auto
eventPos
=
event
->
globalPos
();
// TODO: use InputDeviceHandler::at() here and check isClient()?
Toplevel
*
t
=
input
()
->
findManagedToplevel
(
eventPos
);
const
auto
dragTarget
=
qobject
_cast
<
AbstractClient
*>
(
t
);
const
auto
dragTarget
=
static
_cast
<
AbstractClient
*>
(
t
&&
t
->
isClient
()
?
t
:
nullptr
);
if
(
dragTarget
)
{
if
(
dragTarget
!=
m_dragTarget
)
{
workspace
()
->
takeActivity
(
dragTarget
,
Workspace
::
ActivityFlag
::
ActivityFocus
);
...
...
@@ -2476,7 +2477,7 @@ public:
if
(
Toplevel
*
t
=
input
()
->
findToplevel
(
pos
.
toPoint
()))
{
// TODO: consider decorations
if
(
t
->
surface
()
!=
seat
->
dragSurface
())
{
if
((
m_dragTarget
=
qobject
_cast
<
AbstractClient
*>
(
t
)))
{
if
((
m_dragTarget
=
static
_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
)))
{
workspace
()
->
takeActivity
(
m_dragTarget
,
Workspace
::
ActivityFlag
::
ActivityFocus
);
m_raiseTimer
.
start
();
}
...
...
@@ -3299,7 +3300,8 @@ void InputDeviceHandler::updateFocus()
void
InputDeviceHandler
::
updateDecoration
()
{
Decoration
::
DecoratedClientImpl
*
decoration
=
nullptr
;
auto
*
ac
=
qobject_cast
<
AbstractClient
*>
(
m_hover
.
window
);
auto
t
=
m_hover
.
window
.
data
();
auto
ac
=
static_cast
<
AbstractClient
*>
(
t
&&
t
->
isClient
()
?
t
:
nullptr
);
if
(
ac
&&
ac
->
decoratedClient
())
{
if
(
!
ac
->
clientGeometry
().
contains
(
position
().
toPoint
()))
{
// input device above decoration
...
...
src/killwindow.cpp
View file @
d146a3d1
...
...
@@ -38,7 +38,7 @@ void KillWindow::start()
if
(
!
t
)
{
return
;
}
if
(
AbstractClient
*
c
=
qobject
_cast
<
AbstractClient
*>
(
t
))
{
if
(
AbstractClient
*
c
=
static
_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
))
{
c
->
killWindow
();
}
else
if
(
Unmanaged
*
u
=
qobject_cast
<
Unmanaged
*>
(
t
))
{
xcb_kill_client
(
kwinApp
()
->
x11Connection
(),
u
->
window
());
...
...
src/layers.cpp
View file @
d146a3d1
...
...
@@ -237,7 +237,8 @@ AbstractClient *Workspace::topClientOnDesktop(VirtualDesktop *desktop, AbstractO
list
=
unconstrained_stacking_order
;
}
for
(
int
i
=
list
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
AbstractClient
*
c
=
qobject_cast
<
AbstractClient
*>
(
list
.
at
(
i
));
auto
t
=
list
.
at
(
i
);
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
c
)
{
continue
;
}
...
...
@@ -261,14 +262,15 @@ AbstractClient *Workspace::findDesktop(bool topmost, VirtualDesktop *desktop) co
// TODO Q_ASSERT( block_stacking_updates == 0 );
if
(
topmost
)
{
for
(
int
i
=
stacking_order
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
AbstractClient
*
c
=
qobject_cast
<
AbstractClient
*>
(
stacking_order
.
at
(
i
));
auto
t
=
stacking_order
.
at
(
i
);
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
c
&&
c
->
isOnDesktop
(
desktop
)
&&
c
->
isDesktop
()
&&
c
->
isShown
())
{
return
c
;
}
}
}
else
{
// bottom-most
for
(
Toplevel
*
c
:
qAsConst
(
stacking_order
))
{
AbstractClient
*
client
=
qobject
_cast
<
AbstractClient
*>
(
c
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
c
->
isClient
()
?
c
:
nullptr
);
if
(
client
&&
c
->
isOnDesktop
(
desktop
)
&&
c
->
isDesktop
()
&&
client
->
isShown
())
{
return
client
;
}
...
...
@@ -334,7 +336,8 @@ void Workspace::lowerClientWithinApplication(AbstractClient *c)
bool
lowered
=
false
;
// first try to put it below the bottom-most window of the application
for
(
auto
it
=
unconstrained_stacking_order
.
begin
();
it
!=
unconstrained_stacking_order
.
end
();
++
it
)
{
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
*
it
);
auto
t
=
*
it
;
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
client
)
{
continue
;
}
...
...
@@ -388,7 +391,8 @@ void Workspace::raiseClientWithinApplication(AbstractClient *c)
// first try to put it above the top-most window of the application
for
(
int
i
=
unconstrained_stacking_order
.
size
()
-
1
;
i
>
-
1
;
--
i
)
{
AbstractClient
*
other
=
qobject_cast
<
AbstractClient
*>
(
unconstrained_stacking_order
.
at
(
i
));
auto
t
=
unconstrained_stacking_order
.
at
(
i
);
auto
other
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
other
)
{
continue
;
}
...
...
@@ -437,7 +441,8 @@ void Workspace::restack(AbstractClient *c, AbstractClient *under, bool force)
if
(
!
force
&&
!
AbstractClient
::
belongToSameApplication
(
under
,
c
))
{
// put in the stacking order below _all_ windows belonging to the active application
for
(
int
i
=
0
;
i
<
unconstrained_stacking_order
.
size
();
++
i
)
{
AbstractClient
*
other
=
qobject_cast
<
AbstractClient
*>
(
unconstrained_stacking_order
.
at
(
i
));
auto
t
=
unconstrained_stacking_order
.
at
(
i
);
auto
other
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
other
&&
other
->
layer
()
==
c
->
layer
()
&&
AbstractClient
::
belongToSameApplication
(
under
,
other
))
{
under
=
(
c
==
other
)
?
nullptr
:
other
;
break
;
...
...
src/placement.cpp
View file @
d146a3d1
...
...
@@ -232,7 +232,8 @@ void Placement::placeSmart(AbstractClient *c, const QRect &area, Policy /*next*/
cyt
=
y
;
cyb
=
y
+
ch
;
for
(
auto
l
=
workspace
()
->
stackingOrder
().
constBegin
();
l
!=
workspace
()
->
stackingOrder
().
constEnd
();
++
l
)
{
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
*
l
);
auto
t
=
*
l
;
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
isIrrelevant
(
client
,
c
,
desktop
))
{
continue
;
}
...
...
@@ -286,7 +287,8 @@ void Placement::placeSmart(AbstractClient *c, const QRect &area, Policy /*next*/
// compare to the position of each client on the same desk
for
(
auto
l
=
workspace
()
->
stackingOrder
().
constBegin
();
l
!=
workspace
()
->
stackingOrder
().
constEnd
();
++
l
)
{
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
*
l
);
auto
t
=
*
l
;
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
isIrrelevant
(
client
,
c
,
desktop
))
{
continue
;
}
...
...
@@ -324,7 +326,8 @@ void Placement::placeSmart(AbstractClient *c, const QRect &area, Policy /*next*/
// test the position of each window on the desk
for
(
auto
l
=
workspace
()
->
stackingOrder
().
constBegin
();
l
!=
workspace
()
->
stackingOrder
().
constEnd
();
++
l
)
{
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
*
l
);
auto
t
=
*
l
;
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
isIrrelevant
(
client
,
c
,
desktop
))
{
continue
;
}
...
...
@@ -633,7 +636,7 @@ void Placement::cascadeDesktop()
reinitCascading
(
desktop
);
const
auto
stackingOrder
=
ws
->
stackingOrder
();
for
(
Toplevel
*
toplevel
:
stackingOrder
)
{
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
!
client
||
(
!
client
->
isOnCurrentDesktop
())
||
(
client
->
isMinimized
())
||
(
client
->
isOnAllDesktops
())
||
(
!
client
->
isMovable
()))
{
continue
;
}
...
...
src/plugins/screencast/screencastmanager.cpp
View file @
d146a3d1
...
...
@@ -48,7 +48,7 @@ public:
:
ScreenCastStream
(
new
WindowScreenCastSource
(
toplevel
),
parent
)
,
m_toplevel
(
toplevel
)
{
if
(
AbstractClient
*
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
AbstractClient
*
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
setObjectName
(
client
->
desktopFileName
());
}
connect
(
this
,
&
ScreenCastStream
::
startStreaming
,
this
,
&
WindowStream
::
startFeeding
);
...
...
src/pointer_input.cpp
View file @
d146a3d1
...
...
@@ -197,7 +197,8 @@ void PointerInputRedirection::updateToReset()
setDecoration
(
nullptr
);
}
if
(
focus
())
{
if
(
AbstractClient
*
c
=
qobject_cast
<
AbstractClient
*>
(
focus
()))
{
auto
t
=
focus
();
if
(
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
))
{
c
->
pointerLeaveEvent
();
}
disconnect
(
m_focusGeometryConnection
);
...
...
@@ -557,7 +558,7 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl
void
PointerInputRedirection
::
focusUpdate
(
Toplevel
*
focusOld
,
Toplevel
*
focusNow
)
{
if
(
AbstractClient
*
ac
=
qobject
_cast
<
AbstractClient
*>
(
focusOld
))
{
if
(
auto
ac
=
static
_cast
<
AbstractClient
*>
(
focusOld
&&
focusOld
->
isClient
()
?
focusOld
:
nullptr
))
{
ac
->
pointerLeaveEvent
();
breakPointerConstraints
(
ac
->
surface
());
disconnectPointerConstraintsConnection
();
...
...
@@ -565,7 +566,7 @@ void PointerInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow
disconnect
(
m_focusGeometryConnection
);
m_focusGeometryConnection
=
QMetaObject
::
Connection
();
if
(
AbstractClient
*
ac
=
qobject
_cast
<
AbstractClient
*>
(
focusNow
))
{
if
(
auto
ac
=
static
_cast
<
AbstractClient
*>
(
focusNow
&&
focusNow
->
isClient
()
?
focusNow
:
nullptr
))
{
ac
->
pointerEnterEvent
(
m_pos
.
toPoint
());
}
...
...
src/popup_input_filter.cpp
View file @
d146a3d1
...
...
@@ -48,8 +48,9 @@ bool PopupInputFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton)
return
false
;
}
if
(
event
->
type
()
==
QMouseEvent
::
MouseButtonPress
)
{
auto
pointerFocus
=
qobject_cast
<
AbstractClient
*>
(
input
()
->
findToplevel
(
event
->
globalPos
()));
if
(
!
pointerFocus
||
!
AbstractClient
::
belongToSameApplication
(
pointerFocus
,
qobject_cast
<
AbstractClient
*>
(
m_popupClients
.
constLast
())))
{
auto
t
=
input
()
->
findToplevel
(
event
->
globalPos
());
auto
pointerFocus
=
static_cast
<
AbstractClient
*>
(
t
&&
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
pointerFocus
||
!
AbstractClient
::
belongToSameApplication
(
pointerFocus
,
static_cast
<
AbstractClient
*>
(
m_popupClients
.
constLast
()
->
isClient
()
?
m_popupClients
.
constLast
()
:
nullptr
)))
{
// a press on a window (or no window) not belonging to the popup window
cancelPopups
();
// filter out this press
...
...
@@ -96,8 +97,9 @@ bool PopupInputFilter::touchDown(qint32 id, const QPointF &pos, quint32 time)
if
(
m_popupClients
.
isEmpty
())
{
return
false
;
}
auto
pointerFocus
=
qobject_cast
<
AbstractClient
*>
(
input
()
->
findToplevel
(
pos
.
toPoint
()));
if
(
!
pointerFocus
||
!
AbstractClient
::
belongToSameApplication
(
pointerFocus
,
qobject_cast
<
AbstractClient
*>
(
m_popupClients
.
constLast
())))
{
auto
t
=
input
()
->
findToplevel
(
pos
.
toPoint
());
auto
pointerFocus
=
static_cast
<
AbstractClient
*>
(
t
&&
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
pointerFocus
||
!
AbstractClient
::
belongToSameApplication
(
pointerFocus
,
static_cast
<
AbstractClient
*>
(
m_popupClients
.
constLast
()
->
isClient
()
?
m_popupClients
.
constLast
()
:
nullptr
)))
{
// a touch on a window (or no window) not belonging to the popup window
cancelPopups
();
// filter out this touch
...
...
src/scenes/qpainter/scene_qpainter.cpp
View file @
d146a3d1
...
...
@@ -246,7 +246,7 @@ void SceneQPainter::Window::renderDecorationItem(QPainter *painter, DecorationIt
{
const
auto
renderer
=
static_cast
<
const
SceneQPainterDecorationRenderer
*>
(
decorationItem
->
renderer
());
QRect
dtr
,
dlr
,
drr
,
dbr
;
if
(
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
client
->
layoutDecorationRects
(
dlr
,
dtr
,
drr
,
dbr
);
}
else
if
(
auto
deleted
=
qobject_cast
<
Deleted
*>
(
toplevel
))
{
deleted
->
layoutDecorationRects
(
dlr
,
dtr
,
drr
,
dbr
);
...
...
src/shadow.cpp
View file @
d146a3d1
...
...
@@ -76,7 +76,7 @@ Shadow *Shadow::createShadowFromX11(Toplevel *toplevel)
Shadow
*
Shadow
::
createShadowFromDecoration
(
Toplevel
*
toplevel
)
{
AbstractClient
*
c
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
c
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
!
c
)
{
return
nullptr
;
}
...
...
@@ -289,7 +289,7 @@ bool Shadow::updateShadow()
}
if
(
m_decorationShadow
)
{
if
(
AbstractClient
*
c
=
qobject
_cast
<
AbstractClient
*>
(
m_topLevel
))
{
if
(
auto
c
=
static
_cast
<
AbstractClient
*>
(
m_topLevel
->
isClient
()
?
m_topLevel
:
nullptr
))
{
if
(
c
->
decoration
())
{
if
(
init
(
c
->
decoration
()))
{
return
true
;
...
...
src/tabbox/tabbox.cpp
View file @
d146a3d1
...
...
@@ -283,7 +283,7 @@ TabBoxClientList TabBoxHandlerImpl::stackingOrder() const
const
QList
<
Toplevel
*>
stacking
=
Workspace
::
self
()
->
stackingOrder
();
TabBoxClientList
ret
;
for
(
Toplevel
*
toplevel
:
stacking
)
{
if
(
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
))
{
if
(
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
))
{
ret
.
append
(
qWeakPointerCast
<
TabBoxClient
,
TabBoxClientImpl
>
(
client
->
tabBoxClient
()));
}
}
...
...
@@ -330,7 +330,7 @@ QWeakPointer<TabBoxClient> TabBoxHandlerImpl::desktopClient() const
{
const
auto
stackingOrder
=
Workspace
::
self
()
->
stackingOrder
();
for
(
Toplevel
*
toplevel
:
stackingOrder
)
{
auto
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
client
&&
client
->
isDesktop
()
&&
client
->
isOnCurrentDesktop
()
&&
client
->
output
()
==
workspace
()
->
activeOutput
())
{
return
qWeakPointerCast
<
TabBoxClient
,
TabBoxClientImpl
>
(
client
->
tabBoxClient
());
}
...
...
@@ -1243,10 +1243,9 @@ void TabBox::CDEWalkThroughWindows(bool forward)
// policies - the topmost one, with some exceptions (can't be keepabove/below,
// otherwise it gets stuck on them)
// Q_ASSERT(Workspace::self()->block_stacking_updates == 0);
for
(
int
i
=
Workspace
::
self
()
->
stackingOrder
().
size
()
-
1
;
i
>=
0
;
--
i
)
{
auto
it
=
qobject_cast
<
AbstractClient
*>
(
Workspace
::
self
()
->
stackingOrder
().
at
(
i
));
for
(
int
i
=
Workspace
::
self
()
->
stackingOrder
().
size
()
-
1
;
i
>=
0
;
--
i
)
{
auto
t
=
Workspace
::
self
()
->
stackingOrder
().
at
(
i
);
auto
it
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
it
&&
it
->
isOnCurrentActivity
()
&&
it
->
isOnCurrentDesktop
()
&&
!
it
->
isSpecialWindow
()
&&
!
it
->
isShade
()
&&
it
->
isShown
()
&&
it
->
wantsTabFocus
()
&&
!
it
->
keepAbove
()
&&
!
it
->
keepBelow
())
{
...
...
src/touch_input.cpp
View file @
d146a3d1
...
...
@@ -93,13 +93,13 @@ void TouchInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow)
{
// TODO: handle pointer grab aka popups
if
(
AbstractClient
*
ac
=
qobject
_cast
<
AbstractClient
*>
(
focusOld
))
{
if
(
AbstractClient
*
ac
=
static
_cast
<
AbstractClient
*>
(
focusOld
&&
focusOld
->
isClient
()
?
focusOld
:
nullptr
))
{
ac
->
pointerLeaveEvent
();
}
disconnect
(
m_focusGeometryConnection
);
m_focusGeometryConnection
=
QMetaObject
::
Connection
();
if
(
AbstractClient
*
ac
=
qobject
_cast
<
AbstractClient
*>
(
focusNow
))
{
if
(
AbstractClient
*
ac
=
static
_cast
<
AbstractClient
*>
(
focusNow
&&
focusNow
->
isClient
()
?
focusNow
:
nullptr
))
{
ac
->
pointerEnterEvent
(
m_lastPosition
.
toPoint
());
}
...
...
src/useractions.cpp
View file @
d146a3d1
...
...
@@ -1679,7 +1679,8 @@ bool Workspace::switchWindow(AbstractClient *c, Direction direction, QPoint curP
QList
<
Toplevel
*>
clist
=
stackingOrder
();
for
(
auto
i
=
clist
.
rbegin
();
i
!=
clist
.
rend
();
++
i
)
{
auto
client
=
qobject_cast
<
AbstractClient
*>
(
*
i
);
auto
t
=
*
i
;
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
client
)
{
continue
;
}
...
...
src/wayland_server.cpp
View file @
d146a3d1
...
...
@@ -527,7 +527,7 @@ SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface
void
WaylandServer
::
shellClientShown
(
Toplevel
*
toplevel
)
{
AbstractClient
*
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
!
client
)
{
qCWarning
(
KWIN_CORE
)
<<
"Failed to cast a Toplevel which is supposed to be an AbstractClient to AbstractClient"
;
return
;
...
...
@@ -555,7 +555,7 @@ void WaylandServer::initWorkspace()
QVector
<
quint32
>
ids
;
QVector
<
QString
>
uuids
;
for
(
Toplevel
*
toplevel
:
workspace
()
->
stackingOrder
())
{
auto
*
client
=
qobject
_cast
<
AbstractClient
*>
(
toplevel
);
auto
*
client
=
static
_cast
<
AbstractClient
*>
(
toplevel
->
isClient
()
?
toplevel
:
nullptr
);
if
(
client
&&
client
->
windowManagementInterface
())
{
ids
<<
client
->
windowManagementInterface
()
->
internalId
();
uuids
<<
client
->
windowManagementInterface
()
->
uuid
();
...
...
src/windowitem.cpp
View file @
d146a3d1
...
...
@@ -21,7 +21,7 @@ WindowItem::WindowItem(Toplevel *window, Item *parent)
:
Item
(
parent
)
,
m_window
(
window
)
{
AbstractClient
*
client
=
qobject
_cast
<
AbstractClient
*>
(
window
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
window
->
isClient
()
?
window
:
nullptr
);
if
(
client
)
{
connect
(
client
,
&
AbstractClient
::
decorationChanged
,
this
,
&
WindowItem
::
updateDecorationItem
);
updateDecorationItem
();
...
...
@@ -108,7 +108,7 @@ void WindowItem::updateShadowItem()
void
WindowItem
::
updateDecorationItem
()
{
AbstractClient
*
client
=
qobject
_cast
<
AbstractClient
*>
(
m_window
);
auto
client
=
static
_cast
<
AbstractClient
*>
(
m_window
->
isClient
()
?
m_window
:
nullptr
);
if
(
!
client
||
client
->
isZombie
())
{
return
;
}
...
...
src/workspace.cpp
View file @
d146a3d1
...
...
@@ -894,7 +894,8 @@ void Workspace::updateToolWindows(bool also_hide)
// SELI TODO: But maybe it should - what if a new client has been added that's not in stacking order yet?
QVector
<
AbstractClient
*>
to_show
,
to_hide
;
for
(
auto
it
=
stacking_order
.
constBegin
();
it
!=
stacking_order
.
constEnd
();
++
it
)
{
auto
c
=
qobject_cast
<
AbstractClient
*>
(
*
it
);
auto
t
=
*
it
;
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
c
)
{
continue
;
}
...
...
@@ -1095,7 +1096,8 @@ AbstractClient *Workspace::findClientToActivateOnDesktop(VirtualDesktop *desktop
if
(
options
->
isNextFocusPrefersMouse
())
{
auto
it
=
stackingOrder
().
constEnd
();
while
(
it
!=
stackingOrder
().
constBegin
())
{
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
*
(
--
it
));
auto
t
=
*
(
--
it
);
auto
client
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
!
client
)
{
continue
;
}
...
...
@@ -1401,7 +1403,8 @@ void Workspace::setShowingDesktop(bool showing, bool animated)
{
// for the blocker RAII
StackingUpdatesBlocker
blocker
(
this
);
// updateLayer & lowerClient would invalidate stacking_order
for
(
int
i
=
stacking_order
.
count
()
-
1
;
i
>
-
1
;
--
i
)
{
AbstractClient
*
c
=
qobject_cast
<
AbstractClient
*>
(
stacking_order
.
at
(
i
));
auto
t
=
stacking_order
.
at
(
i
);
auto
c
=
static_cast
<
AbstractClient
*>
(
t
->
isClient
()
?
t
:
nullptr
);
if
(
c
&&
c
->
isOnCurrentDesktop
())
{
if
(
c
->
isDock
())
{
c
->
updateLayer
();
...
...
@@ -1783,7 +1786,8 @@ AbstractClient *Workspace::findAbstractClient(std::function<bool(const AbstractC
AbstractClient
*
Workspace
::
findAbstractClient
(
const
QUuid
&
internalId
)
const
{
return
qobject_cast
<
AbstractClient
*>
(
findToplevel
(
internalId
));
auto
t
=
findToplevel
(
internalId
);
return
static_cast
<
AbstractClient
*>
(
t
&&
t
->
isClient
()
?
t
:
nullptr
);
}