gtk: forward middle click to TUIs with mouse reporting (#13108)

Fix for Issue #12940 
I actually do not know if this has already been resolved and the issue
is just still open. Either way, here's a fix. Now we run a check to see
if the current program is accepting mouse events before discarding the
middle click.
This commit is contained in:
Mitchell Hashimoto
2026-08-04 08:53:39 -07:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@@ -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,

View File

@@ -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;
}