aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.h
blob: d1c3b4e0405a13af6e1cf5a28caf74ed6701b3b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//===========================================
//  Lumina desktop source code
//  Copyright (c) 2017, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
//  Class for managing key presses and sending out signals
//    when a shortcut combination is pressed
//===========================================
#ifndef _LUMINA_KEY_SEQUENCE_DETECTION_H
#define _LUMINA_KEY_SEQUENCE_DETECTION_H

#include "../global-includes.h"

class LShortcutEvents : public QObject{
	Q_OBJECT
public:
	LShortcutEvents();
	~LShortcutEvents();

	void start();
	void stop();

private:
	QList<int> keylist; //keys currently held down (NOTE: QKeySequence has a max of 4 keys for combinations)
	WId WIN; //current window being acted on by the keys
	QTimer *clearTimer; //used to clear the internal keylist every once in a while if no events come in.
	bool evaluated;

	//Actual check functions
	void CheckKeySequence(WId win);
	void CheckMouseSequence(WId win, Lumina::MouseButton, bool release);
	QString keylistToString();
	void evaluateShortcutAction(QString action);

public slots:
	void KeyPress(WId window, int key);
	void KeyRelease(WId window, int key);
	void MousePress(WId window, Lumina::MouseButton);
	void MouseRelease(WId window, Lumina::MouseButton);
	void clearKeys();

signals:
	// Power Options
	void OpenLeaveDialog();
	void StartLogout();
	void StartReboot();  //assumes startUpdates==true
	void StartShutdown(); //assumes startUpdates==true

	// Session Options
	void ChangeWorkspace(int); // +/- 1 from current
	void LockSession();
	
	//Active Window Options
	void ActiveWindowMoveToWorkspace(int); //number of workspace
	void ActiveWindowTakeToWorkspace(int); //number of workspace
	void ActiveWindowKill();
	void ActiveWindowClose();
	void ActiveWindowMinMaxToggle();
	void ActiveWindowFullscreenToggle();
	void ActiveWindowStartMove();
	void ActiveWindowStopMove();
	void ActiveWindowStartResize();
	void ActiveWindowStopResize();


	//General Utility Launch
	void LaunchApplication(QString exec);

};

#endif
bgstack15