aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/LInputDevice.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-11-21 10:05:11 -0500
committerKen Moore <ken@ixsystems.com>2016-11-21 10:05:11 -0500
commitff63b6fb460e467488257ba94a23e95912045f6e (patch)
treef30016141a3035f3ff74d70d2c32151b46692c92 /src-qt5/core/libLumina/LInputDevice.cpp
parentAdd a new menu plugin: "lockdesktop". (diff)
parentFix a reference to an uncommitted function by q5sys. (diff)
downloadlumina-ff63b6fb460e467488257ba94a23e95912045f6e.tar.gz
lumina-ff63b6fb460e467488257ba94a23e95912045f6e.tar.bz2
lumina-ff63b6fb460e467488257ba94a23e95912045f6e.zip
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/core/libLumina/LInputDevice.cpp')
-rw-r--r--src-qt5/core/libLumina/LInputDevice.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/src-qt5/core/libLumina/LInputDevice.cpp b/src-qt5/core/libLumina/LInputDevice.cpp
index 79f5c27f..d141e39a 100644
--- a/src-qt5/core/libLumina/LInputDevice.cpp
+++ b/src-qt5/core/libLumina/LInputDevice.cpp
@@ -15,12 +15,17 @@
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xinput.h>
+#include <xcb/xproto.h>
-// LInputDevice Class
+//===================
+// LInputDevice Class
+//===================
+// === PUBLIC ===
LInputDevice::LInputDevice(unsigned int id, unsigned int type){
devID = id;
devType = type;
//devName = name;
+ getProperties(); //need to populate the name/atom correlations for properties
}
LInputDevice::~LInputDevice(){
@@ -47,18 +52,37 @@ bool LInputDevice::isExtension(){
|| devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_POINTER);
}
+// Property Management
QStringList LInputDevice::listProperties(){
+ return devProps.keys();
+}
+
+QVariant LInputDevice::propertyValue(QString prop){
+ if(!devProps.contains(prop)){ return QVariant(); }
+ //Now generate the property request
+ // xcb_input_get_device_property_cookie_t cookie = xcb_input_get_device_property_unchecked( QX11Info::connection(), devProps.value(prop), \
+// XCB_ATOM_ATOM, 0, 1000, devID, NULL);
+ QVariant result;
+ return result;
+}
+
+// === PRIVATE ===
+void LInputDevice::getProperties(){
+ devProps.clear();
xcb_input_list_device_properties_cookie_t cookie = xcb_input_list_device_properties_unchecked(QX11Info::connection(), devID);
xcb_input_list_device_properties_reply_t *reply = xcb_input_list_device_properties_reply(QX11Info::connection(), cookie, NULL);
- qDebug() << "Property List:";
- qDebug() << " - response_type:" << reply->response_type;
- qDebug() << " - num atoms:" << reply->num_atoms;
- qDebug() << " - length:" << reply->length;
- qDebug() << " - sequence:" << reply->sequence;
+ //Get the atoms
+ xcb_atom_t *atoms = xcb_input_list_device_properties_atoms(reply);
+ //qDebug() << "Property Response Type:" << reply->response_type; //Always seems to be "1"
+ QList<xcb_get_atom_name_cookie_t> cookies;
+ for(int i=0; i<reply->num_atoms; i++){ cookies << xcb_get_atom_name(QX11Info::connection(), atoms[i]); }
+ for(int i=0; i<reply->num_atoms; i++){
+ xcb_get_atom_name_reply_t *nr = xcb_get_atom_name_reply(QX11Info::connection(), cookies[i], NULL);
+ devProps.insert(QString::fromUtf8( xcb_get_atom_name_name(nr), xcb_get_atom_name_name_length(nr) ),atoms[i] );
+ ::free(nr);
+ }
//Done with data structure
::free(reply);
- //Return info
- return QStringList();
}
//======================
// LInput Static Functions
bgstack15