diff --git a/src/BaseItem.vala b/src/BaseItem.vala index 8fe6da6c..0522be34 100644 --- a/src/BaseItem.vala +++ b/src/BaseItem.vala @@ -69,6 +69,7 @@ public class Dock.BaseItem : Gtk.Box { private int drag_offset_x = 0; private int drag_offset_y = 0; + private uint open_tooltip_timeout_id = 0; protected BaseItem () {} @@ -149,11 +150,18 @@ public class Dock.BaseItem : Gtk.Box { var motion_controller = new Gtk.EventControllerMotion (); motion_controller.enter.connect (() => { - if (!popover_menu.visible && tooltip_text != null) { - popover_tooltip.popup (); + wait_and_show_tooltip (100); + }); + motion_controller.leave.connect (() => { + if (open_tooltip_timeout_id > 0) { + GLib.Source.remove (open_tooltip_timeout_id); + open_tooltip_timeout_id = 0; + } + + if (popover_tooltip.visible) { + popover_tooltip.popdown (); } }); - motion_controller.leave.connect (popover_tooltip.popdown); add_controller (motion_controller); @@ -315,6 +323,21 @@ public class Dock.BaseItem : Gtk.Box { return obj != null && obj is BaseItem && ((BaseItem) obj).group == group && obj != this; } + private void wait_and_show_tooltip (uint delay_ms) { + if (!popover_menu.visible && tooltip_text != null) { + // Add timeout to avoid "Error 71 (Protocol error) dispatching to Wayland display". + // This error is probably caused by a bug in GTK caused by the Nvidia driver at least up to v580. + // See https://github.com/elementary/dock/issues/559 + + open_tooltip_timeout_id = GLib.Timeout.add_once (delay_ms, () => { + open_tooltip_timeout_id = 0; + if (!popover_menu.visible) { + popover_tooltip.popup (); + } + }); + } + } + private class PopoverTooltip : Gtk.Popover { class construct { set_css_name ("tooltip");