Use better window placement heuristics for internal clients

Currently, we do some sort of window placement only for decorated
internal windows, which feels hacky.

With this change, all internal clients will go through the window
placement code, unless it's a popup or the BypassWindowManagerHint
flag is set.

If the BypassWindowManagerHint flag is set, the window must have
valid position.

CCBUG: 400675
master
Vlad Zahorodnii 2020-09-23 16:24:10 +03:00
parent 960a40ef44
commit bc34736534
3 changed files with 9 additions and 2 deletions

View File

@ -211,6 +211,11 @@ bool InternalClient::isResizable() const
return true;
}
bool InternalClient::isPlaceable() const
{
return !(m_internalWindowFlags & Qt::BypassWindowManagerHint) && !(m_internalWindowFlags & Qt::Popup);
}
bool InternalClient::noBorder() const
{
return m_userNoBorder || m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup);

View File

@ -45,6 +45,7 @@ public:
bool isMovable() const override;
bool isMovableAcrossScreens() const override;
bool isResizable() const override;
bool isPlaceable() const override;
bool noBorder() const override;
bool userCanSetNoBorder() const override;
bool wantsInput() const override;

View File

@ -1810,8 +1810,9 @@ void Workspace::addInternalClient(InternalClient *client)
setupClientConnections(client);
client->updateLayer();
if (client->isDecorated()) {
client->keepInArea(clientArea(FullScreenArea, client));
if (client->isPlaceable()) {
const QRect area = clientArea(PlacementArea, screens()->current(), client->desktop());
client->placeIn(area);
}
markXStackingOrderAsDirty();