Skip to content

Commit 9ed958f

Browse files
committed
Repace waiting_to_open_tooltip flag by open_tooltip_timeout_id and GLib.Source.remove
1 parent 5c5b953 commit 9ed958f

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/BaseItem.vala

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +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;
73+
private uint open_tooltip_timeout_id = 0;
7474

7575
protected BaseItem () {}
7676

@@ -154,7 +154,10 @@ public class Dock.BaseItem : Gtk.Box {
154154
this.wait_and_show_tooltip (100);
155155
});
156156
motion_controller.leave.connect (() => {
157-
this.waiting_to_open_tooltip = false;
157+
if (open_tooltip_timeout_id > 0) {
158+
GLib.Source.remove (open_tooltip_timeout_id);
159+
}
160+
158161
if (popover_tooltip.visible) popover_tooltip.popdown ();
159162
});
160163

@@ -322,13 +325,11 @@ public class Dock.BaseItem : Gtk.Box {
322325
// Add timeout to avoid "Error 71 (Protocol error) dispatching to Wayland display".
323326
// This error is probably caused by a bug in GTK caused by the Nvidia driver at least up to v580.
324327
// 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-
}
328+
329+
open_tooltip_timeout_id = GLib.Timeout.add (delay_ms, () => {
330+
open_tooltip_timeout_id = 0;
331+
if (!popover_menu.visible) {
332+
popover_tooltip.popup ();
332333
}
333334

334335
return false;

0 commit comments

Comments
 (0)