- unsigned index=devices.size();
- devices.push_back(&dev);
- dev.signal_button_press.connect(sigc::bind(sigc::mem_fun(this, &Hub::button_press), index));
- dev.signal_button_release.connect(sigc::bind(sigc::mem_fun(this, &Hub::button_release), index));
- dev.signal_axis_motion.connect(sigc::bind(sigc::mem_fun(this, &Hub::axis_motion), index));
- return index;
+ unsigned tag = hash32(dev.get_name(), 20);
+ while(devices.count(tag))
+ ++tag;
+
+ devices[tag] = &dev;
+ dev.signal_button_press.connect(sigc::bind_return(sigc::bind(sigc::mem_fun(this, &Hub::button_press), tag), false));
+ dev.signal_button_release.connect(sigc::bind_return(sigc::bind(sigc::mem_fun(this, &Hub::button_release), tag), false));
+ dev.signal_axis_motion.connect(sigc::bind_return(sigc::bind(sigc::mem_fun(this, &Hub::axis_motion), tag), false));