Fix PopupMenu behavior on MacOS when multiple monitors are used
* DisplayServerOSX::mouse_get_position returns wrong x axis data in multi-monitor case, which makes mouse_process_popups send WINDOW_EVENT_CLOSE_REQUEST, then eventually make PopupMenu close on mouse down without activating item.
This commit is contained in:
parent
bab2ad4d32
commit
6866eee641
|
@ -1682,7 +1682,11 @@ Point2i DisplayServerOSX::mouse_get_position() const {
|
|||
for (NSScreen *screen in [NSScreen screens]) {
|
||||
NSRect frame = [screen frame];
|
||||
if (NSMouseInRect(mouse_pos, frame, NO)) {
|
||||
return Vector2i((int)mouse_pos.x, (int)-mouse_pos.y) * scale + _get_screens_origin();
|
||||
Vector2i pos = Vector2i((int)mouse_pos.x, (int)mouse_pos.y);
|
||||
pos *= scale;
|
||||
pos -= _get_screens_origin();
|
||||
pos.y *= -1;
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
return Vector2i();
|
||||
|
|
Loading…
Reference in New Issue