You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
Merge pull request #108604 from deralmas/fitting-shenanigans
Wayland: Workaround tooltip issues
This commit is contained in:
@@ -4655,6 +4655,7 @@ void EditorHelpBitTooltip::popup_under_cursor() {
|
|||||||
vr = window->get_usable_parent_rect();
|
vr = window->get_usable_parent_rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SELF_FITTING_WINDOWS) || is_embedded()) {
|
||||||
if (r.size.x + r.position.x > vr.size.x + vr.position.x) {
|
if (r.size.x + r.position.x > vr.size.x + vr.position.x) {
|
||||||
// Place it in the opposite direction. If it fails, just hug the border.
|
// Place it in the opposite direction. If it fails, just hug the border.
|
||||||
r.position.x = mouse_pos.x - r.size.x - tooltip_offset.x;
|
r.position.x = mouse_pos.x - r.size.x - tooltip_offset.x;
|
||||||
@@ -4676,6 +4677,7 @@ void EditorHelpBitTooltip::popup_under_cursor() {
|
|||||||
} else if (r.position.y < vr.position.y) {
|
} else if (r.position.y < vr.position.y) {
|
||||||
r.position.y = vr.position.y;
|
r.position.y = vr.position.y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip.
|
// When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip.
|
||||||
// This way, clicks and double-clicks are still available outside the tooltip.
|
// This way, clicks and double-clicks are still available outside the tooltip.
|
||||||
|
|||||||
@@ -1049,7 +1049,7 @@ void DisplayServerWayland::window_set_drop_files_callback(const Callable &p_call
|
|||||||
}
|
}
|
||||||
|
|
||||||
int DisplayServerWayland::window_get_current_screen(DisplayServer::WindowID p_window_id) const {
|
int DisplayServerWayland::window_get_current_screen(DisplayServer::WindowID p_window_id) const {
|
||||||
ERR_FAIL_COND_V(p_window_id != MAIN_WINDOW_ID, INVALID_SCREEN);
|
ERR_FAIL_COND_V(!windows.has(p_window_id), INVALID_SCREEN);
|
||||||
// Standard Wayland APIs don't support getting the screen of a window.
|
// Standard Wayland APIs don't support getting the screen of a window.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1678,6 +1678,7 @@ void Viewport::_gui_show_tooltip_at(const Point2i &p_pos) {
|
|||||||
r.size = r.size.ceil();
|
r.size = r.size.ceil();
|
||||||
r.size = r.size.min(panel->get_max_size());
|
r.size = r.size.min(panel->get_max_size());
|
||||||
|
|
||||||
|
if (!DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SELF_FITTING_WINDOWS) || gui.tooltip_popup->is_embedded()) {
|
||||||
if (r.size.x + r.position.x > vr.size.x + vr.position.x) {
|
if (r.size.x + r.position.x > vr.size.x + vr.position.x) {
|
||||||
// Place it in the opposite direction. If it fails, just hug the border.
|
// Place it in the opposite direction. If it fails, just hug the border.
|
||||||
r.position.x = gui.tooltip_pos.x - r.size.x - tooltip_offset.x;
|
r.position.x = gui.tooltip_pos.x - r.size.x - tooltip_offset.x;
|
||||||
@@ -1699,6 +1700,7 @@ void Viewport::_gui_show_tooltip_at(const Point2i &p_pos) {
|
|||||||
} else if (r.position.y < vr.position.y) {
|
} else if (r.position.y < vr.position.y) {
|
||||||
r.position.y = vr.position.y;
|
r.position.y = vr.position.y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DisplayServer::WindowID active_popup = DisplayServer::get_singleton()->window_get_active_popup();
|
DisplayServer::WindowID active_popup = DisplayServer::get_singleton()->window_get_active_popup();
|
||||||
if (active_popup == DisplayServer::INVALID_WINDOW_ID || active_popup == window->get_window_id()) {
|
if (active_popup == DisplayServer::INVALID_WINDOW_ID || active_popup == window->get_window_id()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user