From b1a2102f48956d7bb21bed8414d7874adbd86238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Thu, 2 Oct 2025 18:58:59 +0300 Subject: [PATCH] [GTK4] Do not mix gtk 3 and 4 focus event handlers In https://github.com/eclipse-platform/eclipse.platform.swt/pull/2582 I've mixed the handlers. This fixes it to not call into each other. --- .../gtk/org/eclipse/swt/widgets/Canvas.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java index 11f68701043..6ca8783717e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java @@ -260,14 +260,15 @@ long gtk_focus_out_event (long widget, long event) { } @Override -void gtk4_focus_window_event(long handle, long event) { - if(event == SWT.FocusIn) { - gtk_focus_in_event (handle, event); - if (caret != null) caret.setFocus (); - } else { - gtk_focus_out_event(handle, event); - if (caret != null) caret.killFocus(); - } +void gtk4_focus_enter_event(long handle, long event) { + super.gtk4_focus_enter_event (handle, event); + if (caret != null) caret.setFocus (); +} + +@Override +void gtk4_focus_leave_event(long handle, long event) { + super.gtk4_focus_leave_event (handle, event); + if (caret != null) caret.setFocus (); } @Override