At present xdg-screensaver contains several almost-identical functions to deal with the various desktops that implement the Freedesktop desktop idleness inhibition DBus API, or something like it.
One example is the code for MATE, which bears the following comment:
# DBUS interface for mate-screensaver
# This is same as gnome's for now but may change in the future as MATE
# does not follow gnome's developement necessarily.
I think this is an unfortunate attitude to take with respect to Freedesktop standards in Freedesktop project code. We should be optimistic about the adoption of standards, and encourage their use.
Hence, I suggest that the following functions have their common code factored out:
screensaver_freedesktop (ironically only used for KDE)
screensaver_gnome_screensaver (also used for GNOME 3's gnome-shell)
Even some DBus end-points not covered by the Freedesktop spec, such as "SimulateUserActivity" are common between most or all of the above, with the exception of a different prefix.