[Libreoffice-commits] core.git: vcl/unx

2020-07-27 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   29 +
 1 file changed, 29 insertions(+)

New commits:
commit fe019b702cfe2af24c35f40db340a82892feb69c
Author: Caolán McNamara 
AuthorDate: Mon Jul 27 15:56:54 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 27 20:13:24 2020 +0200

detect small-button class and minimize padding and size in that case

Change-Id: I7db9d765549112e292f60d1cd47002e45f0136b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99517
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e9c7dab0b0e0..7b9b8b134e3d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -15349,6 +15349,7 @@ private:
 GtkBuilder* m_pBuilder;
 GSList* m_pObjectList;
 GtkWidget* m_pParentWidget;
+GtkCssProvider *m_pSmallButtonProvider;
 gulong m_nNotifySignalId;
 std::vector m_aMnemonicButtons;
 std::vector m_aMnemonicLabels;
@@ -15440,6 +15441,33 @@ private:
 }
 if (gtk_button_get_use_underline(pButton) && 
!gtk_button_get_use_stock(pButton))
 m_aMnemonicButtons.push_back(pButton);
+
+GtkStyleContext *pButtonContext = 
gtk_widget_get_style_context(pWidget);
+if (gtk_style_context_has_class(pButtonContext, "small-button"))
+{
+if (!m_pSmallButtonProvider)
+{
+m_pSmallButtonProvider = gtk_css_provider_new();
+static const gchar data[] = "* { "
+  "padding: 0;"
+  "margin-left: 0px;"
+  "margin-right: 0px;"
+  "min-height: 18px;"
+  "min-width: 18px;"
+  "}";
+const gchar olddata[] = "* { "
+  "padding: 0;"
+  "margin-left: 0px;"
+  "margin-right: 0px;"
+  "}";
+gtk_css_provider_load_from_data(m_pSmallButtonProvider, 
gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+}
+
+gtk_style_context_add_provider(pButtonContext,
+   
GTK_STYLE_PROVIDER(m_pSmallButtonProvider),
+   
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
 }
 else if (GTK_IS_LABEL(pWidget))
 {
@@ -15522,6 +15550,7 @@ public:
 : weld::Builder()
 , m_pStringReplace(Translate::GetReadStringHook())
 , m_pParentWidget(pParent)
+, m_pSmallButtonProvider(nullptr)
 , m_nNotifySignalId(0)
 , m_xInterimGlue(pInterimGlue)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-27 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 1d1ea369da6e027b1ed1453584233f0f7cdcf223
Author: Caolán McNamara 
AuthorDate: Sat Jul 25 20:49:05 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 27 12:05:42 2020 +0200

A GtkButton is already sufficient to get mouse events

Change-Id: Ia61a7906198bf6b6a4ce188d7de9a627c8540af4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99450
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 003af767ca65..e9c7dab0b0e0 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1929,7 +1929,7 @@ protected:
 m_aFocusOutHdl.Call(*this);
 }
 
-void ensureMouseEventWidget()
+virtual void ensureMouseEventWidget()
 {
 if (!m_pMouseEventBox)
 m_pMouseEventBox = ::ensureEventWidget(m_pWidget);
@@ -6662,6 +6662,13 @@ private:
 pThis->signal_clicked();
 }
 
+virtual void ensureMouseEventWidget() override
+{
+// The GtkButton is sufficient to get mouse events without an 
intermediate GtkEventBox
+if (!m_pMouseEventBox)
+m_pMouseEventBox = m_pWidget;
+}
+
 public:
 GtkInstanceButton(GtkButton* pButton, GtkInstanceBuilder* pBuilder, bool 
bTakeOwnership)
 : GtkInstanceContainer(GTK_CONTAINER(pButton), pBuilder, 
bTakeOwnership)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit dcba6d96003d65e51d57b27493f4ff13b255202b
Author: Caolán McNamara 
AuthorDate: Sat Jul 25 20:43:49 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 26 11:30:45 2020 +0200

rename ensureEventWidget to ensureMouseEventWidget

Change-Id: Ibe2d8722dc61c56e762cabb1cecccac8706fb4cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99449
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 3435ea041d45..003af767ca65 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1929,7 +1929,7 @@ protected:
 m_aFocusOutHdl.Call(*this);
 }
 
-void ensureEventWidget()
+void ensureMouseEventWidget()
 {
 if (!m_pMouseEventBox)
 m_pMouseEventBox = ::ensureEventWidget(m_pWidget);
@@ -1939,7 +1939,7 @@ protected:
 {
 if (!m_nButtonPressSignalId)
 {
-ensureEventWidget();
+ensureMouseEventWidget();
 m_nButtonPressSignalId = g_signal_connect(m_pMouseEventBox, 
"button-press-event", G_CALLBACK(signalButton), this);
 }
 }
@@ -2439,7 +2439,7 @@ public:
 
 virtual void connect_mouse_move(const Link& 
rLink) override
 {
-ensureEventWidget();
+ensureMouseEventWidget();
 if (!m_nMotionSignalId)
 m_nMotionSignalId = g_signal_connect(m_pMouseEventBox, 
"motion-notify-event", G_CALLBACK(signalMotion), this);
 if (!m_nLeaveSignalId)
@@ -2451,7 +2451,7 @@ public:
 
 virtual void connect_mouse_release(const Link& 
rLink) override
 {
-ensureEventWidget();
+ensureMouseEventWidget();
 if (!m_nButtonReleaseSignalId)
 m_nButtonReleaseSignalId = g_signal_connect(m_pMouseEventBox, 
"button-release-event", G_CALLBACK(signalButton), this);
 weld::Widget::connect_mouse_release(rLink);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-24 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 5c5dbcbf76f9f1a22538bc7f20966618cd9cdeaf
Author: Caolán McNamara 
AuthorDate: Fri Jul 24 15:57:14 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 24 18:11:50 2020 +0200

block mouse down on GtkTextView getting to toplevel parent

making it similar to GtkEntry

Change-Id: Ic3621dc308222b2464f0daf919a10b81bc887f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99381
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8d6c2b1e345b..1dd294f7b995 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12462,8 +12462,18 @@ private:
 gulong m_nChangedSignalId; // we don't disable/enable this one, it's to 
implement max-length
 gulong m_nInsertTextSignalId;
 gulong m_nCursorPosSignalId;
-gulong m_nHasSelectionSignalId; // we don't disable/enable this one, it's 
to implement auto-scroll to cursor on losing selection
+gulong m_nHasSelectionSignalId; // we don't disable/enable this one, it's 
to implement
+// auto-scroll to cursor on losing 
selection
 gulong m_nVAdjustChangedSignalId;
+gulong m_nButtonPressEvent; // we don't disable/enable this one, it's to 
block mouse
+// click down from getting to (potential) 
toplevel
+// GtkSalFrame parent, which grabs focus away
+
+static gboolean signalButtonPressEvent(GtkWidget*, GdkEventButton*, 
gpointer)
+{
+// e.g. on clicking on the help TextView in OTableDesignHelpBar the 
currently displayed text shouldn't disappear
+return true;
+}
 
 static void signalChanged(GtkTextBuffer*, gpointer widget)
 {
@@ -12542,6 +12552,7 @@ public:
 , m_nCursorPosSignalId(g_signal_connect(m_pTextBuffer, 
"notify::cursor-position", G_CALLBACK(signalCursorPosition), this))
 , m_nHasSelectionSignalId(g_signal_connect(m_pTextBuffer, 
"notify::has-selection", G_CALLBACK(signalHasSelection), this))
 , m_nVAdjustChangedSignalId(g_signal_connect(m_pVAdjustment, 
"value-changed", G_CALLBACK(signalVAdjustValueChanged), this))
+, m_nButtonPressEvent(g_signal_connect_after(m_pTextView, 
"button-press-event", G_CALLBACK(signalButtonPressEvent), this))
 {
 }
 
@@ -12743,6 +12754,7 @@ public:
 
 virtual ~GtkInstanceTextView() override
 {
+g_signal_handler_disconnect(m_pTextView, m_nButtonPressEvent);
 g_signal_handler_disconnect(m_pVAdjustment, m_nVAdjustChangedSignalId);
 g_signal_handler_disconnect(m_pTextBuffer, m_nInsertTextSignalId);
 g_signal_handler_disconnect(m_pTextBuffer, m_nChangedSignalId);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-20 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c39621e557df334edaf5fcc0321f223e6a4e35d2
Author: Caolán McNamara 
AuthorDate: Mon Jul 20 12:03:00 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 20 20:38:38 2020 +0200

set fill to true for label widget of GtkMenuButton

which centers the icon of the calendar menubutton for the data browser data
field

Change-Id: I5c5c2f93f9994dc3f93a1018e7d71574ec139571
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99043
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7cf389b846b7..f8fbcb1a9fee 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7300,7 +7300,7 @@ public:
 gtk_style_context_get_style(pContext, "image-spacing", , 
nullptr);
 m_pBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 
nImageSpacing));
 
-gtk_box_pack_start(m_pBox, m_pLabel, false, false, 0);
+gtk_box_pack_start(m_pBox, m_pLabel, true, false, 0);
 g_object_unref(m_pLabel);
 
 if (gtk_toggle_button_get_mode(GTK_TOGGLE_BUTTON(m_pMenuButton)))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-19 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 46bfb9da866c2e7bb37c7f5d8980f378c52f79f8
Author: Caolán McNamara 
AuthorDate: Sun Jul 19 20:08:35 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 19 22:17:50 2020 +0200

reset m_pFormatter in dtor

Change-Id: I86ab9039544b9aefee31541da1a05ffd56a06609
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99010
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 3b37ab24499a..7cf389b846b7 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12363,6 +12363,9 @@ public:
 g_signal_handler_disconnect(m_pButton, m_nInputSignalId);
 g_signal_handler_disconnect(m_pButton, m_nOutputSignalId);
 g_signal_handler_disconnect(m_pButton, m_nValueChangedSignalId);
+
+m_pFormatter = nullptr;
+m_xOwnFormatter.reset();
 }
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 5e440f5f7ced4ddf1533de9e8ea722e3b99db02f
Author: Caolán McNamara 
AuthorDate: Tue Jul 14 15:34:02 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 15 10:24:35 2020 +0200

support IsEmptyFieldEnabled like vcl::FormattedField

so a formatted spinbutton will stay blank when set empty
as used by the databrowser as a special mode

Change-Id: I24cd6fb0560b20d17574e3b5266fff8dd9f0acb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98789
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fb2cc20ca61f..375526d595a5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12196,10 +12196,15 @@ private:
 gulong m_nValueChangedSignalId;
 gulong m_nOutputSignalId;
 gulong m_nInputSignalId;
+bool m_bEmptyField;
+double m_dValueWhenEmpty;
 
 bool signal_output()
 {
-GetFormatter().SetValue(gtk_spin_button_get_value(m_pButton));
+double fValue = gtk_spin_button_get_value(m_pButton);
+m_bEmptyField &= fValue == m_dValueWhenEmpty;
+if (!m_bEmptyField)
+GetFormatter().SetValue(fValue);
 return true;
 }
 
@@ -12214,7 +12219,18 @@ private:
 {
 Formatter& rFormatter = GetFormatter();
 rFormatter.Modify();
-*value = rFormatter.GetValue();
+// if the blank-mode is enabled then if the input is empty don't parse
+// the input but keep the value as it is. store what the value the
+// blank is associated with and until the value is changed, or the text
+// is updated from the outside, don't output that value
+m_bEmptyField = rFormatter.IsEmptyFieldEnabled() && 
get_text().isEmpty();
+if (m_bEmptyField)
+{
+m_dValueWhenEmpty = gtk_spin_button_get_value(m_pButton);
+*value = m_dValueWhenEmpty;
+}
+else
+*value = rFormatter.GetValue();
 return 1;
 }
 
@@ -12239,7 +12255,18 @@ public:
 , m_nValueChangedSignalId(g_signal_connect(pButton, "value-changed", 
G_CALLBACK(signalValueChanged), this))
 , m_nOutputSignalId(g_signal_connect(pButton, "output", 
G_CALLBACK(signalOutput), this))
 , m_nInputSignalId(g_signal_connect(pButton, "input", 
G_CALLBACK(signalInput), this))
+, m_bEmptyField(false)
+, m_dValueWhenEmpty(0.0)
+{
+}
+
+virtual void set_text(const OUString& rText) override
 {
+GtkInstanceEntry::set_text(rText);
+Formatter& rFormatter = GetFormatter();
+m_bEmptyField = rFormatter.IsEmptyFieldEnabled() && rText.isEmpty();
+if (m_bEmptyField)
+m_dValueWhenEmpty = gtk_spin_button_get_value(m_pButton);
 }
 
 virtual void connect_changed(const Link& rLink) 
override
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e200a08f0982cc9f5993d03eb8ce2a110e71
Author: Caolán McNamara 
AuthorDate: Mon Jul 13 20:43:39 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 14 10:14:46 2020 +0200

Resolves: tdf#134786 use std::numeric_limits::lowest

Change-Id: I5ef2a2779f2b534d68a8a15b74beb62b2eeefa5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98693
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 348cea8618e7..fb2cc20ca61f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12306,8 +12306,8 @@ public:
 virtual void sync_range_from_formatter() override
 {
 disable_notify_events();
-double fMin = m_xFormatter->HasMinValue() ? 
m_xFormatter->GetMinValue() : DBL_MIN;
-double fMax = m_xFormatter->HasMaxValue() ? 
m_xFormatter->GetMaxValue() : DBL_MAX;
+double fMin = m_xFormatter->HasMinValue() ? 
m_xFormatter->GetMinValue() : std::numeric_limits::lowest();
+double fMax = m_xFormatter->HasMaxValue() ? 
m_xFormatter->GetMaxValue() : std::numeric_limits::max();
 gtk_spin_button_set_range(m_pButton, fMin, fMax);
 enable_notify_events();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-12 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 466e63ed692974c1b7529f22574538178e8928af
Author: Caolán McNamara 
AuthorDate: Sun Jul 12 16:59:46 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 12 20:00:44 2020 +0200

m_pEntry may be null

Change-Id: I704ff31906437f0d998f3089cf1df43d29187e0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98604
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 3a81302d515d..348cea8618e7 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -14549,7 +14549,9 @@ public:
 
 virtual bool has_focus() const override
 {
-return gtk_widget_has_focus(m_pToggleButton) || 
gtk_widget_has_focus(m_pEntry) ||
+if (m_pEntry && gtk_widget_has_focus(m_pEntry))
+return true;
+return gtk_widget_has_focus(m_pToggleButton) ||
gtk_widget_has_focus(GTK_WIDGET(m_pOverlayButton)) ||
gtk_widget_has_focus(GTK_WIDGET(m_pTreeView)) || 
GtkInstanceWidget::has_focus();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-12 Thread Andrea Gelmini (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7fc92da7ac5ea887a2fd5737f133795a1ffb3137
Author: Andrea Gelmini 
AuthorDate: Sun Jul 12 09:34:09 2020 +0200
Commit: Julien Nabet 
CommitDate: Sun Jul 12 18:18:43 2020 +0200

Fix typo

Change-Id: Ifad92aedd6f72f837d1839638d9f76b92d0c29d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98585
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 76bd00278bd1..3a81302d515d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12409,7 +12409,7 @@ private:
 gulong m_nChangedSignalId; // we don't disable/enable this one, it's to 
implement max-length
 gulong m_nInsertTextSignalId;
 gulong m_nCursorPosSignalId;
-gulong m_nHasSelectionSignalId; // we don't disable/enable this one, its 
to implement auto-scroll to cursor on losing selection
+gulong m_nHasSelectionSignalId; // we don't disable/enable this one, it's 
to implement auto-scroll to cursor on losing selection
 gulong m_nVAdjustChangedSignalId;
 
 static void signalChanged(GtkTextBuffer*, gpointer widget)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 976367d5d0d0eb2099df32ca4b562a202da6d405
Author: Caolán McNamara 
AuthorDate: Sat Jul 11 18:54:51 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jul 11 21:08:46 2020 +0200

use accessible description before querying help

Change-Id: I1b5814566fd0750b92797cbf8581da0bee003630
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98568
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index d1503f4cae44..ebcb51236fed 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -15176,9 +15176,18 @@ public:
  gboolean /*keyboard_mode*/, 
GtkTooltip *tooltip)
 {
 const ImplSVHelpData& aHelpData = ImplGetSVHelpData();
-if (aHelpData.mbBalloonHelp)
+if (aHelpData.mbBalloonHelp) // extended tips
 {
-/*Current mechanism which needs help installed*/
+// by default use accessible description
+AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
+const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
+if (pDesc && pDesc[0])
+{
+gtk_tooltip_set_text(tooltip, pDesc);
+return true;
+}
+
+// fallback to the mechanism which needs help installed
 OString sHelpId = ::get_help_id(pWidget);
 Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : 
nullptr;
 if (pHelp)
@@ -15190,15 +15199,6 @@ public:
 return true;
 }
 }
-
-/*This is how I would prefer things to be, only a few like this 
though*/
-AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
-const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
-if (pDesc && pDesc[0])
-{
-gtk_tooltip_set_text(tooltip, pDesc);
-return true;
-}
 }
 
 const char* pDesc = gtk_widget_get_tooltip_text(pWidget);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-10 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 76f3995c0ddb06ca5d3e1b147bbd5cc9d74c8654
Author: Caolán McNamara 
AuthorDate: Fri Jul 10 14:55:07 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 10 20:58:40 2020 +0200

disable animations during widget render to surface

Change-Id: I6b3073092e8eaf83bff89b35c50b3476039af410
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98531
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 6a8adcbc9ad5..d1503f4cae44 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3056,12 +3056,19 @@ public:
 
 assert(gtk_widget_is_drawable(m_pWidget)); // all that should result 
in this holding
 
+// turn off animations, otherwise we get a frame of an animation 
sequence
+gboolean bAnimations;
+GtkSettings* pSettings = gtk_widget_get_settings(m_pWidget);
+g_object_get(pSettings, "gtk-enable-animations", , 
nullptr);
+if (bAnimations)
+g_object_set(pSettings, "gtk-enable-animations", false, nullptr);
+
 Size aSize(rRect.GetSize());
 
 GtkAllocation aOrigAllocation;
 gtk_widget_get_allocation(m_pWidget, );
 
-GtkAllocation aNewAllocation {aOrigAllocation.x,
+GtkAllocation aNewAllocation {aOrigAllocation.x + 100,
   aOrigAllocation.y,
   static_cast(aSize.Width()),
   static_cast(aSize.Height()) };
@@ -3084,6 +3091,9 @@ public:
 
 rOutput.DrawOutDev(rRect.TopLeft(), aSize, Point(), aSize, *xOutput);
 
+if (bAnimations)
+g_object_set(pSettings, "gtk-enable-animations", true, nullptr);
+
 if (!bAlreadyMapped)
 gtk_widget_unmap(m_pWidget);
 if (!bAlreadyVisible)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-10 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 6f496fee3ca649144621fcf15e4906fde9fbb9fc
Author: Caolán McNamara 
AuthorDate: Thu Jul 9 15:56:36 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 10 10:34:26 2020 +0200

GtkTextView not auto-scrolling to insertion point on losing selection

In the data browser (Data Sources, shift+ctrl+f4), entering a multiline cell
selects all. On cursoring to the right, the selection is lost and the 
cursor is
placed at the end but gtk doesn't auto-scroll to the cursor so if the text
needs scrolling to see the cursor it is off screen. Another cursor move 
makes
gtk auto-scroll as wanted. So on losing selection do an initial scroll
ourselves here which gives me what I want.

Change-Id: I2c2f703ae173078bc38f2dab99cf8620720e88e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98441
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1b94d454ba82..6a8adcbc9ad5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12399,9 +12399,10 @@ private:
 gulong m_nChangedSignalId; // we don't disable/enable this one, it's to 
implement max-length
 gulong m_nInsertTextSignalId;
 gulong m_nCursorPosSignalId;
+gulong m_nHasSelectionSignalId; // we don't disable/enable this one, its 
to implement auto-scroll to cursor on losing selection
 gulong m_nVAdjustChangedSignalId;
 
-static void signalChanged(GtkTextView*, gpointer widget)
+static void signalChanged(GtkTextBuffer*, gpointer widget)
 {
 GtkInstanceTextView* pThis = static_cast(widget);
 SolarMutexGuard aGuard;
@@ -12430,12 +12431,35 @@ private:
 }
 }
 
-static void signalCursorPosition(GtkTextView*, GParamSpec*, gpointer 
widget)
+static void signalCursorPosition(GtkTextBuffer*, GParamSpec*, gpointer 
widget)
 {
 GtkInstanceTextView* pThis = static_cast(widget);
 pThis->signal_cursor_position();
 }
 
+static void signalHasSelection(GtkTextBuffer*, GParamSpec*, gpointer 
widget)
+{
+GtkInstanceTextView* pThis = static_cast(widget);
+pThis->signal_has_selection();
+}
+
+void signal_has_selection()
+{
+/*
+  in the data browser (Data Sources, shift+ctrl+f4), entering a
+  multiline cell selects all, on cursoring to the right, the selection
+  is lost and the cursor is at the end but gtk doesn't auto-scroll to
+  the cursor so if the text needs scrolling to see the cursor it is off
+  screen, another cursor makes gtk auto-scroll as wanted. So on losing
+  selection help gtk out and do the initial scroll ourselves here
+*/
+if (!gtk_text_buffer_get_has_selection(m_pTextBuffer))
+{
+GtkTextMark* pMark = gtk_text_buffer_get_insert(m_pTextBuffer);
+gtk_text_view_scroll_mark_onscreen(m_pTextView, pMark);
+}
+}
+
 static void signalVAdjustValueChanged(GtkAdjustment*, gpointer widget)
 {
 GtkInstanceTextView* pThis = static_cast(widget);
@@ -12453,6 +12477,7 @@ public:
 , m_nChangedSignalId(g_signal_connect(m_pTextBuffer, "changed", 
G_CALLBACK(signalChanged), this))
 , m_nInsertTextSignalId(g_signal_connect_after(m_pTextBuffer, 
"insert-text", G_CALLBACK(signalInserText), this))
 , m_nCursorPosSignalId(g_signal_connect(m_pTextBuffer, 
"notify::cursor-position", G_CALLBACK(signalCursorPosition), this))
+, m_nHasSelectionSignalId(g_signal_connect(m_pTextBuffer, 
"notify::has-selection", G_CALLBACK(signalHasSelection), this))
 , m_nVAdjustChangedSignalId(g_signal_connect(m_pVAdjustment, 
"value-changed", G_CALLBACK(signalVAdjustValueChanged), this))
 {
 }
@@ -12659,6 +12684,7 @@ public:
 g_signal_handler_disconnect(m_pTextBuffer, m_nInsertTextSignalId);
 g_signal_handler_disconnect(m_pTextBuffer, m_nChangedSignalId);
 g_signal_handler_disconnect(m_pTextBuffer, m_nCursorPosSignalId);
+g_signal_handler_disconnect(m_pTextBuffer, m_nHasSelectionSignalId);
 }
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-08 Thread Andrea Gelmini (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ebe3a4b1d7eed5439c125c088b1fb4df438e8614
Author: Andrea Gelmini 
AuthorDate: Tue Jul 7 11:52:33 2020 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Jul 8 22:21:38 2020 +0200

Fix typo

Change-Id: I2a5a231d7e58c3a84651c70cdf561c81b56a651a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98250
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1cba75f751e2..1b94d454ba82 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12396,7 +12396,7 @@ private:
 GtkTextBuffer* m_pTextBuffer;
 GtkAdjustment* m_pVAdjustment;
 int m_nMaxTextLength;
-gulong m_nChangedSignalId; // we don't disable/enable this one, its to 
implement max-length
+gulong m_nChangedSignalId; // we don't disable/enable this one, it's to 
implement max-length
 gulong m_nInsertTextSignalId;
 gulong m_nCursorPosSignalId;
 gulong m_nVAdjustChangedSignalId;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-07-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   33 ++---
 1 file changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 2d8e2813ddc87f7ce03b97e4d603df11613461f0
Author: Caolán McNamara 
AuthorDate: Wed Jul 8 10:13:26 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 8 13:38:50 2020 +0200

use gdk_wayland_window_set_application_id when it becomes available

Change-Id: I60775dcbfbc396f195a71f219668944d0bfecf31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98325
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 2ddcb832569b..7f2ce207ea7a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1244,6 +1244,20 @@ void GtkSalFrame::SetIcon( sal_uInt16 nIcon )
 appicon = g_strdup ("libreoffice-startcenter");
 
 gtk_window_set_icon_name (GTK_WINDOW (m_pWindow), appicon);
+
+#if defined(GDK_WINDOWING_WAYLAND)
+if (DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()))
+{
+static auto set_application_id = reinterpret_cast(
+ dlsym(nullptr, 
"gdk_wayland_window_set_application_id"));
+if (set_application_id)
+{
+GdkWindow* gdkWindow = gtk_widget_get_window(m_pWindow);
+set_application_id(gdkWindow, appicon);
+}
+}
+#endif
+
 g_free (appicon);
 }
 
@@ -1312,13 +1326,18 @@ void GtkSalFrame::Show( bool bVisible, bool 
/*bNoActivate*/ )
 }
 
 #if defined(GDK_WINDOWING_WAYLAND)
-//rhbz#1334915, gnome#779143, tdf#100158
-//gtk under wayland lacks a way to change the app_id
-//of a window, so brute force everything as a
-//startcenter when initially shown to at least get
-//the default LibreOffice icon and not the broken
-//app icon
-if (DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()))
+/*
+ rhbz#1334915, gnome#779143, tdf#100158
+ https://gitlab.gnome.org/GNOME/gtk/-/issues/767
+
+ before gdk_wayland_window_set_application_id was available gtk
+ under wayland lacked a way to change the app_id of a window, so
+ brute force everything as a startcenter when initially shown to at
+ least get the default LibreOffice icon and not the broken app icon
+*/
+static bool bAppIdImmutable = 
DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay()) &&
+  !dlsym(nullptr, 
"gdk_wayland_window_set_application_id");
+if (bAppIdImmutable)
 {
 OString sOrigName(g_get_prgname());
 g_set_prgname("libreoffice-startcenter");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-30 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit d828da851efa8e243a940f3eceefc39c6c735f9b
Author: Caolán McNamara 
AuthorDate: Tue Jun 30 09:49:49 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 30 12:18:45 2020 +0200

tdf#134390 update spin button before processing activate signal

Change-Id: I698c789c9fe79e931547d8b230a4885393f5ff28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97476
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8e6ed420a381..84d7fa437f96 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8691,7 +8691,9 @@ private:
 pThis->signal_activate();
 }
 
-void signal_activate()
+protected:
+
+virtual void signal_activate()
 {
 if (m_aActivateHdl.IsSet())
 {
@@ -12007,6 +12009,12 @@ private:
 return GTK_INPUT_ERROR;
 }
 
+virtual void signal_activate() override
+{
+gtk_spin_button_update(m_pButton);
+GtkInstanceEntry::signal_activate();
+}
+
 double toGtk(int nValue) const
 {
 return static_cast(nValue) / Power10(get_digits());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-24 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 322b1250117f86cf7280caae751478ffefd02e3a
Author: Caolán McNamara 
AuthorDate: Wed Jun 24 09:51:37 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 24 17:19:01 2020 +0200

use gtk_label_new_with_mnemonic

Change-Id: I0282e6c467cd4f07780df65f7d9bade1c377e261
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97037
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index b273a7fd47f1..c38e1ebe373a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3407,7 +3407,7 @@ public:
 if (pImage)
 {
 GtkWidget *pBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-GtkWidget *pLabel = 
gtk_label_new(MapToGtkAccelerator(rStr).getStr());
+GtkWidget *pLabel = 
gtk_label_new_with_mnemonic(MapToGtkAccelerator(rStr).getStr());
 pItem = eCheckRadioFalse != TRISTATE_INDET ? 
gtk_check_menu_item_new() : gtk_menu_item_new();
 gtk_container_add(GTK_CONTAINER(pBox), pImage);
 gtk_container_add(GTK_CONTAINER(pBox), pLabel);
@@ -6098,7 +6098,7 @@ private:
 {
 disable_notify_events();
 
-GtkWidget *pTabWidget = 
gtk_label_new(MapToGtkAccelerator(rLabel).getStr());
+GtkWidget *pTabWidget = 
gtk_label_new_with_mnemonic(MapToGtkAccelerator(rLabel).getStr());
 gtk_buildable_set_name(GTK_BUILDABLE(pTabWidget), rIdent.getStr());
 
 gtk_notebook_insert_page(pNotebook, pChild, pTabWidget, nPos);
@@ -7660,7 +7660,7 @@ public:
 if (pImage)
 {
 GtkWidget *pBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-GtkWidget *pLabel = 
gtk_label_new(MapToGtkAccelerator(rStr).getStr());
+GtkWidget *pLabel = 
gtk_label_new_with_mnemonic(MapToGtkAccelerator(rStr).getStr());
 pItem = eCheckRadioFalse != TRISTATE_INDET ? 
gtk_check_menu_item_new() : gtk_menu_item_new();
 gtk_container_add(GTK_CONTAINER(pBox), pImage);
 gtk_container_add(GTK_CONTAINER(pBox), pLabel);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-21 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit a641e68077b8c91db8f7520f817da9f7949d0e6d
Author: Caolán McNamara 
AuthorDate: Sun Jun 21 17:15:28 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jun 21 20:22:51 2020 +0200

block GtkCalendar mouse click from propogating to toplevel GtkWindow

Change-Id: I0f6d98a8e8ec95616e8aeec83874f220200dcf24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96815
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 01390a5d1fd7..26e1742f7e61 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8454,6 +8454,7 @@ private:
 gulong m_nDaySelectedSignalId;
 gulong m_nDaySelectedDoubleClickSignalId;
 gulong m_nKeyPressEventSignalId;
+gulong m_nButtonPressEventSignalId;
 
 static void signalDaySelected(GtkCalendar*, gpointer widget)
 {
@@ -8483,6 +8484,16 @@ private:
 return pThis->signal_key_press(pEvent);
 }
 
+static gboolean signalButton(GtkWidget*, GdkEventButton*, gpointer)
+{
+// don't let button press get to parent window, for the case of the
+// ImplCFieldFloatWin floating window belonging to CalendarField where
+// the click on the calendar continues to the parent GtkWindow and
+// closePopup is called by GtkSalFrame::signalButton because the click
+// window isn't that of the floating parent GtkWindow
+return true;
+}
+
 public:
 GtkInstanceCalendar(GtkCalendar* pCalendar, GtkInstanceBuilder* pBuilder, 
bool bTakeOwnership)
 : GtkInstanceWidget(GTK_WIDGET(pCalendar), pBuilder, bTakeOwnership)
@@ -8490,6 +8501,7 @@ public:
 , m_nDaySelectedSignalId(g_signal_connect(pCalendar, "day-selected", 
G_CALLBACK(signalDaySelected), this))
 , m_nDaySelectedDoubleClickSignalId(g_signal_connect(pCalendar, 
"day-selected-double-click", G_CALLBACK(signalDaySelectedDoubleClick), this))
 , m_nKeyPressEventSignalId(g_signal_connect(pCalendar, 
"key-press-event", G_CALLBACK(signalKeyPress), this))
+, m_nButtonPressEventSignalId(g_signal_connect_after(pCalendar, 
"button-press-event", G_CALLBACK(signalButton), this))
 {
 }
 
@@ -8524,6 +8536,7 @@ public:
 
 virtual ~GtkInstanceCalendar() override
 {
+g_signal_handler_disconnect(m_pCalendar, m_nButtonPressEventSignalId);
 g_signal_handler_disconnect(m_pCalendar, m_nKeyPressEventSignalId);
 g_signal_handler_disconnect(m_pCalendar, 
m_nDaySelectedDoubleClickSignalId);
 g_signal_handler_disconnect(m_pCalendar, m_nDaySelectedSignalId);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit c438f489093b082d28082e60042102ebf2c0d480
Author: Caolán McNamara 
AuthorDate: Wed Jun 17 15:47:40 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 17 22:15:08 2020 +0200

avoid gtk_tree_view_get_dest_row_at_pos: assertion 'drag_x >= 0'

Change-Id: I24328c14a666dc580d189ad9475c967ba43cf399
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96551
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f394a04fba84..e1c7aa4e7260 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -11233,6 +11233,12 @@ public:
 
 virtual bool get_dest_row_at_pos(const Point , weld::TreeIter* 
pResult, bool bHighLightTarget) override
 {
+if (rPos.X() < 0 || rPos.Y() < 0)
+{
+// short-circuit to avoid "gtk_tree_view_get_dest_row_at_pos: 
assertion 'drag_x >= 0'" g_assert
+return false;
+}
+
 const bool bAsTree = gtk_tree_view_get_enable_tree_lines(m_pTreeView);
 
 // to keep it simple we'll default to always drop before the current 
row
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 76fab297b1e4aec8b8eaefbb58c261cb16fa17d5
Author: Caolán McNamara 
AuthorDate: Tue Jun 16 21:37:46 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 17 10:15:27 2020 +0200

tdf#130449 allow gdk_window_move_to_rect to try GDK_ANCHOR_SLIDE

as well as GDK_ANCHOR_FLIP if the window placement will put part of the
floating window off screen

Change-Id: I6b76df371048865cb4b1befea5ba34b38336944e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96482
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 62307f5deef0..2ddcb832569b 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2984,7 +2984,7 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer 
frame)
static_cast(aFloatRect.GetWidth()), 
static_cast(aFloatRect.GetHeight())};
 
 GdkWindow* gdkWindow = gtk_widget_get_window(pThis->m_pWindow);
-window_move_to_rect(gdkWindow, , rect_anchor, menu_anchor, 
GDK_ANCHOR_FLIP, 0, 0);
+window_move_to_rect(gdkWindow, , rect_anchor, menu_anchor, 
static_cast(GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE), 0, 0);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit bed1bd821384f00ee02ec80594ee0fc4c5f15abe
Author: Caolán McNamara 
AuthorDate: Thu Jun 11 15:04:31 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 11 20:30:58 2020 +0200

allow tabbing between native widgets in floating windows

i.e. in the calc autofilter menu-alike popups

Change-Id: I93fc74325b8d39807e5126fc694addd3d0a50d53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96127
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 5f2ec2a152b2..62307f5deef0 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3087,16 +3087,23 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, 
GdkEventFocus* pEvent, gpointer f
 return false;
 }
 
+// change of focus between native widgets within the toplevel
 void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* pWidget, gpointer 
frame)
 {
-// do not propagate focus get/lose if floats are open
-if (m_nFloats)
-return;
-// change of focus between native widgets within the toplevel
 GtkSalFrame* pThis = static_cast(frame);
+
+GtkWidget* pGrabWidget;
+if (GTK_IS_EVENT_BOX(pThis->m_pWindow))
+pGrabWidget = GTK_WIDGET(pThis->m_pWindow);
+else
+pGrabWidget = GTK_WIDGET(pThis->m_pFixedContainer);
+
 // tdf#129634 interpret losing focus as focus passing explicitly to 
another widget
-bool bLoseFocus = pWidget && pWidget != 
GTK_WIDGET(pThis->m_pFixedContainer);
+bool bLoseFocus = pWidget && pWidget != pGrabWidget;
+
+// do not propagate focus get/lose if floats are open
 pThis->CallCallbackExc(bLoseFocus ? SalEvent::LoseFocus : 
SalEvent::GetFocus, nullptr);
+
 gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), 
!bLoseFocus);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7ccfba06efaa28423accaeab9cd248fa0093f737
Author: Caolán McNamara 
AuthorDate: Thu Jun 11 12:32:23 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 11 18:21:12 2020 +0200

restore parent grab mode instead of assuming it should be false

Change-Id: If20de104a058ef3bb5642cb4ecdb7c5c6f931efe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96126
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index a8d33f80fbc2..5f2ec2a152b2 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1356,7 +1356,8 @@ void GtkSalFrame::Show( bool bVisible, bool 
/*bNoActivate*/ )
 removeGrabLevel();
 grabPointer(false, true, false);
 m_pParent->removeGrabLevel();
-m_pParent->grabPointer(false, true, false);
+bool bParentIsFloatGrabWindow = 
m_pParent->isFloatGrabWindow();
+m_pParent->grabPointer(bParentIsFloatGrabWindow, true, 
bParentIsFloatGrabWindow);
 }
 }
 gtk_widget_hide( m_pWindow );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 10367c3a583e962dbb0df5b81846f702f4180097
Author: Caolán McNamara 
AuthorDate: Wed Jun 10 21:22:04 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 11 10:03:45 2020 +0200

don't need to treat floating toolbars differently for set-focus

We don't seem to need this anymore, probably

commit ea1182c8c2c42c0c527e232f7e392196796940d7
Author: Caolán McNamara 
Date:   Wed Jun 10 12:16:17 2020 +0100

grab focus to style combobox when parent gets focus

was the right fix

Change-Id: If5d966bfb3fcb47ba09f81b1e786df76a7561bf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96071
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d372391fec2a..a8d33f80fbc2 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3093,10 +3093,6 @@ void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* 
pWidget, gpointer frame)
 return;
 // change of focus between native widgets within the toplevel
 GtkSalFrame* pThis = static_cast(frame);
-// tdf#129634 ignore floating toolbars
-if (pThis->m_nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION)
-return;
-
 // tdf#129634 interpret losing focus as focus passing explicitly to 
another widget
 bool bLoseFocus = pWidget && pWidget != 
GTK_WIDGET(pThis->m_pFixedContainer);
 pThis->CallCallbackExc(bLoseFocus ? SalEvent::LoseFocus : 
SalEvent::GetFocus, nullptr);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit dbf3eba5514f0ed48683e2b58ac56c96b6d48792
Author: Caolán McNamara 
AuthorDate: Tue Jun 9 20:32:52 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 9 22:18:11 2020 +0200

Resolves: tdf#132540 theme the unwanted popover into invisibility

Change-Id: If18c5c1de40a4f93d062265d41a2bff72555d6c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95964
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 6d692f76405d..058bdfb38e4c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7415,6 +7415,15 @@ public:
 {
 GtkWidget* pPlaceHolder = 
gtk_popover_new(GTK_WIDGET(m_pMenuButton));
 gtk_popover_set_transitions_enabled(GTK_POPOVER(pPlaceHolder), 
false);
+
+// tdf#132540 theme the unwanted popover into invisibility
+GtkStyleContext *pPopoverContext = 
gtk_widget_get_style_context(pPlaceHolder);
+GtkCssProvider *pProvider = gtk_css_provider_new();
+static const gchar data[] = "popover { box-shadow: none; padding: 
0 0 0 0; margin: 0 0 0 0; border-image: none; border-image-width: 0 0 0 0; 
background-image: none; background-color: transparent; border-radius: 0 0 0 0; 
border-width: 0 0 0 0; border-style: none; border-color: transparent; opacity: 
0; min-height: 0; min-width: 0; }";
+gtk_css_provider_load_from_data(pProvider, data, -1, nullptr);
+gtk_style_context_add_provider(pPopoverContext, 
GTK_STYLE_PROVIDER(pProvider),
+   
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
 gtk_menu_button_set_popover(m_pMenuButton, pPlaceHolder);
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkobject.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit fcd898c60093eeb5e81f8dc312edc768107c9380
Author: Caolán McNamara 
AuthorDate: Tue Jun 9 15:08:34 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 9 20:52:44 2020 +0200

tdf#133822 mirror GtkSalObjectWidgetClip location for RTL

Change-Id: I4ab4a0fb8fc343ee9a4c66c58e20583482958f37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95951
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index 219805daed49..cb60406ec0e0 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -359,7 +359,14 @@ void GtkSalObjectWidgetClip::ApplyClipRegion()
 allocation.height = m_aClipRect.GetHeight();
 }
 
-gtk_fixed_move(pContainer, m_pScrolledWindow, allocation.x, 
allocation.y);
+if (AllSettings::GetLayoutRTL())
+{
+GtkAllocation aParentAllocation;
+gtk_widget_get_allocation(GTK_WIDGET(pContainer), 
);
+gtk_fixed_move(pContainer, m_pScrolledWindow, 
aParentAllocation.width - allocation.width - 1 - allocation.x, allocation.y);
+}
+else
+gtk_fixed_move(pContainer, m_pScrolledWindow, allocation.x, 
allocation.y);
 gtk_widget_set_size_request(m_pScrolledWindow, allocation.width, 
allocation.height);
 gtk_widget_size_allocate(m_pScrolledWindow, );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 341cc5bfa06e895f091523bbf8c159ca626b6f1a
Author: Caolán McNamara 
AuthorDate: Mon Jun 8 14:38:08 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 9 12:18:29 2020 +0200

tdf#133412 replicate active entry to ComboBox replacement

Change-Id: Ifde87738710406fb9f28008fa96241d59c52f450
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95808
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index da66005a8a9e..6d692f76405d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13848,6 +13848,7 @@ public:
 , m_nMRUCount(0)
 , m_nMaxMRUCount(0)
 {
+int nActive = gtk_combo_box_get_active(m_pComboBox);
 insertAsParent(GTK_WIDGET(m_pComboBox), GTK_WIDGET(getContainer()));
 gtk_widget_set_visible(GTK_WIDGET(m_pComboBox), false);
 gtk_widget_set_no_show_all(GTK_WIDGET(m_pComboBox), true);
@@ -13936,6 +13937,9 @@ public:
 
 g_list_free(cells);
 
+if (nActive != -1)
+tree_view_set_cursor(nActive);
+
 g_signal_connect(m_pMenuWindow, "grab-broken-event", 
G_CALLBACK(signalGrabBroken), this);
 g_signal_connect(m_pMenuWindow, "button-press-event", 
G_CALLBACK(signalButtonPress), this);
 g_signal_connect(m_pMenuWindow, "motion-notify-event", 
G_CALLBACK(signalMotion), this);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-06 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit db9a737c6bec181a259d6bdba2a70b8342b7bdd6
Author: Caolán McNamara 
AuthorDate: Fri Jun 5 20:37:03 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jun 6 16:24:17 2020 +0200

adjust internal/external index for signal_toggled

g-lo-CellIndex is the internal view, adjust that for
signal_toggled

Change-Id: I9ad0cf2e63c2bb03463650a84a9145cf3760ae4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95621
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 4a9d950ab533..12214117ffa8 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9439,7 +9439,7 @@ private:
 
 set(iter, m_aToggleTriStateMap[nCol], false);
 
-signal_toggled(iter_col(GtkInstanceTreeIter(iter), nCol));
+signal_toggled(iter_col(GtkInstanceTreeIter(iter), 
to_external_model(nCol)));
 
 gtk_tree_path_free(tree_path);
 }
@@ -9551,6 +9551,8 @@ private:
 
 void set_column_editable(int nCol, bool bEditable)
 {
+nCol = to_internal_model(nCol);
+
 for (GList* pEntry = g_list_first(m_pColumns); pEntry; pEntry = 
g_list_next(pEntry))
 {
 GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data);
@@ -9840,8 +9842,7 @@ public:
 else if (m_nImageCol == -1)
 m_nImageCol = nIndex;
 }
-int nExternalIndex = to_external_model(nIndex);
-g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", 
reinterpret_cast(nExternalIndex));
+g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", 
reinterpret_cast(nIndex));
 ++nIndex;
 }
 g_list_free(pRenderers);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-05 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   45 +++
 1 file changed, 20 insertions(+), 25 deletions(-)

New commits:
commit 3ace835e16883f8f651437f905c6a65f6e2a2263
Author: Caolán McNamara 
AuthorDate: Thu Jun 4 11:21:05 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 5 09:38:09 2020 +0200

simplify column/renderer mapping

Change-Id: I1949a9596d37009e8585dfd2181cc96c03d6e4b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95522
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1d4fa5ae530f..b07acf43e0b6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9107,7 +9107,6 @@ private:
 std::vector> m_aSeparatorRows;
 std::vector m_aSavedSortTypes;
 std::vector m_aSavedSortColumns;
-std::vector m_aViewColToModelCol;
 bool m_bWorkAroundBadDragRegion;
 bool m_bInDrag;
 gint m_nTextCol;
@@ -9540,11 +9539,6 @@ private:
 pThis->signal_visible_range_changed();
 }
 
-int get_model_col(int viewcol) const
-{
-return m_aViewColToModelCol[viewcol];
-}
-
 // The outside concept of a column maps to a gtk CellRenderer, rather than
 // a TreeViewColumn. If the first TreeViewColumn has two CellRenderers, and
 // the first CellRenderer is an image, that CellRenderer is considered to
@@ -9859,7 +9853,6 @@ public:
 ++nIndex;
 }
 g_list_free(pRenderers);
-m_aViewColToModelCol.push_back(nIndex - 1);
 ++nViewColumn;
 }
 
@@ -10376,8 +10369,10 @@ public:
 virtual OUString get_text(int pos, int col) const override
 {
 if (col == -1)
-return get(pos, m_nTextCol);
-return get(pos, get_model_col(col));
+col = m_nTextCol;
+else
+col = to_internal_model(col);
+return get(pos, col);
 }
 
 virtual void set_text(int pos, const OUString& rText, int col) override
@@ -10385,13 +10380,13 @@ public:
 if (col == -1)
 col = m_nTextCol;
 else
-col = get_model_col(col);
+col = to_internal_model(col);
 set(pos, col, rText);
 }
 
 virtual TriState get_toggle(int pos, int col) const override
 {
-col = get_model_col(col);
+col = to_internal_model(col);
 if (get_bool(pos, m_aToggleTriStateMap.find(col)->second))
 return TRISTATE_INDET;
 return get_bool(pos, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
@@ -10399,7 +10394,7 @@ public:
 
 virtual TriState get_toggle(const weld::TreeIter& rIter, int col) const 
override
 {
-col = get_model_col(col);
+col = to_internal_model(col);
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
 if (get_bool(rGtkIter.iter, m_aToggleTriStateMap.find(col)->second))
 return TRISTATE_INDET;
@@ -10408,7 +10403,7 @@ public:
 
 virtual void set_toggle(int pos, TriState eState, int col) override
 {
-col = get_model_col(col);
+col = to_internal_model(col);
 // checkbuttons are invisible until toggled on or off
 set(pos, m_aToggleVisMap[col], true);
 if (eState == TRISTATE_INDET)
@@ -10423,7 +10418,7 @@ public:
 virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int 
col) override
 {
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
-col = get_model_col(col);
+col = to_internal_model(col);
 // checkbuttons are invisible until toggled on or off
 set(rGtkIter.iter, m_aToggleVisMap[col], true);
 if (eState == TRISTATE_INDET)
@@ -10444,39 +10439,39 @@ public:
 virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int 
col) override
 {
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
-col = get_model_col(col);
+col = to_internal_model(col);
 set(rGtkIter.iter, m_aWeightMap[col], bOn ? PANGO_WEIGHT_BOLD : 
PANGO_WEIGHT_NORMAL);
 }
 
 virtual void set_text_emphasis(int pos, bool bOn, int col) override
 {
-col = get_model_col(col);
+col = to_internal_model(col);
 set(pos, m_aWeightMap[col], bOn ? PANGO_WEIGHT_BOLD : 
PANGO_WEIGHT_NORMAL);
 }
 
 virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const 
override
 {
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
-col = get_model_col(col);
+col = to_internal_model(col);
 return get_int(rGtkIter.iter, m_aWeightMap.find(col)->second) == 
PANGO_WEIGHT_BOLD;
 }
 
 virtual bool get_text_emphasis(int pos, int col) const override
 {
-col = get_model_col(col);
+col = to_internal_model(col);
 return get_int(pos, m_aWeightMap.find(col)->second) == 
PANGO_WEIGHT_BOLD;
 }
 
 virtual void 

[Libreoffice-commits] core.git: vcl/unx

2020-06-05 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 36f57d5aebe448701ffe3bbc529f29d2112dec94
Author: Caolán McNamara 
AuthorDate: Thu Jun 4 11:08:20 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 5 09:37:19 2020 +0200

document the mapping to CellRenderers

and clarify that g-lo-CellIndex is the index from the external pov

Change-Id: Id747acaeabab50755188732637a72c1fce8a97dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95519
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 396ed5b71645..1d4fa5ae530f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9809,6 +9809,11 @@ public:
 , 
m_pVAdjustment(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(pTreeView)))
 , m_pChangeEvent(nullptr)
 {
+/* The outside concept of a column maps to a gtk CellRenderer, rather 
than
+   a TreeViewColumn. If the first TreeViewColumn has two 
CellRenderers, and
+   the first CellRenderer is an image, that CellRenderer is considered 
to
+   be index -1.
+*/
 m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
 int nIndex(0);
 int nViewColumn(0);
@@ -9820,7 +9825,6 @@ public:
 for (GList* pRenderer = g_list_first(pRenderers); pRenderer; 
pRenderer = g_list_next(pRenderer))
 {
 GtkCellRenderer* pCellRenderer = 
GTK_CELL_RENDERER(pRenderer->data);
-g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", 
reinterpret_cast(nIndex));
 if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
 {
 if (m_nTextCol == -1)
@@ -9850,6 +9854,8 @@ public:
 else if (m_nImageCol == -1)
 m_nImageCol = nIndex;
 }
+int nExternalIndex = to_external_model(nIndex);
+g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", 
reinterpret_cast(nExternalIndex));
 ++nIndex;
 }
 g_list_free(pRenderers);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-05 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c69c90469b2bf017e8a6fdddc395266044eba755
Author: Caolán McNamara 
AuthorDate: Thu Jun 4 11:00:39 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 5 09:36:17 2020 +0200

update the CellRenderer comment

Change-Id: I537d123f1c127301d66de06c8cac76f8fe7427c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95535
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fe4d84a7397d..396ed5b71645 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9545,10 +9545,10 @@ private:
 return m_aViewColToModelCol[viewcol];
 }
 
-// We allow only one CellRenderer per TreeViewColumn except for the first
-// TreeViewColumn which can have two, where the first CellRenderer is
-// either an expander image. From outside the second CellRenderer is
-// considered index 0 in the model and the expander as -1
+// The outside concept of a column maps to a gtk CellRenderer, rather than
+// a TreeViewColumn. If the first TreeViewColumn has two CellRenderers, and
+// the first CellRenderer is an image, that CellRenderer is considered to
+// be index -1.
 int to_external_model(int modelcol) const
 {
 if (m_nExpanderImageCol == -1)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-04 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit e7f971f45a154f53be9d4df8fa6ce4f89ad5d92b
Author: Caolán McNamara 
AuthorDate: Thu Jun 4 11:18:28 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 4 20:58:33 2020 +0200

drop unneccessary argument and use known TextColumnId directly

Change-Id: I0c0331e3cf2aa76bca3aabacf06dcf5aebcb55a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95520
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 257c403615c4..b821ebe7302d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -11151,9 +11151,9 @@ public:
 return 
gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection(m_pTreeView));
 }
 
-int starts_with(const OUString& rStr, int col, int nStartRow, bool 
bCaseSensitive)
+int starts_with(const OUString& rStr, int nStartRow, bool bCaseSensitive)
 {
-return ::starts_with(GTK_TREE_MODEL(m_pTreeStore), rStr, 
get_model_col(col), nStartRow, bCaseSensitive);
+return ::starts_with(GTK_TREE_MODEL(m_pTreeStore), rStr, m_nTextCol, 
nStartRow, bCaseSensitive);
 }
 
 virtual void disable_notify_events() override
@@ -14638,32 +14638,32 @@ private:
 nStart = 0;
 
 // Try match case sensitive from current position
-int nPos = m_pTreeView->starts_with(aStartText, 0, nStart, true);
+int nPos = m_pTreeView->starts_with(aStartText, nStart, true);
 if (nPos == -1 && nStart != 0)
 {
 // Try match case insensitive, but from start
-nPos = m_pTreeView->starts_with(aStartText, 0, 0, true);
+nPos = m_pTreeView->starts_with(aStartText, 0, true);
 }
 
 if (!m_bAutoCompleteCaseSensitive)
 {
 // Try match case insensitive from current position
-nPos = m_pTreeView->starts_with(aStartText, 0, nStart, false);
+nPos = m_pTreeView->starts_with(aStartText, nStart, false);
 if (nPos == -1 && nStart != 0)
 {
 // Try match case insensitive, but from start
-nPos = m_pTreeView->starts_with(aStartText, 0, 0, false);
+nPos = m_pTreeView->starts_with(aStartText, 0, false);
 }
 }
 
 if (nPos == -1)
 {
 // Try match case sensitive from current position
-nPos = m_pTreeView->starts_with(aStartText, 0, nStart, true);
+nPos = m_pTreeView->starts_with(aStartText, nStart, true);
 if (nPos == -1 && nStart != 0)
 {
 // Try match case sensitive, but from start
-nPos = m_pTreeView->starts_with(aStartText, 0, 0, true);
+nPos = m_pTreeView->starts_with(aStartText, 0, true);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-04 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   33 +
 1 file changed, 25 insertions(+), 8 deletions(-)

New commits:
commit c11350e44e39eec2d992836200b90be5c9ab35eb
Author: Caolán McNamara 
AuthorDate: Thu Jun 4 11:00:39 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jun 4 20:54:55 2020 +0200

clarify and simplify the mapping of the sort column to model

Change-Id: I3361b0c35965133747c502c5bd81359915507ebd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95518
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a8e9b6c2b69f..257c403615c4 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9108,10 +9108,10 @@ private:
 std::vector m_aSavedSortTypes;
 std::vector m_aSavedSortColumns;
 std::vector m_aViewColToModelCol;
-std::vector m_aModelColToViewCol;
 bool m_bWorkAroundBadDragRegion;
 bool m_bInDrag;
 gint m_nTextCol;
+gint m_nTextView;
 gint m_nImageCol;
 gint m_nExpanderImageCol;
 gint m_nIdCol;
@@ -9545,9 +9545,22 @@ private:
 return m_aViewColToModelCol[viewcol];
 }
 
-int get_view_col(int modelcol) const
+// We allow only one CellRenderer per TreeViewColumn except for the first
+// TreeViewColumn which can have two, where the first CellRenderer is
+// either an expander image. From outside the second CellRenderer is
+// considered index 0 in the model and the expander as -1
+int to_external_model(int modelcol) const
 {
-return m_aModelColToViewCol[modelcol];
+if (m_nExpanderImageCol == -1)
+return modelcol;
+return modelcol - 1;
+}
+
+int to_internal_model(int modelcol) const
+{
+if (m_nExpanderImageCol == -1)
+return modelcol;
+return modelcol + 1;
 }
 
 void set_column_editable(int nCol, bool bEditable)
@@ -9780,6 +9793,7 @@ public:
 , m_bWorkAroundBadDragRegion(false)
 , m_bInDrag(false)
 , m_nTextCol(-1)
+, m_nTextView(-1)
 , m_nImageCol(-1)
 , m_nExpanderImageCol(-1)
 , m_nPendingVAdjustment(-1)
@@ -9797,6 +9811,7 @@ public:
 {
 m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
 int nIndex(0);
+int nViewColumn(0);
 for (GList* pEntry = g_list_first(m_pColumns); pEntry; pEntry = 
g_list_next(pEntry))
 {
 GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data);
@@ -9809,7 +9824,10 @@ public:
 if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
 {
 if (m_nTextCol == -1)
+{
 m_nTextCol = nIndex;
+m_nTextView = nViewColumn;
+}
 m_aWeightMap[nIndex] = -1;
 m_aSensitiveMap[nIndex] = -1;
 m_aIndentMap[nIndex] = -1;
@@ -9832,11 +9850,11 @@ public:
 else if (m_nImageCol == -1)
 m_nImageCol = nIndex;
 }
-m_aModelColToViewCol.push_back(m_aViewColToModelCol.size());
 ++nIndex;
 }
 g_list_free(pRenderers);
 m_aViewColToModelCol.push_back(nIndex - 1);
+++nViewColumn;
 }
 
 m_nIdCol = nIndex++;
@@ -10159,7 +10177,7 @@ public:
 gint sort_column_id(0);
 if (!gtk_tree_sortable_get_sort_column_id(pSortable, _column_id, 
nullptr))
 return -1;
-return get_view_col(sort_column_id);
+return to_external_model(sort_column_id);
 }
 
 virtual void set_sort_column(int nColumn) override
@@ -10172,7 +10190,7 @@ public:
 GtkSortType eSortType;
 GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
 gtk_tree_sortable_get_sort_column_id(pSortable, nullptr, );
-int nSortCol = get_model_col(nColumn);
+int nSortCol = to_internal_model(nColumn);
 gtk_tree_sortable_set_sort_func(pSortable, nSortCol, sortFunc, this, 
nullptr);
 gtk_tree_sortable_set_sort_column_id(pSortable, nSortCol, eSortType);
 }
@@ -11272,8 +11290,7 @@ public:
 
 virtual void start_editing(const weld::TreeIter& rIter) override
 {
-int col = get_view_col(m_nTextCol);
-GtkTreeViewColumn* pColumn = 
GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, col));
+GtkTreeViewColumn* pColumn = 
GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, m_nTextView));
 assert(pColumn && "wrong column");
 
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-06-02 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 07c2bfc895c7a4074cb0cdcb12fead7624fc6336
Author: Caolán McNamara 
AuthorDate: Tue Jun 2 17:19:49 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 2 20:58:24 2020 +0200

use pseudo keyevent we already have if gtk_get_current_event is null

so gtk's desire for one can be satisfied

Change-Id: I486331bdc1778f07c02d0249f239c8d14fc4f5e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95371
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7e851797806c..a8e9b6c2b69f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7531,11 +7531,16 @@ public:
 // Send a keyboard event through gtk_main_do_event to toggle any 
active tooltip offs
 // before trying to launch the menu
 // https://gitlab.gnome.org/GNOME/gtk/issues/1785
-GdkEvent *event = GtkSalFrame::makeFakeKeyPress(pWidget);
-gtk_main_do_event(event);
-gdk_event_free(event);
+GdkEvent *pKeyEvent = GtkSalFrame::makeFakeKeyPress(pWidget);
+gtk_main_do_event(pKeyEvent);
 
-gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), 
, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr);
+GdkEvent *pTriggerEvent = gtk_get_current_event();
+if (!pTriggerEvent)
+pTriggerEvent = pKeyEvent;
+
+gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), 
, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, pTriggerEvent);
+
+gdk_event_free(pKeyEvent);
 }
 else
 #else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-25 Thread Stephan Bergmann (via logerrit)
 vcl/unx/generic/app/i18n_cb.cxx |   32 +---
 1 file changed, 1 insertion(+), 31 deletions(-)

New commits:
commit d073cca5f7c04de3e1bcedda334d864e98ac7835
Author: Stephan Bergmann 
AuthorDate: Sun May 24 18:35:41 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Mon May 25 20:13:35 2020 +0200

Clean up dead code

...after 5bfa8b8d5e1cf3cb572dbd91bf3b0cfcf29fb65a "tdf#118314 Code clean up 
on
imestatuswindow" had removed the sole consumer of aText.

(It is unclear to me whether the use of StatusDrawCallback in the
SalI18N_InputContext in vcl/unx/generic/app/i18n_ic.cxx is still necessary 
when
StatusDrawCallback does not do anything.  But StatusStartCallback and
StatusDoneCallback do not do anything, either, and are used exactly the 
same way
there, so lets keep all that, at least for now.)

Change-Id: Ic2a61819c6bb8ed192231ca309f03b6c29768f29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94760
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index 52bf3bf873fe..4e5f9952c20f 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -469,38 +469,8 @@ StatusDoneCallback (XIC, XPointer, XPointer)
 }
 
 void
-StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data)
+StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *)
 {
-if( call_data->type == XIMTextType )
-{
-OUString aText;
-if( call_data->data.text )
-{
-// XIM with text
-char* pMBString = nullptr;
-size_t nLength = 0;
-if( call_data->data.text->encoding_is_wchar )
-{
-if( call_data->data.text->string.wide_char )
-{
-wchar_t* pWString = call_data->data.text->string.wide_char;
-size_t nBytes = wcstombs( nullptr, pWString, 1024 );
-pMBString = static_cast(alloca( nBytes+1 ));
-nLength = wcstombs( pMBString, pWString, nBytes+1 );
-}
-}
-else
-{
-if( call_data->data.text->string.multi_byte )
-{
-pMBString = call_data->data.text->string.multi_byte;
-nLength = strlen( pMBString );
-}
-}
-if( nLength )
-aText = OUString( pMBString, nLength, 
osl_getThreadTextEncoding() );
-}
-}
 }
 
 // vii. destroy callbacks: internally disable all IC/IM calls
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-24 Thread Stephan Bergmann (via logerrit)
 vcl/unx/generic/app/i18n_cb.cxx |   10 --
 1 file changed, 10 deletions(-)

New commits:
commit de01c1978216373a9aa7cd01e28186d2752e6cc4
Author: Stephan Bergmann 
AuthorDate: Sun May 24 17:02:39 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Sun May 24 18:28:52 2020 +0200

Remove some OSL_DEBUG_LEVEL > 1 code

...that would no longer compile since 
2f5f45921b05904a4be1ff633be09c62cb44ff08
"support O(U)String::number() for fast string concatenation", anyway:

> vcl/unx/generic/app/i18n_cb.cxx:508:56: error: incompatible operand types 
('const char [14]' and 'OStringNumber')
> << ((call_data->type == XIMBitmapType) ?
>^

Change-Id: Id7818ed6228ff317e1bee4efd53f15a2786689d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94758
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index 2944c85480cc..52bf3bf873fe 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -501,16 +501,6 @@ StatusDrawCallback (XIC, XPointer, 
XIMStatusDrawCallbackStruct *call_data)
 aText = OUString( pMBString, nLength, 
osl_getThreadTextEncoding() );
 }
 }
-#if OSL_DEBUG_LEVEL > 1
-else
-{
-SAL_WARN("vcl.app", "XIMStatusDataType "
-<< ((call_data->type == XIMBitmapType) ?
-"XIMBitmapType" :
-OString::number(call_data->type))
-<< " not supported.");
-}
-#endif
 }
 
 // vii. destroy callbacks: internally disable all IC/IM calls
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-22 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a12b8566e835badeae449c52dbace21efc5e623e
Author: Caolán McNamara 
AuthorDate: Fri May 22 12:24:01 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 22 20:35:15 2020 +0200

Resolves: tdf#133269 infinite regress

Change-Id: Iffd7306517ceca94eb6db5360c7d5069c8958acc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94664
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 31d4d8dbb1f5..d372391fec2a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -4512,9 +4512,10 @@ bool GtkSalFrame::CallCallbackExc(SalEvent nEvent, const 
void* pEvent) const
 
 void GtkSalFrame::nopaint_container_resize_children(GtkContainer *pContainer)
 {
+bool bOrigSalObjectSetPosSize = m_bSalObjectSetPosSize;
 m_bSalObjectSetPosSize = true;
 gtk_container_resize_children(pContainer);
-m_bSalObjectSetPosSize = false;
+m_bSalObjectSetPosSize = bOrigSalObjectSetPosSize;
 }
 
 GdkEvent* GtkSalFrame::makeFakeKeyPress(GtkWidget* pWidget)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-18 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit fc59a701cceb6e83c00fc3c9fab747987376c00f
Author: Caolán McNamara 
AuthorDate: Mon May 18 17:23:41 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 18 22:11:28 2020 +0200

don't bother undoing the replacement of combobox if unparented

as seen in tdf#133098 example

Change-Id: I58bf5c5c931cbd1f002ff28f6844d0bebcdd1913
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94440
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 503da469aef5..530a115bd96b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1714,11 +1714,15 @@ namespace
 
 void replaceWidget(GtkWidget* pWidget, GtkWidget* pReplacement)
 {
-g_object_ref(pWidget);
-
 // remove the widget and replace it with pReplacement
 GtkWidget* pParent = gtk_widget_get_parent(pWidget);
 
+// if pWidget was un-parented then don't bother
+if (!pParent)
+return;
+
+g_object_ref(pWidget);
+
 gint nTopAttach(0), nLeftAttach(0), nHeight(1), nWidth(1);
 if (GTK_IS_GRID(pParent))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bc94fe8a7415cb0df0e613fb764f886f45a648e3
Author: Caolán McNamara 
AuthorDate: Sun May 17 19:28:17 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 17 21:23:19 2020 +0200

GdkEventKey::state can contain states, e.g. num lock, which we don't use

Change-Id: I280777c1524de2b640564183461903fd80d345be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94387
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 2c34b5db715e..503da469aef5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13272,7 +13272,7 @@ private:
 }
 default:
 // tdf#131076 let base space toggle menu popup when it's not 
already visible
-if (nCode == KEY_SPACE && !pEvent->state && !m_bPopupActive)
+if (nCode == KEY_SPACE && !aKeyCode.GetModifier() && 
!m_bPopupActive)
 bDone = false;
 else
 bDone = m_aQuickSelectionEngine.HandleKeyEvent(aKEvt);
@@ -14500,7 +14500,7 @@ private:
 
 bool signal_key_press(GdkEventKey* pEvent)
 {
-if (pEvent->state) // only with no modifiers held
+if (GtkSalFrame::GetMouseModCode(pEvent->state)) // only with no 
modifiers held
 return false;
 
 if (pEvent->keyval == GDK_KEY_KP_Up || pEvent->keyval == GDK_KEY_Up || 
pEvent->keyval == GDK_KEY_KP_Page_Up || pEvent->keyval == GDK_KEY_Page_Up ||
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/generic/dtrans/X11_selection.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 773b8e3cc1340e6f5bfc364f0705344b744edd8d
Author: Caolán McNamara 
AuthorDate: Fri May 15 10:28:03 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 15 13:12:42 2020 +0200

tdf#133053 reset after clear so avoid later assert

Change-Id: Ib2b637c8a6d5af04256bfd9631e43d334343b610
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94265
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index 5545a2a9f441..3e15173ba75e 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -2743,6 +2743,7 @@ bool SelectionManager::handleDragEvent( XEvent const & 
rMessage )
 dte.Source = static_cast< OWeakObject* >( it->second.m_pTarget 
);
 aGuard.clear();
 it->second.m_pTarget->dragExit( dte );
+aGuard.reset();
 }
 else if( m_aDropProxy != None && m_nCurrentProtocolVersion >= 0 )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-14 Thread Stephan Bergmann (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit a9a19777d53beb762fabad3a67ddc68ad75bca6c
Author: Stephan Bergmann 
AuthorDate: Thu May 14 14:47:21 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu May 14 17:25:26 2020 +0200

Keep order of GDK input events intact

As explained at 
"[Wayland] When typing fast at high CPU load, LibreOffice breaks key 
(letter)
order":  "with a local LO master --with-lang=ALL ASan+UBSan build (i.e., 
which
executes somewhat slowly):  When typing 'file' in Writer right after it 
started
up (but no longer after more typing), that gets garbled as 'fiel'."  The 
reason
for that (but probably not for the original issue reported in that 
rhbz#1377293)
apparently was:

Two GDK_KEY_PRESS events (A and B) were in the GTK event queue.
GtkInstance::AnyInput consumed only A, because it broke from the first while
loop as soon as it saw the first event of appropriate type.  In the second 
while
loop it put A back on the end of the GTK event loop, so that it now 
followed B.
GtkSalFrame::signalKey (vcl/unx/gtk3/gtk3gtkframe.cxx) thus received the 
events
in the wrong order.

Dropping the "break" also reveals that GtkInstance::AnyInput should 
obviously
use a queue (i.e., deque) rather than a stack to hold the events it 
consumed and
needs to re-enqueue.

This appears to be a regression introduced with
658954e8b50fc264428402dc5a95b0d6f690d191 "Resolves: fdo#48011 writer
idle-callbacks are halting when events pending".

Change-Id: I87d601df118a20ea3dd59e9cebbcf5176db04be8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94202
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 549132dad52e..2c34b5db715e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7,6 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+
+#include 
 #include 
 #include 
 #include 
@@ -402,25 +405,24 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 return true;
 
 bool bRet = false;
-std::stack aEvents;
+std::deque aEvents;
 GdkEvent *pEvent = nullptr;
 while ((pEvent = gdk_event_get()))
 {
-aEvents.push(pEvent);
+aEvents.push_back(pEvent);
 VclInputFlags nEventType = categorizeEvent(pEvent);
 if ( (nEventType & nType) || ( nEventType == VclInputFlags::NONE && 
(nType & VclInputFlags::OTHER) ) )
 {
 bRet = true;
-break;
 }
 }
 
 while (!aEvents.empty())
 {
-pEvent = aEvents.top();
+pEvent = aEvents.front();
 gdk_event_put(pEvent);
 gdk_event_free(pEvent);
-aEvents.pop();
+aEvents.pop_front();
 }
 return bRet;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-13 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx  |   15 ++-
 vcl/unx/gtk3/gtk3gtkobject.cxx |2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 48ee17acde5189318963f302ed6f987c11f3a39f
Author: Caolán McNamara 
AuthorDate: Wed May 13 14:50:38 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 13 20:31:15 2020 +0200

use gtk_widget_get_screen instead of cast + gtk_window_get_screen

cause the toplevel may not be a GtkWindow

Change-Id: Iceb1fc9a5d0054a7a2aefa5ba2ad7a2572dbb4c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94134
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 0960b46354d2..31d4d8dbb1f5 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -962,12 +962,9 @@ void GtkSalFrame::InitCommon()
 {
 m_aSystemData.pDisplay = gdk_x11_display_get_xdisplay(pDisplay);
 m_aSystemData.platform = SystemEnvData::Platform::Xcb;
-if (GTK_IS_WINDOW(m_pWindow))
-{
-GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(m_pWindow));
-GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
-m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
-}
+GdkScreen* pScreen = gtk_widget_get_screen(m_pWindow);
+GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
+m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
 }
 #endif
 #if defined(GDK_WINDOWING_WAYLAND)
@@ -1062,7 +1059,7 @@ void GtkSalFrame::Init( SalFrame* pParent, 
SalFrameStyleFlags nStyle )
 {
 GtkWidget* pTopLevel = 
gtk_widget_get_toplevel(m_pParent->m_pWindow);
 if (!isChild())
-gtk_window_set_screen(GTK_WINDOW(m_pWindow), 
gtk_window_get_screen(GTK_WINDOW(pTopLevel)));
+gtk_window_set_screen(GTK_WINDOW(m_pWindow), 
gtk_widget_get_screen(pTopLevel));
 
 if (!(m_pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 gtk_window_set_transient_for(GTK_WINDOW(m_pWindow), 
GTK_WINDOW(pTopLevel));
@@ -1539,7 +1536,7 @@ void GtkSalFrame::GetClientSize( long& rWidth, long& 
rHeight )
 
 void GtkSalFrame::GetWorkArea( tools::Rectangle& rRect )
 {
-GdkScreen  *pScreen = gtk_window_get_screen(GTK_WINDOW(m_pWindow));
+GdkScreen  *pScreen = gtk_widget_get_screen(m_pWindow);
 tools::Rectangle aRetRect;
 int max = gdk_screen_get_n_monitors (pScreen);
 for (int i = 0; i < max; ++i)
@@ -2031,7 +2028,7 @@ void GtkSalFrame::SetPointerPos( long nX, long nY )
 if( ! pFrame )
 return;
 
-GdkScreen *pScreen = gtk_window_get_screen( GTK_WINDOW(pFrame->m_pWindow) 
);
+GdkScreen *pScreen = gtk_widget_get_screen(pFrame->m_pWindow);
 GdkDisplay *pDisplay = gdk_screen_get_display( pScreen );
 
 /* when the application tries to center the mouse in the dialog the
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index 9b9fff958908..219805daed49 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -71,7 +71,7 @@ void GtkSalObjectBase::Init()
 m_aSystemData.pWidget   = m_pSocket;
 m_aSystemData.nScreen   = m_pParent->getXScreenNumber().getXScreen();
 m_aSystemData.toolkit   = SystemEnvData::Toolkit::Gtk3;
-GdkScreen* pScreen = 
gtk_window_get_screen(GTK_WINDOW(m_pParent->getWindow()));
+GdkScreen* pScreen = gtk_widget_get_screen(m_pParent->getWindow());
 GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
 
 #if defined(GDK_WINDOWING_X11)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-12 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit b3d03b315b5b86994214ac6f0167248ff5bc187b
Author: Caolán McNamara 
AuthorDate: Tue May 12 15:30:29 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 12 20:24:08 2020 +0200

allow double-clicking etc to expand on-demand rows too

Change-Id: Idb8bca730d4c8d8da0d4689961cf1468051159d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94062
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 04fc440f50c6..cfb15f3cb4de 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9102,7 +9102,7 @@ private:
 GtkInstanceTreeIter aIter(nullptr);
 if (!get_cursor())
 return;
-if (iter_has_child(aIter))
+if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(m_pTreeStore), 
))
 get_row_expanded(aIter) ? collapse_row(aIter) : expand_row(aIter);
 }
 
@@ -9540,9 +9540,11 @@ private:
 if (!get_cursor())
 return false;
 
+bool bHasChild = 
gtk_tree_model_iter_has_child(GTK_TREE_MODEL(m_pTreeStore), );
+
 if (pEvent->keyval == GDK_KEY_Right)
 {
-if (iter_has_child(aIter) && !get_row_expanded(aIter))
+if (bHasChild && !get_row_expanded(aIter))
 {
 expand_row(aIter);
 return true;
@@ -9550,7 +9552,7 @@ private:
 return false;
 }
 
-if (iter_has_child(aIter) && get_row_expanded(aIter))
+if (bHasChild && get_row_expanded(aIter))
 {
 collapse_row(aIter);
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-11 Thread Jim Raykowski (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 3951a71777038e635e9747684806678c1c7f6612
Author: Jim Raykowski 
AuthorDate: Sat May 9 23:53:34 2020 -0800
Commit: Caolán McNamara 
CommitDate: Mon May 11 17:15:02 2020 +0200

tdf#132935 fix gtk3 submenu crash

Change-Id: Icfc7d17f289bb94896e5e770c61809cb473d35a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93943
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1620077aa79e..934d52f8f6f5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7632,6 +7632,16 @@ public:
 
 void remove(const OString& rIdent) override
 {
+if (!m_aExtraItems.empty())
+{
+GtkMenuItem* pMenuItem = m_aMap[rIdent];
+auto iter = std::find(m_aExtraItems.begin(), m_aExtraItems.end(), 
pMenuItem);
+if (iter != m_aExtraItems.end())
+{
+m_pTopLevelMenuHelper->remove_from_map(pMenuItem);
+m_aExtraItems.erase(iter);
+}
+}
 MenuHelper::remove_item(rIdent);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   17 +
 1 file changed, 17 insertions(+)

New commits:
commit 0c50447a94d092d1c19edb1bdebf9bf6dde3ae0f
Author: Caolán McNamara 
AuthorDate: Mon May 11 10:04:07 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 11 16:45:32 2020 +0200

Resolves: tdf#132902 restore original hierarchy in dtor

so a repeated weld will result in the same layout each time

Change-Id: I9ba41e70c29046b84392280d4bd95f8141b24251
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93953
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7e05280bbc46..1620077aa79e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -14304,6 +14304,23 @@ public:
 g_signal_handler_disconnect(m_pTreeView, m_nRowActivatedSignalId);
 g_signal_handler_disconnect(m_pToggleButton, m_nPopupShownSignalId);
 
+gtk_combo_box_set_model(m_pComboBox, m_pTreeModel);
+gtk_tree_view_set_model(m_pTreeView, nullptr);
+
+// restore original hierarchy in dtor so a new GtkInstanceComboBox will
+// result in the same layout each time
+{
+g_object_ref(m_pComboBox);
+
+GtkContainer* pContainer = getContainer();
+
+gtk_container_remove(pContainer, GTK_WIDGET(m_pComboBox));
+
+replaceWidget(GTK_WIDGET(pContainer), GTK_WIDGET(m_pComboBox));
+
+g_object_unref(m_pComboBox);
+}
+
 g_object_unref(m_pComboBuilder);
 }
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit a24b27986dfedd4566cf4081090bac8bd2f63e2a
Author: Caolán McNamara 
AuthorDate: Mon May 11 09:35:42 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 11 16:45:13 2020 +0200

split and rename to form insertAsParent

for clarity as to what each chunk does

Change-Id: Ia58d19dfe162631d0ba67975eb2b9546d7afa2cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93952
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8cb8d0c71823..7e05280bbc46 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1710,13 +1710,13 @@ namespace
 }
 #endif
 
-void insertParent(GtkWidget* pWidget, GtkWidget* pReplacement)
+void replaceWidget(GtkWidget* pWidget, GtkWidget* pReplacement)
 {
+g_object_ref(pWidget);
+
 // remove the widget and replace it with pReplacement
 GtkWidget* pParent = gtk_widget_get_parent(pWidget);
 
-g_object_ref(pWidget);
-
 gint nTopAttach(0), nLeftAttach(0), nHeight(1), nWidth(1);
 if (GTK_IS_GRID(pParent))
 {
@@ -1794,6 +1794,15 @@ namespace
 gtk_widget_set_halign(pReplacement, gtk_widget_get_halign(pWidget));
 gtk_widget_set_valign(pReplacement, gtk_widget_get_valign(pWidget));
 
+g_object_unref(pWidget);
+}
+
+void insertAsParent(GtkWidget* pWidget, GtkWidget* pReplacement)
+{
+g_object_ref(pWidget);
+
+replaceWidget(pWidget, pReplacement);
+
 gtk_container_add(GTK_CONTAINER(pReplacement), pWidget);
 
 g_object_unref(pWidget);
@@ -1817,7 +1826,7 @@ namespace
 pMouseEventBox = gtk_event_box_new();
 gtk_event_box_set_above_child(GTK_EVENT_BOX(pMouseEventBox), 
false);
 gtk_event_box_set_visible_window(GTK_EVENT_BOX(pMouseEventBox), 
false);
-insertParent(pWidget, pMouseEventBox);
+insertAsParent(pWidget, pMouseEventBox);
 }
 
 return pMouseEventBox;
@@ -13687,7 +13696,7 @@ public:
 , m_nMRUCount(0)
 , m_nMaxMRUCount(0)
 {
-insertParent(GTK_WIDGET(m_pComboBox), GTK_WIDGET(getContainer()));
+insertAsParent(GTK_WIDGET(m_pComboBox), GTK_WIDGET(getContainer()));
 gtk_widget_set_visible(GTK_WIDGET(m_pComboBox), false);
 gtk_widget_set_no_show_all(GTK_WIDGET(m_pComboBox), true);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d37aa807fe264b7172416a52ef21b178fb502b71
Author: Caolán McNamara 
AuthorDate: Fri May 8 17:25:09 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 9 20:07:52 2020 +0200

GDK_KEY_Return or GDK_KEY_KP_Enter

Change-Id: I9bfe6ecd3490d9c6d12c21f8c8a7074e611f0eb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93784
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ee7486bae3de..8cb8d0c71823 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8391,7 +8391,7 @@ private:
 
 bool signal_key_press(GdkEventKey* pEvent)
 {
-if (pEvent->keyval == GDK_KEY_Return)
+if (pEvent->keyval == GDK_KEY_Return || pEvent->keyval == 
GDK_KEY_KP_Enter)
 {
 signal_activated();
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 255056a13d064742457a1cc481c5acc8c05c14e4
Author: Caolán McNamara 
AuthorDate: Fri May 8 11:32:41 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 8 15:16:06 2020 +0200

true is sensitive not insensitive

Change-Id: If009f0456a9e4d070b8a20fa1c63b1262b98d3df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93719
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 0a99fe737316..ee7486bae3de 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -14476,7 +14476,7 @@ private:
 if (nStart == -1)
 nStart = 0;
 
-// Try match case insensitive from current position
+// Try match case sensitive from current position
 int nPos = m_pTreeView->starts_with(aStartText, 0, nStart, true);
 if (nPos == -1 && nStart != 0)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit ea6a978d873c5320d3cc2526f97636f815efde06
Author: Caolán McNamara 
AuthorDate: Thu May 7 19:41:25 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 8 10:10:02 2020 +0200

Resolves: tdf#132477 use "cancel" on GdkDragContext

gtk_drag_cancel gave trouble as previously described and GDK_KEY_Escape was 
a
placebo which didn't do anything seeing as it wasn't applied by
gtk_main_do_event to the drag GDK_KEY_Escape handler

Change-Id: I66f6e04ded12144a33a38504f5bfc1cad7807bb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93673
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 20bf6596cd77..0a99fe737316 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3075,14 +3075,9 @@ IMPL_LINK(GtkInstanceWidget, async_drag_cancel, void*, 
arg, void)
 // doesn't seem to work as hoped for (though under wayland all is well).
 // Under X the next (allowed) drag effort doesn't work to drop anything,
 // but a then repeated attempt does.
-// Sending ESC to get gtk to cancel the drag for us does work as hoped for.
-GdkEvent *event = GtkSalFrame::makeFakeKeyPress(m_pWidget);
-event->key.keyval = GDK_KEY_Escape;
-gtk_main_do_event(event);
-gdk_event_free(event);
-
-// Retain this gtk_drag_cancel belt-and-braces call anyway
-gtk_drag_cancel(context);
+// emitting cancel to get gtk to cancel the drag for us does work as hoped 
for.
+g_signal_emit_by_name(context, "cancel", 0, 
GDK_DRAG_CANCEL_USER_CANCELLED);
+
 g_object_unref(context);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-02 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit ce019a60c0a348eb08453dc159e2805ffe2ba188
Author: Caolán McNamara 
AuthorDate: Sat May 2 17:16:13 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 2 20:17:10 2020 +0200

Related: tdf#132477 use GDK_KEY_Escape to cancel dnd

simply calling gtk_drag_cancel on the treeview dnd under X doesn't seem to 
work
as hoped for (though under wayland all is well).  Under X the next (allowed)
drag effort doesn't work to drop anything, but a then repeated attempt does.

But sending an Escape keyevent to get gtk to cancel the drag for us does 
work
as hoped for.

Change-Id: I09d3187e66774f9d23c77e0d515af7ae2a8fe156
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93317
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 7732afb6821f..20bf6596cd77 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3070,6 +3070,18 @@ IMPL_LINK(GtkInstanceWidget, async_drag_cancel, void*, 
arg, void)
 {
 m_pDragCancelEvent = nullptr;
 GdkDragContext* context = static_cast(arg);
+
+// tdf#132477 simply calling gtk_drag_cancel on the treeview dnd under X
+// doesn't seem to work as hoped for (though under wayland all is well).
+// Under X the next (allowed) drag effort doesn't work to drop anything,
+// but a then repeated attempt does.
+// Sending ESC to get gtk to cancel the drag for us does work as hoped for.
+GdkEvent *event = GtkSalFrame::makeFakeKeyPress(m_pWidget);
+event->key.keyval = GDK_KEY_Escape;
+gtk_main_do_event(event);
+gdk_event_free(event);
+
+// Retain this gtk_drag_cancel belt-and-braces call anyway
 gtk_drag_cancel(context);
 g_object_unref(context);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-02 Thread Andrea Gelmini (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 05b87ae66ebccd06995cf530b860443ad9503b31
Author: Andrea Gelmini 
AuthorDate: Sat May 2 00:27:24 2020 +0200
Commit: Julien Nabet 
CommitDate: Sat May 2 09:31:16 2020 +0200

Fix typo

Change-Id: I1014ee1ee67b475d5dd72ceb07fd8fd234171f55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93309
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 76786d642d88..7732afb6821f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7044,7 +7044,7 @@ private:
 GtkWidget* m_pLabel;
 //popover cannot escape dialog under X so stick up own window instead
 GtkWindow* m_pMenuHack;
-//when doing so, if its a toolbar menubutton align the menu to the full 
toolitem
+//when doing so, if it's a toolbar menubutton align the menu to the full 
toolitem
 GtkWidget* m_pMenuHackAlign;
 GtkWidget* m_pPopover;
 gulong m_nSignalId;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-01 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit c3a03f03187b697bce84a9efa2de9964eb5466a1
Author: Caolán McNamara 
AuthorDate: Fri May 1 15:06:23 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 1 17:48:57 2020 +0200

transfer halign and valign also

Change-Id: I37bd5adab653f80a120cb9850a0bebd45c5cb7e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93276
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9d43dc9df103..76786d642d88 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1785,8 +1785,14 @@ namespace
 nullptr);
 }
 
-gtk_widget_set_hexpand(pReplacement, gtk_widget_get_hexpand(pWidget));
-gtk_widget_set_vexpand(pReplacement, gtk_widget_get_vexpand(pWidget));
+if (gtk_widget_get_hexpand_set(pWidget))
+gtk_widget_set_hexpand(pReplacement, 
gtk_widget_get_hexpand(pWidget));
+
+if (gtk_widget_get_vexpand_set(pWidget))
+gtk_widget_set_vexpand(pReplacement, 
gtk_widget_get_vexpand(pWidget));
+
+gtk_widget_set_halign(pReplacement, gtk_widget_get_halign(pWidget));
+gtk_widget_set_valign(pReplacement, gtk_widget_get_valign(pWidget));
 
 gtk_container_add(GTK_CONTAINER(pReplacement), pWidget);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-01 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 3b44e585c9e9fb949cea5cda9fc19cdb27edbf65
Author: Caolán McNamara 
AuthorDate: Thu Apr 30 21:26:48 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 1 09:29:08 2020 +0200

tdf#132540 and tdf#132338 align popover replacement with complete toolitem

not just the menubutton sub-part

Change-Id: I75342e3b7b21537565a3a367e1a8b2924b95e822
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93233
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index cce6c4e6eefd..9d43dc9df103 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7038,6 +7038,8 @@ private:
 GtkWidget* m_pLabel;
 //popover cannot escape dialog under X so stick up own window instead
 GtkWindow* m_pMenuHack;
+//when doing so, if its a toolbar menubutton align the menu to the full 
toolitem
+GtkWidget* m_pMenuHackAlign;
 GtkWidget* m_pPopover;
 gulong m_nSignalId;
 
@@ -7087,7 +7089,7 @@ private:
 gtk_container_add(GTK_CONTAINER(m_pMenuHack), pChild);
 g_object_unref(pChild);
 
-GtkPositionType ePosUsed = show_menu(GTK_WIDGET(m_pMenuButton), 
m_pMenuHack);
+GtkPositionType ePosUsed = show_menu(m_pMenuHackAlign ? 
m_pMenuHackAlign : GTK_WIDGET(m_pMenuButton), m_pMenuHack);
 // tdf#132540 keep the placeholder popover on this same side as 
the replacement menu
 
gtk_popover_set_position(gtk_menu_button_get_popover(m_pMenuButton), ePosUsed);
 }
@@ -7175,12 +7177,13 @@ private:
 }
 
 public:
-GtkInstanceMenuButton(GtkMenuButton* pMenuButton, GtkInstanceBuilder* 
pBuilder, bool bTakeOwnership)
+GtkInstanceMenuButton(GtkMenuButton* pMenuButton, GtkWidget* pMenuAlign, 
GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
 : GtkInstanceToggleButton(GTK_TOGGLE_BUTTON(pMenuButton), pBuilder, 
bTakeOwnership)
 , MenuHelper(gtk_menu_button_get_popup(pMenuButton), false)
 , m_pMenuButton(pMenuButton)
 , m_pImage(nullptr)
 , m_pMenuHack(nullptr)
+, m_pMenuHackAlign(pMenuAlign)
 , m_pPopover(nullptr)
 , m_nSignalId(0)
 {
@@ -7729,7 +7732,7 @@ private:
 m_aMap[id] = pToolItem;
 if (pMenuButton)
 {
-m_aMenuButtonMap[id] = 
std::make_unique(pMenuButton, m_pBuilder, false);
+m_aMenuButtonMap[id] = 
std::make_unique(pMenuButton, GTK_WIDGET(pToolItem), 
m_pBuilder, false);
 // so that, e.g. with focus initially in writer main document then
 // after clicking the heading menu in the writer navigator focus is
 // left in the main document and not in the toolbar
@@ -15233,7 +15236,7 @@ public:
 if (!pButton)
 return nullptr;
 auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
-return std::make_unique(pButton, this, 
bTakeOwnership);
+return std::make_unique(pButton, nullptr, this, 
bTakeOwnership);
 }
 
 virtual std::unique_ptr weld_link_button(const OString 
, bool bTakeOwnership) override
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-05-01 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   24 
 1 file changed, 20 insertions(+), 4 deletions(-)

New commits:
commit b3a548a1b3155abad5f134955a6bda8ec133b032
Author: Caolán McNamara 
AuthorDate: Thu Apr 30 21:02:04 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 1 09:28:28 2020 +0200

Related: tdf#132540 keep placeholder popover on same side as menu

Change-Id: I344dde9e04496612641bca502e7aac53506f920a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93232
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c9ef82ec8657..cce6c4e6eefd 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6884,7 +6884,7 @@ void do_ungrab(GtkWidget* pWidget)
 gdk_device_ungrab(pKeyboard, nCurrentTime);
 }
 
-void show_menu_older_gtk(GtkWidget* pMenuButton, GtkWindow* pMenu)
+GtkPositionType show_menu_older_gtk(GtkWidget* pMenuButton, GtkWindow* pMenu)
 {
 //place the toplevel just below its launcher button
 GtkWidget* pToplevel = gtk_widget_get_toplevel(pMenuButton);
@@ -6921,6 +6921,8 @@ void show_menu_older_gtk(GtkWidget* pMenuButton, 
GtkWindow* pMenu)
 x = 0;
 }
 
+GtkPositionType ePosUsed = GTK_POS_BOTTOM;
+
 gint endy = y + nMenuHeight;
 gint nMissingBelow = endy - aWorkArea.Bottom();
 if (nMissingBelow > 0)
@@ -6935,14 +6937,20 @@ void show_menu_older_gtk(GtkWidget* pMenuButton, 
GtkWindow* pMenu)
 {
 nMenuHeight -= nMissingAbove;
 y = aWorkArea.Top();
+ePosUsed = GTK_POS_TOP;
 }
 gtk_widget_set_size_request(GTK_WIDGET(pMenu), nMenuWidth, 
nMenuHeight);
 }
 else
+{
 y = nNewY;
+ePosUsed = GTK_POS_TOP;
+}
 }
 
 gtk_window_move(pMenu, x, y);
+
+return ePosUsed;
 }
 
 bool show_menu_newer_gtk(GtkWidget* pComboBox, GtkWindow* pMenu)
@@ -6991,8 +6999,12 @@ bool show_menu_newer_gtk(GtkWidget* pComboBox, 
GtkWindow* pMenu)
 return true;
 }
 
-void show_menu(GtkWidget* pMenuButton, GtkWindow* pMenu)
+GtkPositionType show_menu(GtkWidget* pMenuButton, GtkWindow* pMenu)
 {
+// we only use ePosUsed in the replacement-for-X-popover case of a
+// MenuButton, so we only need it when show_menu_older_gtk is used
+GtkPositionType ePosUsed = GTK_POS_BOTTOM;
+
 // tdf#120764 It isn't allowed under wayland to have two visible popups 
that share
 // the same top level parent. The problem is that since gtk 3.24 tooltips 
are also
 // implemented as popups, which means that we cannot show any popup if 
there is a
@@ -7009,10 +7021,12 @@ void show_menu(GtkWidget* pMenuButton, GtkWindow* pMenu)
 
 // try with gdk_window_move_to_rect, but if that's not available, try 
without
 if (!show_menu_newer_gtk(pMenuButton, pMenu))
-show_menu_older_gtk(pMenuButton, pMenu);
+ePosUsed = show_menu_older_gtk(pMenuButton, pMenu);
 gtk_widget_show_all(GTK_WIDGET(pMenu));
 gtk_widget_grab_focus(GTK_WIDGET(pMenu));
 do_grab(GTK_WIDGET(pMenu));
+
+return ePosUsed;
 }
 
 class GtkInstanceMenuButton : public GtkInstanceToggleButton, public 
MenuHelper, public virtual weld::MenuButton
@@ -7073,7 +7087,9 @@ private:
 gtk_container_add(GTK_CONTAINER(m_pMenuHack), pChild);
 g_object_unref(pChild);
 
-show_menu(GTK_WIDGET(m_pMenuButton), m_pMenuHack);
+GtkPositionType ePosUsed = show_menu(GTK_WIDGET(m_pMenuButton), 
m_pMenuHack);
+// tdf#132540 keep the placeholder popover on this same side as 
the replacement menu
+
gtk_popover_set_position(gtk_menu_button_get_popover(m_pMenuButton), ePosUsed);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-25 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3e3e28dcc89f0b756a7f2af1d410a42655b58a88
Author: Caolán McNamara 
AuthorDate: Fri Apr 24 12:38:29 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sat Apr 25 17:50:16 2020 +0200

ignore mrucount if the entry was not found

Change-Id: I4b69964fc888b18a5e3baff6a1aeec3bf23c8015
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92852
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 04a6f68837ea..cb88d8f4b486 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13862,7 +13862,7 @@ public:
 virtual int find_text(const OUString& rStr) const override
 {
 int nPos = find_text_including_mru(rStr, false);
-if (m_nMRUCount)
+if (nPos != -1 && m_nMRUCount)
 nPos -= (m_nMRUCount + 1);
 return nPos;
 }
@@ -13870,7 +13870,7 @@ public:
 virtual int find_id(const OUString& rId) const override
 {
 int nPos = find_id_including_mru(rId, false);
-if (m_nMRUCount)
+if (nPos != -1 && m_nMRUCount)
 nPos -= (m_nMRUCount + 1);
 return nPos;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-23 Thread Andrea Gelmini (via logerrit)
 vcl/unx/generic/app/saldisp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 43d108b55bf98849c8c5b7313fe44105db6f972d
Author: Andrea Gelmini 
AuthorDate: Mon Apr 20 13:15:41 2020 +0200
Commit: Julien Nabet 
CommitDate: Thu Apr 23 13:34:29 2020 +0200

Removed duplicated include

Change-Id: I839d1414bfd4a6d75b1393f006e770c1c9775d84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92560
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 7e23b1046f5a..679014cd53be 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -62,7 +62,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-20 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   42 ++
 1 file changed, 22 insertions(+), 20 deletions(-)

New commits:
commit 12aaa40735e1e429cd75bbe08e20dfdad631c3e4
Author: Caolán McNamara 
AuthorDate: Mon Apr 20 11:46:09 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 20 16:07:01 2020 +0200

allow bare GtkToolItems in the map

for the combobox item windows, e.g. font size and font name

Change-Id: Idde4be9f406a426b80a7a9b19d3e782a58dabf89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92561
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 257d41b7a4ec..ff07a983813d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7662,7 +7662,7 @@ class GtkInstanceToolbar : public GtkInstanceWidget, 
public virtual weld::Toolba
 private:
 GtkToolbar* m_pToolbar;
 
-std::map m_aMap;
+std::map m_aMap;
 std::map> m_aMenuButtonMap;
 
 // at the time of writing there is no gtk_menu_tool_button_set_popover 
available
@@ -7692,9 +7692,9 @@ private:
 
 static void collect(GtkWidget* pItem, gpointer widget)
 {
-if (GTK_IS_TOOL_BUTTON(pItem))
+if (GTK_IS_TOOL_ITEM(pItem))
 {
-GtkToolButton* pToolItem = GTK_TOOL_BUTTON(pItem);
+GtkToolItem* pToolItem = GTK_TOOL_ITEM(pItem);
 GtkInstanceToolbar* pThis = 
static_cast(widget);
 
 GtkMenuButton* pMenuButton = nullptr;
@@ -7705,7 +7705,7 @@ private:
 }
 }
 
-void add_to_map(GtkToolButton* pToolItem, GtkMenuButton* pMenuButton)
+void add_to_map(GtkToolItem* pToolItem, GtkMenuButton* pMenuButton)
 {
 const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pToolItem));
 OString id(pStr, pStr ? strlen(pStr) : 0);
@@ -7719,6 +7719,8 @@ private:
 gtk_button_set_focus_on_click(GTK_BUTTON(pMenuButton), false);
 g_signal_connect(pMenuButton, "toggled", 
G_CALLBACK(signalItemToggled), this);
 }
+if (!GTK_IS_TOOL_BUTTON(pToolItem))
+return;
 g_signal_connect(pToolItem, "clicked", G_CALLBACK(signalItemClicked), 
this);
 }
 
@@ -7839,7 +7841,7 @@ public:
 {
 disable_item_notify_events();
 
-GtkToolButton* pToolButton = m_aMap.find(rIdent)->second;
+GtkToolItem* pToolButton = m_aMap.find(rIdent)->second;
 
 assert(GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton) || 
GTK_IS_MENU_TOOL_BUTTON(pToolButton) || !bActive);
 if (GTK_IS_MENU_TOOL_BUTTON(pToolButton))
@@ -7864,7 +7866,7 @@ public:
 
 virtual bool get_item_active(const OString& rIdent) const override
 {
-GtkToolButton* pToolButton = m_aMap.find(rIdent)->second;
+GtkToolItem* pToolButton = m_aMap.find(rIdent)->second;
 
 assert(GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton) || 
GTK_IS_MENU_TOOL_BUTTON(pToolButton));
 if (GTK_IS_MENU_TOOL_BUTTON(pToolButton))
@@ -7948,22 +7950,22 @@ public:
 
 virtual void set_item_label(const OString& rIdent, const OUString& rLabel) 
override
 {
-GtkToolButton* pItem = m_aMap[rIdent];
-if (!pItem)
+GtkToolItem* pItem = m_aMap[rIdent];
+if (!pItem || !GTK_IS_TOOL_BUTTON(pItem))
 return;
 gtk_tool_button_set_label(GTK_TOOL_BUTTON(pItem), 
MapToGtkAccelerator(rLabel).getStr());
 }
 
 OUString get_item_label(const OString& rIdent) const override
 {
-const gchar* pText = 
gtk_tool_button_get_label(m_aMap.find(rIdent)->second);
+const gchar* pText = 
gtk_tool_button_get_label(GTK_TOOL_BUTTON(m_aMap.find(rIdent)->second));
 return OUString(pText, pText ? strlen(pText) : 0, 
RTL_TEXTENCODING_UTF8);
 }
 
 virtual void set_item_icon_name(const OString& rIdent, const OUString& 
rIconName) override
 {
-GtkToolButton* pItem = m_aMap[rIdent];
-if (!pItem)
+GtkToolItem* pItem = m_aMap[rIdent];
+if (!pItem || !GTK_IS_TOOL_BUTTON(pItem))
 return;
 
 GtkWidget* pImage = nullptr;
@@ -7975,23 +7977,23 @@ public:
 gtk_widget_show(pImage);
 }
 
-gtk_tool_button_set_icon_widget(pItem, pImage);
+gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(pItem), pImage);
 }
 
 virtual void set_item_image(const OString& rIdent, const 
css::uno::Reference& rIcon) override
 {
-GtkToolButton* pItem = m_aMap[rIdent];
-if (!pItem)
+GtkToolItem* pItem = m_aMap[rIdent];
+if (!pItem || !GTK_IS_TOOL_BUTTON(pItem))
 return;
-set_item_image(pItem, rIcon);
+set_item_image(GTK_TOOL_BUTTON(pItem), rIcon);
 }
 
 virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) 
override
 {
-GtkToolButton* pItem = m_aMap[rIdent];
-if (!pItem)
+GtkToolItem* pItem = m_aMap[rIdent];
+if (!pItem 

[Libreoffice-commits] core.git: vcl/unx

2020-04-20 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8c3c221c12dbc4d5eafe5988d72d04e86db6c278
Author: Caolán McNamara 
AuthorDate: Mon Apr 20 08:42:55 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 20 10:44:43 2020 +0200

cid#1462315 Division or modulo by zero

Change-Id: If4e5624675250cf288227b46514e432c3c662ca2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92522
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index eeed79fc7883..257d41b7a4ec 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12782,7 +12782,7 @@ private:
 // if we're using a custom renderer, limit the height to the height 
nMaxRows would be
 // for a normal renderer, and then round down to how many custom rows 
fit in that
 // space
-if (m_nNonCustomLineHeight != -1)
+if (m_nNonCustomLineHeight != -1 && nRowHeight)
 {
 gint nNormalHeight = get_height_rows(m_nNonCustomLineHeight, 
nSeparatorHeight, nMaxRows);
 if (nHeight > nNormalHeight)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   20 
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 8e5a43223ce421643213e6542c6a971b6164f6aa
Author: Caolán McNamara 
AuthorDate: Fri Apr 17 09:21:52 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 17 11:46:46 2020 +0200

turn off hover selection until mouse is moved

which solves in a simpler and better way the problem under wayland where I 
see
that the cursor pos in super long treeview menus ends up in the wrong place

Change-Id: If9c7e26c3858ef00bc1fbf26319d859ff529db44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92403
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 0ab70cdb8500..eeed79fc7883 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12800,6 +12800,14 @@ private:
 {
 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_pToggleButton)))
 {
+if (m_bHoverSelection)
+{
+// turn hover selection back off until mouse is moved again
+// *after* menu is shown again
+gtk_tree_view_set_hover_selection(m_pTreeView, false);
+m_bHoverSelection = false;
+}
+
 do_ungrab(GTK_WIDGET(m_pMenuWindow));
 
 gtk_widget_hide(GTK_WIDGET(m_pMenuWindow));
@@ -12833,18 +12841,6 @@ private:
 
 m_bActivateCalled = false;
 show_menu(pComboBox, m_pMenuWindow);
-
-// under wayland I see that the cursor pos in super
-// long treeview menus ends up in the wrong place
-// but letting all pending events get processed
-// before enabling hover selection solve it
-Scheduler::ProcessEventsToIdle();
-
-if (!m_bHoverSelection)
-{
-gtk_tree_view_set_hover_selection(m_pTreeView, true);
-m_bHoverSelection = true;
-}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-16 Thread Justin Luth (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aeac363fcfd94e1c2fbfd877aa5018ba06811165
Author: Justin Luth 
AuthorDate: Thu Apr 16 09:03:15 2020 +0300
Commit: Caolán McNamara 
CommitDate: Thu Apr 16 09:41:13 2020 +0200

fix compile: missing semi-colon in < gtk 3.22 block

compile error message:
vcl/unx/gtk3/gtk3gtkframe.cxx:2930:1: error: new types
may not be defined in a return type
 enum GdkAnchorHints
 ^~~~
vcl/unx/gtk3/gtk3gtkframe.cxx:2930:1: note: (perhaps a
semicolon is missing after the definition of ‘GdkAnchorHints’)

It passes Jenkins tests since they ignore this block.

Change-Id: I3da71d114ac4cd82ac4644f3b6cc1f7142810f44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92334
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 84de83107190..99dbbe49162a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2938,7 +2938,7 @@ enum GdkAnchorHints
   GDK_ANCHOR_FLIP = GDK_ANCHOR_FLIP_X | GDK_ANCHOR_FLIP_Y,
   GDK_ANCHOR_SLIDE= GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_SLIDE_Y,
   GDK_ANCHOR_RESIZE   = GDK_ANCHOR_RESIZE_X | GDK_ANCHOR_RESIZE_Y
-}
+};
 #endif
 
 void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 65474ce8869da250c7e1ac5aa96e2ae12eed4a23
Author: Caolán McNamara 
AuthorDate: Wed Apr 15 19:18:49 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 15 21:32:07 2020 +0200

GdkAnchorHints isn't available < gtk 3.22

Change-Id: Icabab4695d75c9067c6a4cff9fbcacaf1474afee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92316
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 18db569607ee..84de83107190 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2926,6 +2926,21 @@ void swapDirection(GdkGravity& gravity)
 
 }
 
+#if !GTK_CHECK_VERSION(3, 22, 0)
+enum GdkAnchorHints
+{
+  GDK_ANCHOR_FLIP_X   = 1 << 0,
+  GDK_ANCHOR_FLIP_Y   = 1 << 1,
+  GDK_ANCHOR_SLIDE_X  = 1 << 2,
+  GDK_ANCHOR_SLIDE_Y  = 1 << 3,
+  GDK_ANCHOR_RESIZE_X = 1 << 4,
+  GDK_ANCHOR_RESIZE_Y = 1 << 5,
+  GDK_ANCHOR_FLIP = GDK_ANCHOR_FLIP_X | GDK_ANCHOR_FLIP_Y,
+  GDK_ANCHOR_SLIDE= GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_SLIDE_Y,
+  GDK_ANCHOR_RESIZE   = GDK_ANCHOR_RESIZE_X | GDK_ANCHOR_RESIZE_Y
+}
+#endif
+
 void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
 {
 GtkSalFrame* pThis = static_cast(frame);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit ff8288b98f6975c7fc9f36155d26a44e8c625f94
Author: Caolán McNamara 
AuthorDate: Wed Apr 15 16:32:50 2020 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 15 20:13:25 2020 +0200

tdf#126828 skip "on-demand" entries

Change-Id: I5a1b20ce2e6c1d228760fc39e7770e1b497bd9ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92306
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 070958751aed..f21de3229b21 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9423,6 +9423,9 @@ private:
 if (gtk_tree_model_iter_next(pModel, ))
 {
 rGtkIter.iter = tmp;
+//on-demand dummy entry doesn't count
+if (get_text(rGtkIter, -1) == "")
+return iter_next(rGtkIter, bOnlyExpanded);
 return true;
 }
 // Move up level(s) until we find the level where the next node exists.
@@ -9432,6 +9435,9 @@ private:
 if (gtk_tree_model_iter_next(pModel, ))
 {
 rGtkIter.iter = tmp;
+//on-demand dummy entry doesn't count
+if (get_text(rGtkIter, -1) == "")
+return iter_next(rGtkIter, bOnlyExpanded);
 return true;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 35a304c4918544d8978e4096f02b62063f1a0e4a
Author: Caolán McNamara 
AuthorDate: Tue Apr 14 14:55:45 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 14 17:46:33 2020 +0200

remove flicker on first position of X11 popover replacement

Change-Id: I62d5b65c21a938b2eb64bbc5615580e5ec3f9b5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92193
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 809a67c9373d..584741d17e11 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7022,6 +7022,8 @@ private:
 gtk_container_remove(GTK_CONTAINER(m_pMenuHack), pChild);
 gtk_container_add(GTK_CONTAINER(m_pPopover), pChild);
 g_object_unref(pChild);
+
+gtk_widget_unrealize(GTK_WIDGET(m_pMenuHack));
 }
 else
 {
@@ -7050,7 +7052,7 @@ private:
 
gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(pToplevel)), 
m_pMenuHack);
 gtk_window_set_transient_for(m_pMenuHack, GTK_WINDOW(pToplevel));
 
-gtk_widget_show_all(GTK_WIDGET(m_pMenuHack));
+gtk_widget_realize(GTK_WIDGET(m_pMenuHack));
 
 tools::Rectangle 
aWorkArea(::get_monitor_workarea(GTK_WIDGET(m_pMenuHack)));
 gint endx = x + 
gtk_widget_get_allocated_width(GTK_WIDGET(m_pMenuHack));
@@ -7070,6 +7072,7 @@ private:
 }
 
 gtk_window_move(m_pMenuHack, x, y);
+gtk_widget_show_all(GTK_WIDGET(m_pMenuHack));
 
 gtk_widget_grab_focus(GTK_WIDGET(m_pMenuHack));
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   16 ++--
 vcl/unx/gtk3/gtk3gtkinst.cxx  |4 ++--
 2 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit fb3a41b328f5e221e96e7f90e28f84988188cbe2
Author: Caolán McNamara 
AuthorDate: Tue Apr 14 09:59:02 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 14 14:51:00 2020 +0200

use gdk_window_move_to_rect if available at runtime

vs at buildtime

Change-Id: I22fdf5f98058bf5212248f33cf879e1420748ba3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92152
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 9b221311a8b3..18db569607ee 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -45,6 +45,8 @@
 
 #include 
 
+#include 
+
 #include 
 
 #if OSL_DEBUG_LEVEL > 1
@@ -2908,7 +2910,6 @@ void GtkSalFrame::sizeAllocated(GtkWidget* pWidget, 
GdkRectangle *pAllocation, g
 pThis->TriggerPaintEvent();
 }
 
-#if GTK_CHECK_VERSION(3,23,0)
 namespace {
 
 void swapDirection(GdkGravity& gravity)
@@ -2924,7 +2925,6 @@ void swapDirection(GdkGravity& gravity)
 }
 
 }
-#endif
 
 void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame)
 {
@@ -2934,8 +2934,13 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer 
frame)
 return;
 pThis->TriggerPaintEvent();
 
-#if GTK_CHECK_VERSION(3,23,0)
-if (gtk_check_version(3, 23, 0) == nullptr && pThis->m_bFloatPositioned)
+if (!pThis->m_bFloatPositioned)
+return;
+
+static auto window_move_to_rect = reinterpret_cast(
+
dlsym(nullptr, "gdk_window_move_to_rect"));
+if (window_move_to_rect)
 {
 GdkGravity rect_anchor = GDK_GRAVITY_SOUTH_WEST, menu_anchor = 
GDK_GRAVITY_NORTH_WEST;
 
@@ -2969,9 +2974,8 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer 
frame)
static_cast(aFloatRect.GetWidth()), 
static_cast(aFloatRect.GetHeight())};
 
 GdkWindow* gdkWindow = gtk_widget_get_window(pThis->m_pWindow);
-gdk_window_move_to_rect(gdkWindow, , rect_anchor, menu_anchor, 
GDK_ANCHOR_FLIP, 0, 0);
+window_move_to_rect(gdkWindow, , rect_anchor, menu_anchor, 
GDK_ANCHOR_FLIP, 0, 0);
 }
-#endif
 }
 
 gboolean GtkSalFrame::signalConfigure(GtkWidget*, GdkEventConfigure* pEvent, 
gpointer frame)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8700a948e28f..809a67c9373d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1623,7 +1623,7 @@ OpenGLContext* GtkInstance::CreateOpenGLContext()
 // tdf#123800 avoid requiring wayland at runtime just because it existed at 
buildtime
 bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay)
 {
-auto get_type = reinterpret_cast(dlsym(nullptr, 
"gdk_wayland_display_get_type"));
+static auto get_type = reinterpret_cast(dlsym(nullptr, 
"gdk_wayland_display_get_type"));
 if (!get_type)
 return false;
 return G_TYPE_CHECK_INSTANCE_TYPE(pDisplay, get_type());
@@ -1631,7 +1631,7 @@ bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay)
 
 bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay)
 {
-auto get_type = reinterpret_cast(dlsym(nullptr, 
"gdk_x11_display_get_type"));
+static auto get_type = reinterpret_cast(dlsym(nullptr, 
"gdk_x11_display_get_type"));
 if (!get_type)
 return false;
 return G_TYPE_CHECK_INSTANCE_TYPE(pDisplay, get_type());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   91 +--
 1 file changed, 46 insertions(+), 45 deletions(-)

New commits:
commit 41431a62f4485ae1bc821258e4d90bb23b45679d
Author: Caolán McNamara 
AuthorDate: Mon Apr 13 20:59:14 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 14 10:41:55 2020 +0200

factor out do_grab and do_ungrab

Change-Id: I0462cedcfb976d3df53a4aca2ef2b6abdc69ccd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92130
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bc36504a4234..8700a948e28f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6945,6 +6945,49 @@ public:
 }
 };
 
+void do_grab(GtkWidget* pWidget)
+{
+GdkDisplay *pDisplay = gtk_widget_get_display(pWidget);
+#if GTK_CHECK_VERSION(3, 20, 0)
+if (gtk_check_version(3, 20, 0) == nullptr)
+{
+GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
+gdk_seat_grab(pSeat, gtk_widget_get_window(pWidget),
+  GDK_SEAT_CAPABILITY_ALL, true, nullptr, nullptr, 
nullptr, nullptr);
+return;
+}
+#endif
+//else older gtk3
+GdkDeviceManager* pDeviceManager = 
gdk_display_get_device_manager(pDisplay);
+GdkDevice* pPointer = 
gdk_device_manager_get_client_pointer(pDeviceManager);
+GdkWindow* pWindow = gtk_widget_get_window(pWidget);
+guint32 nCurrentTime = gtk_get_current_event_time();
+gdk_device_grab(pPointer, pWindow, GDK_OWNERSHIP_NONE, true, 
GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
+if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
+gdk_device_grab(pKeyboard, pWindow, GDK_OWNERSHIP_NONE, true, 
GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
+}
+
+void do_ungrab(GtkWidget* pWidget)
+{
+GdkDisplay *pDisplay = gtk_widget_get_display(pWidget);
+#if GTK_CHECK_VERSION(3, 20, 0)
+if (gtk_check_version(3, 20, 0) == nullptr)
+{
+GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
+gdk_seat_ungrab(pSeat);
+return;
+}
+#endif
+//else older gtk3
+GdkDeviceManager* pDeviceManager = 
gdk_display_get_device_manager(pDisplay);
+GdkDevice* pPointer = 
gdk_device_manager_get_client_pointer(pDeviceManager);
+guint32 nCurrentTime = gtk_get_current_event_time();
+gdk_device_ungrab(pPointer, nCurrentTime);
+if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
+gdk_device_ungrab(pKeyboard, nCurrentTime);
+}
+
+
 class GtkInstanceMenuButton : public GtkInstanceToggleButton, public 
MenuHelper, public virtual weld::MenuButton
 {
 private:
@@ -6964,55 +7007,13 @@ private:
 pThis->toggle_menu();
 }
 
-void do_grab()
-{
-GdkDisplay *pDisplay = gtk_widget_get_display(GTK_WIDGET(m_pMenuHack));
-#if GTK_CHECK_VERSION(3, 20, 0)
-if (gtk_check_version(3, 20, 0) == nullptr)
-{
-GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
-gdk_seat_grab(pSeat, 
gtk_widget_get_window(GTK_WIDGET(m_pMenuHack)),
-  GDK_SEAT_CAPABILITY_ALL, true, nullptr, nullptr, 
nullptr, nullptr);
-return;
-}
-#endif
-//else older gtk3
-GdkDeviceManager* pDeviceManager = 
gdk_display_get_device_manager(pDisplay);
-GdkDevice* pPointer = 
gdk_device_manager_get_client_pointer(pDeviceManager);
-GdkWindow* pWindow = gtk_widget_get_window(GTK_WIDGET(m_pMenuHack));
-guint32 nCurrentTime = gtk_get_current_event_time();
-gdk_device_grab(pPointer, pWindow, GDK_OWNERSHIP_NONE, true, 
GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
-if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
-gdk_device_grab(pKeyboard, pWindow, GDK_OWNERSHIP_NONE, true, 
GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
-}
-
-void do_ungrab()
-{
-GdkDisplay *pDisplay = gtk_widget_get_display(GTK_WIDGET(m_pMenuHack));
-#if GTK_CHECK_VERSION(3, 20, 0)
-if (gtk_check_version(3, 20, 0) == nullptr)
-{
-GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
-gdk_seat_ungrab(pSeat);
-return;
-}
-#endif
-//else older gtk3
-GdkDeviceManager* pDeviceManager = 
gdk_display_get_device_manager(pDisplay);
-GdkDevice* pPointer = 
gdk_device_manager_get_client_pointer(pDeviceManager);
-guint32 nCurrentTime = gtk_get_current_event_time();
-gdk_device_ungrab(pPointer, nCurrentTime);
-if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
-gdk_device_ungrab(pKeyboard, nCurrentTime);
-}
-
 void toggle_menu()
 {
 if (!m_pMenuHack)
 return;
 if (!get_active())
 {
-do_ungrab();
+do_ungrab(GTK_WIDGET(m_pMenuHack));
 
 

[Libreoffice-commits] core.git: vcl/unx

2020-04-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 670f0b16f3d3f2a879303ef06ba8a08f275c1380
Author: Caolán McNamara 
AuthorDate: Mon Apr 13 20:53:05 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 14 10:41:33 2020 +0200

improve reparenting to keep size-group and size-request

Change-Id: Id12fc3f5c55d7ed027f11645bb17233d2da9e268
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92129
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 4dc4f10152d2..bc36504a4234 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1746,6 +1746,21 @@ namespace
 gtk_container_remove(GTK_CONTAINER(pParent), pWidget);
 
 gtk_widget_set_visible(pReplacement, gtk_widget_get_visible(pWidget));
+gtk_widget_set_no_show_all(pReplacement, 
gtk_widget_get_no_show_all(pWidget));
+
+int nReqWidth, nReqHeight;
+gtk_widget_get_size_request(pWidget, , );
+gtk_widget_set_size_request(pReplacement, nReqWidth, nReqHeight);
+
+static GQuark quark_size_groups = 
g_quark_from_static_string("gtk-widget-size-groups");
+GSList* pSizeGroups = 
static_cast(g_object_get_qdata(G_OBJECT(pWidget), quark_size_groups));
+while (pSizeGroups)
+{
+GtkSizeGroup *pSizeGroup = 
static_cast(pSizeGroups->data);
+pSizeGroups = pSizeGroups->next;
+gtk_size_group_remove_widget(pSizeGroup, pWidget);
+gtk_size_group_add_widget(pSizeGroup, pReplacement);
+}
 
 gtk_container_add(GTK_CONTAINER(pParent), pReplacement);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-10 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit f52ca8e48174f7d0f7df38c1bdf17f8491b2259f
Author: Caolán McNamara 
AuthorDate: Thu Apr 9 20:10:01 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 10 09:55:55 2020 +0200

fix tree view cursor leak

Change-Id: I8660db3d5eddb1596529783e13dff130bb3d0858
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91999
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index d4a65c9ce53f..4dc4f10152d2 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10433,7 +10433,10 @@ public:
 GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
 gtk_tree_model_get_iter(pModel, >iter, path);
 }
-return path != nullptr;
+if (!path)
+return false;
+gtk_tree_path_free(path);
+return true;
 }
 
 virtual int get_cursor_index() const override
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |  131 ++-
 1 file changed, 69 insertions(+), 62 deletions(-)

New commits:
commit 8550e6699d783be295fc2078fbb96ee8e0ea953b
Author: Caolán McNamara 
AuthorDate: Thu Apr 9 15:15:19 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 9 20:34:53 2020 +0200

split out insertParent code

Change-Id: Ideee16b57548df5f6fd1561d68729968edc42e76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91989
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 88d751bdf7a0..d4a65c9ce53f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1710,6 +1710,74 @@ namespace
 }
 #endif
 
+void insertParent(GtkWidget* pWidget, GtkWidget* pReplacement)
+{
+// remove the widget and replace it with pReplacement
+GtkWidget* pParent = gtk_widget_get_parent(pWidget);
+
+g_object_ref(pWidget);
+
+gint nTopAttach(0), nLeftAttach(0), nHeight(1), nWidth(1);
+if (GTK_IS_GRID(pParent))
+{
+gtk_container_child_get(GTK_CONTAINER(pParent), pWidget,
+"left-attach", ,
+"top-attach", ,
+"width", ,
+"height", ,
+nullptr);
+}
+
+gboolean bExpand(false), bFill(false);
+GtkPackType ePackType(GTK_PACK_START);
+guint nPadding(0);
+gint nPosition(0);
+if (GTK_IS_BOX(pParent))
+{
+gtk_container_child_get(GTK_CONTAINER(pParent), pWidget,
+"expand", ,
+"fill", ,
+"pack-type", ,
+"padding", ,
+"position", ,
+nullptr);
+}
+
+gtk_container_remove(GTK_CONTAINER(pParent), pWidget);
+
+gtk_widget_set_visible(pReplacement, gtk_widget_get_visible(pWidget));
+
+gtk_container_add(GTK_CONTAINER(pParent), pReplacement);
+
+if (GTK_IS_GRID(pParent))
+{
+gtk_container_child_set(GTK_CONTAINER(pParent), pReplacement,
+"left-attach", nTopAttach,
+"top-attach", nLeftAttach,
+"width", nWidth,
+"height", nHeight,
+nullptr);
+}
+
+if (GTK_IS_BOX(pParent))
+{
+gtk_container_child_set(GTK_CONTAINER(pParent), pReplacement,
+"expand", bExpand,
+"fill", bFill,
+"pack-type", ePackType,
+"padding", nPadding,
+"position", nPosition,
+nullptr);
+}
+
+gtk_widget_set_hexpand(pReplacement, gtk_widget_get_hexpand(pWidget));
+gtk_widget_set_vexpand(pReplacement, gtk_widget_get_vexpand(pWidget));
+
+gtk_container_add(GTK_CONTAINER(pReplacement), pWidget);
+
+g_object_unref(pWidget);
+}
+
 GtkWidget* ensureEventWidget(GtkWidget* pWidget)
 {
 if (!pWidget)
@@ -1725,71 +1793,10 @@ namespace
 {
 // remove the widget and replace it with an eventbox and put the 
old
 // widget into it
-GtkWidget* pParent = gtk_widget_get_parent(pWidget);
-
-g_object_ref(pWidget);
-
-gint nTopAttach(0), nLeftAttach(0), nHeight(1), nWidth(1);
-if (GTK_IS_GRID(pParent))
-{
-gtk_container_child_get(GTK_CONTAINER(pParent), pWidget,
-"left-attach", ,
-"top-attach", ,
-"width", ,
-"height", ,
-nullptr);
-}
-
-gboolean bExpand(false), bFill(false);
-GtkPackType ePackType(GTK_PACK_START);
-guint nPadding(0);
-gint nPosition(0);
-if (GTK_IS_BOX(pParent))
-{
-gtk_container_child_get(GTK_CONTAINER(pParent), pWidget,
-"expand", ,
-"fill", ,
-"pack-type", ,
-"padding", ,
-"position", ,
-nullptr);
-}
-
-gtk_container_remove(GTK_CONTAINER(pParent), pWidget);
-
 pMouseEventBox = gtk_event_box_new();
 gtk_event_box_set_above_child(GTK_EVENT_BOX(pMouseEventBox), 
false);
 gtk_event_box_set_visible_window(GTK_EVENT_BOX(pMouseEventBox), 
false);
-gtk_widget_set_visible(pMouseEventBox, 
gtk_widget_get_visible(pWidget));
-
-gtk_container_add(GTK_CONTAINER(pParent), pMouseEventBox);
-
-if (GTK_IS_GRID(pParent))
-{
-gtk_container_child_set(GTK_CONTAINER(pParent), pMouseEventBox,
-"left-attach", 

[Libreoffice-commits] core.git: vcl/unx

2020-04-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9a400496a4f510a1a54bfe131d864647efd38c20
Author: Caolán McNamara 
AuthorDate: Thu Apr 9 17:13:57 2020 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 9 20:34:41 2020 +0200

don't animate the placeholder popover

Change-Id: I483db377b10df0a8ced20901fde5286576ef6986
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91988
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 69904fe34b17..88d751bdf7a0 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7304,7 +7304,9 @@ public:
 
 if (m_pMenuHack)
 {
-gtk_menu_button_set_popover(m_pMenuButton, 
gtk_popover_new(GTK_WIDGET(m_pMenuButton)));
+GtkWidget* pPlaceHolder = 
gtk_popover_new(GTK_WIDGET(m_pMenuButton));
+gtk_popover_set_transitions_enabled(GTK_POPOVER(pPlaceHolder), 
false);
+gtk_menu_button_set_popover(m_pMenuButton, pPlaceHolder);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-04-05 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 6769c358b7975d118a6762780a17278ce0ac6b8d
Author: Caolán McNamara 
AuthorDate: Sun Apr 5 19:58:30 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 5 21:43:38 2020 +0200

Related: tdf#131873 focus-on-click in data browser

Change-Id: I99cf1f42c89ee6d9e17ac1a24ae8e58e6e47a55d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91727
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d4c04ff0a88f..9b221311a8b3 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2489,8 +2489,13 @@ namespace
 
 void GtkSalFrame::GrabFocus()
 {
-gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), true);
-gtk_widget_grab_focus(GTK_WIDGET(m_pFixedContainer));
+GtkWidget* pGrabWidget;
+if (GTK_IS_EVENT_BOX(m_pWindow))
+pGrabWidget = GTK_WIDGET(m_pWindow);
+else
+pGrabWidget = GTK_WIDGET(m_pFixedContainer);
+gtk_widget_set_can_focus(pGrabWidget, true);
+gtk_widget_grab_focus(pGrabWidget);
 }
 
 gboolean GtkSalFrame::signalButton(GtkWidget*, GdkEventButton* pEvent, 
gpointer frame)
@@ -3056,7 +3061,12 @@ 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 )
 {
-bool bHasFocus = 
gtk_widget_has_focus(GTK_WIDGET(pThis->m_pFixedContainer));
+GtkWidget* pGrabWidget;
+if (GTK_IS_EVENT_BOX(pThis->m_pWindow))
+pGrabWidget = GTK_WIDGET(pThis->m_pWindow);
+else
+pGrabWidget = GTK_WIDGET(pThis->m_pFixedContainer);
+bool bHasFocus = gtk_widget_has_focus(pGrabWidget);
 pThis->CallCallbackExc(bHasFocus ? SalEvent::GetFocus : 
SalEvent::LoseFocus, nullptr);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-27 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   46 +--
 1 file changed, 19 insertions(+), 27 deletions(-)

New commits:
commit 60c4a457bb75a3734be0636fb14a78e070a50666
Author: Caolán McNamara 
AuthorDate: Fri Mar 27 14:57:35 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 27 20:36:26 2020 +0100

no need to special case 0

and the impress animation pane show the need to not special case 0
in the effect list

Change-Id: I806365df1a77b58b8d4f474d945f7a7e50c53757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91231
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 03386b798f17..0656f08a8a65 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10858,37 +10858,29 @@ public:
 {
 disable_notify_events();
 
-if (value == 0)
-{
-gtk_adjustment_set_value(m_pVAdjustment, 0);
-m_nPendingVAdjustment = -1;
-}
-else
-{
-/* This rube goldberg device is to remove flicker from setting the
-   scroll position of a GtkTreeView directly after clearing it and
-   filling it. As a specific example the writer navigator with ~100
-   tables, scroll to the end, right click on an entry near the end
-   and rename it, the tree is cleared and refilled and an attempt
-   made to set the scroll position of the freshly refilled tree to
-   the same point as before the clear.
-*/
+/* This rube goldberg device is to remove flicker from setting the
+   scroll position of a GtkTreeView directly after clearing it and
+   filling it. As a specific example the writer navigator with ~100
+   tables, scroll to the end, right click on an entry near the end
+   and rename it, the tree is cleared and refilled and an attempt
+   made to set the scroll position of the freshly refilled tree to
+   the same point as before the clear.
+*/
 
-// This forces the tree to recalculate now its preferred size
-// after being cleared
-GtkRequisition size;
-gtk_widget_get_preferred_size(GTK_WIDGET(m_pTreeView), nullptr, 
);
+// This forces the tree to recalculate now its preferred size
+// after being cleared
+GtkRequisition size;
+gtk_widget_get_preferred_size(GTK_WIDGET(m_pTreeView), nullptr, );
 
-m_nPendingVAdjustment = value;
+m_nPendingVAdjustment = value;
 
-// The value set here just has to be different to the final value
-// set later so that isn't a no-op
-gtk_adjustment_set_value(m_pVAdjustment, value - 0.0001);
+// The value set here just has to be different to the final value
+// set later so that isn't a no-op
+gtk_adjustment_set_value(m_pVAdjustment, value - 0.0001);
 
-// This will set the desired m_nPendingVAdjustment value right
-// before the tree gets drawn
-gtk_widget_add_tick_callback(GTK_WIDGET(m_pTreeView), 
setAdjustmentCallback, this, nullptr);
-}
+// This will set the desired m_nPendingVAdjustment value right
+// before the tree gets drawn
+gtk_widget_add_tick_callback(GTK_WIDGET(m_pTreeView), 
setAdjustmentCallback, this, nullptr);
 
 enable_notify_events();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-23 Thread Jim Raykowski (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 6e83e7778d26f35d79ce573b6ee3ab149f7b6179
Author: Jim Raykowski 
AuthorDate: Sun Mar 22 20:54:24 2020 -0800
Commit: Caolán McNamara 
CommitDate: Mon Mar 23 15:22:51 2020 +0100

GtkInstanceTreeView: Expand to path before setting cursor

Expands the parent of a child, if needed, so the child can be selected.

Change-Id: If4b7322a7024065e5e96ed2ed43289c5ae7c5f5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 02055e04b15b..46fa3b9cf03a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10144,6 +10144,14 @@ public:
 disable_notify_events();
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
 GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+GtkTreeIter Iter;
+if (gtk_tree_model_iter_parent(pModel, , 
const_cast()))
+{
+GtkTreePath* path = gtk_tree_model_get_path(pModel, );
+if (!gtk_tree_view_row_expanded(m_pTreeView, path))
+gtk_tree_view_expand_to_path(m_pTreeView, path);
+gtk_tree_path_free(path);
+}
 GtkTreePath* path = gtk_tree_model_get_path(pModel, 
const_cast());
 gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
 gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-22 Thread Andrea Gelmini (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 54d3760f7dbd759cc8de6c777c6a2154d2382f16
Author: Andrea Gelmini 
AuthorDate: Sat Mar 21 18:44:34 2020 +0100
Commit: Julien Nabet 
CommitDate: Sun Mar 22 12:27:42 2020 +0100

Fix typo

Change-Id: I52d6c6108861bf2118854e78b2653f3157595b31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90861
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 6f11a6a89017..02055e04b15b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10835,7 +10835,7 @@ public:
the same point as before the clear.
 */
 
-// This forces the tree to recalculate now its preferrred size
+// This forces the tree to recalculate now its preferred size
 // after being cleared
 GtkRequisition size;
 gtk_widget_get_preferred_size(GTK_WIDGET(m_pTreeView), nullptr, 
);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-21 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   56 ++-
 1 file changed, 55 insertions(+), 1 deletion(-)

New commits:
commit 0ef2443c856b2685c6c234d6c2016d30fb25a78e
Author: Caolán McNamara 
AuthorDate: Fri Mar 20 17:10:32 2020 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 21 11:22:16 2020 +0100

scroll GtkTreeView to a position after clear+fill without flickering

Change-Id: Ibe5519cf19c35da91ce7bef46a0b72292621d3e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90830
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ce42d63401a9..d8c0213e8750 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8637,6 +8637,7 @@ private:
 gint m_nImageCol;
 gint m_nExpanderImageCol;
 gint m_nIdCol;
+int m_nPendingVAdjustment;
 gulong m_nChangedSignalId;
 gulong m_nRowActivatedSignalId;
 gulong m_nTestExpandRowSignalId;
@@ -9207,6 +9208,24 @@ private:
 return nExpanderSize + (nHorizontalSeparator/ 2);
 }
 
+void real_vadjustment_set_value(int value)
+{
+disable_notify_events();
+gtk_adjustment_set_value(m_pVAdjustment, value);
+enable_notify_events();
+}
+
+static gboolean setAdjustmentCallback(GtkWidget*, GdkFrameClock*, gpointer 
widget)
+{
+GtkInstanceTreeView* pThis = static_cast(widget);
+if (pThis->m_nPendingVAdjustment != -1)
+{
+pThis->real_vadjustment_set_value(pThis->m_nPendingVAdjustment);
+pThis->m_nPendingVAdjustment = -1;
+}
+return false;
+}
+
 public:
 GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, 
bool bTakeOwnership)
 : GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, 
bTakeOwnership)
@@ -9217,6 +9236,7 @@ public:
 , m_nTextCol(-1)
 , m_nImageCol(-1)
 , m_nExpanderImageCol(-1)
+, m_nPendingVAdjustment(-1)
 , 
m_nChangedSignalId(g_signal_connect(gtk_tree_view_get_selection(pTreeView), 
"changed",
  G_CALLBACK(signalChanged), this))
 , m_nRowActivatedSignalId(g_signal_connect(pTreeView, "row-activated", 
G_CALLBACK(signalRowActivated), this))
@@ -10783,13 +10803,47 @@ public:
 
 virtual int vadjustment_get_value() const override
 {
+if (m_nPendingVAdjustment != -1)
+return m_nPendingVAdjustment;
 return gtk_adjustment_get_value(m_pVAdjustment);
 }
 
 virtual void vadjustment_set_value(int value) override
 {
 disable_notify_events();
-gtk_adjustment_set_value(m_pVAdjustment, value);
+
+if (value == 0)
+{
+gtk_adjustment_set_value(m_pVAdjustment, 0);
+m_nPendingVAdjustment = -1;
+}
+else
+{
+/* This rube goldberg device is to remove flicker from setting the
+   scroll position of a GtkTreeView directly after clearing it and
+   filling it. As a specific example the writer navigator with ~100
+   tables, scroll to the end, right click on an entry near the end
+   and rename it, the tree is cleared and refilled and an attempt
+   made to set the scroll position of the freshly refilled tree to
+   the same point as before the clear.
+*/
+
+// This forces the tree to recalculate now its preferrred size
+// after being cleared
+GtkRequisition size;
+gtk_widget_get_preferred_size(GTK_WIDGET(m_pTreeView), nullptr, 
);
+
+m_nPendingVAdjustment = value;
+
+// The value set here just has to be different to the final value
+// set later so that isn't a no-op
+gtk_adjustment_set_value(m_pVAdjustment, value - 0.0001);
+
+// This will set the desired m_nPendingVAdjustment value right
+// before the tree gets drawn
+gtk_widget_add_tick_callback(GTK_WIDGET(m_pTreeView), 
setAdjustmentCallback, this, nullptr);
+}
+
 enable_notify_events();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-16 Thread Andrea Gelmini (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cc17485472ca4217013cebaa32f7b574c020a394
Author: Andrea Gelmini 
AuthorDate: Thu Feb 13 18:33:29 2020 +0100
Commit: Andras Timar 
CommitDate: Mon Mar 16 09:53:13 2020 +0100

Fix typo

Change-Id: Iedeb55e5b907c6b837b0d70c2a17f6e23f824cd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88626
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 36b12d9742e1..d4c04ff0a88f 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -903,7 +903,7 @@ void GtkSalFrame::InitCommon()
 
 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 );
-if (GTK_IS_WINDOW(m_pWindow)) // i.e. not if its a GtkEventBox which 
doesn't have the signal
+if (GTK_IS_WINDOW(m_pWindow)) // i.e. not if it's a GtkEventBox which 
doesn't have the signal
 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 );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-13 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

New commits:
commit e52df8390274bfbf9eeb4a72a2b580ba03152ba0
Author: Caolán McNamara 
AuthorDate: Fri Mar 13 13:09:18 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 13 21:58:53 2020 +0100

compare using GtkTreePath instead of GtkTreeIter

Change-Id: I53d8f686fd924c82fc00285f28dbdc7c73577f7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90466
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fefc63bb1d1f..ce42d63401a9 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8598,11 +8598,11 @@ static GtkInstanceTreeView* g_DragSource;
 
 namespace {
 
-struct CompareGtkTreeIter
+struct CompareGtkTreePath
 {
-bool operator()(const GtkTreeIter& lhs, const GtkTreeIter& rhs) const
+bool operator()(const GtkTreePath* lhs, const GtkTreePath* rhs) const
 {
-return memcmp(, , sizeof(GtkTreeIter)) < 0;
+return gtk_tree_path_compare(lhs, rhs) < 0;
 }
 };
 
@@ -8626,7 +8626,7 @@ private:
 std::map m_aIndentMap;
 // currently expanding parent that logically, but not currently physically,
 // contain placeholders
-o3tl::sorted_vector 
m_aExpandingPlaceHolderParents;
+o3tl::sorted_vector 
m_aExpandingPlaceHolderParents;
 std::vector m_aSavedSortTypes;
 std::vector m_aSavedSortColumns;
 std::vector m_aViewColToModelCol;
@@ -8847,10 +8847,15 @@ private:
 
 bool child_is_placeholder(GtkInstanceTreeIter& rGtkIter) const
 {
-if (m_aExpandingPlaceHolderParents.count(rGtkIter.iter))
+GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+
+GtkTreePath* pPath = gtk_tree_model_get_path(pModel, );
+bool bExpanding = m_aExpandingPlaceHolderParents.count(pPath);
+gtk_tree_path_free(pPath);
+if (bExpanding)
 return true;
+
 bool bPlaceHolder = false;
-GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
 GtkTreeIter tmp;
 if (gtk_tree_model_iter_children(pModel, , ))
 {
@@ -8870,11 +8875,15 @@ private:
 // if there's a preexisting placeholder child, required to make this
 // potentially expandable in the first place, now we remove it
 GtkInstanceTreeIter aIter(iter);
+GtkTreePath* pPlaceHolderPath = nullptr;
 bool bPlaceHolder = child_is_placeholder(aIter);
 if (bPlaceHolder)
 {
 gtk_tree_store_remove(m_pTreeStore, );
-m_aExpandingPlaceHolderParents.insert(iter);
+
+GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+pPlaceHolderPath = gtk_tree_model_get_path(pModel, );
+m_aExpandingPlaceHolderParents.insert(pPlaceHolderPath);
 }
 
 aIter.iter = iter;
@@ -8889,7 +8898,8 @@ private:
 OUString sDummy("");
 insert_row(subiter, , -1, nullptr, , nullptr, 
nullptr, nullptr);
 }
-m_aExpandingPlaceHolderParents.erase(iter);
+m_aExpandingPlaceHolderParents.erase(pPlaceHolderPath);
+gtk_tree_path_free(pPlaceHolderPath);
 }
 
 enable_notify_events();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-13 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   35 +--
 1 file changed, 29 insertions(+), 6 deletions(-)

New commits:
commit 7ba168173addd286fef11c0d5634fb3a1eb73fee
Author: Caolán McNamara 
AuthorDate: Thu Mar 12 20:22:56 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 13 09:19:54 2020 +0100

skip on-demand entries on iter_next/iter_previous

Change-Id: I5a12cae948893ea4e221f335cc29acc663e1ce29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90442
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c9867a731903..fefc63bb1d1f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10139,10 +10139,20 @@ public:
 {
 GtkInstanceTreeIter& rGtkIter = 
static_cast(rIter);
 GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+GtkTreeIter tmp;
 GtkTreeIter iter = rGtkIter.iter;
-if (iter_children(rGtkIter))
+
+bool ret = gtk_tree_model_iter_children(pModel, , );
+rGtkIter.iter = tmp;
+if (ret)
+{
+//on-demand dummy entry doesn't count
+if (get_text(rGtkIter, -1) == "")
+return iter_next(rGtkIter);
 return true;
-GtkTreeIter tmp = iter;
+}
+
+tmp = iter;
 if (gtk_tree_model_iter_next(pModel, ))
 {
 rGtkIter.iter = tmp;
@@ -10163,6 +10173,7 @@ public:
 
 virtual bool iter_previous(weld::TreeIter& rIter) const override
 {
+bool ret = false;
 GtkInstanceTreeIter& rGtkIter = 
static_cast(rIter);
 GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
 GtkTreeIter iter = rGtkIter.iter;
@@ -10175,14 +10186,26 @@ public:
 rGtkIter.iter = tmp;
 else
 last_child(pModel, , , nChildren);
-return true;
+ret = true;
 }
-// Move up level
-if (gtk_tree_model_iter_parent(pModel, , ))
+else
 {
-rGtkIter.iter = tmp;
+// Move up level
+if (gtk_tree_model_iter_parent(pModel, , ))
+{
+rGtkIter.iter = tmp;
+ret = true;
+}
+}
+
+if (ret)
+{
+//on-demand dummy entry doesn't count
+if (get_text(rGtkIter, -1) == "")
+return iter_previous(rGtkIter);
 return true;
 }
+
 return false;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit af4a5ef3afc04d2c5472139e69bf9f56767a20d3
Author: Caolán McNamara 
AuthorDate: Wed Mar 11 12:42:01 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 11 15:33:23 2020 +0100

mysterious greyed out native toggle buttons when in foreground

and flipping to normal mode when in background.

Change-Id: I100efb651515b044d56a8c3838569cf717b37d51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90328
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 1a1a334d1439..3a8297b3ab52 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -3064,11 +3064,14 @@ bool GtkSalGraphics::updateSettings(AllSettings& 
rSettings)
 pos = gtk_widget_path_append_type (pCPath, GTK_TYPE_LABEL);
 gtk_widget_path_iter_add_class(pCPath, pos, GTK_STYLE_CLASS_LABEL);
 GtkStyleContext *pCStyle = makeContext (pCPath, nullptr);
+aContextState.save(pCStyle);
 
 GdkRGBA tooltip_bg_color, tooltip_fg_color;
 style_context_set_state(pCStyle, GTK_STATE_FLAG_NORMAL);
 gtk_style_context_get_color(pCStyle, 
gtk_style_context_get_state(pCStyle), _fg_color);
 gtk_style_context_get_background_color(pCStyle, 
gtk_style_context_get_state(pCStyle), _bg_color);
+
+aContextState.restore();
 g_object_unref( pCStyle );
 
 aStyleSet.SetHelpColor( getColor( tooltip_bg_color ));
@@ -3081,6 +3084,7 @@ bool GtkSalGraphics::updateSettings(AllSettings& 
rSettings)
 gtk_widget_path_append_type( pCPath, GTK_TYPE_TEXT_VIEW );
 gtk_widget_path_iter_add_class( pCPath, -1, GTK_STYLE_CLASS_VIEW );
 GtkStyleContext *pCStyle = makeContext( pCPath, nullptr );
+aContextState.save(pCStyle);
 
 // highlighting colors
 style_context_set_state(pCStyle, GTK_STATE_FLAG_SELECTED);
@@ -3120,6 +3124,7 @@ bool GtkSalGraphics::updateSettings(AllSettings& 
rSettings)
 aShadowColor.DecreaseLuminance(64);
 aStyleSet.SetShadowColor(aShadowColor);
 
+aContextState.restore();
 g_object_unref( pCStyle );
 
 // Tab colors
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0d81a613ef5af22253e51d9917c5d5c94d764456
Author: Caolán McNamara 
AuthorDate: Sun Mar 8 15:13:50 2020 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 8 17:08:32 2020 +0100

tdf#131223 let return deactive active popup

Change-Id: Ib116a1eb047aa9f1a5ca7a2ec9333a793addd304
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90188
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f589667bd4e4..202b5f4c1c10 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12397,8 +12397,8 @@ private:
 case KEY_RIGHT:
 case KEY_RETURN:
 m_aQuickSelectionEngine.Reset();
-// tdf#131076 don't let bare return toggle menu popup
-if (nCode == KEY_RETURN && !pEvent->state)
+// tdf#131076 don't let bare return toggle menu popup active, 
but do allow deactive
+if (nCode == KEY_RETURN && !pEvent->state && !m_bPopupActive)
 bDone = combobox_activate();
 break;
 default:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-08 Thread Julien Nabet (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 3ddfba19c964a65a5bfa1c172e83532af305c985
Author: Julien Nabet 
AuthorDate: Sun Mar 8 00:25:16 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Mar 8 15:15:11 2020 +0100

tdf#131210: avoid infinite loop in 'Date acceptance patterns'

Change-Id: Ib049b5d44f91e2b36c068e1ef351ae81707d885e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90180
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 10ddc6612ec9..f589667bd4e4 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8339,11 +8339,13 @@ public:
 
 virtual void replace_selection(const OUString& rText) override
 {
+disable_notify_events();
 gtk_editable_delete_selection(GTK_EDITABLE(m_pEntry));
 OString sText(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
 gint position = gtk_editable_get_position(GTK_EDITABLE(m_pEntry));
 gtk_editable_insert_text(GTK_EDITABLE(m_pEntry), sText.getStr(), 
sText.getLength(),
  );
+enable_notify_events();
 }
 
 virtual void set_position(int nCursorPos) override
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-06 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit b5d1c3c8519308d610a37e29eea300ad654cd371
Author: Caolán McNamara 
AuthorDate: Fri Mar 6 12:42:35 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 6 17:26:39 2020 +0100

don't set labels/icon if the toolitem isn't a button

Change-Id: I48cd752e72e2c9fb92713343d9b3447817b10728
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90105
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bf480535ec8e..10ddc6612ec9 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7699,12 +7699,16 @@ public:
 virtual void set_item_label(int nIndex, const OUString& rLabel) override
 {
 GtkToolItem* pItem = gtk_toolbar_get_nth_item(m_pToolbar, nIndex);
+if (!GTK_IS_TOOL_BUTTON(pItem))
+return;
 gtk_tool_button_set_label(GTK_TOOL_BUTTON(pItem), 
MapToGtkAccelerator(rLabel).getStr());
 }
 
 virtual void set_item_label(const OString& rIdent, const OUString& rLabel) 
override
 {
 GtkToolButton* pItem = m_aMap[rIdent];
+if (!pItem)
+return;
 gtk_tool_button_set_label(GTK_TOOL_BUTTON(pItem), 
MapToGtkAccelerator(rLabel).getStr());
 }
 
@@ -7717,6 +7721,8 @@ public:
 virtual void set_item_icon_name(const OString& rIdent, const OUString& 
rIconName) override
 {
 GtkToolButton* pItem = m_aMap[rIdent];
+if (!pItem)
+return;
 
 GtkWidget* pImage = nullptr;
 
@@ -7733,18 +7739,24 @@ public:
 virtual void set_item_image(const OString& rIdent, const 
css::uno::Reference& rIcon) override
 {
 GtkToolButton* pItem = m_aMap[rIdent];
+if (!pItem)
+return;
 set_item_image(pItem, rIcon);
 }
 
 virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) 
override
 {
 GtkToolButton* pItem = m_aMap[rIdent];
+if (!pItem)
+return;
 set_item_image(pItem, pDevice);
 }
 
 virtual void set_item_image(int nIndex, const 
css::uno::Reference& rIcon) override
 {
 GtkToolItem* pItem = gtk_toolbar_get_nth_item(m_pToolbar, nIndex);
+if (!GTK_IS_TOOL_BUTTON(pItem))
+return;
 set_item_image(GTK_TOOL_BUTTON(pItem), rIcon);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-06 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit beabc0deddce2a5ce0a9f9b20316a7798a08318c
Author: Caolán McNamara 
AuthorDate: Fri Mar 6 12:35:53 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 6 16:24:08 2020 +0100

failure seen as setting length of -1 and returning null

Change-Id: I84e7b3a4ad63e70499910f09bd4c70a43137fa10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90103
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index a4f90290e3bd..36b12d9742e1 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3456,8 +3456,12 @@ public:
 gint length(0);
 const guchar *rawdata = 
gtk_selection_data_get_data_with_length(m_pData,
 
);
-css::uno::Sequence aSeq(reinterpret_cast(rawdata), length);
-aRet <<= aSeq;
+// seen here was rawhide == nullptr and length set to -1
+if (rawdata)
+{
+css::uno::Sequence aSeq(reinterpret_cast(rawdata), length);
+aRet <<= aSeq;
+}
 }
 
 gtk_selection_data_free(m_pData);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-04 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 4e755e622f2d782d657626b6234fb3acd3d08e15
Author: Caolán McNamara 
AuthorDate: Wed Mar 4 17:04:07 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 4 21:38:35 2020 +0100

scroll to the row when putting the cursor in it

Change-Id: If1edbf1d0f94176a12a9359c17179301304f2c56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89988
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8c384f5477df..a79a3b6fa654 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9560,6 +9560,7 @@ public:
 {
 disable_notify_events();
 GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
+gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
 gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
 gtk_tree_path_free(path);
 enable_notify_events();
@@ -10064,6 +10065,7 @@ public:
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
 GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
 GtkTreePath* path = gtk_tree_model_get_path(pModel, 
const_cast());
+gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
 gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
 gtk_tree_path_free(path);
 enable_notify_events();
@@ -10614,6 +10616,7 @@ public:
 }
 g_list_free(pRenderers);
 
+gtk_tree_view_scroll_to_cell(m_pTreeView, path, pColumn, false, 0, 0);
 gtk_tree_view_set_cursor(m_pTreeView, path, pColumn, true);
 
 gtk_tree_path_free(path);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-04 Thread Andrea Gelmini (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8d9d6d43a9d895eb781a7fb7f47b7e4342883829
Author: Andrea Gelmini 
AuthorDate: Wed Mar 4 19:26:22 2020 +0100
Commit: Julien Nabet 
CommitDate: Wed Mar 4 19:55:04 2020 +0100

Fix typo

Change-Id: I90b8ec6b62ae421822acdec0d99b0ff768b01e09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89990
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e8f827738f25..d9e3320fe09a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12353,7 +12353,7 @@ private:
 bDone = combobox_activate();
 break;
 default:
-// tdf#131076 let base space toggle menu popup when its not 
already visible
+// tdf#131076 let base space toggle menu popup when it's not 
already visible
 if (nCode == KEY_SPACE && !pEvent->state && !m_bPopupActive)
 bDone = false;
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-04 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit b07d429f8610c4df93dffa72552f4f759ec0b74f
Author: Caolán McNamara 
AuthorDate: Wed Mar 4 14:02:33 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 4 17:44:24 2020 +0100

leave focus where it came from for GtkMenuToolButtons

Change-Id: I111aac99120ae2d3284f5c41a52cde718079a383
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89976
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 99fc6205ad67..e8f827738f25 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7471,6 +7471,10 @@ private:
 if (pMenuButton)
 {
 m_aMenuButtonMap[id] = 
std::make_unique(pMenuButton, m_pBuilder, false);
+// so that, e.g. with focus initially in writer main document then
+// after clicking the heading menu in the writer navigator focus is
+// left in the main document and not in the toolbar
+gtk_button_set_focus_on_click(GTK_BUTTON(pMenuButton), false);
 g_signal_connect(pMenuButton, "toggled", 
G_CALLBACK(signalItemToggled), this);
 }
 g_signal_connect(pToolItem, "clicked", G_CALLBACK(signalItemClicked), 
this);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-04 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 7a078207fbfd71b33cb51c38b3886351fedcde8d
Author: Caolán McNamara 
AuthorDate: Wed Mar 4 10:13:08 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 4 12:45:18 2020 +0100

tdf#131076 allow 'return' in GtkComboBox to activate default widget

typically ok and accept the dialog. alt+down is documented as the
default menu-activate key binding, space will also work to popup
the menu from a combobox.

Change-Id: I7bec880670cc006b288996d6f59a88fe9a9fb8cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89950
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 28344edc8cc4..99fc6205ad67 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12305,6 +12305,24 @@ private:
 g_signal_handler_unblock(m_pMenu, m_nMenuActivateSignalId);
 }
 
+// tdf#131076 we want return in a GtkComboBox to act like return in a
+// GtkEntry and activate the default dialog/assistant button
+bool combobox_activate()
+{
+GtkWidget *pComboBox = GTK_WIDGET(m_pComboBox);
+GtkWidget *pToplevel = gtk_widget_get_toplevel(pComboBox);
+GtkWindow *pWindow = GTK_WINDOW(pToplevel);
+if (!pWindow)
+return false;
+if (!GTK_IS_DIALOG(pWindow) && !GTK_IS_ASSISTANT(pWindow))
+return false;
+bool bDone = false;
+GtkWidget *pDefaultWidget = gtk_window_get_default_widget(pWindow);
+if (pDefaultWidget && pDefaultWidget != m_pToggleButton && 
gtk_widget_get_sensitive(pDefaultWidget))
+bDone = gtk_widget_activate(pDefaultWidget);
+return bDone;
+}
+
 bool signal_key_press(const GdkEventKey* pEvent)
 {
 KeyEvent aKEvt(GtkToVcl(*pEvent));
@@ -12313,7 +12331,8 @@ private:
 
 bool bDone = false;
 
-switch (aKeyCode.GetCode())
+auto nCode = aKeyCode.GetCode();
+switch (nCode)
 {
 case KEY_DOWN:
 case KEY_UP:
@@ -12325,9 +12344,16 @@ private:
 case KEY_RIGHT:
 case KEY_RETURN:
 m_aQuickSelectionEngine.Reset();
+// tdf#131076 don't let bare return toggle menu popup
+if (nCode == KEY_RETURN && !pEvent->state)
+bDone = combobox_activate();
 break;
 default:
-bDone = m_aQuickSelectionEngine.HandleKeyEvent(aKEvt);
+// tdf#131076 let base space toggle menu popup when its not 
already visible
+if (nCode == KEY_SPACE && !pEvent->state && !m_bPopupActive)
+bDone = false;
+else
+bDone = m_aQuickSelectionEngine.HandleKeyEvent(aKEvt);
 break;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-02 Thread Jan-Marek Glogowski (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit a0e8a42a45abc7e626346bf01903ed81a026287d
Author: Jan-Marek Glogowski 
AuthorDate: Sat Feb 29 19:37:35 2020 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Mon Mar 2 10:34:03 2020 +0100

tdf#131031 Gtk3 presume the resize did happen

Regression from commit b26ca5b13733b46c2df0787502f885e15b390956
("tdf#130841 resize to client size after SetPosSize"). It just
happens for me on gtk3, not gen and not win. But since gtk3 also
sets the nX and nY value SetPosSize eventually before the fact,
do the same for the nWidth and nHeight.

Change-Id: I2898c403b73de790f3f988b8b8ec2067f4b0b43f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89760
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 12df8c289fae..a4f90290e3bd 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1482,6 +1482,9 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long 
nWidth, long nHeight, sal_u
 {
 m_bDefaultSize = false;
 
+maGeometry.nWidth = nWidth;
+maGeometry.nHeight = nHeight;
+
 if( isChild( false ) )
 widget_set_size_request(nWidth, nHeight);
 else if( ! ( m_nState & GDK_WINDOW_STATE_MAXIMIZED ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-03-01 Thread Samuel Thibault (via logerrit)
 vcl/unx/gtk3/a11y/gtk3atktext.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 607827d988f7690a52ccb947231441cd1da7
Author: Samuel Thibault 
AuthorDate: Tue Feb 25 22:19:26 2020 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Mar 2 03:23:24 2020 +0100

gtk3 a11y: fix get_text(1,-1)

Even when the end offset is -1, we have to return the text starting a the
given starting position, up to the end, but not necessarily from the
beginning.

Change-Id: I6a79092c683c273eaedb8661545df71b742110ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89486
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/unx/gtk3/a11y/gtk3atktext.cxx 
b/vcl/unx/gtk3/a11y/gtk3atktext.cxx
index 1406ceea5544..f219efb90fef 100644
--- a/vcl/unx/gtk3/a11y/gtk3atktext.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atktext.cxx
@@ -250,10 +250,13 @@ text_wrapper_get_text (AtkText *text,
 OUString aText;
 sal_Int32 n = pText->getCharacterCount();
 
-if( -1 == end_offset )
-aText = pText->getText();
-else if( start_offset < n )
-aText = pText->getTextRange(start_offset, end_offset);
+if( start_offset < n )
+{
+if( -1 == end_offset )
+aText = pText->getTextRange(start_offset, n - 
start_offset);
+else
+aText = pText->getTextRange(start_offset, end_offset);
+}
 
 ret = g_strdup( OUStringToOString(aText, RTL_TEXTENCODING_UTF8 
).getStr() );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2cf5fa87c405e5665ad14951b52c7cae38ab79fc
Author: Caolán McNamara 
AuthorDate: Wed Feb 26 14:19:45 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 26 16:42:36 2020 +0100

tdf#130845 sidebar widget visible when sidebar collapsed

default to "false" and track the parent widget clipping/visibility
instead of "true" which makes it unconditionally visible

Change-Id: I1f8cec2b07ac20c33ff09cc278424d7e20199946
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89552
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ad19e1d762f0..f1d28a270e15 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13975,7 +13975,7 @@ weld::Builder* 
GtkInstance::CreateInterimBuilder(vcl::Window* pParent, const OUS
 // support GtkWidgets within a vcl::Window
 SystemWindowData winData = {};
 winData.bClipUsingNativeWidget = true;
-auto xEmbedWindow = VclPtr::Create(pParent, 0, 
, true);
+auto xEmbedWindow = VclPtr::Create(pParent, 0, 
, false);
 xEmbedWindow->Show();
 xEmbedWindow->set_expand(true);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   34 --
 1 file changed, 28 insertions(+), 6 deletions(-)

New commits:
commit 9b17ad5b54b684e58eb488f2ab586e694c65e1ef
Author: Caolán McNamara 
AuthorDate: Wed Feb 26 11:57:04 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 26 16:42:01 2020 +0100

get the real last row, not the last toplevel row

Change-Id: I7de72c383f11187ec706cd6971ff0431d04db72f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89539
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1e93792e7778..ad19e1d762f0 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9051,6 +9051,33 @@ private:
 return true;
 }
 
+void last_child(GtkTreeModel* pModel, GtkTreeIter* result, GtkTreeIter* 
pParent, int nChildren)
+{
+gtk_tree_model_iter_nth_child(pModel, result, pParent, nChildren - 1);
+nChildren = gtk_tree_model_iter_n_children(pModel, result);
+if (nChildren)
+{
+GtkTreeIter newparent(*result);
+last_child(pModel, result, , nChildren);
+}
+}
+
+GtkTreePath* get_path_of_last_entry(GtkTreeModel *pModel)
+{
+GtkTreePath *lastpath;
+// find the last entry in the model for comparison
+int nChildren = gtk_tree_model_iter_n_children(pModel, nullptr);
+if (!nChildren)
+lastpath = gtk_tree_path_new_from_indices(0, -1);
+else
+{
+GtkTreeIter iter;
+last_child(pModel, , nullptr, nChildren);
+lastpath = gtk_tree_model_get_path(pModel, );
+}
+return lastpath;
+}
+
 public:
 GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, 
bool bTakeOwnership)
 : GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, 
bTakeOwnership)
@@ -10381,12 +10408,7 @@ public:
 
 // find the last entry in the model for comparison
 GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
-int nChildren = gtk_tree_model_iter_n_children(pModel, nullptr);
-GtkTreePath *lastpath;
-if (nChildren)
-lastpath = gtk_tree_path_new_from_indices(nChildren - 1, -1);
-else
-lastpath = gtk_tree_path_new_from_indices(0, -1);
+GtkTreePath *lastpath = get_path_of_last_entry(pModel);
 
 if (!ret)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 813217dee1d809a2c33785c9024dc42671696067
Author: Caolán McNamara 
AuthorDate: Tue Feb 25 15:23:38 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 26 09:52:50 2020 +0100

only call enter/leave page when not changing programatically

which is how the vcl version traditionally works, this results
in the "General" tab in the basic dialog editor 'sticking' as the
the default page

Change-Id: I2bc88093df48724c32c99add5234968fa672e4a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89463
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e6c80ab1a456..1e93792e7778 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5694,6 +5694,7 @@ private:
 guint m_nLaunchSplitTimeoutId;
 bool m_bOverFlowBoxActive;
 bool m_bOverFlowBoxIsStart;
+bool m_bInternalPageChange;
 int m_nStartTabCount;
 int m_nEndTabCount;
 mutable std::vector> m_aPages;
@@ -5726,7 +5727,7 @@ private:
 nNewPage += nOverFlowLen;
 }
 
-bool bAllow = !m_aLeavePageHdl.IsSet() || 
m_aLeavePageHdl.Call(get_current_page_ident());
+bool bAllow = m_bInternalPageChange || !m_aLeavePageHdl.IsSet() || 
m_aLeavePageHdl.Call(get_current_page_ident());
 if (!bAllow)
 {
 g_signal_stop_emission_by_name(m_pNotebook, "switch-page");
@@ -5735,7 +5736,8 @@ private:
 if (m_bOverFlowBoxActive)
 gtk_notebook_set_current_page(m_pOverFlowNotebook, 
gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1);
 OString sNewIdent(get_page_ident(nNewPage));
-m_aEnterPageHdl.Call(sNewIdent);
+if (!m_bInternalPageChange)
+m_aEnterPageHdl.Call(sNewIdent);
 }
 
 void unsplit_notebooks()
@@ -6133,6 +6135,7 @@ public:
 , m_nLaunchSplitTimeoutId(0)
 , m_bOverFlowBoxActive(false)
 , m_bOverFlowBoxIsStart(false)
+, m_bInternalPageChange(false)
 , m_nStartTabCount(0)
 , m_nEndTabCount(0)
 {
@@ -6234,6 +6237,13 @@ public:
 
 virtual void set_current_page(int nPage) override
 {
+// normally we'd call disable_notify_events/enable_notify_events here,
+// but the notebook is complicated by the need to support the
+// double-decker hackery so for simplicity just flag that the page
+// change is not a directly user-triggered one
+bool bInternalPageChange = m_bInternalPageChange;
+m_bInternalPageChange = true;
+
 if (m_bOverFlowBoxIsStart)
 {
 auto nOverFlowLen = m_bOverFlowBoxActive ? 
gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1 : 0;
@@ -6256,6 +6266,8 @@ public:
 gtk_notebook_set_current_page(m_pOverFlowNotebook, nPage);
 }
 }
+
+m_bInternalPageChange = bInternalPageChange;
 }
 
 virtual void set_current_page(const OString& rIdent) override
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4c15615d348f184ccc9d6f126f0840cec40e8e2c
Author: Caolán McNamara 
AuthorDate: Tue Feb 25 17:06:39 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 26 09:51:59 2020 +0100

leave "skipped" events available to gtk parent handler

Change-Id: I6cf4b8b308ec41a46aeb6b48554d87a2fa316d85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89475
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 155472a91532..e6c80ab1a456 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2058,7 +2058,7 @@ private:
 gdk_event_free(pPeekEvent);
 if (bSkip)
 {
-return true;
+return false;
 }
 }
 nEventType = SalEvent::MouseButtonDown;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-25 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 64ad7b44e3b36f538a23a851b0e9df7ee0df52b7
Author: Caolán McNamara 
AuthorDate: Tue Feb 25 09:07:09 2020 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 25 15:03:33 2020 +0100

cancelling drag from drag-begin doesn't work, call it async

Change-Id: I9323e8ab4d3df9f2ded0c7bfb21582faa3b5e1a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89412
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9d958393a5f1..155472a91532 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1819,6 +1819,7 @@ protected:
 
 DECL_LINK(async_signal_focus_in, void*, void);
 DECL_LINK(async_signal_focus_out, void*, void);
+DECL_LINK(async_drag_cancel, void*, void);
 
 void launch_signal_focus_in()
 {
@@ -1871,6 +1872,15 @@ protected:
 return false;
 }
 
+void launch_drag_cancel(GdkDragContext* context)
+{
+// post our drag cancel to happen at the next available event cycle
+if (m_pDragCancelEvent)
+return;
+g_object_ref(context);
+m_pDragCancelEvent = Application::PostUserEvent(LINK(this, 
GtkInstanceWidget, async_drag_cancel), context);
+}
+
 void signal_focus_out()
 {
 m_aFocusOutHdl.Call(*this);
@@ -1958,6 +1968,7 @@ private:
 int m_nPressStartY;
 ImplSVEvent* m_pFocusInEvent;
 ImplSVEvent* m_pFocusOutEvent;
+ImplSVEvent* m_pDragCancelEvent;
 GtkCssProvider* m_pBgCssProvider;
 GdkDragAction m_eDragAction;
 gulong m_nFocusInSignalId;
@@ -2238,7 +2249,7 @@ private:
 {
 if (do_signal_drag_begin())
 {
-gtk_drag_cancel(context);
+launch_drag_cancel(context);
 return;
 }
 if (!m_xDragSource)
@@ -2318,6 +2329,7 @@ public:
 , m_nPressStartY(-1)
 , m_pFocusInEvent(nullptr)
 , m_pFocusOutEvent(nullptr)
+, m_pDragCancelEvent(nullptr)
 , m_pBgCssProvider(nullptr)
 , m_eDragAction(GdkDragAction(0))
 , m_nFocusInSignalId(0)
@@ -2895,6 +2907,8 @@ public:
 Application::RemoveUserEvent(m_pFocusInEvent);
 if (m_pFocusOutEvent)
 Application::RemoveUserEvent(m_pFocusOutEvent);
+if (m_pDragCancelEvent)
+Application::RemoveUserEvent(m_pDragCancelEvent);
 if (m_nDragMotionSignalId)
 g_signal_handler_disconnect(m_pWidget, m_nDragMotionSignalId);
 if (m_nDragDropSignalId)
@@ -3012,6 +3026,14 @@ IMPL_LINK_NOARG(GtkInstanceWidget, 
async_signal_focus_out, void*, void)
 signal_focus_out();
 }
 
+IMPL_LINK(GtkInstanceWidget, async_drag_cancel, void*, arg, void)
+{
+m_pDragCancelEvent = nullptr;
+GdkDragContext* context = static_cast(arg);
+gtk_drag_cancel(context);
+g_object_unref(context);
+}
+
 namespace
 {
 OString MapToGtkAccelerator(const OUString )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-24 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 982c8bfce565bc2e2c3802924ec73e9d247044f2
Author: Caolán McNamara 
AuthorDate: Mon Feb 24 11:20:38 2020 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 24 14:03:46 2020 +0100

set the state on the widget instead of the context to get it to stick

Change-Id: I76f7487957d38f155ea086fd01855149ad170166
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89339
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fe3cd37ba8af..0875bb071251 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7536,11 +7536,10 @@ public:
 find_menupeer_button(GTK_WIDGET(pToolButton), );
 if (pButton)
 {
-GtkStyleContext *pWidgetContext = 
gtk_widget_get_style_context(GTK_WIDGET(pButton));
-auto eState = gtk_style_context_get_state(pWidgetContext) & 
~GTK_STATE_FLAG_CHECKED;
+auto eState = gtk_widget_get_state_flags(GTK_WIDGET(pButton)) 
& ~GTK_STATE_FLAG_CHECKED;
 if (bActive)
 eState |= GTK_STATE_FLAG_CHECKED;
-gtk_style_context_set_state(pWidgetContext, 
static_cast(eState));
+gtk_widget_set_state_flags(GTK_WIDGET(pButton), 
static_cast(eState), true);
 }
 }
 else if (GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton))
@@ -7562,8 +7561,7 @@ public:
 find_menupeer_button(GTK_WIDGET(pToolButton), );
 if (pButton)
 {
-GtkStyleContext *pWidgetContext = 
gtk_widget_get_style_context(GTK_WIDGET(pButton));
-return gtk_style_context_get_state(pWidgetContext) & 
GTK_STATE_FLAG_CHECKED;
+return gtk_widget_get_state_flags(GTK_WIDGET(pButton)) & 
GTK_STATE_FLAG_CHECKED;
 }
 }
 else if (GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 817656f12b7a3ea791d2a483cdabe201fde59ec6
Author: Caolán McNamara 
AuthorDate: Mon Feb 17 14:38:45 2020 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 17 16:30:59 2020 +0100

default to not selecting all on explicitly grabbing focus

like vcl does, cause there are assumptions built into the writer
InputEdit that this is the case

Change-Id: I39358e2c82f602fe2e9a62d54d075888fe80265f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88864
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bdaf11ffecf6..9e023d4b2c3a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8343,6 +8343,13 @@ public:
 gtk_entry_set_placeholder_text(m_pEntry, rText.toUtf8().getStr());
 }
 
+virtual void grab_focus() override
+{
+disable_notify_events();
+gtk_entry_grab_focus_without_selecting(m_pEntry);
+enable_notify_events();
+}
+
 virtual ~GtkInstanceEntry() override
 {
 g_signal_handler_disconnect(m_pEntry, m_nActivateSignalId);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 734ec70f30340a7d943dc8121b51a2a24902a5c5
Author: Caolán McNamara 
AuthorDate: Sun Feb 16 17:02:52 2020 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 17 15:45:01 2020 +0100

disconnect damage when target window is destroyed

Change-Id: I4b14ec12112e54bc913fe960808f0bbf8ba4bada
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88820
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index ee32281378be..3165067028d5 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3694,6 +3694,10 @@ void GtkSalFrame::signalDestroy( GtkWidget* pObj, 
gpointer frame )
 GtkSalFrame* pThis = static_cast(frame);
 if( pObj == pThis->m_pWindow )
 {
+pThis->m_aDamageHandler.damaged = nullptr;
+pThis->m_aDamageHandler.handle = nullptr;
+if (pThis->m_pSurface)
+cairo_surface_set_user_data(pThis->m_pSurface, 
SvpSalGraphics::getDamageKey(), nullptr, nullptr);
 pThis->m_pFixedContainer = nullptr;
 pThis->m_pEventBox = nullptr;
 pThis->m_pTopLevelGrid = nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkinst.cxx |   53 ---
 1 file changed, 40 insertions(+), 13 deletions(-)

New commits:
commit e05c7017a04a1c2a2ee4dc22ee53ae8d66847c32
Author: Caolán McNamara 
AuthorDate: Sun Feb 16 20:45:06 2020 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 17 12:05:37 2020 +0100

Related: tdf#130414 implement queue_resize for ChildFrame

so it can respond to changes to its childrens layout request state

Change-Id: I32235c1df9f315954b9d91b500388abe663fa16d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88824
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f6414f2f9d8c..bdaf11ffecf6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3461,20 +3461,47 @@ public:
 }
 };
 
-class ChildFrame : public WorkWindow
+class ChildFrame : public WorkWindow
+{
+private:
+Idle  maLayoutIdle;
+
+DECL_LINK(ImplHandleLayoutTimerHdl, Timer*, void);
+public:
+ChildFrame(vcl::Window* pParent, WinBits nStyle)
+: WorkWindow(pParent, nStyle)
 {
-public:
-ChildFrame(vcl::Window* pParent, WinBits nStyle)
-: WorkWindow(pParent, nStyle)
-{
-}
-virtual void Resize() override
-{
-WorkWindow::Resize();
-if (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild))
-pChild->SetPosSizePixel(Point(0, 0), GetSizePixel());
-}
-};
+maLayoutIdle.SetPriority(TaskPriority::RESIZE);
+maLayoutIdle.SetInvokeHandler( LINK( this, ChildFrame, 
ImplHandleLayoutTimerHdl ) );
+maLayoutIdle.SetDebugName( "ChildFrame maLayoutIdle" );
+}
+
+virtual void dispose() override
+{
+maLayoutIdle.Stop();
+WorkWindow::dispose();
+}
+
+virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override
+{
+WorkWindow::queue_resize(eReason);
+if (maLayoutIdle.IsActive())
+return;
+maLayoutIdle.Start();
+}
+
+virtual void Resize() override
+{
+WorkWindow::Resize();
+queue_resize();
+}
+};
+
+IMPL_LINK_NOARG(ChildFrame, ImplHandleLayoutTimerHdl, Timer*, void)
+{
+if (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild))
+pChild->SetPosSizePixel(Point(0, 0), GetSizePixel());
+}
 
 class GtkInstanceContainer : public GtkInstanceWidget, public virtual 
weld::Container
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit e30caebf76ccd088840b870ecb8929ce132baed0
Author: Caolán McNamara 
AuthorDate: Fri Feb 14 17:08:04 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Feb 14 20:57:46 2020 +0100

don't use gtk_window_group_remove_window if widgets are not GtkWindows

Change-Id: I80d01f29091d7cc06e82295e781ef7a53fb7776b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88739
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 118c77f9f7b3..ee32281378be 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2252,19 +2252,22 @@ const SystemEnvData* GtkSalFrame::GetSystemData() const
 
 void GtkSalFrame::SetParent( SalFrame* pNewParent )
 {
+GtkWindow* pWindow = GTK_IS_WINDOW(m_pWindow) ? GTK_WINDOW(m_pWindow) : 
nullptr;
 if (m_pParent)
 {
-
gtk_window_group_remove_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)),
 GTK_WINDOW(m_pWindow));
+if (pWindow && GTK_IS_WINDOW(m_pParent->m_pWindow))
+
gtk_window_group_remove_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)),
 pWindow);
 m_pParent->m_aChildren.remove(this);
 }
 m_pParent = static_cast(pNewParent);
 if (m_pParent)
 {
 m_pParent->m_aChildren.push_back(this);
-
gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)),
 GTK_WINDOW(m_pWindow));
+if (pWindow && GTK_IS_WINDOW(m_pParent->m_pWindow))
+
gtk_window_group_add_window(gtk_window_get_group(GTK_WINDOW(m_pParent->m_pWindow)),
 pWindow);
 }
-if( ! isChild() )
-gtk_window_set_transient_for( GTK_WINDOW(m_pWindow),
+if (!isChild() && pWindow)
+gtk_window_set_transient_for( pWindow,
   (m_pParent && ! 
m_pParent->isChild(true,false)) ? GTK_WINDOW(m_pParent->m_pWindow) : nullptr
  );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit ce16f1f32937ee881268abf91454900b0170c637
Author: Caolán McNamara 
AuthorDate: Fri Feb 14 16:57:12 2020 +
Commit: Caolán McNamara 
CommitDate: Fri Feb 14 20:57:06 2020 +0100

Resolves: tdf#130414 don't crash attempting gtk_fixed_move if parent changed

Change-Id: I5b51f1fb0eccbdb1b3ad14ff7b36077a0016a838
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88738
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 62d49dd106e8..118c77f9f7b3 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -709,10 +709,15 @@ void GtkSalFrame::moveWindow( long nX, long nY )
 {
 if( isChild( false ) )
 {
-if( m_pParent )
-gtk_fixed_move( m_pParent->getFixedContainer(),
+GtkWidget* pParent = m_pParent ? gtk_widget_get_parent(m_pWindow) : 
nullptr;
+// tdf#130414 its possible that we were reparented and are no longer 
inside
+// our original GtkFixed parent
+if (pParent && GTK_IS_FIXED(pParent))
+{
+gtk_fixed_move( GTK_FIXED(pParent),
 m_pWindow,
 nX - m_pParent->maGeometry.nX, nY - 
m_pParent->maGeometry.nY );
+}
 }
 else
 gtk_window_move( GTK_WINDOW(m_pWindow), nX, nY );
@@ -1030,7 +1035,6 @@ void GtkSalFrame::Init( SalFrame* pParent, 
SalFrameStyleFlags nStyle )
 // insert into container
 gtk_fixed_put( m_pParent->getFixedContainer(),
m_pWindow, 0, 0 );
-
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-13 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f2818681e949c67bcce430c4f83b3a75df75dcc4
Author: Caolán McNamara 
AuthorDate: Thu Feb 13 09:40:45 2020 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 13 13:37:42 2020 +0100

set-focus doesn't exist in GtkEventBox, only GtkWindow

Change-Id: I7e8ba4891a34fa585831e11fd4e2fcbbfe7b859d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88595
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 60886d3439e8..09a6b11bc45e 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -898,7 +898,8 @@ void GtkSalFrame::InitCommon()
 
 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 );
+if (GTK_IS_WINDOW(m_pWindow)) // i.e. not if its a GtkEventBox which 
doesn't have the signal
+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 );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2020-02-11 Thread Maxim Monastirsky (via logerrit)
 vcl/unx/gtk3/gtk3gtkframe.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 2ce99d12771407631288af5a12fe2165ae3599d8
Author: Maxim Monastirsky 
AuthorDate: Tue Feb 11 23:36:54 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Feb 12 06:57:15 2020 +0100

nModCode assigned but not used

aModEvt.mnCode used to get the currently pressed keys
before commit fe0451259d2fb93c809c1bfa3baf5abd90019c58
("tdf#103158 ctrl+shift should work on key up"). Now
it gets the previously pressed ones, by ignoring the
last nModCode assignment.

My intention in the mentioned commit was to only change
aModEvt.mnModKeyCode to also include the released key,
and nothing else. So let's revert the unintentional
change to aModEvt.mnCode.

Change-Id: Ic182119e732b79bc494c73f9bd72959f75cc38b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88484
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 85106bb86035..60886d3439e8 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3188,17 +3188,16 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointe
 
 SalKeyModEvent aModEvt;
 aModEvt.mbDown = pEvent->type == GDK_KEY_PRESS;
-aModEvt.mnCode = nModCode;
 
 if( pEvent->type == GDK_KEY_RELEASE )
 {
 aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
-nModCode &= ~nModMask;
+aModEvt.mnCode = nModCode & ~nModMask;
 pThis->m_nKeyModifiers &= ~nExtModMask;
 }
 else
 {
-nModCode |= nModMask;
+aModEvt.mnCode = nModCode | nModMask;
 pThis->m_nKeyModifiers |= nExtModMask;
 aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


<    3   4   5   6   7   8   9   10   11   12   >