Git commit aac3a7489f8ee1e606c3fe5a21f58f607067b5c0 by shivam makkar. Committed on 01/06/2014 at 00:48. Pushed by makkar into branch 'amourphious/keyboard'. ported XEventNotifier::getNewDeviceEventType(xcb_generic_event_t *event) M +0 -4 kcms/keyboard/flags.cpp M +32 -34 kcms/keyboard/xinput_helper.cpp http://commits.kde.org/plasma-desktop/aac3a7489f8ee1e606c3fe5a21f58f607067b= 5c0 diff --git a/kcms/keyboard/flags.cpp b/kcms/keyboard/flags.cpp index 3fb98e5..5206d1d 100644 --- a/kcms/keyboard/flags.cpp +++ b/kcms/keyboard/flags.cpp @@ -18,10 +18,6 @@ = #include "flags.h" = -<<<<<<< HEAD -=3D=3D=3D=3D=3D=3D=3D -//#include ->>>>>>> b756db51d8293b4a96ab851f9174e48f8ef36429 #include #include #include diff --git a/kcms/keyboard/xinput_helper.cpp b/kcms/keyboard/xinput_helper.= cpp index 980338e..1c9604b 100644 --- a/kcms/keyboard/xinput_helper.cpp +++ b/kcms/keyboard/xinput_helper.cpp @@ -37,12 +37,16 @@ static int DEVICE_NONE =3D 0; static int DEVICE_KEYBOARD =3D 1; static int DEVICE_POINTER =3D 2; +static int connectedDevices; +static int addedDevices =3D 0; = = XInputEventNotifier::XInputEventNotifier(QWidget* parent): XEventNotifier(parent), //TODO: destruct properly? xinputEventType(-1) { + XListInputDevices(QX11Info::display(), &connectedDevices); + qDebug()<<"initializing connectedDevices to: "<type =3D=3D xinputEventType ) { - XDevicePresenceNotifyEvent *xdpne =3D (XDevicePresenceNotifyEvent*) even= t; - if( xdpne->devchange =3D=3D DeviceEnabled ) { - int ndevices; - XDeviceInfo *devices =3D XListInputDevices(xdpne->display, &ndevices); - if( devices !=3D NULL ) { -// kDebug() << "New device id:" << xdpne->deviceid; - for(int i=3D0; ideviceid ) { - if( devices[i].use =3D=3D IsXKeyboard || devices[i].use =3D=3D IsXEx= tensionKeyboard ) { - if( isRealKeyboard(devices[i].name) ) { - newDeviceType =3D DEVICE_KEYBOARD; - qDebug() << "new keyboard device, id:" << devices[i].id << "name:"= << devices[i].name << "used as:" << devices[i].use; - break; - } - } - if( devices[i].use =3D=3D IsXPointer || devices[i].use =3D=3D IsXExt= ensionPointer ) { - newDeviceType =3D DEVICE_POINTER; - qDebug() << "new pointer device, id:" << devices[i].id << "name:" <= < devices[i].name << "used as:" << devices[i].use; - break; - } - } - } - XFreeDeviceList(devices); - } - } - } -#endif + int ndevices; + XDeviceInfo *devices =3D XListInputDevices(QX11Info::display(), &ndevi= ces); + if((ndevices > connectedDevices && addedDevices < 20)){ + addedDevices++; + qDebug() << "id:" << devices[ndevices - 1].id << "name:" << device= s[ndevices - 1].name << "used as:" << devices[ndevices-1].use; + if( devices[ndevices - 1].use =3D=3D IsXKeyboard || devices[ndevic= es - 1].use =3D=3D IsXExtensionKeyboard ) { + if( isRealKeyboard(devices[ndevices - 1].name) ) { + newDeviceType =3D DEVICE_KEYBOARD; + qDebug() << "new keyboard device, id:" << devices[ndevices= - 1].id << "name:" << devices[ndevices - 1].name << "used as:" << devices[= ndevices - 1].use; + } + } + if( devices[ndevices - 1].use =3D=3D IsXPointer || devices[ndevice= s - 1].use =3D=3D IsXExtensionPointer ) { + newDeviceType =3D DEVICE_POINTER; + qDebug() << "new pointer device, id:" << devices[ndevices - 1]= .id << "name:" << devices[ndevices - 1].name << "used as:" << devices[ndevi= ces - 1].use; + } + } + else{ + connectedDevices =3D ndevices; + addedDevices =3D 0; + } + if(addedDevices =3D=3D 20){ + connectedDevices =3D ndevices; + addedDevices =3D 0; + } return newDeviceType; } =20