more flexible window implementation
moved window input handling into window.c
made all functions static