Merge "Fix the logic for mouse event handling."