You just declare a pointer:
And try to write there in the next lines, while the pointer still doesn't point to any valid object:
win->topX = topX;
You probably wanted to create a new object:
Window *win = (Window*)malloc(sizeof(Window));
Keep in mind that
Foo *bar = (Foo*)malloc(sizeof(Foo));
is a different things.