Fix invisible cairo caret issue.

Do more check of Cairo context before using it.

https://code.google.com/p/pcmanx-gtk2/issues/detail?id=68