-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove some DisplayServer::mouse_get_position
calls
#78472
base: master
Are you sure you want to change the base?
Conversation
db279e3
to
5270c45
Compare
@@ -40,7 +40,7 @@ void EditorTitleBar::gui_input(const Ref<InputEvent> &p_event) { | |||
if (mm->get_button_mask().has_flag(MouseButtonMask::LEFT)) { | |||
Window *w = Object::cast_to<Window>(get_viewport()); | |||
if (w) { | |||
Point2 mouse = DisplayServer::get_singleton()->mouse_get_position(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, it should be global mouse position. EditorTitleBar is a custom editor window title bar used to move window, local coordinates will always go out of sync when window moves. It's used exclusively on macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Viewport::get_embedder_mouse_position()
returns for a non-embedded window the screen coordinates and not the viewport local coordinates.
I have verified, that this change works on Linux by setting EditorTitleBar::can_move = true
.
5270c45
to
ce0c968
Compare
I believe, that with the latest change, this PR makes all calls of |
This PR fixes #86240. |
These functions can get called in situations, where relying on DisplayServer make no sense (e.g. XR or Gui-in-3D Demo). This PR introduces `Viewport::get_embedder_mouse_position()` and adds checks to verify if `DisplayServer::mouse_get_position` can get called.
ce0c968
to
fddf02b
Compare
This PR got partially superseded by #86304. |
These functions can get called in situations, where there is no reasonable DisplayServer available (e.g. XR or Gui-in-3D Demo). This PR introduces
Viewport::get_embedder_mouse_position()
which verifies ifDisplayServer::mouse_get_position
can get called.part of #77189
resolves no longer #86240 (this got fixed in #86304)
get_embedder_mouse_position
)MenuBar
andMenuButton
hover position scaling properly with the scale factor multiplier #86304)MenuBar
andMenuButton
hover position scaling properly with the scale factor multiplier #86304)get_embedder_mouse_position
)get_embedder_mouse_position
)