Bug 705182 Reset Cocoa IME state when immodule is reset

Commits the pre-edit string on receipt of focus_out and reset
commands.
Patch refinements by Cody Russell <bratsche@gnome.org> and
Ek Kato <ek.kato@gmail.com>
Fix a crasher that was introduced by 9ca802161ec6387419d160f21fe477008a567477
due to preedit_str being initialized as an empty string rather than NULL.