Implement Element.matches().
Move compositor event handling code to a new `events` module

Also, make them free functions rather than static methods on
CompositorData.
Merge pull request #2789 from zwarich/compositor-events

Move compositor event handling code to a new `events` module
Merge pull request #2772 from saneyuki/match

Implement Element.matches().
Revert "Implement Element.matches()."

This reverts commit b6edd5318f3fe5c751d1c011e87adbfe0cac4fcc.