@@ -70,6 +70,7 @@ public class Dock.BaseItem : Gtk.Box {
7070
7171 private int drag_offset_x = 0 ;
7272 private int drag_offset_y = 0 ;
73+ private bool waiting_to_open_tooltip = false ;
7374
7475 protected BaseItem () {}
7576
@@ -150,11 +151,12 @@ public class Dock.BaseItem : Gtk.Box {
150151
151152 var motion_controller = new Gtk .EventControllerMotion ();
152153 motion_controller. enter. connect (() = > {
153- if (! popover_menu. visible && tooltip_text != null ) {
154- popover_tooltip. popup ();
155- }
154+ this . wait_and_show_tooltip (100 );
155+ });
156+ motion_controller. leave. connect (() = > {
157+ this . waiting_to_open_tooltip = false ;
158+ if (popover_tooltip. visible) popover_tooltip. popdown ();
156159 });
157- motion_controller. leave. connect (popover_tooltip. popdown);
158160
159161 add_controller (motion_controller);
160162
@@ -315,6 +317,25 @@ public class Dock.BaseItem : Gtk.Box {
315317 return obj != null && obj is BaseItem && ((BaseItem ) obj). group == group;
316318 }
317319
320+ private void wait_and_show_tooltip (uint delay_ms ) {
321+ if (! popover_menu. visible && tooltip_text != null ) {
322+ // Add timeout to avoid "Error 71 (Protocol error) dispatching to Wayland display".
323+ // This error is probably caused by a bug in GTK caused by the Nvidia driver at least up to v580.
324+ // Documented in issue #559 on the Github project.
325+ waiting_to_open_tooltip = true ;
326+ GLib . Timeout . add (delay_ms, () = > {
327+ if (waiting_to_open_tooltip) {
328+ waiting_to_open_tooltip = false ;
329+ if (! popover_menu. visible) {
330+ popover_tooltip. popup ();
331+ }
332+ }
333+
334+ return false ;
335+ });
336+ }
337+ }
338+
318339 private class PopoverTooltip : Gtk .Popover {
319340 class construct {
320341 set_css_name ("tooltip ");
0 commit comments