aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-events/LShortcutEvents.h
blob: 4560cb1f3e0784888c52f9c9d0454c326f25f49f (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
73
//===========================================
//  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< Qt::Key > keylist; //keys currently held down
	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, NativeWindowSystem::MouseButton, bool release);
	QString keylistToString();
	void evaluateShortcutAction(QString action);

public slots:
	void KeyPress(WId window, Qt::Key key);
	void KeyRelease(WId window, Qt::Key key);
	void MousePress(WId window, NativeWindowSystem::MouseButton);
	void MouseRelease(WId window, NativeWindowSystem::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);
	void LaunchStandardApplication(QString app); //standard app like "terminal", "browser", "email", "settings", etc..

};

#endif
bgstack15