diff --git a/src/Surface.zig b/src/Surface.zig index 055f7c00c..0ea6dd159 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -3682,6 +3682,12 @@ fn isMouseReporting(self: *const Surface) bool { self.io.terminal.flags.mouse_event != .none; } +pub fn mouseReportingActive(self: *Surface) bool { + self.renderer_state.mutex.lock(); + defer self.renderer_state.mutex.unlock(); + return self.isMouseReporting(); +} + fn mouseReport( self: *Surface, button: ?input.MouseButton, diff --git a/src/apprt/gtk/class/surface.zig b/src/apprt/gtk/class/surface.zig index c539326ba..ac997f54a 100644 --- a/src/apprt/gtk/class/surface.zig +++ b/src/apprt/gtk/class/surface.zig @@ -2872,7 +2872,10 @@ pub const Surface = extern struct { return; } - if (button == .middle and !priv.gtk_enable_primary_paste) { + if (button == .middle and + !priv.gtk_enable_primary_paste and + !core_surface.mouseReportingActive()) + { return; } @@ -2932,7 +2935,10 @@ pub const Surface = extern struct { return; } - if (button == .middle and !priv.gtk_enable_primary_paste) { + if (button == .middle and + !priv.gtk_enable_primary_paste and + !surface.mouseReportingActive()) + { return; }