native-wayland: code cleanup, refactoring