Changeset View
Changeset View
Standalone View
Standalone View
effects/presentwindows/presentwindows.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 51 | PresentWindowsEffect::PresentWindowsEffect() | |||
---|---|---|---|---|---|
61 | , m_filterFrame(NULL) | 61 | , m_filterFrame(NULL) | ||
62 | , m_closeView(NULL) | 62 | , m_closeView(NULL) | ||
63 | , m_closeWindow(NULL) | 63 | , m_closeWindow(NULL) | ||
64 | , m_exposeAction(new QAction(this)) | 64 | , m_exposeAction(new QAction(this)) | ||
65 | , m_exposeAllAction(new QAction(this)) | 65 | , m_exposeAllAction(new QAction(this)) | ||
66 | , m_exposeClassAction(new QAction(this)) | 66 | , m_exposeClassAction(new QAction(this)) | ||
67 | { | 67 | { | ||
68 | initConfig<PresentWindowsConfig>(); | 68 | initConfig<PresentWindowsConfig>(); | ||
69 | auto announceSupportProperties = [this] { | ||||
69 | m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this); | 70 | m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this); | ||
70 | m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this); | 71 | m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this); | ||
72 | }; | ||||
73 | announceSupportProperties(); | ||||
74 | connect(effects, &EffectsHandler::xcbConnectionChanged, this, announceSupportProperties); | ||||
71 | 75 | | |||
72 | QAction* exposeAction = m_exposeAction; | 76 | QAction* exposeAction = m_exposeAction; | ||
73 | exposeAction->setObjectName(QStringLiteral("Expose")); | 77 | exposeAction->setObjectName(QStringLiteral("Expose")); | ||
74 | exposeAction->setText(i18n("Toggle Present Windows (Current desktop)")); | 78 | exposeAction->setText(i18n("Toggle Present Windows (Current desktop)")); | ||
75 | KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | 79 | KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | ||
76 | KGlobalAccel::self()->setShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | 80 | KGlobalAccel::self()->setShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | ||
77 | shortcut = KGlobalAccel::self()->shortcut(exposeAction); | 81 | shortcut = KGlobalAccel::self()->shortcut(exposeAction); | ||
78 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F9, exposeAction); | 82 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F9, exposeAction); | ||
▲ Show 20 Lines • Show All 745 Lines • ▼ Show 20 Line(s) | 751 | if (e->type() == QEvent::KeyPress) { | |||
824 | } | 828 | } | ||
825 | } | 829 | } | ||
826 | } | 830 | } | ||
827 | 831 | | |||
828 | //----------------------------------------------------------------------------- | 832 | //----------------------------------------------------------------------------- | ||
829 | // Atom handling | 833 | // Atom handling | ||
830 | void PresentWindowsEffect::slotPropertyNotify(EffectWindow* w, long a) | 834 | void PresentWindowsEffect::slotPropertyNotify(EffectWindow* w, long a) | ||
831 | { | 835 | { | ||
836 | if (m_atomDesktop == XCB_ATOM_NONE && m_atomWindows == XCB_ATOM_NONE) { | ||||
837 | return; | ||||
838 | } | ||||
832 | if (!w || (a != m_atomDesktop && a != m_atomWindows)) | 839 | if (!w || (a != m_atomDesktop && a != m_atomWindows)) | ||
833 | return; // Not our atom | 840 | return; // Not our atom | ||
834 | 841 | | |||
835 | if (a == m_atomDesktop) { | 842 | if (a == m_atomDesktop) { | ||
836 | QByteArray byteData = w->readProperty(m_atomDesktop, m_atomDesktop, 32); | 843 | QByteArray byteData = w->readProperty(m_atomDesktop, m_atomDesktop, 32); | ||
837 | if (byteData.length() < 1) { | 844 | if (byteData.length() < 1) { | ||
838 | // Property was removed, end present windows | 845 | // Property was removed, end present windows | ||
839 | setActive(false); | 846 | setActive(false); | ||
▲ Show 20 Lines • Show All 772 Lines • ▼ Show 20 Line(s) | 1593 | } else { | |||
1612 | 1619 | | |||
1613 | effects->stopMouseInterception(this); | 1620 | effects->stopMouseInterception(this); | ||
1614 | if (m_hasKeyboardGrab) | 1621 | if (m_hasKeyboardGrab) | ||
1615 | effects->ungrabKeyboard(); | 1622 | effects->ungrabKeyboard(); | ||
1616 | m_hasKeyboardGrab = false; | 1623 | m_hasKeyboardGrab = false; | ||
1617 | 1624 | | |||
1618 | // destroy atom on manager window | 1625 | // destroy atom on manager window | ||
1619 | if (m_managerWindow) { | 1626 | if (m_managerWindow) { | ||
1620 | if (m_mode == ModeSelectedDesktop) | 1627 | if (m_mode == ModeSelectedDesktop && m_atomDesktop != XCB_ATOM_NONE) | ||
1621 | m_managerWindow->deleteProperty(m_atomDesktop); | 1628 | m_managerWindow->deleteProperty(m_atomDesktop); | ||
1622 | else if (m_mode == ModeWindowGroup) | 1629 | else if (m_mode == ModeWindowGroup && m_atomWindows != XCB_ATOM_NONE) | ||
1623 | m_managerWindow->deleteProperty(m_atomWindows); | 1630 | m_managerWindow->deleteProperty(m_atomWindows); | ||
1624 | m_managerWindow = NULL; | 1631 | m_managerWindow = NULL; | ||
1625 | } | 1632 | } | ||
1626 | } | 1633 | } | ||
1627 | effects->addRepaintFull(); // Trigger the first repaint | 1634 | effects->addRepaintFull(); // Trigger the first repaint | ||
1628 | } | 1635 | } | ||
1629 | 1636 | | |||
1630 | //----------------------------------------------------------------------------- | 1637 | //----------------------------------------------------------------------------- | ||
▲ Show 20 Lines • Show All 421 Lines • Show Last 20 Lines |