Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions src/BaseItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class Dock.BaseItem : Gtk.Box {

private int drag_offset_x = 0;
private int drag_offset_y = 0;
private bool waiting_to_open_tooltip = false;

protected BaseItem () {}

Expand Down Expand Up @@ -150,11 +151,12 @@ 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 ();
}
this.wait_and_show_tooltip (100);
});
motion_controller.leave.connect (() => {
this.waiting_to_open_tooltip = false;
if (popover_tooltip.visible) popover_tooltip.popdown ();
});
motion_controller.leave.connect (popover_tooltip.popdown);

add_controller (motion_controller);

Expand Down Expand Up @@ -315,6 +317,25 @@ public class Dock.BaseItem : Gtk.Box {
return obj != null && obj is BaseItem && ((BaseItem) obj).group == group;
}

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.
// Documented in issue #559 on the Github project.
waiting_to_open_tooltip = true;
GLib.Timeout.add (delay_ms, () => {
if (waiting_to_open_tooltip) {
waiting_to_open_tooltip = false;
if (!popover_menu.visible) {
popover_tooltip.popup ();
}
}

return false;
});
}
}

private class PopoverTooltip : Gtk.Popover {
class construct {
set_css_name ("tooltip");
Expand Down