diff --git a/src/Surface.zig b/src/Surface.zig index 2839f908c..e40c0a06f 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1319,9 +1319,12 @@ pub fn keyCallback( // This handles the scenario where URL highlighting should be // toggled for example. if (!self.mouse.mods.equal(event.mods)) mouse_mods: { - // Usually moving the cursor unhides the mouse so we need - // to hide it again if it was hidden. + // This is a hacky way to prevent cursorPosCallback from + // showing our hidden mouse: we just pretend the mouse isn't hidden. + // We used to re-call `self.hideMouse()` but this causes flickering + // in some cases in GTK. const rehide = self.mouse.hidden; + self.mouse.hidden = false; // Update our modifiers, this will update mouse mods too self.modsChanged(event.mods); @@ -1331,7 +1334,7 @@ pub fn keyCallback( self.mouse.link_point = null; const pos = self.rt_surface.getCursorPos() catch break :mouse_mods; self.cursorPosCallback(pos) catch {}; - if (rehide) self.hideMouse(); + if (rehide) self.mouse.hidden = true; } // Process the cursor state logic. This will update the cursor shape if