tabbox: move global to Workspace
This commit is contained in:
parent
43b78e40d8
commit
497a78b7cf
11 changed files with 66 additions and 70 deletions
|
@ -93,9 +93,9 @@ void TabBoxTest::testCapsLock()
|
||||||
QVERIFY(c3->isActive());
|
QVERIFY(c3->isActive());
|
||||||
|
|
||||||
// Setup tabbox signal spies
|
// Setup tabbox signal spies
|
||||||
QSignalSpy tabboxAddedSpy(TabBox::TabBox::self(), &TabBox::TabBox::tabBoxAdded);
|
QSignalSpy tabboxAddedSpy(workspace()->tabbox(), &TabBox::TabBox::tabBoxAdded);
|
||||||
QVERIFY(tabboxAddedSpy.isValid());
|
QVERIFY(tabboxAddedSpy.isValid());
|
||||||
QSignalSpy tabboxClosedSpy(TabBox::TabBox::self(), &TabBox::TabBox::tabBoxClosed);
|
QSignalSpy tabboxClosedSpy(workspace()->tabbox(), &TabBox::TabBox::tabBoxClosed);
|
||||||
QVERIFY(tabboxClosedSpy.isValid());
|
QVERIFY(tabboxClosedSpy.isValid());
|
||||||
|
|
||||||
// enable capslock
|
// enable capslock
|
||||||
|
@ -111,19 +111,19 @@ void TabBoxTest::testCapsLock()
|
||||||
Test::keyboardKeyReleased(KEY_TAB, timestamp++);
|
Test::keyboardKeyReleased(KEY_TAB, timestamp++);
|
||||||
|
|
||||||
QVERIFY(tabboxAddedSpy.wait());
|
QVERIFY(tabboxAddedSpy.wait());
|
||||||
QVERIFY(TabBox::TabBox::self()->isGrabbed());
|
QVERIFY(workspace()->tabbox()->isGrabbed());
|
||||||
|
|
||||||
// release alt
|
// release alt
|
||||||
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
||||||
QCOMPARE(tabboxClosedSpy.count(), 1);
|
QCOMPARE(tabboxClosedSpy.count(), 1);
|
||||||
QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false);
|
QCOMPARE(workspace()->tabbox()->isGrabbed(), false);
|
||||||
|
|
||||||
// release caps lock
|
// release caps lock
|
||||||
Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++);
|
Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++);
|
||||||
Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++);
|
Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++);
|
||||||
QCOMPARE(input()->keyboardModifiers(), Qt::NoModifier);
|
QCOMPARE(input()->keyboardModifiers(), Qt::NoModifier);
|
||||||
QCOMPARE(tabboxClosedSpy.count(), 1);
|
QCOMPARE(tabboxClosedSpy.count(), 1);
|
||||||
QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false);
|
QCOMPARE(workspace()->tabbox()->isGrabbed(), false);
|
||||||
QCOMPARE(workspace()->activeWindow(), c2);
|
QCOMPARE(workspace()->activeWindow(), c2);
|
||||||
|
|
||||||
surface3.reset();
|
surface3.reset();
|
||||||
|
@ -156,9 +156,9 @@ void TabBoxTest::testMoveForward()
|
||||||
QVERIFY(c3->isActive());
|
QVERIFY(c3->isActive());
|
||||||
|
|
||||||
// Setup tabbox signal spies
|
// Setup tabbox signal spies
|
||||||
QSignalSpy tabboxAddedSpy(TabBox::TabBox::self(), &TabBox::TabBox::tabBoxAdded);
|
QSignalSpy tabboxAddedSpy(workspace()->tabbox(), &TabBox::TabBox::tabBoxAdded);
|
||||||
QVERIFY(tabboxAddedSpy.isValid());
|
QVERIFY(tabboxAddedSpy.isValid());
|
||||||
QSignalSpy tabboxClosedSpy(TabBox::TabBox::self(), &TabBox::TabBox::tabBoxClosed);
|
QSignalSpy tabboxClosedSpy(workspace()->tabbox(), &TabBox::TabBox::tabBoxClosed);
|
||||||
QVERIFY(tabboxClosedSpy.isValid());
|
QVERIFY(tabboxClosedSpy.isValid());
|
||||||
|
|
||||||
// press alt+tab
|
// press alt+tab
|
||||||
|
@ -169,12 +169,12 @@ void TabBoxTest::testMoveForward()
|
||||||
Test::keyboardKeyReleased(KEY_TAB, timestamp++);
|
Test::keyboardKeyReleased(KEY_TAB, timestamp++);
|
||||||
|
|
||||||
QVERIFY(tabboxAddedSpy.wait());
|
QVERIFY(tabboxAddedSpy.wait());
|
||||||
QVERIFY(TabBox::TabBox::self()->isGrabbed());
|
QVERIFY(workspace()->tabbox()->isGrabbed());
|
||||||
|
|
||||||
// release alt
|
// release alt
|
||||||
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
||||||
QCOMPARE(tabboxClosedSpy.count(), 1);
|
QCOMPARE(tabboxClosedSpy.count(), 1);
|
||||||
QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false);
|
QCOMPARE(workspace()->tabbox()->isGrabbed(), false);
|
||||||
QCOMPARE(workspace()->activeWindow(), c2);
|
QCOMPARE(workspace()->activeWindow(), c2);
|
||||||
|
|
||||||
surface3.reset();
|
surface3.reset();
|
||||||
|
@ -207,9 +207,9 @@ void TabBoxTest::testMoveBackward()
|
||||||
QVERIFY(c3->isActive());
|
QVERIFY(c3->isActive());
|
||||||
|
|
||||||
// Setup tabbox signal spies
|
// Setup tabbox signal spies
|
||||||
QSignalSpy tabboxAddedSpy(TabBox::TabBox::self(), &TabBox::TabBox::tabBoxAdded);
|
QSignalSpy tabboxAddedSpy(workspace()->tabbox(), &TabBox::TabBox::tabBoxAdded);
|
||||||
QVERIFY(tabboxAddedSpy.isValid());
|
QVERIFY(tabboxAddedSpy.isValid());
|
||||||
QSignalSpy tabboxClosedSpy(TabBox::TabBox::self(), &TabBox::TabBox::tabBoxClosed);
|
QSignalSpy tabboxClosedSpy(workspace()->tabbox(), &TabBox::TabBox::tabBoxClosed);
|
||||||
QVERIFY(tabboxClosedSpy.isValid());
|
QVERIFY(tabboxClosedSpy.isValid());
|
||||||
|
|
||||||
// press alt+shift+tab
|
// press alt+shift+tab
|
||||||
|
@ -222,14 +222,14 @@ void TabBoxTest::testMoveBackward()
|
||||||
Test::keyboardKeyReleased(KEY_TAB, timestamp++);
|
Test::keyboardKeyReleased(KEY_TAB, timestamp++);
|
||||||
|
|
||||||
QVERIFY(tabboxAddedSpy.wait());
|
QVERIFY(tabboxAddedSpy.wait());
|
||||||
QVERIFY(TabBox::TabBox::self()->isGrabbed());
|
QVERIFY(workspace()->tabbox()->isGrabbed());
|
||||||
|
|
||||||
// release alt
|
// release alt
|
||||||
Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++);
|
Test::keyboardKeyReleased(KEY_LEFTSHIFT, timestamp++);
|
||||||
QCOMPARE(tabboxClosedSpy.count(), 0);
|
QCOMPARE(tabboxClosedSpy.count(), 0);
|
||||||
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
|
||||||
QCOMPARE(tabboxClosedSpy.count(), 1);
|
QCOMPARE(tabboxClosedSpy.count(), 1);
|
||||||
QCOMPARE(TabBox::TabBox::self()->isGrabbed(), false);
|
QCOMPARE(workspace()->tabbox()->isGrabbed(), false);
|
||||||
QCOMPARE(workspace()->activeWindow(), c1);
|
QCOMPARE(workspace()->activeWindow(), c1);
|
||||||
|
|
||||||
surface3.reset();
|
surface3.reset();
|
||||||
|
|
|
@ -206,7 +206,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
|
||||||
#endif
|
#endif
|
||||||
connect(ws, &Workspace::stackingOrderChanged, this, &EffectsHandler::stackingOrderChanged);
|
connect(ws, &Workspace::stackingOrderChanged, this, &EffectsHandler::stackingOrderChanged);
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox *tabBox = TabBox::TabBox::self();
|
TabBox::TabBox *tabBox = workspace()->tabbox();
|
||||||
connect(tabBox, &TabBox::TabBox::tabBoxAdded, this, &EffectsHandler::tabBoxAdded);
|
connect(tabBox, &TabBox::TabBox::tabBoxAdded, this, &EffectsHandler::tabBoxAdded);
|
||||||
connect(tabBox, &TabBox::TabBox::tabBoxUpdated, this, &EffectsHandler::tabBoxUpdated);
|
connect(tabBox, &TabBox::TabBox::tabBoxUpdated, this, &EffectsHandler::tabBoxUpdated);
|
||||||
connect(tabBox, &TabBox::TabBox::tabBoxClosed, this, &EffectsHandler::tabBoxClosed);
|
connect(tabBox, &TabBox::TabBox::tabBoxClosed, this, &EffectsHandler::tabBoxClosed);
|
||||||
|
@ -1157,7 +1157,7 @@ void EffectsHandlerImpl::setTabBoxWindow(EffectWindow *w)
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
auto window = static_cast<EffectWindowImpl *>(w)->window();
|
auto window = static_cast<EffectWindowImpl *>(w)->window();
|
||||||
if (window->isClient()) {
|
if (window->isClient()) {
|
||||||
TabBox::TabBox::self()->setCurrentClient(window);
|
workspace()->tabbox()->setCurrentClient(window);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(w)
|
Q_UNUSED(w)
|
||||||
|
@ -1167,7 +1167,7 @@ void EffectsHandlerImpl::setTabBoxWindow(EffectWindow *w)
|
||||||
void EffectsHandlerImpl::setTabBoxDesktop(int desktop)
|
void EffectsHandlerImpl::setTabBoxDesktop(int desktop)
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox::self()->setCurrentDesktop(desktop);
|
workspace()->tabbox()->setCurrentDesktop(desktop);
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(desktop)
|
Q_UNUSED(desktop)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1176,7 +1176,7 @@ void EffectsHandlerImpl::setTabBoxDesktop(int desktop)
|
||||||
EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const
|
EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
const auto clients = TabBox::TabBox::self()->currentClientList();
|
const auto clients = workspace()->tabbox()->currentClientList();
|
||||||
EffectWindowList ret;
|
EffectWindowList ret;
|
||||||
ret.reserve(clients.size());
|
ret.reserve(clients.size());
|
||||||
std::transform(std::cbegin(clients), std::cend(clients),
|
std::transform(std::cbegin(clients), std::cend(clients),
|
||||||
|
@ -1193,28 +1193,28 @@ EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const
|
||||||
void EffectsHandlerImpl::refTabBox()
|
void EffectsHandlerImpl::refTabBox()
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox::self()->reference();
|
workspace()->tabbox()->reference();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandlerImpl::unrefTabBox()
|
void EffectsHandlerImpl::unrefTabBox()
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox::self()->unreference();
|
workspace()->tabbox()->unreference();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandlerImpl::closeTabBox()
|
void EffectsHandlerImpl::closeTabBox()
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox::self()->close();
|
workspace()->tabbox()->close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> EffectsHandlerImpl::currentTabBoxDesktopList() const
|
QList<int> EffectsHandlerImpl::currentTabBoxDesktopList() const
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
return TabBox::TabBox::self()->currentDesktopList();
|
return workspace()->tabbox()->currentDesktopList();
|
||||||
#else
|
#else
|
||||||
return QList<int>();
|
return QList<int>();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1223,7 +1223,7 @@ QList<int> EffectsHandlerImpl::currentTabBoxDesktopList() const
|
||||||
int EffectsHandlerImpl::currentTabBoxDesktop() const
|
int EffectsHandlerImpl::currentTabBoxDesktop() const
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
return TabBox::TabBox::self()->currentDesktop();
|
return workspace()->tabbox()->currentDesktop();
|
||||||
#else
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1232,7 +1232,7 @@ int EffectsHandlerImpl::currentTabBoxDesktop() const
|
||||||
EffectWindow *EffectsHandlerImpl::currentTabBoxWindow() const
|
EffectWindow *EffectsHandlerImpl::currentTabBoxWindow() const
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
if (auto c = TabBox::TabBox::self()->currentClient()) {
|
if (auto c = workspace()->tabbox()->currentClient()) {
|
||||||
return c->effectWindow();
|
return c->effectWindow();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -825,7 +825,7 @@ void X11Window::updateMouseGrab()
|
||||||
xcb_ungrab_button(kwinApp()->x11Connection(), XCB_BUTTON_INDEX_ANY, m_wrapper, XCB_MOD_MASK_ANY);
|
xcb_ungrab_button(kwinApp()->x11Connection(), XCB_BUTTON_INDEX_ANY, m_wrapper, XCB_MOD_MASK_ANY);
|
||||||
|
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
if (TabBox::TabBox::self()->forcedGlobalMouseGrab()) { // see TabBox::establishTabBoxGrab()
|
if (workspace()->tabbox()->forcedGlobalMouseGrab()) { // see TabBox::establishTabBoxGrab()
|
||||||
m_wrapper.grabButton(XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
|
m_wrapper.grabButton(XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1646,14 +1646,14 @@ public:
|
||||||
bool pointerEvent(QMouseEvent *event, quint32 button) override
|
bool pointerEvent(QMouseEvent *event, quint32 button) override
|
||||||
{
|
{
|
||||||
Q_UNUSED(button)
|
Q_UNUSED(button)
|
||||||
if (!TabBox::TabBox::self() || !TabBox::TabBox::self()->isGrabbed()) {
|
if (!workspace()->tabbox() || !workspace()->tabbox()->isGrabbed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return TabBox::TabBox::self()->handleMouseEvent(event);
|
return workspace()->tabbox()->handleMouseEvent(event);
|
||||||
}
|
}
|
||||||
bool keyEvent(QKeyEvent *event) override
|
bool keyEvent(QKeyEvent *event) override
|
||||||
{
|
{
|
||||||
if (!TabBox::TabBox::self() || !TabBox::TabBox::self()->isGrabbed()) {
|
if (!workspace()->tabbox() || !workspace()->tabbox()->isGrabbed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto seat = waylandServer()->seat();
|
auto seat = waylandServer()->seat();
|
||||||
|
@ -1664,18 +1664,18 @@ public:
|
||||||
passToWaylandServer(event);
|
passToWaylandServer(event);
|
||||||
|
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::KeyPress) {
|
||||||
TabBox::TabBox::self()->keyPress(event->modifiers() | event->key());
|
workspace()->tabbox()->keyPress(event->modifiers() | event->key());
|
||||||
} else if (static_cast<KeyEvent *>(event)->modifiersRelevantForGlobalShortcuts() == Qt::NoModifier) {
|
} else if (static_cast<KeyEvent *>(event)->modifiersRelevantForGlobalShortcuts() == Qt::NoModifier) {
|
||||||
TabBox::TabBox::self()->modifiersReleased();
|
workspace()->tabbox()->modifiersReleased();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool wheelEvent(QWheelEvent *event) override
|
bool wheelEvent(QWheelEvent *event) override
|
||||||
{
|
{
|
||||||
if (!TabBox::TabBox::self() || !TabBox::TabBox::self()->isGrabbed()) {
|
if (!workspace()->tabbox() || !workspace()->tabbox()->isGrabbed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return TabBox::TabBox::self()->handleWheelEvent(event);
|
return workspace()->tabbox()->handleWheelEvent(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -440,18 +440,9 @@ QUuid TabBoxClientImpl::internalId() const
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
* TabBox
|
* TabBox
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
TabBox *TabBox::s_self = nullptr;
|
|
||||||
|
|
||||||
TabBox *TabBox::create(QObject *parent)
|
TabBox::TabBox()
|
||||||
{
|
: m_displayRefcount(0)
|
||||||
Q_ASSERT(!s_self);
|
|
||||||
s_self = new TabBox(parent);
|
|
||||||
return s_self;
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBox::TabBox(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_displayRefcount(0)
|
|
||||||
, m_desktopGrab(false)
|
, m_desktopGrab(false)
|
||||||
, m_tabGrab(false)
|
, m_tabGrab(false)
|
||||||
, m_noModifierGrab(false)
|
, m_noModifierGrab(false)
|
||||||
|
@ -506,10 +497,7 @@ TabBox::TabBox(QObject *parent)
|
||||||
connect(Workspace::self(), &Workspace::configChanged, this, &TabBox::reconfigure);
|
connect(Workspace::self(), &Workspace::configChanged, this, &TabBox::reconfigure);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabBox::~TabBox()
|
TabBox::~TabBox() = default;
|
||||||
{
|
|
||||||
s_self = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabBox::handlerReady()
|
void TabBox::handlerReady()
|
||||||
{
|
{
|
||||||
|
@ -526,7 +514,7 @@ void TabBox::key(const KLazyLocalizedString &actionName, Slot slot, const QKeySe
|
||||||
a->setObjectName(QString::fromUtf8(actionName.untranslatedText()));
|
a->setObjectName(QString::fromUtf8(actionName.untranslatedText()));
|
||||||
a->setText(actionName.toString());
|
a->setText(actionName.toString());
|
||||||
KGlobalAccel::self()->setGlobalShortcut(a, QList<QKeySequence>() << shortcut);
|
KGlobalAccel::self()->setGlobalShortcut(a, QList<QKeySequence>() << shortcut);
|
||||||
input()->registerShortcut(shortcut, a, TabBox::self(), slot);
|
input()->registerShortcut(shortcut, a, this, slot);
|
||||||
auto cuts = KGlobalAccel::self()->shortcut(a);
|
auto cuts = KGlobalAccel::self()->shortcut(a);
|
||||||
globalShortcutChanged(a, cuts.isEmpty() ? QKeySequence() : cuts.first());
|
globalShortcutChanged(a, cuts.isEmpty() ? QKeySequence() : cuts.first());
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,8 @@ class KWIN_EXPORT TabBox : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
~TabBox() override;
|
explicit TabBox();
|
||||||
|
~TabBox();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the currently displayed client ( only works in TabBoxWindowsMode ).
|
* Returns the currently displayed client ( only works in TabBoxWindowsMode ).
|
||||||
|
@ -261,9 +262,6 @@ public:
|
||||||
}
|
}
|
||||||
void setCurrentIndex(QModelIndex index, bool notifyEffects = true);
|
void setCurrentIndex(QModelIndex index, bool notifyEffects = true);
|
||||||
|
|
||||||
static TabBox *self();
|
|
||||||
static TabBox *create(QObject *parent);
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* Notify effects that the tab box is being shown, and only display the
|
* Notify effects that the tab box is being shown, and only display the
|
||||||
|
@ -357,16 +355,9 @@ private:
|
||||||
QList<ElectricBorder> m_borderActivate, m_borderAlternativeActivate;
|
QList<ElectricBorder> m_borderActivate, m_borderAlternativeActivate;
|
||||||
QHash<ElectricBorder, QAction *> m_touchActivate;
|
QHash<ElectricBorder, QAction *> m_touchActivate;
|
||||||
QHash<ElectricBorder, QAction *> m_touchAlternativeActivate;
|
QHash<ElectricBorder, QAction *> m_touchAlternativeActivate;
|
||||||
QScopedPointer<X11EventFilter> m_x11EventFilter;
|
std::unique_ptr<X11EventFilter> m_x11EventFilter;
|
||||||
|
|
||||||
static TabBox *s_self;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline TabBox *TabBox::self()
|
|
||||||
{
|
|
||||||
return s_self;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace TabBox
|
} // namespace TabBox
|
||||||
} // namespace
|
} // namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,8 @@ X11Filter::X11Filter()
|
||||||
|
|
||||||
bool X11Filter::event(xcb_generic_event_t *event)
|
bool X11Filter::event(xcb_generic_event_t *event)
|
||||||
{
|
{
|
||||||
if (!TabBox::TabBox::self()->isGrabbed()) {
|
const auto tab = workspace()->tabbox();
|
||||||
|
if (!tab->isGrabbed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const uint8_t eventType = event->response_type & ~0x80;
|
const uint8_t eventType = event->response_type & ~0x80;
|
||||||
|
@ -38,7 +39,6 @@ bool X11Filter::event(xcb_generic_event_t *event)
|
||||||
case XCB_BUTTON_RELEASE: {
|
case XCB_BUTTON_RELEASE: {
|
||||||
auto e = reinterpret_cast<xcb_button_press_event_t *>(event);
|
auto e = reinterpret_cast<xcb_button_press_event_t *>(event);
|
||||||
xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
|
xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
|
||||||
const auto tab = TabBox::TabBox::self();
|
|
||||||
if (!tab->isShown() && tab->isDisplayed()) {
|
if (!tab->isShown() && tab->isDisplayed()) {
|
||||||
if (effects && static_cast<EffectsHandlerImpl *>(effects)->isMouseInterception()) {
|
if (effects && static_cast<EffectsHandlerImpl *>(effects)->isMouseInterception()) {
|
||||||
// pass on to effects, effects will filter out the event
|
// pass on to effects, effects will filter out the event
|
||||||
|
@ -67,7 +67,7 @@ bool X11Filter::event(xcb_generic_event_t *event)
|
||||||
bool X11Filter::buttonPress(xcb_button_press_event_t *event)
|
bool X11Filter::buttonPress(xcb_button_press_event_t *event)
|
||||||
{
|
{
|
||||||
// press outside Tabbox?
|
// press outside Tabbox?
|
||||||
const auto tab = TabBox::TabBox::self();
|
const auto tab = workspace()->tabbox();
|
||||||
QPoint pos(event->root_x, event->root_y);
|
QPoint pos(event->root_x, event->root_y);
|
||||||
if ((!tab->isShown() && tab->isDisplayed())
|
if ((!tab->isShown() && tab->isDisplayed())
|
||||||
|| (!tabBox->containsPos(pos) && (event->detail == XCB_BUTTON_INDEX_1 || event->detail == XCB_BUTTON_INDEX_2 || event->detail == XCB_BUTTON_INDEX_3))) {
|
|| (!tabBox->containsPos(pos) && (event->detail == XCB_BUTTON_INDEX_1 || event->detail == XCB_BUTTON_INDEX_2 || event->detail == XCB_BUTTON_INDEX_3))) {
|
||||||
|
@ -99,7 +99,7 @@ void X11Filter::keyPress(xcb_generic_event_t *event)
|
||||||
int keyQt;
|
int keyQt;
|
||||||
xcb_key_press_event_t *keyEvent = reinterpret_cast<xcb_key_press_event_t *>(event);
|
xcb_key_press_event_t *keyEvent = reinterpret_cast<xcb_key_press_event_t *>(event);
|
||||||
KKeyServer::xcbKeyPressEventToQt(keyEvent, &keyQt);
|
KKeyServer::xcbKeyPressEventToQt(keyEvent, &keyQt);
|
||||||
TabBox::TabBox::self()->keyPress(keyQt);
|
workspace()->tabbox()->keyPress(keyQt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11Filter::keyRelease(xcb_generic_event_t *event)
|
void X11Filter::keyRelease(xcb_generic_event_t *event)
|
||||||
|
@ -141,7 +141,7 @@ void X11Filter::keyRelease(xcb_generic_event_t *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (release) {
|
if (release) {
|
||||||
TabBox::TabBox::self()->modifiersReleased();
|
workspace()->tabbox()->modifiersReleased();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ void Workspace::initShortcuts()
|
||||||
initShortcut("Invert Screen Colors", i18n("Invert Screen Colors"), 0, kwinApp()->platform(), &Platform::invertScreen);
|
initShortcut("Invert Screen Colors", i18n("Invert Screen Colors"), 0, kwinApp()->platform(), &Platform::invertScreen);
|
||||||
|
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox::self()->initShortcuts();
|
m_tabbox->initShortcuts();
|
||||||
#endif
|
#endif
|
||||||
vds->initShortcuts();
|
vds->initShortcuts();
|
||||||
m_userActionsMenu->discard(); // so that it's recreated next time
|
m_userActionsMenu->discard(); // so that it's recreated next time
|
||||||
|
|
|
@ -4432,7 +4432,7 @@ void Window::setFullscreenGeometryRestore(const QRectF &geom)
|
||||||
void Window::cleanTabBox()
|
void Window::cleanTabBox()
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox *tabBox = TabBox::TabBox::self();
|
TabBox::TabBox *tabBox = workspace()->tabbox();
|
||||||
if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) {
|
if (tabBox && tabBox->isDisplayed() && tabBox->currentClient() == this) {
|
||||||
tabBox->nextPrev(true);
|
tabBox->nextPrev(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ Workspace::Workspace()
|
||||||
|
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
// need to create the tabbox before compositing scene is setup
|
// need to create the tabbox before compositing scene is setup
|
||||||
TabBox::TabBox::create(this);
|
m_tabbox = std::make_unique<TabBox::TabBox>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!Compositor::self()) {
|
if (!Compositor::self()) {
|
||||||
|
@ -1874,9 +1874,8 @@ void Workspace::setWasUserInteraction()
|
||||||
void Workspace::updateTabbox()
|
void Workspace::updateTabbox()
|
||||||
{
|
{
|
||||||
#if KWIN_BUILD_TABBOX
|
#if KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox *tabBox = TabBox::TabBox::self();
|
if (m_tabbox->isDisplayed()) {
|
||||||
if (tabBox->isDisplayed()) {
|
m_tabbox->reset(true);
|
||||||
tabBox->reset(true);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2866,6 +2865,13 @@ Screens *Workspace::screens() const
|
||||||
return m_screens.get();
|
return m_screens.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_TABBOX
|
||||||
|
TabBox::TabBox *Workspace::tabbox() const
|
||||||
|
{
|
||||||
|
return m_tabbox.get();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if KWIN_BUILD_ACTIVITIES
|
#if KWIN_BUILD_ACTIVITIES
|
||||||
Activities *Workspace::activities() const
|
Activities *Workspace::activities() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,11 @@ class Tree;
|
||||||
class Window;
|
class Window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace TabBox
|
||||||
|
{
|
||||||
|
class TabBox;
|
||||||
|
}
|
||||||
|
|
||||||
class Window;
|
class Window;
|
||||||
class Output;
|
class Output;
|
||||||
class ColorMapper;
|
class ColorMapper;
|
||||||
|
@ -445,6 +450,9 @@ public:
|
||||||
RuleBook *rulebook() const;
|
RuleBook *rulebook() const;
|
||||||
ScreenEdges *screenEdges() const;
|
ScreenEdges *screenEdges() const;
|
||||||
Screens *screens() const;
|
Screens *screens() const;
|
||||||
|
#if KWIN_BUILD_TABBOX
|
||||||
|
TabBox::TabBox *tabbox() const;
|
||||||
|
#endif
|
||||||
#if KWIN_BUILD_ACTIVITIES
|
#if KWIN_BUILD_ACTIVITIES
|
||||||
Activities *activities() const;
|
Activities *activities() const;
|
||||||
#endif
|
#endif
|
||||||
|
@ -724,6 +732,9 @@ private:
|
||||||
std::unique_ptr<RuleBook> m_rulebook;
|
std::unique_ptr<RuleBook> m_rulebook;
|
||||||
std::unique_ptr<ScreenEdges> m_screenEdges;
|
std::unique_ptr<ScreenEdges> m_screenEdges;
|
||||||
std::unique_ptr<Screens> m_screens;
|
std::unique_ptr<Screens> m_screens;
|
||||||
|
#if KWIN_BUILD_TABBOX
|
||||||
|
std::unique_ptr<TabBox::TabBox> m_tabbox;
|
||||||
|
#endif
|
||||||
#if KWIN_BUILD_ACTIVITIES
|
#if KWIN_BUILD_ACTIVITIES
|
||||||
std::unique_ptr<Activities> m_activities;
|
std::unique_ptr<Activities> m_activities;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue