[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 19 15:54:22 UTC 2019
vcl/inc/unx/gtk/gtkframe.hxx | 1 +
vcl/unx/gtk3/gtk3gtkframe.cxx | 23 ++++++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
New commits:
commit b37540b1b3d387668c7b9f89eb54f8c5c60c1152
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 18 14:19:03 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Dec 19 16:53:35 2019 +0100
remove can-focus when focus is lost
so main window is not a candidate to be tabbed into when focus is in sidebar
Change-Id: Ifca270e16bc3766cb12bda95f595887d5f01efe6
Reviewed-on: https://gerrit.libreoffice.org/85405
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 6001ac8db017..7a4f7a151a22 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1929,6 +1929,7 @@ void GtkSalFrame::ToTop( SalFrameToTop nFlags )
{
if( isChild( false ) )
{
+ gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), true);
gtk_widget_grab_focus(GTK_WIDGET(m_pFixedContainer));
}
else if( IS_WIDGET_MAPPED( m_pWindow ) )
@@ -2494,7 +2495,10 @@ gboolean GtkSalFrame::signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer
// focus on click
if (!bDifferentEventWindow)
+ {
+ gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), true);
gtk_widget_grab_focus(GTK_WIDGET(pThis->m_pFixedContainer));
+ }
}
SalMouseEvent aEvent;
@@ -3048,7 +3052,9 @@ void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* pWidget, gpointer frame)
{
// change of focus between native widgets within the toplevel
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
- pThis->CallCallbackExc(pWidget == GTK_WIDGET(pThis->m_pFixedContainer) ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr);
+ bool bGainFocus = pWidget == GTK_WIDGET(pThis->m_pFixedContainer);
+ pThis->CallCallbackExc(bGainFocus ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr);
+ gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), bGainFocus);
}
gboolean GtkSalFrame::signalMap(GtkWidget *, GdkEvent*, gpointer frame)
commit a3f2c64d5ec9d1ea34ec04ebc9e00ef67651a190
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 17 17:20:32 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Dec 19 16:53:21 2019 +0100
handle change of focus between widgets within the toplevel GtkWindow
Change-Id: I3515b33fdb74d294992df516fbe8cebb7ae68376
Reviewed-on: https://gerrit.libreoffice.org/85324
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index dbfa5cc5db84..0955a1d92dc9 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -248,6 +248,7 @@ class GtkSalFrame final : public SalFrame
static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame);
static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
+ static void signalSetFocus( GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame );
static gboolean signalMap( GtkWidget*, GdkEvent*, gpointer );
static gboolean signalUnmap( GtkWidget*, GdkEvent*, gpointer );
static gboolean signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer );
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 6c9fa21828b2..6001ac8db017 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -899,8 +899,9 @@ void GtkSalFrame::InitCommon()
gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER (pLongPress), GTK_PHASE_TARGET);
g_object_weak_ref(G_OBJECT(pEventWidget), reinterpret_cast<GWeakNotify>(g_object_unref), pLongPress);
- g_signal_connect( G_OBJECT(m_pWindow), "focus-in-event", G_CALLBACK(signalFocus), this );
- g_signal_connect( G_OBJECT(m_pWindow), "focus-out-event", G_CALLBACK(signalFocus), this );
+ g_signal_connect_after( G_OBJECT(m_pWindow), "focus-in-event", G_CALLBACK(signalFocus), this );
+ g_signal_connect_after( G_OBJECT(m_pWindow), "focus-out-event", G_CALLBACK(signalFocus), this );
+ g_signal_connect( G_OBJECT(m_pWindow), "set-focus", G_CALLBACK(signalSetFocus), this );
g_signal_connect( G_OBJECT(m_pWindow), "map-event", G_CALLBACK(signalMap), this );
g_signal_connect( G_OBJECT(m_pWindow), "unmap-event", G_CALLBACK(signalUnmap), this );
g_signal_connect( G_OBJECT(m_pWindow), "configure-event", G_CALLBACK(signalConfigure), this );
@@ -3035,11 +3036,21 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
// in the meantime do not propagate focus get/lose if floats are open
if( m_nFloats == 0 )
- pThis->CallCallbackExc( pEvent->in ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr );
+ {
+ bool bHasFocus = gtk_widget_has_focus(GTK_WIDGET(pThis->m_pFixedContainer));
+ pThis->CallCallbackExc(bHasFocus ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr);
+ }
return false;
}
+void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* pWidget, gpointer frame)
+{
+ // change of focus between native widgets within the toplevel
+ GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+ pThis->CallCallbackExc(pWidget == GTK_WIDGET(pThis->m_pFixedContainer) ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr);
+}
+
gboolean GtkSalFrame::signalMap(GtkWidget *, GdkEvent*, gpointer frame)
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
More information about the Libreoffice-commits
mailing list