source: packages/Xorg/lib/qt4/patches/500-allow-device-grabbing.patch @ 26780

Last change on this file since 26780 was 26780, checked in by mirko, 6 years ago

[packages/qt4] allow configure 'grabbing' of linuxinput devices (via ioctl EVIOCGRAB) -
without 'grabbing' all keystrokes are passed to other applications as well as to possible underlying ttys / shells

File size: 2.4 KB
  • qt-everywhere-opensource-src-4.7.0/src/gui/embedded/qkbdlinuxinput_qws.cpp

    old new  
    103103    QString dev = QLatin1String("/dev/input/event1"); 
    104104    int repeat_delay = -1; 
    105105    int repeat_rate = -1; 
     106    int grab = 0; 
    106107 
    107108    QStringList args = device.split(QLatin1Char(':')); 
    108109    foreach (const QString &arg, args) { 
     
    110111            repeat_delay = arg.mid(13).toInt(); 
    111112        else if (arg.startsWith(QLatin1String("repeat-rate="))) 
    112113            repeat_rate = arg.mid(12).toInt(); 
     114        else if (arg.startsWith(QLatin1String("grab="))) 
     115            grab = arg.mid(5).toInt(); 
    113116        else if (arg.startsWith(QLatin1String("/dev/"))) 
    114117            dev = arg; 
    115118    } 
    116119 
    117120    m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0); 
    118121    if (m_fd >= 0) { 
     122        ::printf("grab kbd: %d\n", grab); 
     123        ::ioctl(m_fd, EVIOCGRAB, grab); 
    119124        if (repeat_delay > 0 && repeat_rate > 0) { 
    120125            int kbdrep[2] = { repeat_delay, repeat_rate }; 
    121126            ::ioctl(m_fd, EVIOCSREP, kbdrep); 
  • qt-everywhere-opensource-src-4.7.0/src/gui/embedded/qmouselinuxinput_qws.cpp

    old new  
    4343 
    4444#include <QScreen> 
    4545#include <QSocketNotifier> 
     46#include <QStringList> 
    4647 
    4748#include <qplatformdefs.h> 
    4849#include <private/qcore_unix_p.h> // overrides QT_OPEN 
     
    101102    setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler")); 
    102103 
    103104    QString dev = QLatin1String("/dev/input/event0"); 
    104     if (device.startsWith(QLatin1String("/dev/"))) 
    105         dev = device; 
     105    int grab = 0; 
     106 
     107    QStringList args = device.split(QLatin1Char(':')); 
     108    foreach (const QString &arg, args) { 
     109        if (arg.startsWith(QLatin1String("grab="))) 
     110            grab = arg.mid(5).toInt(); 
     111        else if (arg.startsWith(QLatin1String("/dev/"))) 
     112            dev = arg; 
     113    } 
    106114 
    107115    m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); 
    108116    if (m_fd >= 0) { 
     117        ::printf("grab mouse: %d\n", grab); 
     118        ::ioctl(m_fd, EVIOCGRAB, grab); 
    109119        m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); 
    110120        connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); 
    111121    } else { 
Note: See TracBrowser for help on using the repository browser.