Commit ef65a340 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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


(cherry picked from commit bc347365)
parent 02490c20
...@@ -211,6 +211,11 @@ bool InternalClient::isResizable() const ...@@ -211,6 +211,11 @@ bool InternalClient::isResizable() const
return true; return true;
} }
bool InternalClient::isPlaceable() const
{
return !(m_internalWindowFlags & Qt::BypassWindowManagerHint) && !(m_internalWindowFlags & Qt::Popup);
}
bool InternalClient::noBorder() const bool InternalClient::noBorder() const
{ {
return m_userNoBorder || m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup); return m_userNoBorder || m_internalWindowFlags.testFlag(Qt::FramelessWindowHint) || m_internalWindowFlags.testFlag(Qt::Popup);
......
...@@ -45,6 +45,7 @@ public: ...@@ -45,6 +45,7 @@ public:
bool isMovable() const override; bool isMovable() const override;
bool isMovableAcrossScreens() const override; bool isMovableAcrossScreens() const override;
bool isResizable() const override; bool isResizable() const override;
bool isPlaceable() const override;
bool noBorder() const override; bool noBorder() const override;
bool userCanSetNoBorder() const override; bool userCanSetNoBorder() const override;
bool wantsInput() const override; bool wantsInput() const override;
......
...@@ -1820,8 +1820,9 @@ void Workspace::addInternalClient(InternalClient *client) ...@@ -1820,8 +1820,9 @@ void Workspace::addInternalClient(InternalClient *client)
setupClientConnections(client); setupClientConnections(client);
client->updateLayer(); client->updateLayer();
if (client->isDecorated()) { if (client->isPlaceable()) {
client->keepInArea(clientArea(FullScreenArea, client)); const QRect area = clientArea(PlacementArea, screens()->current(), client->desktop());
client->placeIn(area);
} }
markXStackingOrderAsDirty(); markXStackingOrderAsDirty();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment