Changeset View
Changeset View
Standalone View
Standalone View
effects/presentwindows/presentwindows.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 51 | PresentWindowsEffect::PresentWindowsEffect() | |||
---|---|---|---|---|---|
56 | , m_hasKeyboardGrab(false) | 56 | , m_hasKeyboardGrab(false) | ||
57 | , m_mode(ModeCurrentDesktop) | 57 | , m_mode(ModeCurrentDesktop) | ||
58 | , m_managerWindow(NULL) | 58 | , m_managerWindow(NULL) | ||
59 | , m_needInitialSelection(false) | 59 | , m_needInitialSelection(false) | ||
60 | , m_highlightedWindow(NULL) | 60 | , m_highlightedWindow(NULL) | ||
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)) | ||||
65 | , m_exposeAllAction(new QAction(this)) | ||||
66 | , m_exposeClassAction(new QAction(this)) | ||||
64 | { | 67 | { | ||
65 | m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this); | 68 | m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this); | ||
66 | m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this); | 69 | m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this); | ||
67 | 70 | | |||
68 | QAction* exposeAction = new QAction(this); | 71 | QAction* exposeAction = m_exposeAction; | ||
69 | exposeAction->setObjectName(QStringLiteral("Expose")); | 72 | exposeAction->setObjectName(QStringLiteral("Expose")); | ||
70 | exposeAction->setText(i18n("Toggle Present Windows (Current desktop)")); | 73 | exposeAction->setText(i18n("Toggle Present Windows (Current desktop)")); | ||
71 | KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | 74 | KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | ||
72 | KGlobalAccel::self()->setShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | 75 | KGlobalAccel::self()->setShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9); | ||
73 | shortcut = KGlobalAccel::self()->shortcut(exposeAction); | 76 | shortcut = KGlobalAccel::self()->shortcut(exposeAction); | ||
74 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F9, exposeAction); | 77 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F9, exposeAction); | ||
75 | connect(exposeAction, SIGNAL(triggered(bool)), this, SLOT(toggleActive())); | 78 | connect(exposeAction, SIGNAL(triggered(bool)), this, SLOT(toggleActive())); | ||
76 | QAction* exposeAllAction = new QAction(this); | 79 | QAction* exposeAllAction = m_exposeAllAction; | ||
77 | exposeAllAction->setObjectName(QStringLiteral("ExposeAll")); | 80 | exposeAllAction->setObjectName(QStringLiteral("ExposeAll")); | ||
78 | exposeAllAction->setText(i18n("Toggle Present Windows (All desktops)")); | 81 | exposeAllAction->setText(i18n("Toggle Present Windows (All desktops)")); | ||
79 | KGlobalAccel::self()->setDefaultShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC); | 82 | KGlobalAccel::self()->setDefaultShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC); | ||
80 | KGlobalAccel::self()->setShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC); | 83 | KGlobalAccel::self()->setShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC); | ||
81 | shortcutAll = KGlobalAccel::self()->shortcut(exposeAllAction); | 84 | shortcutAll = KGlobalAccel::self()->shortcut(exposeAllAction); | ||
82 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F10, exposeAllAction); | 85 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F10, exposeAllAction); | ||
83 | effects->registerTouchpadSwipeShortcut(SwipeDirection::Down, exposeAllAction); | 86 | effects->registerTouchpadSwipeShortcut(SwipeDirection::Down, exposeAllAction); | ||
84 | connect(exposeAllAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops())); | 87 | connect(exposeAllAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops())); | ||
85 | QAction* exposeClassAction = new QAction(this); | 88 | QAction* exposeClassAction = m_exposeClassAction; | ||
86 | exposeClassAction->setObjectName(QStringLiteral("ExposeClass")); | 89 | exposeClassAction->setObjectName(QStringLiteral("ExposeClass")); | ||
87 | exposeClassAction->setText(i18n("Toggle Present Windows (Window class)")); | 90 | exposeClassAction->setText(i18n("Toggle Present Windows (Window class)")); | ||
88 | KGlobalAccel::self()->setDefaultShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7); | 91 | KGlobalAccel::self()->setDefaultShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7); | ||
89 | KGlobalAccel::self()->setShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7); | 92 | KGlobalAccel::self()->setShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7); | ||
90 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F7, exposeClassAction); | 93 | effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F7, exposeClassAction); | ||
91 | connect(exposeClassAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass())); | 94 | connect(exposeClassAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass())); | ||
92 | shortcutClass = KGlobalAccel::self()->shortcut(exposeClassAction); | 95 | shortcutClass = KGlobalAccel::self()->shortcut(exposeClassAction); | ||
93 | connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &PresentWindowsEffect::globalShortcutChanged); | 96 | connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &PresentWindowsEffect::globalShortcutChanged); | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 118 | { | |||
149 | m_fadeDuration = double(animationTime(150)); | 152 | m_fadeDuration = double(animationTime(150)); | ||
150 | m_showPanel = PresentWindowsConfig::showPanel(); | 153 | m_showPanel = PresentWindowsConfig::showPanel(); | ||
151 | m_leftButtonWindow = (WindowMouseAction)PresentWindowsConfig::leftButtonWindow(); | 154 | m_leftButtonWindow = (WindowMouseAction)PresentWindowsConfig::leftButtonWindow(); | ||
152 | m_middleButtonWindow = (WindowMouseAction)PresentWindowsConfig::middleButtonWindow(); | 155 | m_middleButtonWindow = (WindowMouseAction)PresentWindowsConfig::middleButtonWindow(); | ||
153 | m_rightButtonWindow = (WindowMouseAction)PresentWindowsConfig::rightButtonWindow(); | 156 | m_rightButtonWindow = (WindowMouseAction)PresentWindowsConfig::rightButtonWindow(); | ||
154 | m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop(); | 157 | m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop(); | ||
155 | m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop(); | 158 | m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop(); | ||
156 | m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop(); | 159 | m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop(); | ||
160 | | ||||
161 | // touch screen edges | ||||
162 | const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom}; | ||||
163 | for (auto e : relevantBorders) { | ||||
164 | effects->unregisterTouchBorder(e, m_exposeAction); | ||||
165 | effects->unregisterTouchBorder(e, m_exposeAllAction); | ||||
166 | effects->unregisterTouchBorder(e, m_exposeClassAction); | ||||
167 | } | ||||
168 | auto touchEdge = [] (const QList<int> touchBorders, QAction *action) { | ||||
169 | for (int i : touchBorders) { | ||||
170 | effects->registerTouchBorder(ElectricBorder(i), action); | ||||
171 | } | ||||
172 | }; | ||||
173 | touchEdge(PresentWindowsConfig::touchBorderActivate(), m_exposeAction); | ||||
174 | touchEdge(PresentWindowsConfig::touchBorderActivateAll(), m_exposeAllAction); | ||||
175 | touchEdge(PresentWindowsConfig::touchBorderActivateClass(), m_exposeClassAction); | ||||
157 | } | 176 | } | ||
158 | 177 | | |||
159 | void* PresentWindowsEffect::proxy() | 178 | void* PresentWindowsEffect::proxy() | ||
160 | { | 179 | { | ||
161 | return &m_proxy; | 180 | return &m_proxy; | ||
162 | } | 181 | } | ||
163 | 182 | | |||
164 | void PresentWindowsEffect::toggleActiveClass() | 183 | void PresentWindowsEffect::toggleActiveClass() | ||
▲ Show 20 Lines • Show All 1864 Lines • Show Last 20 Lines |