summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-10 12:41:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-09-10 18:57:35 +0200
commit0ce5ded132342d8420caab94e7376b0f33826f28 (patch)
tree97bb73af8792d1bbab8f868d86e6b4fbeb116903
parentfeae69bad70d637a92e6dbb7c18b756943858379 (diff)
gtk4: we don't need to block the drawing area as a focus candidate
because we put that as a child of the overlay so its not a focus candidate in the gtk4 version, and blocking the FixedContainer in gtk4 means none of its children can have focus since gtk4 and that the opposite of what we want to make focus traversal work between native gtk widgets Change-Id: Ide59e816189b5a89d13be9205d1fc9579ae33f92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121900 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtkframe.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 807d5e8b5445..9a6e386d0588 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -1193,10 +1193,15 @@ void GtkSalFrame::DisallowCycleFocusOut()
g_signal_handler_disconnect(G_OBJECT(m_pWindow), m_nSetFocusSignalId);
m_nSetFocusSignalId = 0;
- // set container without can-focus and focus will tab between
+#if !GTK_CHECK_VERSION(4, 0, 0)
+ // gtk3: set container without can-focus and focus will tab between
// the native embedded widgets using the default gtk handling for
// that
+ // gtk4: no need because the native widgets are the only
+ // thing in the overlay and the drawing widget is underneath so
+ // the natural focus cycle is sufficient
gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), false);
+#endif
}
bool GtkSalFrame::IsCycleFocusOutDisallowed() const
@@ -1216,10 +1221,15 @@ void GtkSalFrame::AllowCycleFocusOut()
m_nSetFocusSignalId = g_signal_connect(G_OBJECT(m_pWindow), "notify::focus-widget", G_CALLBACK(signalSetFocus), this);
#endif
+#if !GTK_CHECK_VERSION(4, 0, 0)
// set container without can-focus and focus will tab between
// the native embedded widgets using the default gtk handling for
// that
+ // gtk4: no need because the native widgets are the only
+ // thing in the overlay and the drawing widget is underneath so
+ // the natural focus cycle is sufficient
gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), true);
+#endif
}
@@ -2877,14 +2887,14 @@ void GtkSalFrame::GrabFocus()
pGrabWidget = GTK_WIDGET(m_pWindow);
else
pGrabWidget = GTK_WIDGET(m_pFixedContainer);
-#else
- pGrabWidget = GTK_WIDGET(m_pFixedContainer);
-#endif
// m_nSetFocusSignalId is 0 for the DisallowCycleFocusOut case where
// we don't allow focus to enter the toplevel, but expect it to
// stay in some embedded native gtk widget
if (!gtk_widget_get_can_focus(pGrabWidget) && m_nSetFocusSignalId)
gtk_widget_set_can_focus(pGrabWidget, true);
+#else
+ pGrabWidget = GTK_WIDGET(m_pFixedContainer);
+#endif
if (!gtk_widget_has_focus(pGrabWidget))
{
gtk_widget_grab_focus(pGrabWidget);
@@ -3710,7 +3720,9 @@ void GtkSalFrame::signalSetFocus(GtkWindow*, GParamSpec*, gpointer frame)
// do not propagate focus get/lose if floats are open
pThis->CallCallbackExc(bLoseFocus ? SalEvent::LoseFocus : SalEvent::GetFocus, nullptr);
+#if !GTK_CHECK_VERSION(4, 0, 0)
gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), !bLoseFocus);
+#endif
}
void GtkSalFrame::WindowMap()