[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-desktop/andriy/keyboard] kcms/keyboard: resurrect restoring keyboard layouts when new keyboa
From: Andriy Rysin <arysin () gmail ! com>
Date: 2014-10-06 14:03:40
Message-ID: E1Xb8t2-0007E8-4r () scm ! kde ! org
[Download RAW message or body]
Git commit e574158445f28238a1eb7876f80c4d9d8b88006a by Andriy Rysin.
Committed on 06/10/2014 at 13:21.
Pushed by rysin into branch 'andriy/keyboard'.
resurrect restoring keyboard layouts when new keyboard device is plugged in
M +12 -12 kcms/keyboard/xinput_helper.cpp
M +1 -0 kcms/keyboard/xinput_helper.h
http://commits.kde.org/plasma-desktop/e574158445f28238a1eb7876f80c4d9d8b88006a
diff --git a/kcms/keyboard/xinput_helper.cpp b/kcms/keyboard/xinput_helper.cpp
index f4d72f1..83a8359 100644
--- a/kcms/keyboard/xinput_helper.cpp
+++ b/kcms/keyboard/xinput_helper.cpp
@@ -28,6 +28,7 @@
#ifdef HAVE_XINPUT_AND_DEVICE_NOTIFY
#include <X11/extensions/XInput.h>
+#include <xcb/xinput.h>
#endif
#include "x11_helper.h"
@@ -78,9 +79,9 @@ bool XInputEventNotifier::processOtherEvents(xcb_generic_event_t* event)
#ifdef HAVE_XINPUT_AND_DEVICE_NOTIFY
-extern "C" {
- extern int _XiGetDevicePresenceNotifyEvent(Display *);
-}
+//extern "C" {
+// extern int _XiGetDevicePresenceNotifyEvent(Display *);
+//}
// This is ugly but allows to skip multiple execution of setxkbmap
// for all keyboard devices that don't care about layouts
@@ -96,17 +97,16 @@ int XInputEventNotifier::getNewDeviceEventType(xcb_generic_event_t* event)
{
int newDeviceType = DEVICE_NONE;
-#if 0
- if( xinputEventType != -1 && event->type == xinputEventType ) {
- XDevicePresenceNotifyEvent *xdpne = (XDevicePresenceNotifyEvent*) event;
+ if( xinputEventType != -1 && event->response_type == xinputEventType ) {
+ xcb_input_device_presence_notify_event_t *xdpne = reinterpret_cast<xcb_input_device_presence_notify_event_t *>(event);
if( xdpne->devchange == DeviceEnabled ) {
int ndevices;
- XDeviceInfo *devices = XListInputDevices(xdpne->display, &ndevices);
+ XDeviceInfo *devices = XListInputDevices(display, &ndevices);
if( devices != NULL ) {
-// qCDebug(KCM_KEYBOARD, ) << "New device id:" << xdpne->deviceid;
+ qCDebug(KCM_KEYBOARD) << "New device id:" << xdpne->device_id;
for(int i=0; i<ndevices; i++) {
-// qCDebug(KCM_KEYBOARD, ) << "id:" << devices[i].id << "name:" << devices[i].name << "used as:" << devices[i].use;
- if( devices[i].id == xdpne->deviceid ) {
+ qCDebug(KCM_KEYBOARD) << "id:" << devices[i].id << "name:" << devices[i].name << "used as:" << devices[i].use;
+ if( devices[i].id == xdpne->device_id ) {
if( devices[i].use == IsXKeyboard || devices[i].use == IsXExtensionKeyboard ) {
if( isRealKeyboard(devices[i].name) ) {
newDeviceType = DEVICE_KEYBOARD;
@@ -125,14 +125,14 @@ int XInputEventNotifier::getNewDeviceEventType(xcb_generic_event_t* event)
}
}
}
-#endif
return newDeviceType;
}
-int XInputEventNotifier::registerForNewDeviceEvent(Display* display)
+int XInputEventNotifier::registerForNewDeviceEvent(Display* display_)
{
int xitype;
XEventClass xiclass;
+ display = display_;
DevicePresence(display, xitype, xiclass);
XSelectExtensionEvent(display, DefaultRootWindow(display), &xiclass, 1);
diff --git a/kcms/keyboard/xinput_helper.h b/kcms/keyboard/xinput_helper.h
index 9251530..af70365 100644
--- a/kcms/keyboard/xinput_helper.h
+++ b/kcms/keyboard/xinput_helper.h
@@ -53,6 +53,7 @@ private:
int getNewDeviceEventType(xcb_generic_event_t* event);
int xinputEventType;
+ Display* display;
};
#endif /* XINPUT_HELPER_H_ */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic