Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 89 | #if HAVE_X11 | |||
---|---|---|---|---|---|
90 | m_kwinAssistPropSet = false; | 90 | m_kwinAssistPropSet = false; | ||
91 | m_isX11 = QX11Info::isPlatformX11(); | 91 | m_isX11 = QX11Info::isPlatformX11(); | ||
92 | #else | 92 | #else | ||
93 | m_isX11 = false; | 93 | m_isX11 = false; | ||
94 | #endif | 94 | #endif | ||
95 | m_isWayland = QGuiApplication::platformName().startsWith(QLatin1String("wayland")); | 95 | m_isWayland = QGuiApplication::platformName().startsWith(QLatin1String("wayland")); | ||
96 | #if HAVE_KWAYLAND | 96 | #if HAVE_KWAYLAND | ||
97 | m_plasmaShell = Q_NULLPTR; | 97 | m_plasmaShell = Q_NULLPTR; | ||
98 | m_plasmaShellSurface = Q_NULLPTR; | ||||
98 | initWayland(); | 99 | initWayland(); | ||
99 | #endif | 100 | #endif | ||
100 | 101 | | |||
101 | m_toggleLock = false; | 102 | m_toggleLock = false; | ||
102 | 103 | | |||
103 | setupActions(); | 104 | setupActions(); | ||
104 | setupMenu(); | 105 | setupMenu(); | ||
105 | 106 | | |||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 171 | if (interface.name != 0) { | |||
171 | m_plasmaShell = registry->createPlasmaShell(interface.name, interface.version, this); | 172 | m_plasmaShell = registry->createPlasmaShell(interface.name, interface.version, this); | ||
172 | } | 173 | } | ||
173 | } | 174 | } | ||
174 | ); | 175 | ); | ||
175 | 176 | | |||
176 | registry->setup(); | 177 | registry->setup(); | ||
177 | connection->roundtrip(); | 178 | connection->roundtrip(); | ||
178 | } | 179 | } | ||
180 | | ||||
181 | void MainWindow::initWaylandSurface() | ||||
182 | { | ||||
183 | if (m_plasmaShellSurface) { | ||||
184 | return; | ||||
185 | } | ||||
186 | if (!m_plasmaShell) { | ||||
187 | return; | ||||
188 | } | ||||
189 | if (auto surface = KWayland::Client::Surface::fromWindow(windowHandle())) { | ||||
190 | m_plasmaShellSurface = m_plasmaShell->createSurface(surface, this); | ||||
191 | m_plasmaShellSurface->setPosition(pos()); | ||||
192 | } | ||||
193 | } | ||||
194 | | ||||
179 | #endif | 195 | #endif | ||
180 | 196 | | |||
181 | bool MainWindow::queryClose() | 197 | bool MainWindow::queryClose() | ||
182 | { | 198 | { | ||
183 | bool confirmQuit = Settings::confirmQuit(); | 199 | bool confirmQuit = Settings::confirmQuit(); | ||
184 | bool hasUnclosableSessions = m_sessionStack->hasUnclosableSessions(); | 200 | bool hasUnclosableSessions = m_sessionStack->hasUnclosableSessions(); | ||
185 | 201 | | |||
186 | QString closeQuestion = xi18nc("@info","Are you sure you want to quit?"); | 202 | QString closeQuestion = xi18nc("@info","Are you sure you want to quit?"); | ||
▲ Show 20 Lines • Show All 669 Lines • ▼ Show 20 Line(s) | 870 | { | |||
856 | 872 | | |||
857 | int maxHeight = workArea.height() * newHeight / 100; | 873 | int maxHeight = workArea.height() * newHeight / 100; | ||
858 | 874 | | |||
859 | int targetWidth = workArea.width() * newWidth / 100; | 875 | int targetWidth = workArea.width() * newWidth / 100; | ||
860 | 876 | | |||
861 | setGeometry(workArea.x() + workArea.width() * newPosition * (100 - newWidth) / 10000, | 877 | setGeometry(workArea.x() + workArea.width() * newPosition * (100 - newWidth) / 10000, | ||
862 | workArea.y(), targetWidth, maxHeight); | 878 | workArea.y(), targetWidth, maxHeight); | ||
863 | #if HAVE_KWAYLAND | 879 | #if HAVE_KWAYLAND | ||
864 | if (m_plasmaShell) { | 880 | initWaylandSurface(); | ||
865 | if (auto surface = KWayland::Client::Surface::fromWindow(windowHandle())) { | | |||
866 | if (auto plasmaSurface = m_plasmaShell->createSurface(surface, this)) { | | |||
867 | plasmaSurface->setPosition(pos()); | | |||
868 | } | | |||
869 | } | | |||
870 | } | | |||
871 | #endif | 881 | #endif | ||
872 | 882 | | |||
873 | maxHeight -= m_titleBar->height(); | 883 | maxHeight -= m_titleBar->height(); | ||
874 | m_titleBar->setGeometry(0, maxHeight, targetWidth, m_titleBar->height()); | 884 | m_titleBar->setGeometry(0, maxHeight, targetWidth, m_titleBar->height()); | ||
875 | if (!isVisible()) m_titleBar->updateMask(); | 885 | if (!isVisible()) m_titleBar->updateMask(); | ||
876 | 886 | | |||
877 | if (Settings::frames() > 0) | 887 | if (Settings::frames() > 0) | ||
878 | m_animationStepSize = maxHeight / Settings::frames(); | 888 | m_animationStepSize = maxHeight / Settings::frames(); | ||
▲ Show 20 Lines • Show All 419 Lines • ▼ Show 20 Line(s) | |||||
1298 | { | 1308 | { | ||
1299 | if (!Settings::firstRun()) KWindowSystem::forceActiveWindow(winId()); | 1309 | if (!Settings::firstRun()) KWindowSystem::forceActiveWindow(winId()); | ||
1300 | 1310 | | |||
1301 | connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, | 1311 | connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, | ||
1302 | this, &MainWindow::wmActiveWindowChanged); | 1312 | this, &MainWindow::wmActiveWindowChanged); | ||
1303 | 1313 | | |||
1304 | applyWindowProperties(); | 1314 | applyWindowProperties(); | ||
1305 | 1315 | | |||
1316 | #if HAVE_KWAYLAND | ||||
1317 | initWaylandSurface(); | ||||
1318 | #endif | ||||
1319 | | ||||
1306 | emit windowOpened(); | 1320 | emit windowOpened(); | ||
1307 | } | 1321 | } | ||
1308 | 1322 | | |||
1309 | void MainWindow::sharedPreHideWindow() | 1323 | void MainWindow::sharedPreHideWindow() | ||
1310 | { | 1324 | { | ||
1311 | disconnect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, | 1325 | disconnect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, | ||
1312 | this, &MainWindow::wmActiveWindowChanged); | 1326 | this, &MainWindow::wmActiveWindowChanged); | ||
1313 | } | 1327 | } | ||
1314 | 1328 | | |||
1315 | void MainWindow::sharedAfterHideWindow() | 1329 | void MainWindow::sharedAfterHideWindow() | ||
1316 | { | 1330 | { | ||
1317 | if (Settings::pollMouse()) toggleMousePoll(true); | 1331 | if (Settings::pollMouse()) toggleMousePoll(true); | ||
1318 | 1332 | | |||
1333 | #if HAVE_KWAYLAND | ||||
1334 | delete m_plasmaShellSurface; | ||||
1335 | m_plasmaShellSurface = Q_NULLPTR; | ||||
1336 | #endif | ||||
1337 | | ||||
1319 | emit windowClosed(); | 1338 | emit windowClosed(); | ||
1320 | } | 1339 | } | ||
1321 | 1340 | | |||
1322 | void MainWindow::activate() | 1341 | void MainWindow::activate() | ||
1323 | { | 1342 | { | ||
1324 | KWindowSystem::activateWindow(winId()); | 1343 | KWindowSystem::activateWindow(winId()); | ||
1325 | } | 1344 | } | ||
1326 | 1345 | | |||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |