summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-02-26 15:34:56 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-02-26 15:34:56 +1030
commit3994c4868421752803bbd10f07ab64587d68a7b9 (patch)
treec23b6dc005f4111bf3dc71de68b2bf5cc7a6a531
parent0199815220ba7d548dceb9b5153edfd55c417ea4 (diff)
Remove rescan pairing, the XGetPairedPointer() doesn't existin anymore.
Instead, this info is in the attached field of the ListInputDevices request.
-rw-r--r--src/Manager.cpp47
-rw-r--r--src/Manager.h1
2 files changed, 27 insertions, 21 deletions
diff --git a/src/Manager.cpp b/src/Manager.cpp
index 4db53ef..f6b7ee6 100644
--- a/src/Manager.cpp
+++ b/src/Manager.cpp
@@ -148,7 +148,19 @@ void Manager::initXi()
{
KeyboardDevice *k = new KeyboardDevice(currDevice, x11, this);
keyboards.push_back(k);
- //dock->appendKeyboard(k);
+ /* run through classes, find attach class to get the
+ paried pointer.*/
+ XAnyClassPtr any = currDevice->inputclassinfo;
+ for (int i = 0; i < currDevice->num_classes; i++) {
+ switch(any->c_class)
+ {
+ case AttachClass:
+ XAttachInfoPtr att = (XAttachInfoPtr)any;
+ k->setPaired(idToPointerDevice(att->attached));
+ break;
+ }
+ any = (XAnyClassPtr) ((char *) any + any->length);
+ }
} catch (DeviceError* e)
{
ERR("%s\n", e->message.c_str());
@@ -159,26 +171,9 @@ void Manager::initXi()
dock->setPointerEvents(&pointers);
XFreeDeviceList(devices);
- rescanPairings();
-
XSelectExtensionEvent(x11->dpy, x11->root, &x11->presence_class, 1);
}
-void Manager::rescanPairings()
-{
- vector<KeyboardDevice*>::const_iterator it = keyboards.begin();
- XID ptr_id;
- while(it != keyboards.end())
- {
- if (XGetPairedPointer(x11->dpy, (*it)->getDevice(), &ptr_id))
- {
- (*it)->setPaired(idToPointerDevice(ptr_id));
- }
- it++;
- }
-
-}
-
/**
* Disconnect from X and bring down any allocated memory.
*/
@@ -823,9 +818,21 @@ void Manager::handlePresenceNotify(XDevicePresenceNotifyEvent* ev)
{
KeyboardDevice *k = new KeyboardDevice(current, x11, this);
keyboards.push_back(k);
- //dock->appendKeyboard(k);
dock->setPointerEvents(&pointers);
- rescanPairings();
+ /* run through classes, find attach class to get the
+ paried pointer.*/
+ XAnyClassPtr any = current->inputclassinfo;
+ for (int i = 0; i < current->num_classes; i++) {
+ switch(any->c_class)
+ {
+ case AttachClass:
+ XAttachInfoPtr att = (XAttachInfoPtr)any;
+ k->setPaired(idToPointerDevice(att->attached));
+ break;
+ }
+ any = (XAnyClassPtr) ((char *) any + any->length);
+ }
+
} catch (DeviceError* e)
{
ERR("%s\n", e->message.c_str());
diff --git a/src/Manager.h b/src/Manager.h
index 220c503..3f717a7 100644
--- a/src/Manager.h
+++ b/src/Manager.h
@@ -77,7 +77,6 @@ class Manager
WMWindow* windowToWMWindow(Window w);
WMWindow* xyToWMWindow(int x, int y);
void raiseWindow(WMWindow* wmwindow);
- void rescanPairings();
/* event processing routines */
void handleCreateNotify(XCreateWindowEvent* ev);