Changeset View
Changeset View
Standalone View
Standalone View
effects/desktopgrid/desktopgrid.cpp
Show All 36 Lines | |||||
37 | #include <QEvent> | 37 | #include <QEvent> | ||
38 | #include <QMouseEvent> | 38 | #include <QMouseEvent> | ||
39 | #include <QTimer> | 39 | #include <QTimer> | ||
40 | #include <QVector2D> | 40 | #include <QVector2D> | ||
41 | #include <QQmlContext> | 41 | #include <QQmlContext> | ||
42 | #include <QQmlEngine> | 42 | #include <QQmlEngine> | ||
43 | #include <QQuickItem> | 43 | #include <QQuickItem> | ||
44 | 44 | | |||
45 | #include <KWayland/Server/surface_interface.h> | ||||
46 | | ||||
45 | namespace KWin | 47 | namespace KWin | ||
46 | { | 48 | { | ||
47 | 49 | | |||
48 | // WARNING, TODO: This effect relies on the desktop layout being EWMH-compliant. | 50 | // WARNING, TODO: This effect relies on the desktop layout being EWMH-compliant. | ||
49 | 51 | | |||
50 | DesktopGridEffect::DesktopGridEffect() | 52 | DesktopGridEffect::DesktopGridEffect() | ||
51 | : activated(false) | 53 | : activated(false) | ||
52 | , timeline() | 54 | , timeline() | ||
▲ Show 20 Lines • Show All 1315 Lines • ▼ Show 20 Line(s) | 1368 | if (w->isOnAllDesktops()) { | |||
1368 | if (allDesktops.count() != effects->numberOfDesktops()) { | 1370 | if (allDesktops.count() != effects->numberOfDesktops()) { | ||
1369 | allDesktops.resize(effects->numberOfDesktops()); | 1371 | allDesktops.resize(effects->numberOfDesktops()); | ||
1370 | for (int i = 0; i < effects->numberOfDesktops(); ++i) | 1372 | for (int i = 0; i < effects->numberOfDesktops(); ++i) | ||
1371 | allDesktops[i] = i; | 1373 | allDesktops[i] = i; | ||
1372 | } | 1374 | } | ||
1373 | return allDesktops; | 1375 | return allDesktops; | ||
1374 | } | 1376 | } | ||
1375 | 1377 | | |||
1378 | //Wayland, arbitrary desktops per window | ||||
1379 | if (w->surface()) { | ||||
davidedmundson: You don't want this as you're breaking xwayland windows.
We should be porting to just this… | |||||
will use the global operatingmode instead for this and all the places i'm doing a check whether we are running in wayland mart: will use the global operatingmode instead for this and all the places i'm doing a check whether… | |||||
1380 | static QVector<int> desktops; | ||||
1381 | desktops.resize(w->desktops().count()); | ||||
1382 | int i = 0; | ||||
1383 | for (const int desk : w->desktops()) { | ||||
1384 | if (desk > 0) { | ||||
1385 | desktops[i++] = desk; | ||||
1386 | } | ||||
1387 | } | ||||
1388 | return desktops; | ||||
1389 | //X11 one desktop per window | ||||
1390 | } else { | ||||
1376 | if (w->desktop() > effects->numberOfDesktops() || w->desktop() < 1) { // sic! desktops are [1,n] | 1391 | if (w->desktop() > effects->numberOfDesktops() || w->desktop() < 1) { // sic! desktops are [1,n] | ||
1377 | static QVector<int> emptyVector; | 1392 | static QVector<int> emptyVector; | ||
1378 | emptyVector.resize(0); | 1393 | emptyVector.resize(0); | ||
1379 | return emptyVector; | 1394 | return emptyVector; | ||
1380 | } | 1395 | } | ||
1381 | 1396 | | |||
1382 | static QVector<int> singleDesktop; | 1397 | static QVector<int> singleDesktop; | ||
1383 | singleDesktop.resize(1); | 1398 | singleDesktop.resize(1); | ||
1384 | singleDesktop[0] = w->desktop() - 1; | 1399 | singleDesktop[0] = w->desktop() - 1; | ||
1385 | return singleDesktop; | 1400 | return singleDesktop; | ||
1386 | } | 1401 | } | ||
1402 | } | ||||
1387 | 1403 | | |||
1388 | bool DesktopGridEffect::isActive() const | 1404 | bool DesktopGridEffect::isActive() const | ||
1389 | { | 1405 | { | ||
1390 | return (timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows())) && !effects->isScreenLocked(); | 1406 | return (timeline.currentValue() != 0 || activated || (isUsingPresentWindows() && isMotionManagerMovingWindows())) && !effects->isScreenLocked(); | ||
1391 | } | 1407 | } | ||
1392 | 1408 | | |||
1393 | bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const | 1409 | bool DesktopGridEffect::isRelevantWithPresentWindows(EffectWindow *w) const | ||
1394 | { | 1410 | { | ||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |
You don't want this as you're breaking xwayland windows.
We should be porting to just this code you've added and doing any wayland/X abstraction in libkwineffects w->plasmasDesktops()