fix the contextmenu position when the pointer is near a screen edge