AntiMicroX
Loading...
Searching...
No Matches
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
29class X11Extras : public QObject
30{
32
33 public:
35 {
36 long id;
40
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);
54 bool hasValidDisplay();
55 QString getDisplayString(QString xcodestring);
60 void closeDisplay();
64 unsigned long getWindowInFocus();
65 int getGroup1KeySym(int virtualkey);
66
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
80
81 protected:
82 explicit X11Extras(QObject *parent = nullptr);
83
88
90
91 public slots:
92 QPoint getPos();
93
94 private:
96 Window *children, Display *display, unsigned int &num_children);
97 void freeDisplay();
101
104};
105
106#endif // X11EXTRAS_H
Definition joydpadxml.h:27
Definition x11extras.h:30
Window findParentClient(Window window)
Definition x11extras.cpp:170
QString getApplicationLocation(int pid)
Find the application file location for a given PID.
Definition x11extras.cpp:336
~X11Extras()
Close display connection if one exists.
Definition x11extras.cpp:49
void x11ResetMouseAccelerationChange()
Definition x11extras.cpp:691
bool windowHasProperty(Display *display, Window window, Atom atom)
Definition x11extras.cpp:416
QHash< QString, QString > const & getKnownAliases()
Definition x11extras.cpp:811
int getApplicationPid(Window window)
Check window and any parents for the window property "_NET_WM_PID".
Definition x11extras.cpp:243
void checkFeedback(XFeedbackState *temp, int &num_feedbacks, int &feedback_id)
Definition x11extras.cpp:776
Display * display()
Get display instance.
Definition x11extras.cpp:117
void populateKnownAliases()
Definition x11extras.cpp:154
unsigned long appRootWindow(int screen=-1)
Return root window for a given X display.
Definition x11extras.cpp:133
QHash< QString, QString > knownAliases
Definition x11extras.h:102
void freeDisplay()
Definition x11extras.cpp:64
void checkPropertyOnWin(bool windowCorrected, Window &window, Window &parent, Window &finalwindow, Window &root, Window *children, Display *display, unsigned int &num_children)
Definition x11extras.cpp:281
bool hasValidDisplay()
Definition x11extras.cpp:119
const char * getEnvVariable(const char *var) const
Definition x11extras.cpp:101
static void setCustomDisplay(QString displayString)
Definition x11extras.cpp:126
Display * _display
Definition x11extras.h:103
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
bool windowIsViewable(Display *display, Window window)
Definition x11extras.cpp:439
QString getWindowTitle(Window window)
Definition x11extras.cpp:486
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
int getGroup1KeySym(int virtualkey)
Definition x11extras.cpp:605
static X11Extras * getInstance()
Definition x11extras.cpp:73
QPoint getPos()
Definition x11extras.cpp:797
void findVirtualPtr(int num_devices, XIDeviceInfo *current_devices, XIDeviceInfo *mouse_device, XIDeviceInfo *all_devices, QString pointerName)
Definition x11extras.cpp:762
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
struct ptrInformation getPointInformation()
Definition x11extras.cpp:792
QString getWindowClass(Window window)
Definition x11extras.cpp:536
static QString getXDisplayString()
Get QString representation of currently utilized X display.
Definition x11extras.cpp:603
unsigned long getWindowInFocus()
Definition x11extras.cpp:574
static void deleteInstance()
Definition x11extras.cpp:91
static X11Extras * _instance
Definition x11extras.h:89
void closeDisplay()
CURRENTLY NOT USED.
Definition x11extras.cpp:124
Definition x11extras.h:35
int accelNum
Definition x11extras.h:38
int accelDenom
Definition x11extras.h:39
ptrInformation()
Definition x11extras.h:41
long id
Definition x11extras.h:36
int threshold
Definition x11extras.h:37