1 //=========================================== 2 // Lumina desktop source code 3 // Copyright (c) 2017, Ken Moore 4 // Available under the 3-clause BSD license 5 // See the LICENSE file for full details 6 //=========================================== 7 // Class for managing key presses and sending out signals 8 // when a shortcut combination is pressed 9 //=========================================== 10 #ifndef _LUMINA_KEY_SEQUENCE_DETECTION_H 11 #define _LUMINA_KEY_SEQUENCE_DETECTION_H 12 13 #include <global-includes.h> 14 #include "NativeWindowSystem.h" 15 16 class LShortcutEvents : public QObject{ 17 Q_OBJECT 18 public: 19 LShortcutEvents(); 20 ~LShortcutEvents(); 21 22 void start(); 23 void stop(); 24 25 private: 26 QList< Qt::Key > keylist; //keys currently held down 27 WId WIN; //current window being acted on by the keys 28 QTimer *clearTimer; //used to clear the internal keylist every once in a while if no events come in. 29 bool evaluated; 30 31 //Actual check functions 32 void CheckKeySequence(WId win); 33 void CheckMouseSequence(WId win, NativeWindowSystem::MouseButton, bool release); 34 QString keylistToString(); 35 void evaluateShortcutAction(QString action); 36 37 public slots: 38 void KeyPress(WId window, Qt::Key key); 39 void KeyRelease(WId window, Qt::Key key); 40 void MousePress(WId window, NativeWindowSystem::MouseButton); 41 void MouseRelease(WId window, NativeWindowSystem::MouseButton); 42 void clearKeys(); 43 44 signals: 45 // Power Options 46 void OpenLeaveDialog(); 47 void StartLogout(); 48 void StartReboot(); //assumes startUpdates==true 49 void StartShutdown(); //assumes startUpdates==true 50 51 // Session Options 52 void ChangeWorkspace(int); // +/- 1 from current 53 void LockSession(); 54 55 //Active Window Options 56 void ActiveWindowMoveToWorkspace(int); //number of workspace 57 void ActiveWindowTakeToWorkspace(int); //number of workspace 58 void ActiveWindowKill(); 59 void ActiveWindowClose(); 60 void ActiveWindowMinMaxToggle(); 61 void ActiveWindowFullscreenToggle(); 62 void ActiveWindowStartMove(); 63 void ActiveWindowStopMove(); 64 void ActiveWindowStartResize(); 65 void ActiveWindowStopResize(); 66 67 68 //General Utility Launch 69 void LaunchApplication(QString exec); 70 void LaunchStandardApplication(QString app); //standard app like "terminal", "browser", "email", "settings", etc.. 71 72 }; 73 74 #endif 75