X11 demo fixes

@rm5248 please review and test to ensure your original functionality still works

The merge pulled in some incomplete duplicate code that was breaking the build, and there was an incomplete implementation of extracting window IDs from XQueryTree results.