[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - cui/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Feb 4 21:37:27 UTC 2019
cui/source/inc/page.hxx | 2 -
cui/source/tabpages/page.cxx | 4 +--
vcl/unx/gtk3/gtk3gtkinst.cxx | 53 ++++++++++++++++++++++++++++++++++++++-----
3 files changed, 51 insertions(+), 8 deletions(-)
New commits:
commit 336feec6b0bef15bd3a234c63d63ad8d869a3374
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 28 13:12:00 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Feb 4 22:37:06 2019 +0100
Resolves: tdf#122930 paper tray is to update on focus-in
which adds the problem that GtkComboBox doesn't send a focus-in,
but its toggle does, to find and use that instead
Change-Id: I18d46511bf2e6997539a8413f574a94b24b4583f
Reviewed-on: https://gerrit.libreoffice.org/67136
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index da7ee7047391..d6fc20577fa7 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -136,7 +136,7 @@ private:
void Init_Impl();
DECL_LINK(LayoutHdl_Impl, weld::ComboBoxText&, void);
- DECL_LINK(PaperBinHdl_Impl, weld::ComboBoxText&, void);
+ DECL_LINK(PaperBinHdl_Impl, weld::Widget&, void);
DECL_LINK(SwapOrientation_Impl, weld::Button&, void);
void SwapFirstValues_Impl( bool bSet );
DECL_LINK(BorderModify_Impl, weld::MetricSpinButton&, void);
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 054bc8fb16ed..a3e7a2ebb80e 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -314,7 +314,7 @@ void SvxPageDescPage::Init_Impl()
// adjust the handler
m_xLayoutBox->connect_changed(LINK(this, SvxPageDescPage, LayoutHdl_Impl));
- m_xPaperTrayBox->connect_changed(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
+ m_xPaperTrayBox->connect_focus_in(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
m_xPaperSizeBox->connect_changed(LINK(this, SvxPageDescPage, PaperSizeSelect_Impl));
m_xPaperWidthEdit->connect_value_changed( LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
m_xPaperHeightEdit->connect_value_changed(LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
@@ -808,7 +808,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, LayoutHdl_Impl, weld::ComboBoxText&, void)
UpdateExample_Impl( true );
}
-IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::ComboBoxText&, void)
+IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
{
if (m_xPaperTrayBox->get_count() > 1)
// already filled
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bd221af10cdb..384f1d411e4d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1183,11 +1183,6 @@ class GtkInstanceWidget : public virtual weld::Widget
{
protected:
GtkWidget* m_pWidget;
-private:
- bool m_bTakeOwnership;
- gulong m_nFocusInSignalId;
- gulong m_nFocusOutSignalId;
- gulong m_nKeyPressSignalId;
static void signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
{
@@ -1203,6 +1198,12 @@ private:
pThis->signal_focus_out();
}
+private:
+ bool m_bTakeOwnership;
+ gulong m_nFocusInSignalId;
+ gulong m_nFocusOutSignalId;
+ gulong m_nKeyPressSignalId;
+
static gboolean signalKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer)
{
// #i1820# use locale specific decimal separator
@@ -4486,8 +4487,11 @@ class GtkInstanceComboBoxText : public GtkInstanceContainer, public virtual weld
{
private:
GtkComboBoxText* m_pComboBoxText;
+ GtkWidget* m_pToggleButton;
std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter;
gboolean m_bPopupActive;
+ gulong m_nToggleFocusInSignalId;
+ gulong m_nToggleFocusOutSignalId;
gulong m_nChangedSignalId;
gulong m_nPopupShownSignalId;
gulong m_nEntryActivateSignalId;
@@ -4594,11 +4598,25 @@ private:
g_object_unref(pCompletion);
}
+ static void find_toggle_button(GtkWidget *pWidget, gpointer user_data)
+ {
+ if (g_strcmp0(gtk_widget_get_name(pWidget), "GtkToggleButton") == 0)
+ {
+ GtkWidget **ppToggleButton = static_cast<GtkWidget**>(user_data);
+ *ppToggleButton = pWidget;
+ }
+ else if (GTK_IS_CONTAINER(pWidget))
+ gtk_container_forall(GTK_CONTAINER(pWidget), find_toggle_button, user_data);
+ }
+
public:
GtkInstanceComboBoxText(GtkComboBoxText* pComboBoxText, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pComboBoxText), bTakeOwnership)
, m_pComboBoxText(pComboBoxText)
+ , m_pToggleButton(nullptr)
, m_bPopupActive(false)
+ , m_nToggleFocusInSignalId(0)
+ , m_nToggleFocusOutSignalId(0)
, m_nChangedSignalId(g_signal_connect(m_pComboBoxText, "changed", G_CALLBACK(signalChanged), this))
, m_nPopupShownSignalId(g_signal_connect(m_pComboBoxText, "notify::popup-shown", G_CALLBACK(signalPopupShown), this))
{
@@ -4616,6 +4634,8 @@ public:
}
else
m_nEntryActivateSignalId = 0;
+
+ find_toggle_button(GTK_WIDGET(m_pComboBoxText), &m_pToggleButton);
}
virtual int get_active() const override
@@ -4787,6 +4807,10 @@ public:
{
if (GtkEntry* pEntry = get_entry())
g_signal_handler_block(pEntry, m_nEntryActivateSignalId);
+ if (m_nToggleFocusInSignalId)
+ g_signal_handler_block(m_pToggleButton, m_nToggleFocusInSignalId);
+ if (m_nToggleFocusOutSignalId)
+ g_signal_handler_block(m_pToggleButton, m_nToggleFocusOutSignalId);
g_signal_handler_block(m_pComboBoxText, m_nChangedSignalId);
g_signal_handler_block(m_pComboBoxText, m_nPopupShownSignalId);
GtkInstanceContainer::disable_notify_events();
@@ -4797,6 +4821,10 @@ public:
GtkInstanceContainer::enable_notify_events();
g_signal_handler_unblock(m_pComboBoxText, m_nPopupShownSignalId);
g_signal_handler_unblock(m_pComboBoxText, m_nChangedSignalId);
+ if (m_nToggleFocusInSignalId)
+ g_signal_handler_unblock(m_pToggleButton, m_nToggleFocusInSignalId);
+ if (m_nToggleFocusOutSignalId)
+ g_signal_handler_unblock(m_pToggleButton, m_nToggleFocusOutSignalId);
if (GtkEntry* pEntry = get_entry())
g_signal_handler_unblock(pEntry, m_nEntryActivateSignalId);
}
@@ -4823,10 +4851,25 @@ public:
GtkInstanceContainer::thaw();
}
+ virtual void connect_focus_in(const Link<Widget&, void>& rLink) override
+ {
+ m_nToggleFocusInSignalId = g_signal_connect(m_pToggleButton, "focus-in-event", G_CALLBACK(signalFocusIn), this);
+ weld::Widget::connect_focus_in(rLink);
+ }
+
+ virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
+ {
+ m_nToggleFocusOutSignalId = g_signal_connect(m_pToggleButton, "focus-out-event", G_CALLBACK(signalFocusOut), this);
+ weld::Widget::connect_focus_out(rLink);
+ }
virtual ~GtkInstanceComboBoxText() override
{
if (GtkEntry* pEntry = get_entry())
g_signal_handler_disconnect(pEntry, m_nEntryActivateSignalId);
+ if (m_nToggleFocusInSignalId)
+ g_signal_handler_disconnect(m_pToggleButton, m_nToggleFocusInSignalId);
+ if (m_nToggleFocusOutSignalId)
+ g_signal_handler_disconnect(m_pToggleButton, m_nToggleFocusOutSignalId);
g_signal_handler_disconnect(m_pComboBoxText, m_nChangedSignalId);
g_signal_handler_disconnect(m_pComboBoxText, m_nPopupShownSignalId);
}
More information about the Libreoffice-commits
mailing list