Commit 9439e771 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

screenedge: move singleton to Workspace

parent 71914795
......@@ -424,7 +424,7 @@ void LockScreenTest::testKeyboard()
void LockScreenTest::testScreenEdge()
{
QSignalSpy screenEdgeSpy(ScreenEdges::self(), &ScreenEdges::approaching);
QSignalSpy screenEdgeSpy(workspace()->screenEdges(), &ScreenEdges::approaching);
QVERIFY(screenEdgeSpy.isValid());
QCOMPARE(screenEdgeSpy.count(), 0);
......
......@@ -262,7 +262,7 @@ void NoGlobalShortcutsTest::testAxisShortcut()
void NoGlobalShortcutsTest::testScreenEdge()
{
// based on LockScreenTest::testScreenEdge
QSignalSpy screenEdgeSpy(ScreenEdges::self(), &ScreenEdges::approaching);
QSignalSpy screenEdgeSpy(workspace()->screenEdges(), &ScreenEdges::approaching);
QVERIFY(screenEdgeSpy.isValid());
QCOMPARE(screenEdgeSpy.count(), 0);
......
......@@ -90,7 +90,7 @@ void ScreenEdgesTest::initTestCase()
void ScreenEdgesTest::init()
{
ScreenEdges::self()->recreateEdges();
workspace()->screenEdges()->recreateEdges();
Workspace::self()->setActiveOutput(QPoint(640, 512));
KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
......@@ -126,7 +126,7 @@ void ScreenEdgesTest::testTouchCallback()
group.writeEntry("Right", "none");
config->sync();
auto s = ScreenEdges::self();
auto s = workspace()->screenEdges();
s->setConfig(config);
s->reconfigure();
......@@ -222,7 +222,7 @@ void ScreenEdgesTest::testPushBack()
config->group("Windows").writeEntry("ElectricBorderPushbackPixels", pushback);
config->sync();
auto s = ScreenEdges::self();
auto s = workspace()->screenEdges();
s->setConfig(config);
s->reconfigure();
......@@ -264,7 +264,7 @@ void ScreenEdgesTest::testClientEdge()
// Reserve an electric border.
QFETCH(ElectricBorder, border);
ScreenEdges::self()->reserve(window, border);
workspace()->screenEdges()->reserve(window, border);
// Hide the window.
window->hideClient();
......@@ -302,7 +302,7 @@ void ScreenEdgesTest::testObjectEdge()
// Reserve a screen edge border.
QFETCH(ElectricBorder, border);
ScreenEdges::self()->reserve(border, &callback, "callback");
workspace()->screenEdges()->reserve(border, &callback, "callback");
QFETCH(QPointF, triggerPoint);
QFETCH(QPointF, delta);
......
......@@ -74,8 +74,8 @@ void ScreenEdgeTest::initTestCase()
QVERIFY(applicationStartedSpy.wait());
QVERIFY(Scripting::self());
ScreenEdges::self()->setTimeThreshold(0);
ScreenEdges::self()->setReActivationThreshold(0);
workspace()->screenEdges()->setTimeThreshold(0);
workspace()->screenEdges()->setReActivationThreshold(0);
}
void ScreenEdgeTest::init()
......
......@@ -82,7 +82,7 @@ void EffectsHandlerImplX11::doStartMouseInterception(Qt::CursorShape shape)
m_x11MouseInterception = std::make_unique<EffectsMouseInterceptionX11Filter>(m_mouseInterceptionWindow, this);
// Raise electric border windows above the input windows
// so they can still be triggered.
ScreenEdges::self()->ensureOnTop();
workspace()->screenEdges()->ensureOnTop();
}
void EffectsHandlerImplX11::doStopMouseInterception()
......@@ -105,7 +105,7 @@ void EffectsHandlerImplX11::doCheckInputWindowStacking()
m_mouseInterceptionWindow.raise();
// Raise electric border windows above the input windows
// so they can still be triggered. TODO: Do both at once.
ScreenEdges::self()->ensureOnTop();
workspace()->screenEdges()->ensureOnTop();
}
}
......@@ -9,6 +9,7 @@
#include "x11_standalone_screenedges_filter.h"
#include "atoms.h"
#include "screenedge.h"
#include "workspace.h"
#include <QWidget>
#include <xcb/xcb.h>
......@@ -29,23 +30,23 @@ bool ScreenEdgesFilter::event(xcb_generic_event_t *event)
const auto mouseEvent = reinterpret_cast<xcb_motion_notify_event_t *>(event);
const QPoint rootPos(mouseEvent->root_x, mouseEvent->root_y);
if (QWidget::mouseGrabber()) {
ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC), true);
workspace()->screenEdges()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC), true);
} else {
ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(mouseEvent->time, Qt::UTC));
workspace()->screenEdges()->check(rootPos, QDateTime::fromMSecsSinceEpoch(mouseEvent->time, Qt::UTC));
}
// not filtered out
break;
}
case XCB_ENTER_NOTIFY: {
const auto enter = reinterpret_cast<xcb_enter_notify_event_t *>(event);
return ScreenEdges::self()->handleEnterNotifiy(enter->event, QPoint(enter->root_x, enter->root_y), QDateTime::fromMSecsSinceEpoch(enter->time, Qt::UTC));
return workspace()->screenEdges()->handleEnterNotifiy(enter->event, QPoint(enter->root_x, enter->root_y), QDateTime::fromMSecsSinceEpoch(enter->time, Qt::UTC));
}
case XCB_CLIENT_MESSAGE: {
const auto ce = reinterpret_cast<xcb_client_message_event_t *>(event);
if (ce->type != atoms->xdnd_position) {
return false;
}
return ScreenEdges::self()->handleDndNotify(ce->window, QPoint(ce->data.data32[2] >> 16, ce->data.data32[2] & 0xffff));
return workspace()->screenEdges()->handleDndNotify(ce->window, QPoint(ce->data.data32[2] >> 16, ce->data.data32[2] & 0xffff));
}
}
return false;
......
......@@ -20,6 +20,7 @@
#include "input.h"
#include "modifier_only_shortcuts.h"
#include "workspace.h"
#include "x11eventfilter.h"
#include <kwinglobals.h>
......@@ -121,7 +122,7 @@ public:
const QPointF touchPosition = QPointF(fixed1616ToReal(e->event_x), fixed1616ToReal(e->event_y));
if (e->detail == m_trackingTouchId) {
const auto last = m_lastTouchPositions.value(e->detail);
ScreenEdges::self()->gestureRecognizer()->updateSwipeGesture(QSizeF(touchPosition.x() - last.x(), touchPosition.y() - last.y()));
workspace()->screenEdges()->gestureRecognizer()->updateSwipeGesture(QSizeF(touchPosition.x() - last.x(), touchPosition.y() - last.y()));
}
m_lastTouchPositions.insert(e->detail, touchPosition);
break;
......@@ -129,7 +130,7 @@ public:
case XI_TouchEnd: {
auto e = reinterpret_cast<xXIDeviceEvent *>(event);
if (e->detail == m_trackingTouchId) {
ScreenEdges::self()->gestureRecognizer()->endSwipeGesture();
workspace()->screenEdges()->gestureRecognizer()->endSwipeGesture();
}
m_lastTouchPositions.remove(e->detail);
m_trackingTouchId = 0;
......@@ -141,7 +142,7 @@ public:
if (it == m_lastTouchPositions.constEnd()) {
XIAllowTouchEvents(display(), e->deviceid, e->sourceid, e->touchid, XIRejectTouch);
} else {
if (ScreenEdges::self()->gestureRecognizer()->startSwipeGesture(it.value()) > 0) {
if (workspace()->screenEdges()->gestureRecognizer()->startSwipeGesture(it.value()) > 0) {
m_trackingTouchId = e->touchid;
}
XIAllowTouchEvents(display(), e->deviceid, e->sourceid, e->touchid, m_trackingTouchId == e->touchid ? XIAcceptTouch : XIRejectTouch);
......
......@@ -212,7 +212,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
connect(tabBox, &TabBox::TabBox::tabBoxClosed, this, &EffectsHandler::tabBoxClosed);
connect(tabBox, &TabBox::TabBox::tabBoxKeyEvent, this, &EffectsHandler::tabBoxKeyEvent);
#endif
connect(ScreenEdges::self(), &ScreenEdges::approaching, this, &EffectsHandler::screenEdgeApproaching);
connect(workspace()->screenEdges(), &ScreenEdges::approaching, this, &EffectsHandler::screenEdgeApproaching);
#if KWIN_BUILD_SCREENLOCKER
connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::locked, this, &EffectsHandler::screenLockingChanged);
connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::aboutToLock, this, &EffectsHandler::screenAboutToLock);
......@@ -589,7 +589,7 @@ void EffectsHandlerImpl::setActiveFullScreenEffect(Effect *e)
}
}
Q_EMIT hasActiveFullScreenEffectChanged();
ScreenEdges::self()->checkBlocking();
workspace()->screenEdges()->checkBlocking();
}
}
......@@ -1377,29 +1377,29 @@ QPoint EffectsHandlerImpl::cursorPos() const
void EffectsHandlerImpl::reserveElectricBorder(ElectricBorder border, Effect *effect)
{
ScreenEdges::self()->reserve(border, effect, "borderActivated");
workspace()->screenEdges()->reserve(border, effect, "borderActivated");
}
void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border, Effect *effect)
{
ScreenEdges::self()->unreserve(border, effect);
workspace()->screenEdges()->unreserve(border, effect);
}
void EffectsHandlerImpl::registerTouchBorder(ElectricBorder border, QAction *action)
{
ScreenEdges::self()->reserveTouch(border, action);
workspace()->screenEdges()->reserveTouch(border, action);
}
void EffectsHandlerImpl::registerRealtimeTouchBorder(ElectricBorder border, QAction *action, EffectsHandler::TouchBorderCallback progressCallback)
{
ScreenEdges::self()->reserveTouch(border, action, [progressCallback](ElectricBorder border, const QSizeF &deltaProgress, Output *output) {
workspace()->screenEdges()->reserveTouch(border, action, [progressCallback](ElectricBorder border, const QSizeF &deltaProgress, Output *output) {
progressCallback(border, deltaProgress, EffectScreenImpl::get(output));
});
}
void EffectsHandlerImpl::unregisterTouchBorder(ElectricBorder border, QAction *action)
{
ScreenEdges::self()->unreserveTouch(border, action);
workspace()->screenEdges()->unreserveTouch(border, action);
}
QPainter *EffectsHandlerImpl::scenePainter()
......@@ -1597,9 +1597,9 @@ QVariant EffectsHandlerImpl::kwinOption(KWinOption kwopt)
return settings && settings->decorationButtonsLeft().contains(KDecoration2::DecorationButtonType::Close) ? Qt::TopLeftCorner : Qt::TopRightCorner;
}
case SwitchDesktopOnScreenEdge:
return ScreenEdges::self()->isDesktopSwitching();
return workspace()->screenEdges()->isDesktopSwitching();
case SwitchDesktopOnScreenEdgeMovingWindows:
return ScreenEdges::self()->isDesktopSwitchingMovingClients();
return workspace()->screenEdges()->isDesktopSwitchingMovingClients();
default:
return QVariant(); // an invalid one
}
......
......@@ -1091,7 +1091,7 @@ bool X11Window::motionNotifyEvent(xcb_window_t w, int state, int x, int y, int x
handleInteractiveMoveResize(QPoint(x, y), QPoint(x_root, y_root));
if (isInteractiveMove()) {
ScreenEdges::self()->check(QPoint(x_root, y_root), QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC));
workspace()->screenEdges()->check(QPoint(x_root, y_root), QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC));
}
return true;
......
......@@ -1686,7 +1686,7 @@ public:
bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override
{
Q_UNUSED(nativeButton)
ScreenEdges::self()->isEntered(event);
workspace()->screenEdges()->isEntered(event);
// always forward
return false;
}
......@@ -1696,12 +1696,12 @@ public:
// TODO: better check whether a touch sequence is in progress
if (m_touchInProgress || waylandServer()->seat()->isTouchSequence()) {
// cancel existing touch
ScreenEdges::self()->gestureRecognizer()->cancelSwipeGesture();
workspace()->screenEdges()->gestureRecognizer()->cancelSwipeGesture();
m_touchInProgress = false;
m_id = 0;
return false;
}
if (ScreenEdges::self()->gestureRecognizer()->startSwipeGesture(pos) > 0) {
if (workspace()->screenEdges()->gestureRecognizer()->startSwipeGesture(pos) > 0) {
m_touchInProgress = true;
m_id = id;
m_lastPos = pos;
......@@ -1713,7 +1713,7 @@ public:
{
Q_UNUSED(time)
if (m_touchInProgress && m_id == id) {
ScreenEdges::self()->gestureRecognizer()->updateSwipeGesture(QSizeF(pos.x() - m_lastPos.x(), pos.y() - m_lastPos.y()));
workspace()->screenEdges()->gestureRecognizer()->updateSwipeGesture(QSizeF(pos.x() - m_lastPos.x(), pos.y() - m_lastPos.y()));
m_lastPos = pos;
return true;
}
......@@ -1723,7 +1723,7 @@ public:
{
Q_UNUSED(time)
if (m_touchInProgress && m_id == id) {
ScreenEdges::self()->gestureRecognizer()->endSwipeGesture();
workspace()->screenEdges()->gestureRecognizer()->endSwipeGesture();
m_touchInProgress = false;
return true;
}
......
......@@ -132,7 +132,7 @@ void Workspace::stackScreenEdgesUnderOverrideRedirect()
if (!rootInfo()) {
return;
}
Xcb::restackWindows(QVector<xcb_window_t>() << rootInfo()->supportWindow() << ScreenEdges::self()->windows());
Xcb::restackWindows(QVector<xcb_window_t>() << rootInfo()->supportWindow() << workspace()->screenEdges()->windows());
}
/**
......@@ -155,7 +155,7 @@ void Workspace::propagateWindows(bool propagate_new_windows)
// windows (e.g. popups).
newWindowStack << rootInfo()->supportWindow();
newWindowStack << ScreenEdges::self()->windows();
newWindowStack << workspace()->screenEdges()->windows();
newWindowStack << manual_overlays;
......
......@@ -760,11 +760,9 @@ Output *Edge::output() const
/**********************************************************
* ScreenEdges
*********************************************************/
KWIN_SINGLETON_FACTORY(ScreenEdges)
ScreenEdges::ScreenEdges(QObject *parent)
: QObject(parent)
, m_desktopSwitching(false)
ScreenEdges::ScreenEdges()
: m_desktopSwitching(false)
, m_desktopSwitchingMovingClients(false)
, m_timeThreshold(0)
, m_reactivateThreshold(0)
......@@ -785,11 +783,6 @@ ScreenEdges::ScreenEdges(QObject *parent)
connect(workspace(), &Workspace::windowRemoved, this, &ScreenEdges::deleteEdgeForClient);
}
ScreenEdges::~ScreenEdges()
{
s_self = nullptr;
}
void ScreenEdges::init()
{
reconfigure();
......
......@@ -233,7 +233,7 @@ class KWIN_EXPORT ScreenEdges : public QObject
Q_PROPERTY(int actionBottomLeft READ actionBottomLeft)
Q_PROPERTY(int actionLeft READ actionLeft)
public:
~ScreenEdges() override;
explicit ScreenEdges();
/**
* @internal
*/
......@@ -431,8 +431,6 @@ private:
int m_cornerOffset;
GestureRecognizer *m_gestureRecognizer;
bool m_remainActiveOnFullscreen = false;
KWIN_SINGLETON(ScreenEdges)
};
/**********************************************************
......
......@@ -11,6 +11,7 @@
#include <config-kwin.h>
#include "screenedge.h"
#include "workspace.h"
#include <QAction>
......@@ -59,10 +60,10 @@ void ScreenEdgeItem::enableEdge()
}
switch (m_mode) {
case Mode::Pointer:
ScreenEdges::self()->reserve(static_cast<ElectricBorder>(m_edge), this, "borderActivated");
workspace()->screenEdges()->reserve(static_cast<ElectricBorder>(m_edge), this, "borderActivated");
break;
case Mode::Touch:
ScreenEdges::self()->reserveTouch(static_cast<ElectricBorder>(m_edge), m_action);
workspace()->screenEdges()->reserveTouch(static_cast<ElectricBorder>(m_edge), m_action);
break;
default:
Q_UNREACHABLE();
......@@ -76,10 +77,10 @@ void ScreenEdgeItem::disableEdge()
}
switch (m_mode) {
case Mode::Pointer:
ScreenEdges::self()->unreserve(static_cast<ElectricBorder>(m_edge), this);
workspace()->screenEdges()->unreserve(static_cast<ElectricBorder>(m_edge), this);
break;
case Mode::Touch:
ScreenEdges::self()->unreserveTouch(static_cast<ElectricBorder>(m_edge), m_action);
workspace()->screenEdges()->unreserveTouch(static_cast<ElectricBorder>(m_edge), m_action);
break;
default:
Q_UNREACHABLE();
......
......@@ -322,7 +322,7 @@ QList<int> ScriptedEffect::touchEdgesForAction(const QString &action) const
const QVector borders({ElectricTop, ElectricRight, ElectricBottom, ElectricLeft});
for (const auto b : borders) {
if (ScreenEdges::self()->actionForTouchBorder(b) == ElectricActionShowDesktop) {
if (workspace()->screenEdges()->actionForTouchBorder(b) == ElectricActionShowDesktop) {
ret.append(b);
}
}
......@@ -707,7 +707,7 @@ bool ScriptedEffect::registerScreenEdge(int edge, const QJSValue &callback)
auto it = screenEdgeCallbacks().find(edge);
if (it == screenEdgeCallbacks().end()) {
// not yet registered
ScreenEdges::self()->reserve(static_cast<KWin::ElectricBorder>(edge), this, "borderActivated");
workspace()->screenEdges()->reserve(static_cast<KWin::ElectricBorder>(edge), this, "borderActivated");
screenEdgeCallbacks().insert(edge, QJSValueList{callback});
} else {
it->append(callback);
......@@ -759,7 +759,7 @@ bool ScriptedEffect::unregisterScreenEdge(int edge)
// not previously registered
return false;
}
ScreenEdges::self()->unreserve(static_cast<KWin::ElectricBorder>(edge), this);
workspace()->screenEdges()->unreserve(static_cast<KWin::ElectricBorder>(edge), this);
screenEdgeCallbacks().erase(it);
return true;
}
......@@ -777,7 +777,7 @@ bool ScriptedEffect::registerTouchScreenEdge(int edge, const QJSValue &callback)
connect(action, &QAction::triggered, this, [callback]() {
QJSValue(callback).call();
});
ScreenEdges::self()->reserveTouch(KWin::ElectricBorder(edge), action);
workspace()->screenEdges()->reserveTouch(KWin::ElectricBorder(edge), action);
m_touchScreenEdgeCallbacks.insert(edge, action);
return true;
}
......
......@@ -372,7 +372,7 @@ bool KWin::Script::registerScreenEdge(int edge, const QJSValue &callback)
QJSValueList &callbacks = m_screenEdgeCallbacks[edge];
if (callbacks.isEmpty()) {
ScreenEdges::self()->reserve(static_cast<KWin::ElectricBorder>(edge), this, "slotBorderActivated");
workspace()->screenEdges()->reserve(static_cast<KWin::ElectricBorder>(edge), this, "slotBorderActivated");
}
callbacks << callback;
......@@ -387,7 +387,7 @@ bool KWin::Script::unregisterScreenEdge(int edge)
return false;
}
ScreenEdges::self()->unreserve(static_cast<KWin::ElectricBorder>(edge), this);
workspace()->screenEdges()->unreserve(static_cast<KWin::ElectricBorder>(edge), this);
m_screenEdgeCallbacks.erase(it);
return true;
......@@ -404,7 +404,7 @@ bool KWin::Script::registerTouchScreenEdge(int edge, const QJSValue &callback)
}
QAction *action = new QAction(this);
ScreenEdges::self()->reserveTouch(KWin::ElectricBorder(edge), action);
workspace()->screenEdges()->reserveTouch(KWin::ElectricBorder(edge), action);
m_touchScreenEdgeCallbacks.insert(edge, action);
connect(action, &QAction::triggered, this, [callback]() {
......
......@@ -769,7 +769,7 @@ void TabBox::reconfigure()
QString borderConfig = QStringLiteral("BorderActivate");
for (int i = 0; i < 2; ++i) {
for (ElectricBorder border : qAsConst(*borders)) {
ScreenEdges::self()->unreserve(border, this);
workspace()->screenEdges()->unreserve(border, this);
}
borders->clear();
QStringList list = config.readEntry(borderConfig, QStringList());
......@@ -780,7 +780,7 @@ void TabBox::reconfigure()
continue;
}
borders->append(ElectricBorder(i));
ScreenEdges::self()->reserve(ElectricBorder(i), this, "toggle");
workspace()->screenEdges()->reserve(ElectricBorder(i), this, "toggle");
}
borders = &m_borderAlternativeActivate;
borderConfig = QStringLiteral("BorderAlternativeActivate");
......@@ -802,7 +802,7 @@ void TabBox::reconfigure()
}
QAction *a = new QAction(this);
connect(a, &QAction::triggered, this, std::bind(&TabBox::toggleMode, this, mode));
ScreenEdges::self()->reserveTouch(ElectricBorder(i), a);
workspace()->screenEdges()->reserveTouch(ElectricBorder(i), a);
actions.insert(ElectricBorder(i), a);
}
};
......
......@@ -11,6 +11,7 @@
#include "effects.h"
#include "screenedge.h"
#include "tabbox/tabbox.h"
#include "workspace.h"
#include <KKeyServer>
......@@ -89,7 +90,7 @@ void X11Filter::motion(xcb_generic_event_t *event)
auto *mouseEvent = reinterpret_cast<xcb_motion_notify_event_t *>(event);
const QPoint rootPos(mouseEvent->root_x, mouseEvent->root_y);
// TODO: this should be in ScreenEdges directly
ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC), true);
workspace()->screenEdges()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime(), Qt::UTC), true);
xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
}
......
......@@ -1656,8 +1656,8 @@ bool Window::startInteractiveMoveResize()
updateElectricGeometryRestore();
checkUnrestrictedInteractiveMoveResize();
Q_EMIT clientStartUserMovedResized(this);
if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) {
ScreenEdges::self()->reserveDesktopSwitching(true, Qt::Vertical | Qt::Horizontal);
if (workspace()->screenEdges()->isDesktopSwitchingMovingClients()) {
workspace()->screenEdges()->reserveDesktopSwitching(true, Qt::Vertical | Qt::Horizontal);
}
return true;
}
......@@ -2784,8 +2784,8 @@ void Window::leaveInteractiveMoveResize()
{
workspace()->setMoveResizeWindow(nullptr);
setInteractiveMoveResize(false);
if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) {
ScreenEdges::self()->reserveDesktopSwitching(false, Qt::Vertical | Qt::Horizontal);
if (workspace()->screenEdges()->isDesktopSwitchingMovingClients()) {
workspace()->screenEdges()->reserveDesktopSwitching(false, Qt::Vertical | Qt::Horizontal);
}
if (isElectricBorderMaximizing()) {
workspace()->outline()->hide();
......
......@@ -158,7 +158,7 @@ Workspace::Workspace()
m_rulebook->load();
Screens::create(this);
ScreenEdges::create(this);
m_screenEdges = std::make_unique<ScreenEdges>();
// VirtualDesktopManager needs to be created prior to init shortcuts
// and prior to TabBox, due to TabBox connecting to signals
......@@ -192,12 +192,11 @@ Workspace::Workspace()
void Workspace::init()
{
KSharedConfigPtr config = kwinApp()->config();
ScreenEdges *screenEdges = ScreenEdges::self();
screenEdges->setConfig(config);
screenEdges->init();
connect(options, &Options::configChanged, screenEdges, &ScreenEdges::reconfigure);
connect(VirtualDesktopManager::self(), &VirtualDesktopManager::layoutChanged, screenEdges, &ScreenEdges::updateLayout);
connect(this, &Workspace::windowActivated, screenEdges, &ScreenEdges::checkBlocking);
m_screenEdges->setConfig(config);
m_screenEdges->init();
connect(options, &Options::configChanged, m_screenEdges.get(), &ScreenEdges::reconfigure);
connect(VirtualDesktopManager::self(), &VirtualDesktopManager::layoutChanged, m_screenEdges.get(), &ScreenEdges::updateLayout);
connect(this, &Workspace::windowActivated, m_screenEdges.get(), &ScreenEdges::checkBlocking);
connect(this, &Workspace::windowRemoved, m_focusChain.get(), &FocusChain::remove);
connect(this, &Workspace::windowActivated, m_focusChain.get(), &FocusChain::setActiveWindow);
......@@ -501,7 +500,7 @@ void Workspace::setupWindowConnections(Window *window)
{
connect(window, &Window::desktopPresenceChanged, this, &Workspace::desktopPresenceChanged);
connect(window, &Window::minimizedChanged, this, std::bind(&Workspace::windowMinimizedChanged, this, window));
connect(window, &Window::fullScreenChanged, ScreenEdges::self(), &ScreenEdges::checkBlocking);
connect(window, &Window::fullScreenChanged, m_screenEdges.get(), &ScreenEdges::checkBlocking);
}
void Workspace::constrain(Window *below, Window *above)
......@@ -1560,13 +1559,13 @@ QString Workspace::supportInformation() const
}
support.append(QStringLiteral("\nScreen Edges\n"));
support.append(QStringLiteral("============\n"));
const QMetaObject *metaScreenEdges = ScreenEdges::self()->metaObject();
const QMetaObject *metaScreenEdges = m_screenEdges->metaObject();
for (int i = 0; i < metaScreenEdges->propertyCount(); ++i) {
const QMetaProperty property = metaScreenEdges->property(i);
if (QLatin1String(property.name()) == QLatin1String("objectName")) {
continue;
}
support.append(QStringLiteral("%1: %2\n").arg(property.name(), printProperty(ScreenEdges::self()->property(property.name()))));
support.append(QStringLiteral("%1: %2\n").arg(property.name(), printProperty(m_screenEdges->property(property.name()))));
}
support.append(QStringLiteral("\nScreens\n"));
support.append(QStringLiteral("=======\n"));
......@@ -2038,7 +2037,7 @@ void Workspace::desktopResized()
saveOldScreenSizes(); // after updateClientArea(), so that one still uses the previous one
// TODO: emit a signal instead and remove the deep function calls into edges and effects
ScreenEdges::self()->recreateEdges();
m_screenEdges->recreateEdges();
if (m_geometry != oldGeometry) {
Q_EMIT geometryChanged();
......@@ -2858,6 +2857,11 @@ RuleBook *Workspace::rulebook() const
return m_rulebook.get();
}
ScreenEdges *Workspace::screenEdges() const
{
return m_screenEdges.get();
}
#if KWIN_BUILD_ACTIVITIES
Activities *Workspace::activities() const
{
......
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