AntiMicroX
Loading...
Searching...
No Matches
src
x11extras.h
Go to the documentation of this file.
1
/* antimicrox Gamepad to KB+M event mapper
2
* Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
3
* Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef X11EXTRAS_H
20
#define X11EXTRAS_H
21
22
#include <QHash>
23
#include <QObject>
24
#include <QPoint>
25
26
#include <X11/extensions/XInput.h>
27
#include <X11/extensions/XInput2.h>
28
29
class
X11Extras
:
public
QObject
30
{
31
Q_OBJECT
32
33
public
:
34
struct
ptrInformation
35
{
36
long
id
;
37
int
threshold
;
38
int
accelNum
;
39
int
accelDenom
;
40
41
ptrInformation
()
42
{
43
id
= -1;
44
threshold
= 0;
45
accelNum
= 0;
46
accelDenom
= 1;
47
}
48
};
49
50
~X11Extras
();
51
52
unsigned
long
appRootWindow
(
int
screen = -1);
53
Display
*
display
();
54
bool
hasValidDisplay
();
55
QString
getDisplayString
(
QString
xcodestring);
56
int
getApplicationPid
(
Window
window
);
57
QString
getApplicationLocation
(
int
pid
);
58
Window
findClientWindow
(
Window
window
);
59
Window
findParentClient
(
Window
window
);
60
void
closeDisplay
();
61
static
QString
getXDisplayString
();
62
QString
getWindowTitle
(
Window
window
);
63
QString
getWindowClass
(
Window
window
);
64
unsigned
long
getWindowInFocus
();
65
int
getGroup1KeySym
(
int
virtualkey);
66
67
void
x11ResetMouseAccelerationChange
();
68
void
x11ResetMouseAccelerationChange
(
QString
pointerName
);
69
struct
ptrInformation
getPointInformation
();
70
struct
ptrInformation
getPointInformation
(
QString
pointerName
);
71
72
static
void
setCustomDisplay
(
QString
displayString);
73
74
const
char
*
getEnvVariable
(
const
char
*
var
)
const
;
75
76
static
X11Extras
*
getInstance
();
77
static
void
deleteInstance
();
78
79
QHash<QString, QString>
const
&
getKnownAliases
();
80
81
protected
:
82
explicit
X11Extras
(QObject *
parent
=
nullptr
);
83
84
void
populateKnownAliases
();
85
bool
windowHasProperty
(
Display
*
display
,
Window
window
,
Atom
atom
);
86
bool
windowIsViewable
(
Display
*
display
,
Window
window
);
87
bool
isWindowRelevant
(
Display
*
display
,
Window
window
);
88
89
static
X11Extras
*
_instance
;
90
91
public
slots
:
92
QPoint
getPos
();
93
94
private
:
95
void
checkPropertyOnWin
(
bool
windowCorrected
,
Window
&
window
,
Window
&
parent
,
Window
&
finalwindow
,
Window
&
root
,
96
Window
*
children
,
Display
*
display
,
unsigned
int
&
num_children
);
97
void
freeDisplay
();
98
void
checkFeedback
(
XFeedbackState
*
temp
,
int
&
num_feedbacks
,
int
&
feedback_id
);
99
void
findVirtualPtr
(
int
num_devices
,
XIDeviceInfo
*
current_devices
,
XIDeviceInfo
*
mouse_device
,
100
XIDeviceInfo
*
all_devices
,
QString
pointerName
);
101
102
QHash<QString, QString>
knownAliases
;
103
Display
*
_display
;
104
};
105
106
#endif
// X11EXTRAS_H
JoyDPadXml
Definition
joydpadxml.h:27
X11Extras
Definition
x11extras.h:30
X11Extras::findParentClient
Window findParentClient(Window window)
Definition
x11extras.cpp:170
X11Extras::getApplicationLocation
QString getApplicationLocation(int pid)
Find the application file location for a given PID.
Definition
x11extras.cpp:336
X11Extras::~X11Extras
~X11Extras()
Close display connection if one exists.
Definition
x11extras.cpp:49
X11Extras::x11ResetMouseAccelerationChange
void x11ResetMouseAccelerationChange()
Definition
x11extras.cpp:691
X11Extras::windowHasProperty
bool windowHasProperty(Display *display, Window window, Atom atom)
Definition
x11extras.cpp:416
X11Extras::getKnownAliases
QHash< QString, QString > const & getKnownAliases()
Definition
x11extras.cpp:811
X11Extras::getApplicationPid
int getApplicationPid(Window window)
Check window and any parents for the window property "_NET_WM_PID".
Definition
x11extras.cpp:243
X11Extras::checkFeedback
void checkFeedback(XFeedbackState *temp, int &num_feedbacks, int &feedback_id)
Definition
x11extras.cpp:776
X11Extras::display
Display * display()
Get display instance.
Definition
x11extras.cpp:117
X11Extras::populateKnownAliases
void populateKnownAliases()
Definition
x11extras.cpp:154
X11Extras::appRootWindow
unsigned long appRootWindow(int screen=-1)
Return root window for a given X display.
Definition
x11extras.cpp:133
X11Extras::knownAliases
QHash< QString, QString > knownAliases
Definition
x11extras.h:102
X11Extras::freeDisplay
void freeDisplay()
Definition
x11extras.cpp:64
X11Extras::checkPropertyOnWin
void checkPropertyOnWin(bool windowCorrected, Window &window, Window &parent, Window &finalwindow, Window &root, Window *children, Display *display, unsigned int &num_children)
Definition
x11extras.cpp:281
X11Extras::hasValidDisplay
bool hasValidDisplay()
Definition
x11extras.cpp:119
X11Extras::getEnvVariable
const char * getEnvVariable(const char *var) const
Definition
x11extras.cpp:101
X11Extras::setCustomDisplay
static void setCustomDisplay(QString displayString)
Definition
x11extras.cpp:126
X11Extras::_display
Display * _display
Definition
x11extras.h:103
X11Extras::getDisplayString
QString getDisplayString(QString xcodestring)
Get appropriate alias for a known KeySym string that might be blank or contain invalid characters whe...
Definition
x11extras.cpp:144
X11Extras::windowIsViewable
bool windowIsViewable(Display *display, Window window)
Definition
x11extras.cpp:439
X11Extras::getWindowTitle
QString getWindowTitle(Window window)
Definition
x11extras.cpp:486
X11Extras::findClientWindow
Window findClientWindow(Window window)
Find the proper client window within a hierarchy. This check is needed in some environments where the...
Definition
x11extras.cpp:375
X11Extras::getGroup1KeySym
int getGroup1KeySym(int virtualkey)
Definition
x11extras.cpp:605
X11Extras::getInstance
static X11Extras * getInstance()
Definition
x11extras.cpp:73
X11Extras::getPos
QPoint getPos()
Definition
x11extras.cpp:797
X11Extras::findVirtualPtr
void findVirtualPtr(int num_devices, XIDeviceInfo *current_devices, XIDeviceInfo *mouse_device, XIDeviceInfo *all_devices, QString pointerName)
Definition
x11extras.cpp:762
X11Extras::isWindowRelevant
bool isWindowRelevant(Display *display, Window window)
Go through a window's properties and search for an Atom from a defined list. If an Atom is found in a...
Definition
x11extras.cpp:461
X11Extras::getPointInformation
struct ptrInformation getPointInformation()
Definition
x11extras.cpp:792
X11Extras::getWindowClass
QString getWindowClass(Window window)
Definition
x11extras.cpp:536
X11Extras::getXDisplayString
static QString getXDisplayString()
Get QString representation of currently utilized X display.
Definition
x11extras.cpp:603
X11Extras::getWindowInFocus
unsigned long getWindowInFocus()
Definition
x11extras.cpp:574
X11Extras::deleteInstance
static void deleteInstance()
Definition
x11extras.cpp:91
X11Extras::_instance
static X11Extras * _instance
Definition
x11extras.h:89
X11Extras::closeDisplay
void closeDisplay()
CURRENTLY NOT USED.
Definition
x11extras.cpp:124
X11Extras::ptrInformation
Definition
x11extras.h:35
X11Extras::ptrInformation::accelNum
int accelNum
Definition
x11extras.h:38
X11Extras::ptrInformation::accelDenom
int accelDenom
Definition
x11extras.h:39
X11Extras::ptrInformation::ptrInformation
ptrInformation()
Definition
x11extras.h:41
X11Extras::ptrInformation::id
long id
Definition
x11extras.h:36
X11Extras::ptrInformation::threshold
int threshold
Definition
x11extras.h:37
Generated by
1.9.8