Changeset View
Changeset View
Standalone View
Standalone View
toplevel.cpp
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org> | 5 | Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org> | ||
6 | Copyright (C) 2019 Vlad Zahorodnii <vladzzag@gmail.com> | ||||
6 | 7 | | |||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 11 | (at your option) any later version. | ||
11 | 12 | | |||
12 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
▲ Show 20 Lines • Show All 237 Lines • ▼ Show 20 Line(s) | |||||
251 | bool Toplevel::setupCompositing() | 252 | bool Toplevel::setupCompositing() | ||
252 | { | 253 | { | ||
253 | if (!compositing()) | 254 | if (!compositing()) | ||
254 | return false; | 255 | return false; | ||
255 | 256 | | |||
256 | if (damage_handle != XCB_NONE) | 257 | if (damage_handle != XCB_NONE) | ||
257 | return false; | 258 | return false; | ||
258 | 259 | | |||
259 | if (kwinApp()->operationMode() == Application::OperationModeX11 && !surface()) { | 260 | if (kwinApp()->operationMode() == Application::OperationModeX11) { | ||
260 | damage_handle = xcb_generate_id(connection()); | 261 | damage_handle = xcb_generate_id(connection()); | ||
261 | xcb_damage_create(connection(), damage_handle, frameId(), XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY); | 262 | xcb_damage_create(connection(), damage_handle, windowId(), XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY); | ||
263 | xcb_composite_redirect_window(connection(), windowId(), XCB_COMPOSITE_REDIRECT_MANUAL); | ||||
262 | } | 264 | } | ||
263 | 265 | | |||
264 | damage_region = QRegion(0, 0, width(), height()); | 266 | damage_region = QRegion(QRect(QPoint(), bufferGeometry().size())); | ||
265 | effect_window = new EffectWindowImpl(this); | 267 | effect_window = new EffectWindowImpl(this); | ||
266 | 268 | | |||
267 | Compositor::self()->scene()->addToplevel(this); | 269 | Compositor::self()->scene()->addToplevel(this); | ||
268 | 270 | | |||
269 | return true; | 271 | return true; | ||
270 | } | 272 | } | ||
271 | 273 | | |||
272 | void Toplevel::finishCompositing(ReleaseReason releaseReason) | 274 | void Toplevel::finishCompositing(ReleaseReason releaseReason) | ||
273 | { | 275 | { | ||
274 | if (kwinApp()->operationMode() == Application::OperationModeX11 && damage_handle == XCB_NONE) | 276 | if (kwinApp()->operationMode() == Application::OperationModeX11 && damage_handle == XCB_NONE) | ||
275 | return; | 277 | return; | ||
276 | if (effect_window->window() == this) { // otherwise it's already passed to Deleted, don't free data | 278 | if (effect_window->window() == this) { // otherwise it's already passed to Deleted, don't free data | ||
277 | discardWindowPixmap(); | 279 | discardWindowPixmap(); | ||
278 | delete effect_window; | 280 | delete effect_window; | ||
279 | } | 281 | } | ||
280 | 282 | | |||
283 | if (kwinApp()->operationMode() == Application::OperationModeX11) { | ||||
284 | xcb_composite_unredirect_window(connection(), windowId(), XCB_COMPOSITE_REDIRECT_MANUAL); | ||||
285 | } | ||||
286 | | ||||
281 | if (damage_handle != XCB_NONE && | 287 | if (damage_handle != XCB_NONE && | ||
282 | releaseReason != ReleaseReason::Destroyed) { | 288 | releaseReason != ReleaseReason::Destroyed) { | ||
283 | xcb_damage_destroy(connection(), damage_handle); | 289 | xcb_damage_destroy(connection(), damage_handle); | ||
284 | } | 290 | } | ||
285 | 291 | | |||
286 | damage_handle = XCB_NONE; | 292 | damage_handle = XCB_NONE; | ||
287 | damage_region = QRegion(); | 293 | damage_region = QRegion(); | ||
288 | repaints_region = QRegion(); | 294 | repaints_region = QRegion(); | ||
▲ Show 20 Lines • Show All 497 Lines • ▼ Show 20 Line(s) | |||||
786 | bool Toplevel::isLocalhost() const | 792 | bool Toplevel::isLocalhost() const | ||
787 | { | 793 | { | ||
788 | if (!m_clientMachine) { | 794 | if (!m_clientMachine) { | ||
789 | return true; | 795 | return true; | ||
790 | } | 796 | } | ||
791 | return m_clientMachine->isLocal(); | 797 | return m_clientMachine->isLocal(); | ||
792 | } | 798 | } | ||
793 | 799 | | |||
794 | QMargins Toplevel::bufferMargins() const | | |||
795 | { | | |||
796 | return QMargins(); | | |||
797 | } | | |||
798 | | ||||
799 | QMargins Toplevel::frameMargins() const | 800 | QMargins Toplevel::frameMargins() const | ||
800 | { | 801 | { | ||
801 | return QMargins(); | 802 | return QMargins(); | ||
802 | } | 803 | } | ||
803 | 804 | | |||
804 | } // namespace | 805 | } // namespace | ||
805 | 806 | |