better debug output formatting: XML v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Thu, 01 Apr 2021 21:09:58 +0200
branchv_0
changeset 7 93d9c4fce585
parent 6 3407386d1f60
child 8 6f5616572273
better debug output formatting: XML
src/X11Handler.h
--- a/src/X11Handler.h	Thu Apr 01 18:55:32 2021 +0200
+++ b/src/X11Handler.h	Thu Apr 01 21:09:58 2021 +0200
@@ -136,13 +136,13 @@
 
 		if (attributeIndex % attributes.size() == 0) {
 			if (currentEvent.type == Event::Type::KEY) {
-				if (debug) std::wcerr << L"KEY:    x = " << currentEvent.x << L" y = " << currentEvent.y << L"    key = " << currentEvent.key << L" state = " << (currentEvent.state == Event::State::PRESSED ? L"pressed" : L"released") << std::endl;
+				if (debug) std::wcerr << L"<key    x=\"" << currentEvent.x << L"\" y=\"" << currentEvent.y << L"\"    code=\"" << currentEvent.key << L"\" state=\"" << (currentEvent.state == Event::State::PRESSED ? L"pressed" : L"released") << L"\"/>" << std::endl;
 				if (run) XTestFakeKeyEvent(display.display, currentEvent.key, currentEvent.state == Event::State::PRESSED, currentEvent.delay);
 			} else if (currentEvent.type == Event::Type::BUTTON) {
-				if (debug) std::wcerr << L"BUTTON: x = " << currentEvent.x << L" y = " << currentEvent.y << L" button = " << currentEvent.button << L" state = " << (currentEvent.state == Event::State::PRESSED ? L"pressed" : L"released") << std::endl;
+				if (debug) std::wcerr << L"<button x=\"" << currentEvent.x << L"\" y=\"" << currentEvent.y << L"\"    code=\"" << currentEvent.button << L"\" state=\"" << (currentEvent.state == Event::State::PRESSED ? L"pressed" : L"released") << L"\"/>" << std::endl;
 				if (run) XTestFakeButtonEvent(display.display, currentEvent.button, currentEvent.state == Event::State::PRESSED, currentEvent.delay);
 			} else if (currentEvent.type == Event::Type::MOTION) {
-				if (debug) std::wcerr << L"MOTION: x = " << currentEvent.x << L" y = " << currentEvent.y << std::endl;
+				if (debug) std::wcerr << L"<motion x=\"" << currentEvent.x << L"\" y=\"" << currentEvent.y << L"\"/>" << std::endl;
 				if (run) XTestFakeMotionEvent(display.display, currentEvent.screen, currentEvent.x, currentEvent.y, currentEvent.delay);
 			} else {
 				std::wcerr << L"Unsupported event" << std::endl;