[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2023-04-20 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 3cf2229102abe46daaf474a875bf24d60f64b12f
Author: Caolán McNamara 
AuthorDate: Thu Apr 20 09:49:36 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Apr 20 13:23:55 2023 +0200

Resolves: tdf#154623 KEY_DECIMAL == GDK_KEY_KP_Decimal or 
GDK_KEY_KP_Separator

Change-Id: Iade6d3f93ff7f9dcc35c5a04e21617df06955527
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150623
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 50253a2cb2e1b604f0d5bfb5be1d6f91eaa0bc8b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150625
Reviewed-by: Xisco Fauli 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 1841ebbaf7f4..592641504018 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -2479,8 +2479,9 @@ GtkWindow* get_active_window()
 
 void LocalizeDecimalSeparator(guint& keyval)
 {
-// #i1820# use locale specific decimal separator
-if (keyval == GDK_KEY_KP_Decimal && 
Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
+const bool bDecimalKey = keyval == GDK_KEY_KP_Decimal || keyval == 
GDK_KEY_KP_Separator;
+// #i1820# (and tdf#154623) use locale specific decimal separator
+if (bDecimalKey && 
Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
 {
 GtkWindow* pFocusWin = get_active_window();
 GtkWidget* pFocus = pFocusWin ? gtk_window_get_focus(pFocusWin) : 
nullptr;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2023-03-21 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9cb9bda78a7e47c4948e6ef2702f07460b22050a
Author: Caolán McNamara 
AuthorDate: Mon Mar 20 11:31:25 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 21 08:36:25 2023 +

tdf#154232 signal_drag_begin callback can delete current GtkTargetList

so fetch the up to date one on calling gtk_drag_begin_with_coordinates

==3221972== Invalid read of size 8
==3221972==at 0x23F281DA: gtk_drag_begin_internal (gtkdnd.c:1801)
==3221972==by 0x23F2886F: gtk_drag_begin_with_coordinates 
(gtkdnd.c:1995)
==3221972==by 0x23845075: (anonymous 
namespace)::GtkInstanceWidget::signal_motion(_GdkEventMotion const*) 
(gtkinst.cxx:3139)
==3221972==by 0x23844F09: (anonymous 
namespace)::GtkInstanceWidget::signalMotion(_GtkWidget*, _GdkEventMotion*, 
void*) (gtkinst.cxx:3130)
==3221972==by 0x23C0FC56: _gtk_marshal_BOOLEAN__BOXED 
(gtkmarshalers.c:84)
==3221972==by 0x1378C05F: g_closure_invoke (gclosure.c:832)
==3221972==by 0x137B8F65: signal_emit_unlocked_R.isra.0 (gsignal.c:3796)
==3221972==by 0x137A8ED5: g_signal_emit_valist (gsignal.c:3559)
==3221972==by 0x137A96F2: g_signal_emit (gsignal.c:3606)
==3221972==by 0x23EF1073: gtk_widget_event_internal.part.0.lto_priv.0 
(gtkwidget.c:7812)
==3221972==by 0x23D825AD: UnknownInlinedFun (gtkmain.c:2588)
==3221972==by 0x23D825AD: propagate_event.lto_priv.0 (gtkmain.c:2691)
==3221972==by 0x23D83320: UnknownInlinedFun (gtkmain.c:1921)
==3221972==by 0x23D83320: gtk_main_do_event (gtkmain.c:1691)
==3221972==  Address 0x2c7d8070 is 0 bytes inside a block of size 16 free'd
==3221972==at 0x48460E4: free (vg_replace_malloc.c:884)
==3221972==by 0x1383388C: g_free (gmem.c:229)
==3221972==by 0x1384E093: g_slice_free1 (gslice.c:1185)
==3221972==by 0x23CD7A08: gtk_drag_source_set (gtkdragsource.c:162)
==3221972==by 0x23ED1EAB: gtk_tree_view_enable_model_drag_source 
(gtktreeview.c:14303)
==3221972==by 0x23877F41: (anonymous 
namespace)::GtkInstanceTreeView::drag_source_set(std::__debug::vector<_GtkTargetEntry,
 std::allocator<_GtkTargetEntry> > const&, GdkDragAction) (gtkinst.cxx:16279)
==3221972==by 0x238440B3: (anonymous 
namespace)::GtkInstanceWidget::do_enable_drag_source(rtl::Reference
 const&, unsigned char) (gtkinst.cxx:2707)
==3221972==by 0x23877E99: (anonymous 
namespace)::GtkInstanceTreeView::enable_drag_source(rtl::Reference&,
 unsigned char) (gtkinst.cxx:16270)
==3221972==by 0x36AAE6D2: SwContentTree::DragBeginHdl(bool&) 
(content.cxx:1227)
==3221972==by 0x36AAE2CE: SwContentTree::LinkStubDragBeginHdl(void*, 
bool&) (content.cxx:1180)
==3221972==by 0x238D38DA: Link::Call(bool&) const 
(link.hxx:111)
==3221972==by 0x23878D2D: (anonymous 
namespace)::GtkInstanceTreeView::do_signal_drag_begin(bool&) (gtkinst.cxx:16520)

Change-Id: Idffa33c6a549bf17a92eb56760ddfb7d5424b7ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149101
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 8697f7f7eb47..1841ebbaf7f4 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3120,12 +3120,12 @@ private:
 
 bool signal_motion(const GdkEventMotion* pEvent)
 {
-GtkTargetList* pDragData = (m_eDragAction != 0 && m_nPressedButton != 
-1 && m_xDragSource.is()) ? gtk_drag_source_get_target_list(m_pWidget) : 
nullptr;
+const bool bDragData = m_eDragAction != 0 && m_nPressedButton != -1 && 
m_xDragSource.is() && gtk_drag_source_get_target_list(m_pWidget);
 bool bUnsetDragIcon(false);
-if (pDragData && gtk_drag_check_threshold(m_pWidget, m_nPressStartX, 
m_nPressStartY, pEvent->x, pEvent->y) && !do_signal_drag_begin(bUnsetDragIcon))
+if (bDragData && gtk_drag_check_threshold(m_pWidget, m_nPressStartX, 
m_nPressStartY, pEvent->x, pEvent->y) && !do_signal_drag_begin(bUnsetDragIcon))
 {
 GdkDragContext* pContext = 
gtk_drag_begin_with_coordinates(m_pWidget,
-   
pDragData,
+   
gtk_drag_source_get_target_list(m_pWidget),

m_eDragAction,

m_nPressedButton,

const_cast(reinterpret_cast(pEvent)),


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2023-02-06 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |   29 +
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx |2 ++
 2 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 4f6cabae397424caa1edf7cc084f5f458b9e5cb7
Author: Caolán McNamara 
AuthorDate: Thu Oct 6 09:59:44 2022 +0100
Commit: Michael Stahl 
CommitDate: Mon Feb 6 12:24:43 2023 +

Related: tdf#150706 & tdf#153330 add OK and CANCEL to known controls

which results that we can rename "Save" to "Export" in pdf export dialog

Change-Id: I8186a9ea3d18bfb383b07ba54f2fd7a5cd71e7b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141004
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 1da3406a8e97934615b5b644cbb81bf3108143ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146520
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index cdb31b326c92..fc990b6fe501 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -1102,6 +1102,10 @@ GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 
nControlId, GType *pType )
 pWidget = m_pToggles[elem]; tType = GTK_TYPE_CHECK_BUTTON; \
 break
 #define MAP_BUTTON( elem ) \
+case CommonFilePickerElementIds::PUSHBUTTON_##elem: \
+pWidget = m_pButtons[elem]; tType = GTK_TYPE_BUTTON; \
+break
+#define MAP_EXT_BUTTON( elem ) \
 case ExtendedFilePickerElementIds::PUSHBUTTON_##elem: \
 pWidget = m_pButtons[elem]; tType = GTK_TYPE_BUTTON; \
 break
@@ -1124,7 +1128,9 @@ GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 
nControlId, GType *pType )
 MAP_TOGGLE( LINK );
 MAP_TOGGLE( PREVIEW );
 MAP_TOGGLE( SELECTION );
-MAP_BUTTON( PLAY );
+MAP_BUTTON( OK );
+MAP_BUTTON( CANCEL );
+MAP_EXT_BUTTON( PLAY );
 MAP_LIST( VERSION );
 MAP_LIST( TEMPLATE );
 MAP_LIST( IMAGE_TEMPLATE );
@@ -1386,7 +1392,7 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 
nControlId, const OUString&
 
 if( !( pWidget = getWidget( nControlId,  ) ) )
 {
-SAL_WARN( "vcl.gtk", "Set label on unknown control " << nControlId);
+SAL_WARN( "vcl.gtk", "Set label '" << rLabel << "' on unknown control 
" << nControlId);
 return;
 }
 
@@ -1778,18 +1784,17 @@ void SalGtkFilePicker::impl_initialize(GtkWidget* 
pParentWidget, sal_Int16 templ
 }
 
 gtk_file_chooser_set_action( GTK_FILE_CHOOSER( m_pDialog ), eAction);
-gtk_dialog_add_button(GTK_DIALOG( m_pDialog ),
-  getCancelText().getStr(),
-  GTK_RESPONSE_CANCEL);
-for( int nTVIndex = 0; nTVIndex < BUTTON_LAST; nTVIndex++ )
+m_pButtons[CANCEL] = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), 
getCancelText().getStr(), GTK_RESPONSE_CANCEL);
+mbButtonVisibility[CANCEL] = true;
+
+if (mbButtonVisibility[PLAY])
 {
-if( mbButtonVisibility[nTVIndex] )
-{
-OString aPlay = OUStringToOString( getResString( PUSHBUTTON_PLAY 
), RTL_TEXTENCODING_UTF8 );
-m_pButtons[ nTVIndex ] = gtk_dialog_add_button( GTK_DIALOG( 
m_pDialog ), aPlay.getStr(), 1 );
-}
+OString aPlay = OUStringToOString(getResString(PUSHBUTTON_PLAY), 
RTL_TEXTENCODING_UTF8);
+m_pButtons[PLAY] = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), 
aPlay.getStr(), 1);
 }
-gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), first_button_text, 
GTK_RESPONSE_ACCEPT );
+
+m_pButtons[OK] = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), 
first_button_text, GTK_RESPONSE_ACCEPT);
+mbButtonVisibility[OK] = true;
 
 gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), 
GTK_RESPONSE_ACCEPT );
 
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
index c412478e8aab..fdc701a20384 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
@@ -170,6 +170,8 @@ class SalGtkFilePicker : public SalGtkPicker, public 
SalGtkFilePicker_Base
 bool mbToggleVisibility[TOGGLE_LAST];
 
 enum {
+OK,
+CANCEL,
 PLAY,
 BUTTON_LAST };
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2023-01-19 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 68b28057a00a152dc23d3363dd413556882e2bfd
Author: Caolán McNamara 
AuthorDate: Thu Jan 19 16:31:03 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 19 19:39:14 2023 +

Resolves: tdf#153091 support text/plain without encoding from nedit

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index b697b0b50a3c..8697f7f7eb47 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -824,16 +824,12 @@ public:
 
 virtual css::uno::Any SAL_CALL getTransferData(const 
css::datatransfer::DataFlavor& rFlavor) override
 {
+css::uno::Any aRet;
+
 css::datatransfer::DataFlavor aFlavor(rFlavor);
 if (aFlavor.MimeType == "text/plain;charset=utf-16")
 aFlavor.MimeType = "text/plain;charset=utf-8";
 
-auto it = m_aMimeTypeToGtkType.find(aFlavor.MimeType);
-if (it == m_aMimeTypeToGtkType.end())
-return css::uno::Any();
-
-css::uno::Any aRet;
-
 GdkClipboard* clipboard = clipboard_get(m_eSelection);
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
@@ -845,21 +841,25 @@ public:
 aRet <<= aStr.replaceAll("\r\n", "\n");
 return aRet;
 }
-else
+#endif
+
+auto it = m_aMimeTypeToGtkType.find(aFlavor.MimeType);
+if (it == m_aMimeTypeToGtkType.end())
+return css::uno::Any();
+
+#if !GTK_CHECK_VERSION(4, 0, 0)
+GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard,
+ it->second);
+if (!data)
 {
-GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard,
- 
it->second);
-if (!data)
-{
-return css::uno::Any();
-}
-gint length;
-const guchar *rawdata = 
gtk_selection_data_get_data_with_length(data,
-
);
-Sequence aSeq(reinterpret_cast(rawdata), length);
-gtk_selection_data_free(data);
-aRet <<= aSeq;
+return css::uno::Any();
 }
+gint length;
+const guchar *rawdata = gtk_selection_data_get_data_with_length(data,
+
);
+Sequence aSeq(reinterpret_cast(rawdata), 
length);
+gtk_selection_data_free(data);
+aRet <<= aSeq;
 #else
 SalInstance* pInstance = GetSalInstance();
 read_transfer_result aRes;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2023-01-13 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 42d7d6a6f5b7701d9ec6c14dae6ffb48eb4b4035
Author: Caolán McNamara 
AuthorDate: Thu Jan 12 20:55:27 2023 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Jan 13 08:14:35 2023 +

Related: tdf#151898 fix gtk4 build in 7-4

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 8ba640992b9a..b697b0b50a3c 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -5114,7 +5114,7 @@ namespace
 
 void picture_set_from_xgraphic(GtkPicture* pPicture, const 
css::uno::Reference& rPicture)
 {
-if (auto xTempFile = getImageFile(rPicture, false))
+if (auto xTempFile = getImageFile(rPicture))
 gtk_picture_set_filename(pPicture, 
OUStringToOString(xTempFile->GetFileName(), 
osl_getThreadTextEncoding()).getStr());
 else
 gtk_picture_set_pixbuf(pPicture, nullptr);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-12-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |  100 +--
 1 file changed, 55 insertions(+), 45 deletions(-)

New commits:
commit 957d8a8c8375bb18eb23317b4853ac1f9503b295
Author: Caolán McNamara 
AuthorDate: Wed Dec 14 10:36:31 2022 +
Commit: Michael Stahl 
CommitDate: Thu Dec 15 11:01:57 2022 +

Resolves: tdf#152501 forward replacement ComboBox query-tooltip to original

Change-Id: I7c56ce58a00d87ce1699bffdf36c9842ac579161
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144119
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 9995d85a3e54..8ba640992b9a 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -18472,6 +18472,47 @@ public:
 
 #endif
 
+gboolean signalTooltipQuery(GtkWidget* pWidget, gint /*x*/, gint /*y*/,
+gboolean /*keyboard_mode*/, GtkTooltip *tooltip)
+{
+const ImplSVHelpData& aHelpData = ImplGetSVHelpData();
+if (aHelpData.mbBalloonHelp) // extended tips
+{
+#if !GTK_CHECK_VERSION(4, 0, 0)
+// 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;
+}
+#endif
+
+// fallback to the mechanism which needs help installed
+OString sHelpId = ::get_help_id(pWidget);
+Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : nullptr;
+if (pHelp)
+{
+OUString sHelpText = pHelp->GetHelpText(OStringToOUString(sHelpId, 
RTL_TEXTENCODING_UTF8), static_cast(nullptr));
+if (!sHelpText.isEmpty())
+{
+gtk_tooltip_set_text(tooltip, OUStringToOString(sHelpText, 
RTL_TEXTENCODING_UTF8).getStr());
+return true;
+}
+}
+}
+
+const char* pDesc = gtk_widget_get_tooltip_text(pWidget);
+if (pDesc && pDesc[0])
+{
+gtk_tooltip_set_text(tooltip, pDesc);
+return true;
+}
+
+return false;
+}
+
 #if GTK_CHECK_VERSION(4, 0, 0)
 
 class GtkInstanceComboBox : public GtkInstanceWidget, public 
vcl::ISearchableStringList, public virtual weld::ComboBox
@@ -21288,6 +21329,14 @@ private:
 return true;
 }
 
+static gboolean signalComboTooltipQuery(GtkWidget* /*pWidget*/, gint x, 
gint y,
+gboolean keyboard_mode, GtkTooltip 
*tooltip,
+gpointer widget)
+{
+GtkInstanceComboBox* pThis = static_cast(widget);
+return signalTooltipQuery(GTK_WIDGET(pThis->m_pComboBox), x, y, 
keyboard_mode, tooltip);
+}
+
 int include_mru(int pos)
 {
 if (m_nMRUCount && pos != -1)
@@ -21337,6 +21386,12 @@ public:
 if 
(gtk_style_context_has_class(gtk_widget_get_style_context(GTK_WIDGET(m_pComboBox)),
 "small-button"))
 
gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(getContainer())),
 "small-button");
 
+if (gtk_widget_get_has_tooltip(GTK_WIDGET(m_pComboBox)))
+{
+gtk_widget_set_has_tooltip(GTK_WIDGET(getContainer()), true);
+g_signal_connect(getContainer(), "query-tooltip", 
G_CALLBACK(signalComboTooltipQuery), this);
+}
+
 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);
@@ -22533,51 +22588,6 @@ public:
 
 }
 
-namespace {
-
-gboolean signalTooltipQuery(GtkWidget* pWidget, gint /*x*/, gint /*y*/,
- gboolean /*keyboard_mode*/, 
GtkTooltip *tooltip)
-{
-const ImplSVHelpData& aHelpData = ImplGetSVHelpData();
-if (aHelpData.mbBalloonHelp) // extended tips
-{
-#if !GTK_CHECK_VERSION(4, 0, 0)
-// 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;
-}
-#endif
-
-// fallback to the mechanism which needs help installed
-OString sHelpId = ::get_help_id(pWidget);
-Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : 
nullptr;
-if (pHelp)
-{
-OUString sHelpText = 
pHelp->GetHelpText(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), 
static_cast(nullptr));
-if (!sHelpText.isEmpty())
-{
-gtk_tooltip_set_text(tooltip, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-12-14 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/a11y/atkwrapper.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 94e3ddb97b1eb0761c09ce56e053f85cd215cbf4
Author: Caolán McNamara 
AuthorDate: Wed Nov 16 10:30:17 2022 +
Commit: Christian Lohmaier 
CommitDate: Wed Dec 14 11:08:09 2022 +

ImplDbgTestSolarMutex assert from a11y

 #5  0x7fffee606a72 in ImplDbgTestSolarMutex() () at 
vcl/source/app/dbggui.cxx:35
 #6  0x771186f0 in DbgTestSolarMutex() () at 
tools/source/debug/debug.cxx:54
 #7  0x73273e39 in SfxBroadcaster::RemoveListener(SfxListener&) 
(this=0x1a38230, rListener=...) at svl/source/notify/SfxBroadcaster.cxx:105
 #8  0x73296eb8 in SfxListener::~SfxListener() (this=0x33abce0) at 
svl/source/notify/lstner.cxx:53
 #9  0x7fffaaa0a0a4 in 
ScAccessibleContextBase::~ScAccessibleContextBase() (this=0x33abc40) at 
sc/source/ui/Accessibility/AccessibleContextBase.cxx:59
 #10 0x7fff6379 in ScAccessibleTableBase::~ScAccessibleTableBase() 
(this=0x33abc40) at sc/source/ui/Accessibility/AccessibleTableBase.cxx:52
 #11 0x7fffaaa831da in 
ScAccessibleSpreadsheet::~ScAccessibleSpreadsheet() (this=0x33abc40) at 
sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx:274
 #12 0x7fffaaa83229 in 
ScAccessibleSpreadsheet::~ScAccessibleSpreadsheet() (this=0x33abc40) at 
sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx:270
 #13 0x75f87fc0 in cppu::OWeakObject::release() (this=0x33abc40) at 
cppuhelper/source/weak.cxx:230
 #14 0x75f88690 in cppu::OWeakAggObject::release() (this=0x33abc40) 
at cppuhelper/source/weak.cxx:296
 #15 0x75e7e4d5 in cppu::WeakAggComponentImplHelperBase::release() 
(this=0x33abc40) at cppuhelper/source/implbase.cxx:211
 #16 0x7fffaaa0d875 in 
cppu::WeakAggComponentImplHelper5::release() (this=0x33abc40)
 at include/cppuhelper/compbase5.hxx:142
 #17 0x7fffaaa0ab15 in ScAccessibleContextBase::release() 
(this=0x33abc40) at sc/source/ui/Accessibility/AccessibleContextBase.cxx:119
 #18 0x7fff6b75 in ScAccessibleTableBase::release() 
(this=0x33abc40) at sc/source/ui/Accessibility/AccessibleTableBase.cxx:86
 #19 0x7fffd8f4f11a in 
com::sun::star::uno::Reference::clear()
 (this=) 
at include/com/sun/star/uno/Reference.hxx:231
 #20 0x7fffd8f4c41d in atk_object_wrapper_finalize(_GObject*) 
(obj=0x7f71930) at vcl/unx/gtk3/a11y/atkwrapper.cxx:662
 #21 0x73538d32 in g_object_unref (_object=) at 
../gobject/gobject.c:3678
 #22 g_object_unref (_object=0x7f71930) at ../gobject/gobject.c:3553
 #23 0x7fffd9571fc5 in expiry_func () at /lib64/libatk-bridge-2.0.so.0
 #24 0x7fffea7197b1 in g_timeout_dispatch (source=0x313d360, 
callback=0x7fffd9571f60 , user_data=0x7fffbc01bec0) at 
../glib/gmain.c:4971
 #25 0x7fffea718faf in g_main_dispatch (context=0x5f8230) at 
../glib/gmain.c:3417

Change-Id: If527f1cf1bfc59bb8df586afaf5da62bbcb08eea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142691
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index b1e4c4479e80..097a5e54dc09 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -643,6 +643,7 @@ atk_object_wrapper_finalize (GObject *obj)
 if( pWrap->mpAccessible.is() )
 {
 ooo_wrapper_registry_remove( pWrap->mpAccessible );
+SolarMutexGuard aGuard;
 pWrap->mpAccessible.clear();
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-12-13 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 0614198babeeb48359c8363c1b098688ccb1406d
Author: Caolán McNamara 
AuthorDate: Tue Dec 13 08:45:57 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Dec 13 11:22:23 2022 +

Related: tdf#150007 add destructive-action to file overwrite message dialog

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

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 183ea20a0a4a..cdb31b326c92 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -1006,6 +1006,10 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
 aMsg.getStr()
 );
 
+GtkWidget* pOkButton = 
gtk_dialog_get_widget_for_response(GTK_DIALOG(dlg), GTK_RESPONSE_YES);
+GtkStyleContext* pStyleContext = 
gtk_widget_get_style_context(pOkButton);
+gtk_style_context_add_class(pStyleContext, 
"destructive-action");
+
 sal_Int32 nSegmentCount = 
aFileObj.getSegmentCount();
 if (nSegmentCount >= 2)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-12-06 Thread Caolán McNamara (via logerrit)
 vcl/unx/generic/fontmanager/fontconfig.cxx |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit ef557f0742b6111827982f5e10bc2f44fb553f78
Author: Caolán McNamara 
AuthorDate: Tue Dec 6 08:59:16 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Dec 7 04:21:34 2022 +

Resolves: tdf#151722 use UI Language for localized font names

instead of system locale

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

diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 1daf54b69fa6..c44cdd2ee05f 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -54,6 +54,7 @@ using namespace psp;
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -440,13 +441,9 @@ FcResult 
FontCfgWrapper::LocalizedElementFromPattern(FcPattern const * pPattern,
 ++k;
 }
 
-//possible to-do, sort by UILocale instead of process locale
 if (!m_pLanguageTag)
-{
-rtl_Locale* pLoc = nullptr;
-osl_getProcessLocale();
-m_pLanguageTag.reset( new LanguageTag(*pLoc) );
-}
+m_pLanguageTag.reset(new 
LanguageTag(SvtSysLocaleOptions().GetRealUILanguageTag()));
+
 *element = bestname(lang_and_elements, *m_pLanguageTag);
 
 //if this element is a fontname, map the other names to this 
best-name


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-11-23 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkframe.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit b534ee2e972711af2dbaadf2190813054adda902
Author: Caolán McNamara 
AuthorDate: Tue Nov 22 11:33:23 2022 +
Commit: Samuel Mehrbrodt 
CommitDate: Thu Nov 24 08:28:04 2022 +0100

Resolves: tdf#152155 use gtk's knowledge of relative widget positions

rather than effectively emulate it poorly

Change-Id: If1c215892645d83937d97158a2d3f8ddac10364e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143104
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 15cdee0d846854b50dd04626b73499bef9305e00)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143197
Reviewed-by: Samuel Mehrbrodt 

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index b17614658122..3d8cce5e02b7 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3688,7 +3688,12 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer 
frame)
 
 tools::Rectangle aFloatRect = 
FloatingWindow::ImplConvertToAbsPos(pVclParent, pThis->m_aFloatRect);
 if 
(gdk_window_get_window_type(widget_get_surface(pThis->m_pParent->m_pWindow)) != 
GDK_WINDOW_TOPLEVEL)
-aFloatRect.Move(-pThis->m_pParent->maGeometry.nX, 
-pThis->m_pParent->maGeometry.nY);
+{
+// See tdf#152155 for an example
+gtk_coord nX(0), nY(0.0);
+gtk_widget_translate_coordinates(pThis->m_pParent->m_pWindow, 
widget_get_toplevel(pThis->m_pParent->m_pWindow), 0, 0, , );
+aFloatRect.Move(nX, nY);
+}
 
 GdkRectangle rect {static_cast(aFloatRect.Left()), 
static_cast(aFloatRect.Top()),
static_cast(aFloatRect.GetWidth()), 
static_cast(aFloatRect.GetHeight())};


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-11-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/a11y/atkwrapper.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 5f3de2ba23486184f5ba8e1efa76a02afb20a42a
Author: Caolán McNamara 
AuthorDate: Fri Nov 11 16:52:33 2022 +
Commit: Michael Stahl 
CommitDate: Tue Nov 15 11:11:42 2022 +0100

ImplDbgTestSolarMutex assert from a11y

 #5  0x7fffee605ea2 in ImplDbgTestSolarMutex() () at 
vcl/source/app/dbggui.cxx:35
 #6  0x771186f0 in DbgTestSolarMutex() () at 
tools/source/debug/debug.cxx:54
 #7  0x7fffa95614d8 in SwAccessibleMap::GetContext(SwFrame const*, 
bool) (this=0x895a9c0, pFrame=0x5358800, bCreate=false) at 
sw/source/core/access/accmap.cxx:1788
 #8  0x7fffa961ac0e in sw::sidebarwindows::(anonymous 
namespace)::SidebarWinAccessibleContext::getAccessibleParent() (this=0xb90f800)
 at sw/source/uibase/docvw/SidebarWinAcc.cxx:65
 #9  0x7fffa961ae27 in non-virtual thunk to 
sw::sidebarwindows::(anonymous 
namespace)::SidebarWinAccessibleContext::getAccessibleParent() ()
 at /home/caolan/LibreOffice/core/instdir/program/../program/libswlo.so
 #10 0x7fffd8f4ae7d in 
atk_object_wrapper_new(com::sun::star::uno::Reference
 const&, AtkObject*, AtkObject*)
 (rxAccessible=uno::Reference to 
(sw::sidebarwindows::SidebarWinAccessible *) 0xba7f450, parent=0x0, orig=0x0) 
at vcl/unx/gtk3/a11y/atkwrapper.cxx:970
 #11 0x7fffd8f4a820 in 
atk_object_wrapper_ref(com::sun::star::uno::Reference
 const&, bool)
 (rxAccessible=uno::Reference to 
(sw::sidebarwindows::SidebarWinAccessible *) 0xba7f450, create=true) at 
vcl/unx/gtk3/a11y/atkwrapper.cxx:925
 #12 0x7fffd8f4d246 in wrapper_ref_child(_AtkObject*, int) 
(atk_obj=0xb9d06f0, i=0) at vcl/unx/gtk3/a11y/atkwrapper.cxx:500
 #13 0x7fffd95700c3 in add_pending_items () at 
/lib64/libatk-bridge-2.0.so.0
 #14 0x7fffea7154cb in g_idle_dispatch (source=0x21d40e0, 
callback=0x7fffd956fec0 , user_data=0x21d5890) at 
../glib/gmain.c:5935

and...

 #5  0x7fffee605ea2 in ImplDbgTestSolarMutex() () at 
vcl/source/app/dbggui.cxx:35
 #6  0x771186f0 in DbgTestSolarMutex() () at 
tools/source/debug/debug.cxx:54
 #7  0x7fffa95614d8 in SwAccessibleMap::GetContext(SwFrame const*, 
bool) (this=0x894ce20, pFrame=0x53390f0, bCreate=false) at 
sw/source/core/access/accmap.cxx:1788
 #8  0x7fffa956285f in SwAccessibleMap::GetContextImpl(SwFrame const*, 
bool) (this=0x894ce20, pFrame=0x53390f0, bCreate=false) at 
sw/source/core/access/accmap.cxx:1917
 #9  0x7fffa9550a91 in 
SwAccessibleChildSList_const_iterator::SwAccessibleChildSList_const_iterator(SwAccessibleChildSList
 const&, SwAccessibleMap&)
 (this=0x7fffbb58, rLst=..., rAccMap=...) at 
sw/source/core/access/accfrmobjslist.cxx:65
 #10 0x7fffa951c507 in SwAccessibleChildSList::begin() const 
(this=0x7fffbb80) at sw/source/core/access/accfrmobjslist.hxx:100
 #11 0x7fffa95421c2 in 
SwAccessibleFrame::GetChildIndex(SwAccessibleMap&, SwRect const&, SwFrame 
const&, sw::access::SwAccessibleChild const&, int&, bool)
 (rAccMap=..., rVisArea=SwRect = {...}, rFrame=..., rChild=..., 
rPos=@0x7fffbcc4: 0, bInPagePreview=false) at 
sw/source/core/access/accframe.cxx:179
 #12 0x7fffa9543be5 in 
SwAccessibleFrame::GetChildIndex(SwAccessibleMap&, 
sw::access::SwAccessibleChild const&) const (this=0xb7bd6e0, rAccMap=..., 
rChild=...)
 at sw/source/core/access/accframe.cxx:455
 #13 0x7fffa9569721 in SwAccessibleMap::GetChildIndex(SwFrame const&, 
vcl::Window&) const (this=0x894ce20, rParentFrame=..., rChild=...)
 at sw/source/core/access/accmap.cxx:2905
 #14 0x7fffa961ad89 in sw::sidebarwindows::(anonymous 
namespace)::SidebarWinAccessibleContext::getAccessibleIndexInParent() 
(this=0xb9ead70)
 at sw/source/uibase/docvw/SidebarWinAcc.cxx:80
 #15 0x7fffd8f4d781 in wrapper_get_index_in_parent(_AtkObject*) 
(atk_obj=0xc517810) at vcl/unx/gtk3/a11y/atkwrapper.cxx:529
 #16 0x7fffd957298c in append_cache_item () at 
/lib64/libatk-bridge-2.0.so.0

Change-Id: I852f40f30be7c10223ccfd570cb8ca30f1a67f47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142625
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index bc493561b1ce..b1e4c4479e80 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "atkwrapper.hxx"
@@ -466,6 +467,8 @@ static AtkObject *
 wrapper_ref_child( AtkObject *atk_obj,
gint   i )
 {
+SolarMutexGuard aGuard;
+
 AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
 
 if (obj->mpSysObjChild)
@@ -504,6 +507,8 @@ wrapper_ref_child( AtkObject *atk_obj,
 static gint
 wrapper_get_index_in_parent( AtkObject *atk_obj )
 {
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-11-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 33e6d65d917e2e9bb8749e506df25d892cf5
Author: Caolán McNamara 
AuthorDate: Fri Sep 30 11:20:28 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Nov 9 11:11:08 2022 +0100

gtk_tree_model_get_iter: assertion 'path->depth > 0' failed

seen in format, cells in calc

try an explicit depth

Change-Id: I395563d2b412b2ca8839292296f9dad6db704620
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140797
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 0c2d5312071a2de2ef2a9bdb997b8b8d4a91e9b4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142417
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 886375486336..13c0a254a9a0 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -14950,7 +14950,7 @@ public:
 gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 
0);
 }
 else
-path = gtk_tree_path_new();
+path = gtk_tree_path_new_from_indices(G_MAXINT, -1);
 gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
 gtk_tree_path_free(path);
 enable_notify_events();
@@ -20840,7 +20840,7 @@ private:
 GtkTreePath* path;
 if (pos == -1)
 {
-path = gtk_tree_path_new();
+path = gtk_tree_path_new_from_indices(G_MAXINT, -1);
 
gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(m_pTreeView));
 if (m_pCellView)
 gtk_cell_view_set_displayed_row(m_pCellView, nullptr);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-11-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/a11y/atkwrapper.cxx |9 -
 vcl/unx/gtk3/a11y/atkwrapper.hxx |3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 14e6a810e14e28ab82fe65d66e604ce562016845
Author: Caolán McNamara 
AuthorDate: Mon Aug 15 13:14:08 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Nov 8 11:37:11 2022 +0100

fix "invalid class cast from 'OOoAtkObj' to 'GtkWidgetAccessible'"

and similar

Change-Id: I8a989465057a5b7810f6cedf370fc1cd77f5af0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138311
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit f3b0a95f9c2f85604808c21485e46e43aebbbfed)

Resolves: tdf#150496 we want the AtkObject get_parent function

GtkAccessible overrode it, but we expect the AtkObject implementation

Change-Id: I5064bc619b11052bd22f9c75043b3e42697ebfc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138558
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit f0827c392641b45647241b3a22e24a95e2b595e3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142419
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index d23f384e26fc..bc493561b1ce 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -666,6 +666,13 @@ atk_object_wrapper_class_init (AtkObjectWrapperClass 
*klass)
   atk_class->get_index_in_parent = wrapper_get_index_in_parent;
   atk_class->ref_relation_set = wrapper_ref_relation_set;
   atk_class->ref_state_set = wrapper_ref_state_set;
+
+  AtkObjectClass* orig_atk_klass = 
static_cast(g_type_class_ref(ATK_TYPE_OBJECT));
+  // tdf#150496 we want to inherit from GtkAccessible because gtk assumes it 
can cast to GtkAccessible
+  // but we want the original behaviour we got from atk_object_real_get_parent 
when we inherited
+  // from AtkObject
+  atk_class->get_parent = orig_atk_klass->get_parent;
+  g_type_class_unref(orig_atk_klass);
 }
 
 static void
@@ -705,7 +712,7 @@ atk_object_wrapper_get_type()
 reinterpret_cast(atk_object_wrapper_init),
 nullptr
   } ;
-  type = g_type_register_static (ATK_TYPE_OBJECT,
+  type = g_type_register_static (GTK_TYPE_WIDGET_ACCESSIBLE,
  "OOoAtkObj",
  , GTypeFlags(0)) ;
   }
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx
index 0b5f64726bba..6f18bde614ee 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx
@@ -47,7 +47,8 @@ namespace com::sun::star::accessibility {
 
 struct AtkObjectWrapper
 {
-AtkObject aParent;
+GtkWidgetAccessible aParent;
+
 AtkObject* mpOrig;  //if we're a GtkDrawingArea acting as a custom 
LibreOffice widget, this is the toolkit default impl
 AtkObject* mpSysObjChild; //if we're a container for a sysobj, then this 
is the sysobj native gtk AtkObject
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-11-07 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkframe.cxx |   31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

New commits:
commit 2d0e324eb9deaf113d63c9ff10d3d017befa665b
Author: Caolán McNamara 
AuthorDate: Fri Nov 4 10:13:58 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Nov 7 20:50:16 2022 +0100

Resolves: tdf#151509 don't overwrite geometry for system childs

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

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 3684dd560593..0a8b8021c127 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3149,7 +3149,7 @@ gboolean GtkSalFrame::signalButton(GtkWidget*, 
GdkEventButton* pEvent, gpointer
 if (bDifferentEventWindow)
 translate_coords(pEvent->window, pEventWidget, nEventX, nEventY);
 
-if (!aDel.isDeleted())
+if (!aDel.isDeleted() && !(pThis->m_nStyle & 
SalFrameStyleFlags::SYSTEMCHILD))
 {
 int frame_x = static_cast(pEvent->x_root - nEventX);
 int frame_y = static_cast(pEvent->y_root - nEventY);
@@ -3168,8 +3168,8 @@ gboolean GtkSalFrame::signalButton(GtkWidget*, 
GdkEventButton* pEvent, gpointer
 if (!aDel.isDeleted())
 {
 bRet = pThis->DrawingAreaButton(nEventType,
-pEvent->x_root - pThis->maGeometry.nX,
-pEvent->y_root - pThis->maGeometry.nY,
+nEventX,
+nEventY,
 pEvent->button,
 pEvent->time,
 pEvent->state);
@@ -3463,21 +3463,22 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, 
GdkEventMotion* pEvent, gpointer
 int frame_x = static_cast(pEvent->x_root - nEventX);
 int frame_y = static_cast(pEvent->y_root - nEventY);
 
-if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX || 
frame_y != pThis->maGeometry.nY)
+if (!aDel.isDeleted() && !(pThis->m_nStyle & 
SalFrameStyleFlags::SYSTEMCHILD))
 {
-pThis->m_bGeometryIsProvisional = false;
-pThis->maGeometry.nX = frame_x;
-pThis->maGeometry.nY = frame_y;
-ImplSVData* pSVData = ImplGetSVData();
-if (pSVData->maNWFData.mbCanDetermineWindowPosition)
-pThis->CallCallbackExc(SalEvent::Move, nullptr);
+if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX 
|| frame_y != pThis->maGeometry.nY)
+{
+pThis->m_bGeometryIsProvisional = false;
+pThis->maGeometry.nX = frame_x;
+pThis->maGeometry.nY = frame_y;
+ImplSVData* pSVData = ImplGetSVData();
+if (pSVData->maNWFData.mbCanDetermineWindowPosition)
+pThis->CallCallbackExc(SalEvent::Move, nullptr);
+}
 }
 
 if (!aDel.isDeleted())
 {
-pThis->DrawingAreaMotion(pEvent->x_root - pThis->maGeometry.nX,
- pEvent->y_root - pThis->maGeometry.nY,
- pEvent->time, pEvent->state);
+pThis->DrawingAreaMotion(nEventX, nEventY, pEvent->time, 
pEvent->state);
 }
 
 if (!aDel.isDeleted())
@@ -3530,8 +3531,8 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, 
GdkEventCrossing* pEvent, gpoi
 {
 GtkSalFrame* pThis = static_cast(frame);
 pThis->DrawingAreaCrossing((pEvent->type == GDK_ENTER_NOTIFY) ? 
SalEvent::MouseMove : SalEvent::MouseLeave,
-   pEvent->x_root - pThis->maGeometry.nX,
-   pEvent->y_root - pThis->maGeometry.nY,
+   pEvent->x,
+   pEvent->y,
pEvent->time,
pEvent->state);
 return true;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-10-24 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 3f472b496be39a0fc1630cd31bfc5f1b9747127e
Author: Caolán McNamara 
AuthorDate: Sat Oct 22 15:05:51 2022 +0100
Commit: Michael Stahl 
CommitDate: Mon Oct 24 12:15:01 2022 +0200

Resolves: tdf#151699 show/hide the overlay along with the edit

if its present

Change-Id: I9f167117329b9fa33a79271c1f97fcb10ab9de32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141590
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index cd9bb63ae4ce..886375486336 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -13242,6 +13242,21 @@ public:
 }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
+
+virtual void show() override
+{
+GtkInstanceEditable::show();
+if (m_pPlaceHolderReplacement)
+gtk_widget_show(GTK_WIDGET(m_pPlaceHolderReplacement));
+}
+
+virtual void hide() override
+{
+if (m_pPlaceHolderReplacement)
+gtk_widget_hide(GTK_WIDGET(m_pPlaceHolderReplacement));
+GtkInstanceEditable::hide();
+}
+
 virtual ~GtkInstanceEntry() override
 {
 if (m_nUpdatePlaceholderReplacementIdle)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-09-27 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 8e9c818f87b20b07d6180d56eaed858740b4d76c
Author: Caolán McNamara 
AuthorDate: Tue Sep 27 12:27:19 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Sep 27 16:03:24 2022 +0200

tdf#150916 make unselect in combobox dropdown same as initially unselected

a similar issue as seen in tdf#148197

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index ca361523a359..690f39a50208 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -20820,22 +20820,24 @@ private:
 
 void tree_view_set_cursor(int pos)
 {
+GtkTreePath* path;
 if (pos == -1)
 {
+path = gtk_tree_path_new();
 
gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(m_pTreeView));
 if (m_pCellView)
 gtk_cell_view_set_displayed_row(m_pCellView, nullptr);
 }
 else
 {
-GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
+path = gtk_tree_path_new_from_indices(pos, -1);
 if (gtk_tree_view_get_model(m_pTreeView))
 gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, 
false, 0, 0);
-gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
 if (m_pCellView)
 gtk_cell_view_set_displayed_row(m_pCellView, path);
-gtk_tree_path_free(path);
 }
+gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
+gtk_tree_path_free(path);
 }
 
 int tree_view_get_cursor() const


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-09-16 Thread Michael Weghorn (via logerrit)
 vcl/unx/gtk3/salnativewidgets-gtk.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 2103178720fd485651b94b7819ea33ec602c3b79
Author: Michael Weghorn 
AuthorDate: Fri Sep 16 10:30:01 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Sep 17 05:10:19 2022 +0200

tdf#137341 gtk: Set missing style text colors from theme

commit 8d11b953c0a69f4f5eb5ca42dec3812a62d0cd0f
Date:   Sun Feb 23 21:11:05 2020 +0100

tdf#125532: White text on default/action buttons and selected tabs 
on macOS

had introduced various new text colors to the style
settings, but some were not set from the theme for gtk.

Add the missing ones.

Change-Id: I1bd7ce358626b3f4ff1d6f2794d5c0f19f78a668
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140058
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 8306152d5205dd35c118d06368f6c77254f87518)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139984
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
index 3eaffc903e16..64f6357abd79 100644
--- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
@@ -2337,10 +2337,16 @@ bool GtkSalGraphics::updateSettings(AllSettings& 
rSettings)
 style_context_set_state(pStyle, GTK_STATE_FLAG_PRELIGHT);
 style_context_get_color(pStyle, _color);
 aTextColor = getColor(text_color);
+aStyleSet.SetDefaultButtonTextColor(aTextColor);
 aStyleSet.SetDefaultButtonRolloverTextColor(aTextColor);
+aStyleSet.SetDefaultButtonPressedRolloverTextColor(aTextColor);
 aStyleSet.SetButtonRolloverTextColor(aTextColor);
 aStyleSet.SetDefaultActionButtonRolloverTextColor(aTextColor);
+aStyleSet.SetDefaultActionButtonPressedRolloverTextColor(aTextColor);
 aStyleSet.SetActionButtonRolloverTextColor(aTextColor);
+aStyleSet.SetActionButtonPressedRolloverTextColor(aTextColor);
+aStyleSet.SetFlatButtonTextColor(aTextColor);
+aStyleSet.SetFlatButtonPressedRolloverTextColor(aTextColor);
 aStyleSet.SetFlatButtonRolloverTextColor(aTextColor);
 aStyleSet.SetFieldRolloverTextColor(aTextColor);
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-09-09 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |  145 +++
 1 file changed, 145 insertions(+)

New commits:
commit 1cba31a159fb1ed4795adeea968dc915b95d64a5
Author: Caolán McNamara 
AuthorDate: Wed Sep 7 12:24:44 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Sep 9 16:41:12 2022 +0200

tdf#150810 get visible placeholder text in GtkEntry with focus

in gtk3 focus causes placeholders to be not rendered
https://gitlab.gnome.org/GNOME/gtk/-/issues/378
https://bugzilla.gnome.org/show_bug.cgi?id=657613

FWIW, currently in gtk4 they are shown when focused

Change-Id: I623c81dd71f651d8b24a717a63fe428bc9d6a505
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139592
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 7ef1de66eb974fdb7638582e80b1cdab46f4e81d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139561
Reviewed-by: Miklos Vajna 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 8c46146b00f6..ec706e524455 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -13092,16 +13092,161 @@ public:
 
 class GtkInstanceEntry : public GtkInstanceEditable
 {
+private:
+#if !GTK_CHECK_VERSION(4, 0, 0)
+GtkEntry* m_pEntry;
+GtkOverlay* m_pPlaceHolderReplacement;
+GtkLabel* m_pPlaceHolderLabel;
+gulong m_nEntryFocusInSignalId;
+gulong m_nEntryFocusOutSignalId;
+gulong m_nEntryTextLengthSignalId;
+gulong m_nEntryScrollOffsetSignalId;
+guint m_nUpdatePlaceholderReplacementIdle;
+
+static gboolean do_update_placeholder_replacement(gpointer widget)
+{
+GtkInstanceEntry* pThis = static_cast(widget);
+pThis->update_placeholder_replacement();
+return false;
+}
+
+void update_placeholder_replacement()
+{
+m_nUpdatePlaceholderReplacementIdle = 0;
+
+const char* placeholder_text = 
gtk_entry_get_placeholder_text(m_pEntry);
+const bool bShow = placeholder_text && 
!gtk_entry_get_text_length(m_pEntry) &&
+   gtk_widget_has_focus(GTK_WIDGET(m_pEntry));
+if (bShow)
+{
+GdkRectangle text_area;
+gtk_entry_get_text_area(m_pEntry, _area);
+gint x;
+gtk_entry_get_layout_offsets(m_pEntry, , nullptr);
+gtk_widget_set_margin_start(GTK_WIDGET(m_pPlaceHolderLabel), x);
+gtk_widget_set_margin_end(GTK_WIDGET(m_pPlaceHolderLabel), x);
+gtk_label_set_text(m_pPlaceHolderLabel, placeholder_text);
+gtk_widget_show(GTK_WIDGET(m_pPlaceHolderLabel));
+}
+else
+gtk_widget_hide(GTK_WIDGET(m_pPlaceHolderLabel));
+}
+
+void launch_update_placeholder_replacement()
+{
+// do it in the next event cycle so the GtkEntry has done its layout
+// and gtk_entry_get_layout_offsets returns the right results
+if (m_nUpdatePlaceholderReplacementIdle)
+return;
+// G_PRIORITY_LOW so gtk's idles are run before this
+m_nUpdatePlaceholderReplacementIdle = g_idle_add_full(G_PRIORITY_LOW, 
do_update_placeholder_replacement, this, nullptr);
+}
+
+static gboolean signalEntryFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
+{
+GtkInstanceEntry* pThis = static_cast(widget);
+pThis->launch_update_placeholder_replacement();
+return false;
+}
+
+static gboolean signalEntryFocusOut(GtkWidget*, GdkEvent*, gpointer widget)
+{
+GtkInstanceEntry* pThis = static_cast(widget);
+pThis->launch_update_placeholder_replacement();
+return false;
+}
+
+static void signalEntryTextLength(void*, GParamSpec*, gpointer widget)
+{
+GtkInstanceEntry* pThis = static_cast(widget);
+pThis->launch_update_placeholder_replacement();
+}
+
+static void signalEntryScrollOffset(void*, GParamSpec*, gpointer widget)
+{
+// this property affects the x-position of the text area
+GtkInstanceEntry* pThis = static_cast(widget);
+pThis->launch_update_placeholder_replacement();
+}
+
+#endif
+
 public:
 GtkInstanceEntry(GtkEntry* pEntry, GtkInstanceBuilder* pBuilder, bool 
bTakeOwnership)
 : GtkInstanceEditable(GTK_WIDGET(pEntry), pBuilder, bTakeOwnership)
+#if !GTK_CHECK_VERSION(4, 0, 0)
+, m_pEntry(pEntry)
+, m_pPlaceHolderReplacement(nullptr)
+, m_pPlaceHolderLabel(nullptr)
+, m_nEntryFocusInSignalId(0)
+, m_nEntryFocusOutSignalId(0)
+, m_nEntryTextLengthSignalId(0)
+, m_nEntryScrollOffsetSignalId(0)
+, m_nUpdatePlaceholderReplacementIdle(0)
+#endif
 {
+#if !GTK_CHECK_VERSION(4, 0, 0)
+// tdf#150810 fake getting placeholders visible even when GtkEntry has 
focus in gtk3.
+// In gtk4 this works out of the box, for gtk3 fake it by having a 
GtkLabel in an
+// overlay and show that label if the 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-09-07 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/a11y/atkfactory.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit efaf44a8d4dc41086ae24b847a86c7b0b66106d3
Author: Caolán McNamara 
AuthorDate: Thu Sep 1 12:07:01 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Sep 7 08:19:26 2022 +0200

tdf#150688 return atk_noop_object_wrapper_new() instead of null on failure

Change-Id: I20fd190a36649193ee2a1e536f520344c5f6c89a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138993
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/vcl/unx/gtk3/a11y/atkfactory.cxx b/vcl/unx/gtk3/a11y/atkfactory.cxx
index f92f9a667c9f..2fc407b7bc06 100644
--- a/vcl/unx/gtk3/a11y/atkfactory.cxx
+++ b/vcl/unx/gtk3/a11y/atkfactory.cxx
@@ -117,7 +117,7 @@ wrapper_factory_create_accessible( GObject *obj )
 return atk_noop_object_wrapper_new();
 
 GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(pTopLevel);
-g_return_val_if_fail( pFrame != nullptr, nullptr );
+g_return_val_if_fail(pFrame != nullptr, atk_noop_object_wrapper_new());
 
 vcl::Window* pFrameWindow = pFrame->GetWindow();
 if( pFrameWindow )
@@ -145,7 +145,7 @@ wrapper_factory_create_accessible( GObject *obj )
 }
 }
 
-return nullptr;
+return atk_noop_object_wrapper_new();
 }
 
 AtkObject* ooo_fixed_get_accessible(GtkWidget *obj)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-08-22 Thread Caolán McNamara (via logerrit)
 vcl/unx/generic/gdi/cairotextrender.cxx |   19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 4ec4fee0cf48142e2f4c594fe401f72872dc1bd9
Author: Caolán McNamara 
AuthorDate: Mon Aug 22 13:22:04 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Aug 23 06:18:52 2022 +0200

tdf#150507 set hint style even if the platform returns no default font 
options

if the platform (e.g. gen/kf5) doesn't return anything for
GetCairoFontOptions() but we have need for specific font options then we
also need to set them

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

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index 7300562d5d68..1e2e75c01d79 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -191,14 +191,15 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 __lsan_disable();
 #endif
 
-if (const cairo_font_options_t* pFontOptions = 
GetSalInstance()->GetCairoFontOptions())
-{
-const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
-bool bDisableAA = !rStyleSettings.GetUseFontAAFromSystem() && 
!rGraphics.getAntiAlias();
+const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
+const bool bDisableAA = !rStyleSettings.GetUseFontAAFromSystem() && 
!rGraphics.getAntiAlias();
+const bool bResolutionIndependentLayoutEnabled = 
rGraphics.getTextRenderModeForResolutionIndependentLayoutEnabled();
 
-const bool bResolutionIndependentLayoutEnabled = 
rGraphics.getTextRenderModeForResolutionIndependentLayoutEnabled();
-cairo_hint_style_t eHintStyle = 
cairo_font_options_get_hint_style(pFontOptions);
-cairo_hint_metrics_t eHintMetricsStyle = 
cairo_font_options_get_hint_metrics(pFontOptions);
+const cairo_font_options_t* pFontOptions = 
GetSalInstance()->GetCairoFontOptions();
+if (pFontOptions || bDisableAA || bResolutionIndependentLayoutEnabled)
+{
+cairo_hint_style_t eHintStyle = pFontOptions ? 
cairo_font_options_get_hint_style(pFontOptions) : CAIRO_HINT_STYLE_DEFAULT;
+cairo_hint_metrics_t eHintMetricsStyle = pFontOptions ? 
cairo_font_options_get_hint_metrics(pFontOptions) : CAIRO_HINT_METRICS_DEFAULT;
 bool bAllowedHintStyle = !bResolutionIndependentLayoutEnabled || 
(eHintStyle == CAIRO_HINT_STYLE_NONE);
 bool bAllowedHintMetricStyle = !bResolutionIndependentLayoutEnabled || 
(eHintMetricsStyle == CAIRO_HINT_METRICS_OFF);
 
@@ -206,7 +207,7 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 {
 // Disable font AA in case global AA setting is supposed to affect
 // font rendering (not the default) and AA is disabled.
-cairo_font_options_t* pOptions = 
cairo_font_options_copy(pFontOptions);
+cairo_font_options_t* pOptions = pFontOptions ? 
cairo_font_options_copy(pFontOptions) : cairo_font_options_create();
 if (bDisableAA)
 cairo_font_options_set_antialias(pOptions, 
CAIRO_ANTIALIAS_NONE);
 if (!bAllowedHintMetricStyle)
@@ -216,7 +217,7 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 cairo_set_font_options(cr, pOptions);
 cairo_font_options_destroy(pOptions);
 }
-else
+else if (pFontOptions)
 cairo_set_font_options(cr, pFontOptions);
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-08-19 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/a11y/atkwrapper.cxx |2 +-
 vcl/unx/gtk3/a11y/atkwrapper.hxx |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 6462bd8bca3d7c89e1dbf7c97ca6dc9056472992
Author: Caolán McNamara 
AuthorDate: Fri Aug 19 12:38:35 2022 +0200
Commit: Michael Weghorn 
CommitDate: Fri Aug 19 21:47:44 2022 +0200

tdf#150496 Revert "fix "invalid class cast from 'OOoAtkObj' to 
'GtkWidgetAccessible'""

This reverts commit e3485e17b06400f5df63d21e00534a6f33b54a72.

Change-Id: I785c9d2129078a38b718b7a150a14bc2e56ff479
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138433
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index f95d3efe78c1..d23f384e26fc 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -705,7 +705,7 @@ atk_object_wrapper_get_type()
 reinterpret_cast(atk_object_wrapper_init),
 nullptr
   } ;
-  type = g_type_register_static (GTK_TYPE_WIDGET_ACCESSIBLE,
+  type = g_type_register_static (ATK_TYPE_OBJECT,
  "OOoAtkObj",
  , GTypeFlags(0)) ;
   }
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx
index 6f18bde614ee..0b5f64726bba 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx
@@ -47,8 +47,7 @@ namespace com::sun::star::accessibility {
 
 struct AtkObjectWrapper
 {
-GtkWidgetAccessible aParent;
-
+AtkObject aParent;
 AtkObject* mpOrig;  //if we're a GtkDrawingArea acting as a custom 
LibreOffice widget, this is the toolkit default impl
 AtkObject* mpSysObjChild; //if we're a container for a sysobj, then this 
is the sysobj native gtk AtkObject
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-08-17 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/a11y/atkwrapper.cxx |2 +-
 vcl/unx/gtk3/a11y/atkwrapper.hxx |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit e3485e17b06400f5df63d21e00534a6f33b54a72
Author: Caolán McNamara 
AuthorDate: Mon Aug 15 13:14:08 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Aug 17 10:11:51 2022 +0200

fix "invalid class cast from 'OOoAtkObj' to 'GtkWidgetAccessible'"

and similar

Change-Id: I8a989465057a5b7810f6cedf370fc1cd77f5af0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138282
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index d23f384e26fc..f95d3efe78c1 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -705,7 +705,7 @@ atk_object_wrapper_get_type()
 reinterpret_cast(atk_object_wrapper_init),
 nullptr
   } ;
-  type = g_type_register_static (ATK_TYPE_OBJECT,
+  type = g_type_register_static (GTK_TYPE_WIDGET_ACCESSIBLE,
  "OOoAtkObj",
  , GTypeFlags(0)) ;
   }
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx
index 0b5f64726bba..6f18bde614ee 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx
@@ -47,7 +47,8 @@ namespace com::sun::star::accessibility {
 
 struct AtkObjectWrapper
 {
-AtkObject aParent;
+GtkWidgetAccessible aParent;
+
 AtkObject* mpOrig;  //if we're a GtkDrawingArea acting as a custom 
LibreOffice widget, this is the toolkit default impl
 AtkObject* mpSysObjChild; //if we're a container for a sysobj, then this 
is the sysobj native gtk AtkObject
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-08-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/generic/fontmanager/fontconfig.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 45e739dfa34b5ea779f59a6b079323fbf5ffee9d
Author: Caolán McNamara 
AuthorDate: Thu Aug 11 16:05:55 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Aug 11 22:14:13 2022 +0200

don't worry about Linux Libertine O vs Linux Libertine G

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

diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index f259277304d0..1daf54b69fa6 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -1185,6 +1185,8 @@ void 
PrintFontManager::Substitute(vcl::font::FontSelectPattern , OUStri
 // ImplFontMetricData::ImplInitTextLineSize
 return;
 }
+if (rPattern.maTargetName == "Linux Libertine G" && 
rPattern.maSearchName == "Linux Libertine O")
+return;
 SAL_WARN("vcl.fonts", "PrintFontManager::Substitute: missing font: '" 
<< rPattern.maTargetName <<
   "' try: " << rPattern.maSearchName << " 
instead");
 std::abort();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-08-11 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   28 
 1 file changed, 28 insertions(+)

New commits:
commit a90354dcb26426016f07ef48c592193031cc0e4e
Author: Caolán McNamara 
AuthorDate: Wed Aug 10 13:11:05 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Aug 11 12:33:34 2022 +0200

gtk3: silence 'invalid cast from 'GtkWindow' to 'GtkMenuShell' warning

from the sidebar tab due to the accelerators in there

its a bogus check in gtk3 in this case of a menu attached to a MenuButton

Change-Id: Ie5216e749993f3d44bfc2e4560cd3b2f49aa8aec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138031
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index ceab7160c86b..8c46146b00f6 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22693,16 +22693,44 @@ bool IsAllowedBuiltInIcon(std::u16string_view 
iconName)
 
 namespace {
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+void silence_gwarning(const gchar* /*log_domain*/,
+  GLogLevelFlags /*log_level*/,
+  const gchar* /*message*/,
+  gpointer /*user_data*/)
+{
+}
+#endif
+
 void load_ui_file(GtkBuilder* pBuilder, const OUString& rUri)
 {
 #if GTK_CHECK_VERSION(4, 0, 0)
 builder_add_from_gtk3_file(pBuilder, rUri);
 #else
+guint nLogHandlerId = 0;
+GLogLevelFlags 
nFatalMask(static_cast(G_LOG_FLAG_RECURSION|G_LOG_LEVEL_ERROR));
+if (rUri.endsWith("sfx/ui/tabbarcontents.ui"))
+{
+// gtk unhelpfully has a bogus warning for the accelerator in this .ui 
because it assumes menus with accelerators
+// if attached to something are attached to a MenuShell, but it's a 
MenuButton in this case. Turn off warnings, and
+// in the case of fatal-warnings temp disable fatal warnings, for this 
case.
+nLogHandlerId = g_log_set_handler("GLib-GObject",
+  
static_cast(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | 
G_LOG_FLAG_RECURSION),
+  silence_gwarning, nullptr);
+nFatalMask = g_log_set_always_fatal(nFatalMask);
+}
+
 OUString aPath;
 osl::FileBase::getSystemPathFromFileURL(rUri, aPath);
 GError *err = nullptr;
 auto rc = gtk_builder_add_from_file(pBuilder, OUStringToOString(aPath, 
RTL_TEXTENCODING_UTF8).getStr(), );
 
+if (nLogHandlerId)
+{
+g_log_remove_handler("GLib-GObject", nLogHandlerId);
+g_log_set_always_fatal(nFatalMask);
+}
+
 if (!rc)
 {
 SAL_WARN( "vcl.gtk", "GtkInstanceBuilder: error when calling 
gtk_builder_add_from_file: " << err->message);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-07-27 Thread Caolán McNamara (via logerrit)
 vcl/unx/generic/gdi/cairotextrender.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d51b00f635e665c19cec078979210df9f79a3aa3
Author: Caolán McNamara 
AuthorDate: Tue Jul 26 13:20:19 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jul 27 09:15:39 2022 +0200

tdf#150145 text appears to have a row of pixels cropped out

which is very similar sounding to
https://gitlab.freedesktop.org/cairo/cairo/-/issues/390

seems to be a bad interaction of slight hinting and sub pixel positioning
with hints_metrics disabled with CAIRO_HINT_METRICS_OFF.

lets continue to assume we desire CAIRO_HINT_METRICS_OFF most and
disable hinting rather than use slight

Change-Id: Id7b35d0e4f9291987e8ab96814936700374c6e16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137431
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index 0be33e9436c9..7300562d5d68 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -199,7 +199,7 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 const bool bResolutionIndependentLayoutEnabled = 
rGraphics.getTextRenderModeForResolutionIndependentLayoutEnabled();
 cairo_hint_style_t eHintStyle = 
cairo_font_options_get_hint_style(pFontOptions);
 cairo_hint_metrics_t eHintMetricsStyle = 
cairo_font_options_get_hint_metrics(pFontOptions);
-bool bAllowedHintStyle = !bResolutionIndependentLayoutEnabled || 
(eHintStyle == CAIRO_HINT_STYLE_NONE || eHintStyle == CAIRO_HINT_STYLE_SLIGHT);
+bool bAllowedHintStyle = !bResolutionIndependentLayoutEnabled || 
(eHintStyle == CAIRO_HINT_STYLE_NONE);
 bool bAllowedHintMetricStyle = !bResolutionIndependentLayoutEnabled || 
(eHintMetricsStyle == CAIRO_HINT_METRICS_OFF);
 
 if (bDisableAA || !bAllowedHintStyle || !bAllowedHintMetricStyle)
@@ -209,10 +209,10 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 cairo_font_options_t* pOptions = 
cairo_font_options_copy(pFontOptions);
 if (bDisableAA)
 cairo_font_options_set_antialias(pOptions, 
CAIRO_ANTIALIAS_NONE);
-if (!bAllowedHintStyle)
-cairo_font_options_set_hint_style(pOptions, 
CAIRO_HINT_STYLE_SLIGHT);
 if (!bAllowedHintMetricStyle)
 cairo_font_options_set_hint_metrics(pOptions, 
CAIRO_HINT_METRICS_OFF);
+if (!bAllowedHintStyle)
+cairo_font_options_set_hint_style(pOptions, 
CAIRO_HINT_STYLE_NONE);
 cairo_set_font_options(cr, pOptions);
 cairo_font_options_destroy(pOptions);
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/unx

2022-07-17 Thread Michael Weghorn (via logerrit)
 vcl/unx/gtk3/a11y/atkcomponent.cxx |   50 ++---
 vcl/unx/gtk3/a11y/atktext.cxx  |4 +-
 2 files changed, 49 insertions(+), 5 deletions(-)

New commits:
commit 69c51d9f172da6490b676f6f4c30e9f173587582
Author: Michael Weghorn 
AuthorDate: Thu Jul 14 08:35:53 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Jul 17 15:48:35 2022 +0200

tdf#149952 gtk3 a11y: Return pos relative to window when requested

ATK (and AT-SPI) allows to specify 3 different coordinate
types [1]:

1) `ATK_XY_SCREEN`: coordinates relative to the screen.
2) `ATK_XY_WINDOW`: coordinates relative to the widget's
   top-level window.
3) `ATK_XY_PARENT` coordinates relative to the widget's
   immediate parent.

The `XAccessibleComponent` interface provides equivalents
for 1) and 3), but not 2), and the gtk3 VCL plugin wasn't
really handling 2) so far either.

This adds handling for `ATK_XY_WINDOW`. The position
in the window is calculated by recursively walking up the a11y
hierarchy and summing up the positions relative to the
parent, until a window is reached (or there's no parent,
or none implementing `AtkComponent`).

Also add an explicit check for `ATK_XY_PARENT` if
none of the other two constants is used and warn
and return if that isn't used either, to cover the case
that new constants will be introduced in newer ATK versions.
(That check needs to be conditional, because `ATK_XY_PARENT`
is only defined from ATK 2.30 on, while our minimum
required version is currently 2.28.1.)

The coordinates received when testing this with a
selected Writer paragraph in Accerciser's IPython console
look generally plausible now with this change in place:

In [108]: acc.queryComponent().getPosition(pyatspi.component.XY_SCREEN)
Out[109]: (1939, 417)
In [109]: acc.queryComponent().getPosition(pyatspi.component.XY_WINDOW)
Out[110]: (19, 245)
In [110]: acc.queryComponent().getPosition(pyatspi.component.XY_PARENT)
Out[111]: (19, 113)
In [111]: acc.queryText().getCharacterExtents(0, 
pyatspi.component.XY_SCREEN)
Out[112]: (2015, 417, 5, 19)
In [112]: acc.queryText().getCharacterExtents(0, 
pyatspi.component.XY_WINDOW)
Out[113]: (95, 245, 5, 19)
In [113]: acc.queryText().getCharacterExtents(0, 
pyatspi.component.XY_PARENT)
Out[114]: (76, 0, 5, 19)

(Previously, requesting window-relative coordinates gave the
same result as coordinates relative to direct parent.)

[1] https://docs.gtk.org/atk/enum.CoordType.html

Change-Id: Idf8f7d08f9054a8df28d1ee8fccc791a803de045
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137027
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 4ac4e8aacefcdc106a450895ab751f0544e76377)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137060
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/a11y/atkcomponent.cxx 
b/vcl/unx/gtk3/a11y/atkcomponent.cxx
index 21301d4da6bb..154f0117f1bc 100644
--- a/vcl/unx/gtk3/a11y/atkcomponent.cxx
+++ b/vcl/unx/gtk3/a11y/atkcomponent.cxx
@@ -19,6 +19,7 @@
 
 #include "atkwrapper.hxx"
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -51,15 +52,41 @@ static 
css::uno::Reference
 return css::uno::Reference();
 }
 
+static awt::Point
+lcl_getLocationInWindow(AtkComponent* pAtkComponent,
+
css::uno::Reference const& xComponent)
+{
+// calculate position in window by adding the component's position in the 
parent
+// to the parent's position in the window (unless parent is a window 
itself)
+awt::Point aPos = xComponent->getLocation();
+AtkObject* pParent = atk_object_get_parent(ATK_OBJECT(pAtkComponent));
+if (ATK_IS_COMPONENT(pParent) && pParent->role != AtkRole::ATK_ROLE_DIALOG
+&& pParent->role != AtkRole::ATK_ROLE_FILE_CHOOSER
+&& pParent->role != AtkRole::ATK_ROLE_FRAME
+&& pParent->role != AtkRole::ATK_ROLE_WINDOW)
+{
+int nX;
+int nY;
+atk_component_get_extents(ATK_COMPONENT(pParent), , , nullptr, 
nullptr, ATK_XY_WINDOW);
+aPos.X += nX;
+aPos.Y += nY;
+}
+
+return aPos;
+}
+
 /*/
 
 static awt::Point
-translatePoint( css::uno::Reference const 
& pComponent,
+translatePoint( AtkComponent* pAtkComponent,
+css::uno::Reference const 
& pComponent,
 gint x, gint y, AtkCoordType t)
 {
 awt::Point aOrigin( 0, 0 );
 if( t == ATK_XY_SCREEN )
 aOrigin = pComponent->getLocationOnScreen();
+else if (t == ATK_XY_WINDOW)
+aOrigin = lcl_getLocationInWindow(pAtkComponent, pComponent);
 return awt::Point( x - aOrigin.X, y - aOrigin.Y );
 }
 
@@ -111,7 +138,8 @@