Move X11Window::findModal() to Window and remove boolean trap
This commit is contained in:
parent
fb6ce3707a
commit
60d36c0753
8 changed files with 17 additions and 31 deletions
|
@ -260,11 +260,6 @@ void InternalWindow::moveResizeInternal(const QRectF &rect, MoveResizeMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
Window *InternalWindow::findModal(bool allow_itself)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool InternalWindow::takeFocus()
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
bool isLockScreen() const override;
|
||||
bool isOutline() const override;
|
||||
QRectF resizeWithChecks(const QRectF &geometry, const QSizeF &size) override;
|
||||
Window *findModal(bool allow_itself = false) override;
|
||||
bool takeFocus() override;
|
||||
void setNoBorder(bool set) override;
|
||||
void invalidateDecoration() override;
|
||||
|
|
|
@ -83,11 +83,6 @@ bool WaylandWindow::isLocalhost() const
|
|||
return true;
|
||||
}
|
||||
|
||||
Window *WaylandWindow::findModal(bool allow_itself)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QRectF WaylandWindow::resizeWithChecks(const QRectF &geometry, const QSizeF &size)
|
||||
{
|
||||
const QRectF area = workspace()->clientArea(WorkArea, this, geometry.center());
|
||||
|
|
|
@ -24,7 +24,6 @@ public:
|
|||
bool isClient() const override;
|
||||
bool isLockScreen() const override;
|
||||
bool isLocalhost() const override;
|
||||
Window *findModal(bool allow_itself = false) override;
|
||||
QRectF resizeWithChecks(const QRectF &geometry, const QSizeF &size) override;
|
||||
void killWindow() override;
|
||||
QString windowRole() const override;
|
||||
|
|
|
@ -2277,6 +2277,22 @@ bool Window::isModal() const
|
|||
return m_modal;
|
||||
}
|
||||
|
||||
Window *Window::findModal() const
|
||||
{
|
||||
for (Window *transient : m_transients) {
|
||||
if (transient->isDeleted()) {
|
||||
continue;
|
||||
}
|
||||
if (transient->isModal()) {
|
||||
return transient;
|
||||
}
|
||||
if (Window *modal = transient->findModal()) {
|
||||
return modal;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Window::isTransient() const
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -938,8 +938,7 @@ public:
|
|||
void setHidden(bool hidden);
|
||||
bool isHiddenByShowDesktop() const;
|
||||
void setHiddenByShowDesktop(bool hidden);
|
||||
// TODO: remove boolean trap
|
||||
virtual Window *findModal(bool allow_itself = false) = 0;
|
||||
Window *findModal() const;
|
||||
virtual bool isTransient() const;
|
||||
/**
|
||||
* @returns Whether there is a hint available to place the Window on it's parent, default @c false.
|
||||
|
|
|
@ -3476,22 +3476,6 @@ QList<Window *> X11Window::mainWindows() const
|
|||
return result;
|
||||
}
|
||||
|
||||
Window *X11Window::findModal(bool allow_itself)
|
||||
{
|
||||
if (isDeleted()) {
|
||||
return nullptr;
|
||||
}
|
||||
for (auto it = transients().constBegin(); it != transients().constEnd(); ++it) {
|
||||
if (Window *ret = (*it)->findModal(true)) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (isModal() && allow_itself) {
|
||||
return this;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// X11Window::window_group only holds the contents of the hint,
|
||||
// but it should be used only to find the group, not for anything else
|
||||
// Argument is only when some specific group needs to be set.
|
||||
|
|
|
@ -117,7 +117,6 @@ public:
|
|||
QList<Window *> mainWindows() const override; // Call once before loop , is not indirect
|
||||
bool hasTransient(const Window *c, bool indirect) const override;
|
||||
void checkTransient(xcb_window_t w);
|
||||
Window *findModal(bool allow_itself = false) override;
|
||||
const Group *group() const override;
|
||||
Group *group() override;
|
||||
void checkGroup(Group *gr = nullptr, bool force = false);
|
||||
|
|
Loading…
Reference in a new issue