app: clenup and fixes in gimp_display_shell_format_title()

Get the active drawable once instead of several times and always check
if it exists before using it. Also fix an xres/yres confusion.