How to utilize mouse / keyboard events on the main canvas?

I know that we can utilize mouse events easily in a dialogue’s canvas. But I can’t find in the api documents how to do it in the main canvas.

Any help is appreciated. Thank you very much in advance.