app: add gimp_get_monitor_at_pointer()

and use it instead of duplicating that code several times.