Skip to content
Merged
Changes from 2 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
28 changes: 25 additions & 3 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 uint open_tooltip_timeout_id = 0;

protected BaseItem () {}

Expand Down Expand Up @@ -150,11 +151,15 @@ 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);
Comment thread
flodavid marked this conversation as resolved.
Outdated
});
motion_controller.leave.connect (() => {
if (open_tooltip_timeout_id > 0) {
GLib.Source.remove (open_tooltip_timeout_id);
Comment thread
flodavid marked this conversation as resolved.
}

if (popover_tooltip.visible) popover_tooltip.popdown ();
Comment thread
flodavid marked this conversation as resolved.
Outdated
});
motion_controller.leave.connect (popover_tooltip.popdown);

add_controller (motion_controller);

Expand Down Expand Up @@ -315,6 +320,23 @@ 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.
Comment thread
flodavid marked this conversation as resolved.
Outdated

open_tooltip_timeout_id = GLib.Timeout.add (delay_ms, () => {
Comment thread
flodavid marked this conversation as resolved.
Outdated
open_tooltip_timeout_id = 0;
if (!popover_menu.visible) {
popover_tooltip.popup ();
}

return false;
});
}
}

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