From: Jon A. Cruz Date: Sat, 10 Apr 2010 05:21:31 +0000 (-0700) Subject: Do not emit signals when setting values to their existing state. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=28544bc443a39b5878cb360b8a4dd3bf02edc6fe;p=inkscape.git Do not emit signals when setting values to their existing state. --- diff --git a/src/device-manager.cpp b/src/device-manager.cpp index 29e15b05a..b71cca059 100644 --- a/src/device-manager.cpp +++ b/src/device-manager.cpp @@ -403,10 +403,9 @@ void DeviceManagerImpl::setMode( Glib::ustring const & id, Gdk::InputMode mode ) { std::list >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id)); if ( it != devices.end() ) { - if (isValidDevice((*it)->getDevice())) { + if (isValidDevice((*it)->getDevice()) && ((*it)->getMode() != mode) ) { bool success = gdk_device_set_mode((*it)->getDevice(), static_cast(mode)); if (success) { - //(*it)->setMode(mode); signalDeviceChangedPriv.emit(*it); } else { g_warning("Unable to set mode on extended input device [%s]", (*it)->getId().c_str()); @@ -420,8 +419,14 @@ void DeviceManagerImpl::setAxisUse( Glib::ustring const & id, guint index, Gdk:: std::list >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id)); if ( it != devices.end() ) { if (isValidDevice((*it)->getDevice())) { - gdk_device_set_axis_use((*it)->getDevice(), index, static_cast(use)); - signalDeviceChangedPriv.emit(*it); + if (static_cast(index) <= (*it)->getNumAxes()) { + if ((*it)->getDevice()->axes[index].use != static_cast(use)) { + gdk_device_set_axis_use((*it)->getDevice(), index, static_cast(use)); + signalDeviceChangedPriv.emit(*it); + } + } else { + g_warning("Invalid device axis number %d on extended input device [%s]", index, (*it)->getId().c_str()); + } } } }