Commit 2fdb55b1 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Rename InternalWindow::internalWindow() to InternalWindow::handle()

internalWindow->handle() reads better than internalWindow->internalWindow()
parent 5ee044e6
Pipeline #169783 passed with stage
in 24 minutes and 26 seconds
......@@ -496,7 +496,7 @@ void DebugConsoleTest::testClosingDebugConsole()
QTRY_COMPARE(windowAddedSpy.count(), 1);
InternalWindow *window = windowAddedSpy.first().first().value<InternalWindow *>();
QVERIFY(window->isInternal());
QCOMPARE(window->internalWindow(), console->windowHandle());
QCOMPARE(window->handle(), console->windowHandle());
QVERIFY(window->isDecorated());
QCOMPARE(window->isMinimizable(), false);
window->closeWindow();
......
......@@ -782,7 +782,7 @@ void DecorationInputTest::testTooltipDoesntEatKeyEvents()
QVERIFY(windowAddedSpy.wait());
InternalWindow *internal = windowAddedSpy.first().first().value<InternalWindow *>();
QVERIFY(internal->isInternal());
QVERIFY(internal->internalWindow()->flags().testFlag(Qt::ToolTip));
QVERIFY(internal->handle()->flags().testFlag(Qt::ToolTip));
// now send a key
quint32 timestamp = 0;
......
......@@ -245,7 +245,7 @@ void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
InternalWindow *tooltip = tooltipAddedSpy.first().first().value<InternalWindow *>();
QVERIFY(tooltip->isInternal());
QVERIFY(tooltip->isPopupWindow());
QVERIFY(tooltip->internalWindow()->flags().testFlag(Qt::ToolTip));
QVERIFY(tooltip->handle()->flags().testFlag(Qt::ToolTip));
QVERIFY(effect->isActive());
// Eventually, the animation will be complete.
......
......@@ -2164,7 +2164,7 @@ EffectWindow *EffectWindowImpl::transientFor()
QWindow *EffectWindowImpl::internalWindow() const
{
if (auto window = qobject_cast<InternalWindow *>(m_window)) {
return window->internalWindow();
return window->handle();
}
return nullptr;
}
......
......@@ -1225,7 +1225,7 @@ class InternalWindowEventFilter : public InputEventFilter
if (!input()->pointer()->focus() || !input()->pointer()->focus()->isInternal()) {
return false;
}
QWindow *internal = static_cast<InternalWindow *>(input()->pointer()->focus())->internalWindow();
QWindow *internal = static_cast<InternalWindow *>(input()->pointer()->focus())->handle();
QMouseEvent mouseEvent(event->type(),
event->pos() - internal->position(),
event->globalPos(),
......@@ -1238,7 +1238,7 @@ class InternalWindowEventFilter : public InputEventFilter
if (!input()->pointer()->focus() || !input()->pointer()->focus()->isInternal()) {
return false;
}
QWindow *internal = static_cast<InternalWindow *>(input()->pointer()->focus())->internalWindow();
QWindow *internal = static_cast<InternalWindow *>(input()->pointer()->focus())->handle();
const QPointF localPos = event->globalPosition() - internal->position();
const Qt::Orientation orientation = (event->angleDelta().x() != 0) ? Qt::Horizontal : Qt::Vertical;
const int delta = event->angleDelta().x() != 0 ? event->angleDelta().x() : event->angleDelta().y();
......@@ -1256,7 +1256,7 @@ class InternalWindowEventFilter : public InputEventFilter
const QList<InternalWindow *> &windows = workspace()->internalWindows();
QWindow *found = nullptr;
for (auto it = windows.crbegin(); it != windows.crend(); ++it) {
if (QWindow *w = (*it)->internalWindow()) {
if (QWindow *w = (*it)->handle()) {
if (!w->isVisible()) {
continue;
}
......@@ -1319,7 +1319,7 @@ class InternalWindowEventFilter : public InputEventFilter
}
touch->setInternalPressId(id);
// Qt's touch event API is rather complex, let's do fake mouse events instead
QWindow *internal = static_cast<InternalWindow *>(input()->touch()->focus())->internalWindow();
QWindow *internal = static_cast<InternalWindow *>(input()->touch()->focus())->handle();
m_lastGlobalTouchPos = pos;
m_lastLocalTouchPos = pos - internal->position();
......@@ -1345,7 +1345,7 @@ class InternalWindowEventFilter : public InputEventFilter
// ignore, but filter out
return true;
}
QWindow *internal = static_cast<InternalWindow *>(input()->touch()->focus())->internalWindow();
QWindow *internal = static_cast<InternalWindow *>(input()->touch()->focus())->handle();
m_lastGlobalTouchPos = pos;
m_lastLocalTouchPos = pos - QPointF(internal->x(), internal->y());
......@@ -1368,7 +1368,7 @@ class InternalWindowEventFilter : public InputEventFilter
if (!input()->touch()->focus() || !input()->touch()->focus()->isInternal()) {
return removed;
}
QWindow *internal = static_cast<InternalWindow *>(input()->touch()->focus())->internalWindow();
QWindow *internal = static_cast<InternalWindow *>(input()->touch()->focus())->handle();
// send mouse up
QMouseEvent e(QEvent::MouseButtonRelease, m_lastLocalTouchPos, m_lastGlobalTouchPos, Qt::LeftButton, Qt::MouseButtons(), input()->keyboardModifiers());
e.setAccepted(false);
......
......@@ -28,40 +28,40 @@ static const QByteArray s_shadowEnabledPropertyName = QByteArrayLiteral("kwin_sh
namespace KWin
{
InternalWindow::InternalWindow(QWindow *window)
: m_internalWindow(window)
, m_internalWindowFlags(window->flags())
{
connect(m_internalWindow, &QWindow::xChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_internalWindow, &QWindow::yChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_internalWindow, &QWindow::widthChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_internalWindow, &QWindow::heightChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_internalWindow, &QWindow::windowTitleChanged, this, &InternalWindow::setCaption);
connect(m_internalWindow, &QWindow::opacityChanged, this, &InternalWindow::setOpacity);
connect(m_internalWindow, &QWindow::destroyed, this, &InternalWindow::destroyWindow);
const QVariant windowType = m_internalWindow->property("kwin_windowType");
InternalWindow::InternalWindow(QWindow *handle)
: m_handle(handle)
, m_internalWindowFlags(handle->flags())
{
connect(m_handle, &QWindow::xChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_handle, &QWindow::yChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_handle, &QWindow::widthChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_handle, &QWindow::heightChanged, this, &InternalWindow::updateInternalWindowGeometry);
connect(m_handle, &QWindow::windowTitleChanged, this, &InternalWindow::setCaption);
connect(m_handle, &QWindow::opacityChanged, this, &InternalWindow::setOpacity);
connect(m_handle, &QWindow::destroyed, this, &InternalWindow::destroyWindow);
const QVariant windowType = m_handle->property("kwin_windowType");
if (!windowType.isNull()) {
m_windowType = windowType.value<NET::WindowType>();
}
setCaption(m_internalWindow->title());
setCaption(m_handle->title());
setIcon(QIcon::fromTheme(QStringLiteral("kwin")));
setOnAllDesktops(true);
setOpacity(m_internalWindow->opacity());
setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool());
setOpacity(m_handle->opacity());
setSkipCloseAnimation(m_handle->property(s_skipClosePropertyName).toBool());
// Create scene window, effect window, and update server-side shadow.
setupCompositing();
updateColorScheme();
blockGeometryUpdates(true);
commitGeometry(m_internalWindow->geometry());
commitGeometry(m_handle->geometry());
updateDecoration(true);
moveResize(clientRectToFrameRect(m_internalWindow->geometry()));
moveResize(clientRectToFrameRect(m_handle->geometry()));
blockGeometryUpdates(false);
m_internalWindow->installEventFilter(this);
m_handle->installEventFilter(this);
}
InternalWindow::~InternalWindow()
......@@ -79,10 +79,10 @@ bool InternalWindow::hitTest(const QPoint &point) const
return false;
}
const QRegion mask = m_internalWindow->mask();
const QRegion mask = m_handle->mask();
if (!mask.isEmpty() && !mask.contains(mapToLocal(point))) {
return false;
} else if (m_internalWindow->property("outputOnly").toBool()) {
} else if (m_handle->property("outputOnly").toBool()) {
return false;
}
......@@ -94,7 +94,7 @@ void InternalWindow::pointerEnterEvent(const QPoint &globalPos)
Window::pointerEnterEvent(globalPos);
QEnterEvent enterEvent(pos(), pos(), globalPos);
QCoreApplication::sendEvent(m_internalWindow, &enterEvent);
QCoreApplication::sendEvent(m_handle, &enterEvent);
}
void InternalWindow::pointerLeaveEvent()
......@@ -102,21 +102,21 @@ void InternalWindow::pointerLeaveEvent()
Window::pointerLeaveEvent();
QEvent event(QEvent::Leave);
QCoreApplication::sendEvent(m_internalWindow, &event);
QCoreApplication::sendEvent(m_handle, &event);
}
bool InternalWindow::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_internalWindow && event->type() == QEvent::DynamicPropertyChange) {
if (watched == m_handle && event->type() == QEvent::DynamicPropertyChange) {
QDynamicPropertyChangeEvent *pe = static_cast<QDynamicPropertyChangeEvent *>(event);
if (pe->propertyName() == s_skipClosePropertyName) {
setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool());
setSkipCloseAnimation(m_handle->property(s_skipClosePropertyName).toBool());
}
if (pe->propertyName() == s_shadowEnabledPropertyName) {
updateShadow();
}
if (pe->propertyName() == "kwin_windowType") {
m_windowType = m_internalWindow->property("kwin_windowType").value<NET::WindowType>();
m_windowType = m_handle->property("kwin_windowType").value<NET::WindowType>();
workspace()->updateClientArea();
}
}
......@@ -125,8 +125,8 @@ bool InternalWindow::eventFilter(QObject *watched, QEvent *event)
qreal InternalWindow::bufferScale() const
{
if (m_internalWindow) {
return m_internalWindow->devicePixelRatio();
if (m_handle) {
return m_handle->devicePixelRatio();
}
return 1;
}
......@@ -143,12 +143,12 @@ QString InternalWindow::captionSuffix() const
QSize InternalWindow::minSize() const
{
return m_internalWindow->minimumSize();
return m_handle->minimumSize();
}
QSize InternalWindow::maxSize() const
{
return m_internalWindow->maximumSize();
return m_handle->maximumSize();
}
NET::WindowType InternalWindow::windowType(bool direct, int supported_types) const
......@@ -178,8 +178,8 @@ QByteArray InternalWindow::windowRole() const
void InternalWindow::closeWindow()
{
if (m_internalWindow) {
m_internalWindow->hide();
if (m_handle) {
m_handle->hide();
}
}
......@@ -230,16 +230,16 @@ bool InternalWindow::isInternal() const
bool InternalWindow::isLockScreen() const
{
if (m_internalWindow) {
return m_internalWindow->property("org_kde_ksld_emergency").toBool();
if (m_handle) {
return m_handle->property("org_kde_ksld_emergency").toBool();
}
return false;
}
bool InternalWindow::isOutline() const
{
if (m_internalWindow) {
return m_internalWindow->property("__kwin_outline").toBool();
if (m_handle) {
return m_handle->property("__kwin_outline").toBool();
}
return false;
}
......@@ -264,7 +264,7 @@ void InternalWindow::showClient()
void InternalWindow::resizeWithChecks(const QSize &size)
{
if (!m_internalWindow) {
if (!m_handle) {
return;
}
const QRect area = workspace()->clientArea(WorkArea, this);
......@@ -371,19 +371,19 @@ void InternalWindow::destroyWindow()
workspace()->removeInternalWindow(this);
deleted->unrefWindow();
m_internalWindow = nullptr;
m_handle = nullptr;
delete this;
}
bool InternalWindow::hasPopupGrab() const
{
return !m_internalWindow->flags().testFlag(Qt::WindowTransparentForInput) && m_internalWindow->flags().testFlag(Qt::Popup) && !m_internalWindow->flags().testFlag(Qt::ToolTip);
return !m_handle->flags().testFlag(Qt::WindowTransparentForInput) && m_handle->flags().testFlag(Qt::Popup) && !m_handle->flags().testFlag(Qt::ToolTip);
}
void InternalWindow::popupDone()
{
m_internalWindow->hide();
m_handle->hide();
}
void InternalWindow::present(const QSharedPointer<QOpenGLFramebufferObject> fbo)
......@@ -416,9 +416,9 @@ void InternalWindow::present(const QImage &image, const QRegion &damage)
surfaceItem()->addDamage(damage);
}
QWindow *InternalWindow::internalWindow() const
QWindow *InternalWindow::handle() const
{
return m_internalWindow;
return m_handle;
}
bool InternalWindow::acceptsFocus() const
......@@ -436,7 +436,7 @@ bool InternalWindow::belongsToSameApplication(const Window *other, SameApplicati
if (otherInternal == this) {
return true;
}
return otherInternal->internalWindow()->isAncestorOf(internalWindow()) || internalWindow()->isAncestorOf(otherInternal->internalWindow());
return otherInternal->handle()->isAncestorOf(handle()) || handle()->isAncestorOf(otherInternal->handle());
}
void InternalWindow::doInteractiveResizeSync()
......@@ -463,8 +463,8 @@ void InternalWindow::updateCaption()
void InternalWindow::requestGeometry(const QRect &rect)
{
if (m_internalWindow) {
m_internalWindow->setGeometry(frameRectToClientRect(rect));
if (m_handle) {
m_handle->setGeometry(frameRectToClientRect(rect));
}
}
......@@ -525,7 +525,7 @@ void InternalWindow::markAsMapped()
void InternalWindow::syncGeometryToInternalWindow()
{
if (m_internalWindow->geometry() == frameRectToClientRect(frameGeometry())) {
if (m_handle->geometry() == frameRectToClientRect(frameGeometry())) {
return;
}
......@@ -537,7 +537,7 @@ void InternalWindow::syncGeometryToInternalWindow()
void InternalWindow::updateInternalWindowGeometry()
{
if (!isInteractiveMoveResize()) {
const QRect rect = clientRectToFrameRect(m_internalWindow->geometry());
const QRect rect = clientRectToFrameRect(m_handle->geometry());
setMoveResizeGeometry(rect);
commitGeometry(rect);
}
......
......@@ -19,7 +19,7 @@ class KWIN_EXPORT InternalWindow : public Window
Q_OBJECT
public:
explicit InternalWindow(QWindow *window);
explicit InternalWindow(QWindow *handle);
~InternalWindow() override;
bool eventFilter(QObject *watched, QEvent *event) override;
......@@ -64,7 +64,7 @@ public:
void present(const QSharedPointer<QOpenGLFramebufferObject> fbo);
void present(const QImage &image, const QRegion &damage);
qreal bufferScale() const;
QWindow *internalWindow() const;
QWindow *handle() const;
protected:
bool acceptsFocus() const override;
......@@ -84,7 +84,7 @@ private:
void createDecoration(const QRect &oldGeometry);
void destroyDecoration();
QWindow *m_internalWindow = nullptr;
QWindow *m_handle = nullptr;
QString m_captionNormal;
QString m_captionSuffix;
NET::WindowType m_windowType = NET::Normal;
......
......@@ -109,7 +109,7 @@ Shadow *Shadow::createShadowFromInternalWindow(Window *window)
if (!internalWindow) {
return nullptr;
}
const QWindow *handle = internalWindow->internalWindow();
const QWindow *handle = internalWindow->handle();
if (!handle) {
return nullptr;
}
......@@ -304,7 +304,7 @@ bool Shadow::updateShadow()
}
if (InternalWindow *window = qobject_cast<InternalWindow *>(m_window)) {
if (init(window->internalWindow())) {
if (init(window->handle())) {
return true;
}
}
......
......@@ -1883,7 +1883,7 @@ Window *Workspace::findInternal(QWindow *w) const
return findUnmanaged(w->winId());
}
for (InternalWindow *window : m_internalWindows) {
if (window->internalWindow() == w) {
if (window->handle() == w) {
return window;
}
}
......
Supports Markdown
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