diff options
author | Ken Moore <ken@ixsystems.com> | 2016-11-20 13:22:08 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-11-20 13:22:08 -0500 |
commit | c79aa5623796f62aa67b2c37367e28710b0f05d2 (patch) | |
tree | baf3f6ea9b462bb35bb71679639dbc345b36f400 /src-qt5/core | |
parent | Revert "comment out changes made to wrong repo, until method can be fixed" (diff) | |
download | lumina-c79aa5623796f62aa67b2c37367e28710b0f05d2.tar.gz lumina-c79aa5623796f62aa67b2c37367e28710b0f05d2.tar.bz2 lumina-c79aa5623796f62aa67b2c37367e28710b0f05d2.zip |
Revert "Revert "search clear function on ESC press""
This reverts commit 151062b99e29e18dbc614bf66582f908c864a96a.
Diffstat (limited to 'src-qt5/core')
-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 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf | 7 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf | 14 |
7 files changed, 195 insertions, 10 deletions
diff --git a/src-qt5/core/libLumina/LInputDevice.cpp b/src-qt5/core/libLumina/LInputDevice.cpp new file mode 100644 index 00000000..d141e39a --- /dev/null +++ b/src-qt5/core/libLumina/LInputDevice.cpp @@ -0,0 +1,112 @@ +//=========================================== +// 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 new file mode 100644 index 00000000..f7a4713c --- /dev/null +++ b/src-qt5/core/libLumina/LInputDevice.h @@ -0,0 +1,53 @@ +//=========================================== +// 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 new file mode 100644 index 00000000..e90728ce --- /dev/null +++ b/src-qt5/core/libLumina/LInputDevice.pri @@ -0,0 +1,13 @@ + +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 3708af6d..a8016460 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-2015, Ken Moore +// Copyright (c) 2014-2016, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -1124,6 +1124,7 @@ 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 7b6cce3c..2c741111 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-2015, Ken Moore +// Copyright (c) 2014-2016, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -161,7 +161,6 @@ 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 diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf index 9b819e7c..56ff8b84 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf @@ -42,6 +42,13 @@ mime_default_unknown/*=lumina-textedit.desktop mime_default_application/x-shellscript=lumina-textedit.desktop mime_default_application/pdf_ifexists=pc-pdfviewer.desktop mime_default_application/pdf_ifexists=okular.desktop +mime_default_application/zip_ifexists=lumina-archiver.desktop +mime_default_application/x-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-xz-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-tar_ifexists=lumina-archiver.desktop #THEME SETTINGS theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index 4950b1a0..46d00053 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -36,13 +36,13 @@ session_default_email_ifexists=trojita.desktop mime_default_text/*_ifexists=lumina-textedit.desktop mime_default_audio/*_ifexists=vlc.desktop mime_default_video/*_ifexists=vlc.desktop -mime_default_application/zip_ifexists=peazip.desktop -mime_default_application/x-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-tar_ifexists=peazip.desktop +mime_default_application/zip_ifexists=lumina-archiver.desktop +mime_default_application/x-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-xz-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-tar_ifexists=lumina-archiver.desktop mime_default_unknown/*=lumina-textedit.desktop mime_default_application/x-shellscript=lumina-textedit.desktop |