mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
core: do not toggle mouse hidden on keyCallback with mods
If the mouse was hidden, we just keep it hidden.
This commit is contained in:
@ -1319,9 +1319,12 @@ pub fn keyCallback(
|
|||||||
// This handles the scenario where URL highlighting should be
|
// This handles the scenario where URL highlighting should be
|
||||||
// toggled for example.
|
// toggled for example.
|
||||||
if (!self.mouse.mods.equal(event.mods)) mouse_mods: {
|
if (!self.mouse.mods.equal(event.mods)) mouse_mods: {
|
||||||
// Usually moving the cursor unhides the mouse so we need
|
// This is a hacky way to prevent cursorPosCallback from
|
||||||
// to hide it again if it was hidden.
|
// 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;
|
const rehide = self.mouse.hidden;
|
||||||
|
self.mouse.hidden = false;
|
||||||
|
|
||||||
// Update our modifiers, this will update mouse mods too
|
// Update our modifiers, this will update mouse mods too
|
||||||
self.modsChanged(event.mods);
|
self.modsChanged(event.mods);
|
||||||
@ -1331,7 +1334,7 @@ pub fn keyCallback(
|
|||||||
self.mouse.link_point = null;
|
self.mouse.link_point = null;
|
||||||
const pos = self.rt_surface.getCursorPos() catch break :mouse_mods;
|
const pos = self.rt_surface.getCursorPos() catch break :mouse_mods;
|
||||||
self.cursorPosCallback(pos) catch {};
|
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
|
// Process the cursor state logic. This will update the cursor shape if
|
||||||
|
Reference in New Issue
Block a user