output: initialize layers and signal before using functions
output: initialize layers and signal before using functions

The previous pull request #2993 tried to fix this by moving the function which
used the layers after the initilization.
Since this initialization is done unconditionally only depending on the struct
definition, move the layer initialization to the beginning of the function.
Also move the signal initialization of the destroy event.

Fixes #2992

ascent12/sway,1ace/sway,ascent12/sway,1ace/sway,SirCmpwn/sway,1ace/sway,ascent12/sway