diff options
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LInputDevice.cpp | 112 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LInputDevice.h | 53 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LInputDevice.pri | 13 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.cpp | 3 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.h | 3 |
5 files changed, 3 insertions, 181 deletions
diff --git a/src-qt5/core/libLumina/LInputDevice.cpp b/src-qt5/core/libLumina/LInputDevice.cpp deleted file mode 100644 index d141e39a..00000000 --- a/src-qt5/core/libLumina/LInputDevice.cpp +++ /dev/null @@ -1,112 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "LInputDevice.h" - -//Qt Library includes -#include <QString> -#include <QX11Info> -#include <QDebug> - -//XCB Library includes -#include <xcb/xcb.h> -#include <xcb/xcb_atom.h> -#include <xcb/xinput.h> -#include <xcb/xproto.h> - -//=================== -// 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(){ - -} - -unsigned int LInputDevice::devNumber(){ - return devID; -} - -bool LInputDevice::isPointer(){ - return (devType==XCB_INPUT_DEVICE_USE_IS_X_POINTER \ - || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_POINTER); -} - -bool LInputDevice::isKeyboard(){ - return (devType==XCB_INPUT_DEVICE_USE_IS_X_KEYBOARD \ - || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_KEYBOARD); -} - -bool LInputDevice::isExtension(){ - return (devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE \ - || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_KEYBOARD \ - || 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); - //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); -} -//====================== -// LInput Static Functions -//====================== -QList<LInputDevice*> LInput::listDevices(){ - QList<LInputDevice*> devices; - xcb_input_list_input_devices_cookie_t cookie = xcb_input_list_input_devices_unchecked(QX11Info::connection()); - xcb_input_list_input_devices_reply_t *reply = xcb_input_list_input_devices_reply(QX11Info::connection(), cookie, NULL); - if(reply==0){ return devices; } //error - nothing returned - //Use the iterator for going through the reply - //qDebug() << "Create iterator"; - xcb_input_device_info_iterator_t iter = xcb_input_list_input_devices_devices_iterator(reply); - //xcb_str_iterator_t nameiter = xcb_input_list_input_devices_names_iterator(reply); - - //Now step through the reply - while(iter.data != 0 ){ - devices << new LInputDevice(iter.data->device_id, iter.data->device_use); - //qDebug() << "Found Input Device:" << iter.data->device_id; - //qDebug() << " - num_class_info:" << iter.data->num_class_info; - if(iter.rem>0){ xcb_input_device_info_next(&iter); } - else{ break; } - } - //Free the reply (done with it) - ::free(reply); - //return the information - return devices; -} diff --git a/src-qt5/core/libLumina/LInputDevice.h b/src-qt5/core/libLumina/LInputDevice.h deleted file mode 100644 index f7a4713c..00000000 --- a/src-qt5/core/libLumina/LInputDevice.h +++ /dev/null @@ -1,53 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2016, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This class governs all the XCB input device interactions -// and provides simpler Qt-based functions for use elsewhere -//=========================================== -#ifndef _LUMINA_XCB_INPUT_DEVICES_H -#define _LUMINA_XCB_INPUT_DEVICES_H - -#include <QList> -#include <QString> -#include <QStringList> -#include <QHash> -#include <QVariant> - -#include <xcb/xproto.h> - -class LInputDevice{ -public: - LInputDevice(unsigned int id, unsigned int type); //don't use this directly - use the "listDevices()" function instead - ~LInputDevice(); - - //Device Information - //QString name(); //Return the name of this device - unsigned int devNumber(); - bool isPointer(); - bool isKeyboard(); - bool isExtension(); - - //Property Management - QStringList listProperties(); - QVariant propertyValue(QString prop); - -private: - unsigned int devID; //device ID number - assigned at class creation - unsigned int devType; //device "use" identifier - assigned at class creation - QHash<QString, xcb_atom_t> devProps; //Known device properties <name, atom> - - void getProperties(); - //QString devName; //device name - use this for cross-session management (id #'s can get changed every session) -}; - -//Static functions for overall management -class LInput{ - public: - static QList<LInputDevice*> listDevices(); //NOTE: Make sure you "free()" all the LInputDevice objects when finished - -}; - -#endif diff --git a/src-qt5/core/libLumina/LInputDevice.pri b/src-qt5/core/libLumina/LInputDevice.pri deleted file mode 100644 index e90728ce..00000000 --- a/src-qt5/core/libLumina/LInputDevice.pri +++ /dev/null @@ -1,13 +0,0 @@ - -QT *= x11extras - -LIBS *= -lc -lxcb -lxcb-xinput - -#LUtils Files -SOURCES *= $${PWD}/LInputDevice.cpp -HEADERS *= $${PWD}/LInputDevice.h - -INCLUDEPATH *= ${PWD} - -#include LUtils and LuminaOS -#include(LUtils.pri) diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index a8016460..3708af6d 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2014-2016, Ken Moore +// Copyright (c) 2014-2015, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -1124,7 +1124,6 @@ void LXCB::closeSystemTray(WId trayID){ xcb_destroy_window(QX11Info::connection(), trayID); } - // === SetScreenWorkArea() === /*void LXCB::SetScreenWorkArea(unsigned int screen, QRect rect){ //This is only useful because Fluxbox does not set the _NET_WORKAREA root atom diff --git a/src-qt5/core/libLumina/LuminaX11.h b/src-qt5/core/libLumina/LuminaX11.h index 2c741111..7b6cce3c 100644 --- a/src-qt5/core/libLumina/LuminaX11.h +++ b/src-qt5/core/libLumina/LuminaX11.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2014-2016, Ken Moore +// Copyright (c) 2014-2015, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -161,6 +161,7 @@ public: WId startSystemTray(int screen = 0); //Startup the system tray (returns window ID for tray) void closeSystemTray(WId); //Close the system tray + //============ // WM Functions (directly changing/reading properties) // - Using these directly may prevent the WM from seeing the change |