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

2022-04-07 Thread Vincent Reher (via logerrit)
 vcl/unx/gtk3/gtkframe.cxx |   20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 41c00d9cf065a6b5ba676807b446f32426e5d642
Author: Vincent Reher 
AuthorDate: Tue Apr 5 18:31:45 2022 -0700
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Apr 7 08:26:25 2022 +0200

Resolves: tdf#146174 allow shortcut key event handling before menubar

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

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index a7ba7eec9cdb..c874b23a13c5 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3785,12 +3785,6 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointe
 
 if (GTK_IS_WINDOW(pThis->m_pWindow))
 {
-// tdf#144846 If this is registered as a menubar mnemonic then ensure
-// that any other widget won't be considered as a candidate by taking
-// over the task of launch the menubar menu outself
-if (pThis->HandleMenubarMnemonic(pEvent->state, pEvent->keyval))
-return true;
-
 GtkWidget* pFocusWindow = 
gtk_window_get_focus(GTK_WINDOW(pThis->m_pWindow));
 bFocusInAnotherGtkWidget = pFocusWindow && pFocusWindow != 
GTK_WIDGET(pThis->m_pDrawingArea);
 if (bFocusInAnotherGtkWidget)
@@ -3947,6 +3941,20 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointe
   
sal_Unicode(gdk_keyval_to_unicode( pEvent->keyval )),
   (pEvent->type == 
GDK_KEY_PRESS),
   false);
+
+// tdf#144846 If this is registered as a menubar mnemonic then ensure
+// that any other widget won't be considered as a candidate by taking
+// over the task of launch the menubar menu outself
+// The code was moved here from its original position at beginning
+// of this function in order to resolve tdf#146174.
+if (!bStopProcessingKey && // module key handler did not process key
+pEvent->type == GDK_KEY_PRESS &&  // module key handler handles 
only GDK_KEY_PRESS
+GTK_IS_WINDOW(pThis->m_pWindow) &&
+pThis->HandleMenubarMnemonic(pEvent->state, pEvent->keyval))
+{
+return true;
+}
+
 if (!aDel.isDeleted())
 {
 pThis->m_nKeyModifiers = ModKeyFlags::NONE;


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

2022-03-01 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit e388a4d6d7ab355fc7aa5fca05e06070693847e9
Author: Caolán McNamara 
AuthorDate: Tue Mar 1 16:50:37 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Mar 2 04:30:47 2022 +0100

Resolves: tdf#145580 need to use gtk_im_context_filter_keypress

for at least xim, ibus works fine. To reproduce under Fedora with gtk3
can use a keyboard layout of "US International with dead keys" with
export GDK_BACKEND=x11
export GTK_IM_MODULE=xim

and 'a in writer comment or calc header/footer dialog

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index aa5b0685aa21..d106aaf92c78 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3911,7 +3911,7 @@ public:
 }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
-bool signal_key(const GdkEventKey* pEvent)
+virtual bool do_signal_key(const GdkEventKey* pEvent)
 {
 if (pEvent->type == GDK_KEY_PRESS && m_aKeyPressHdl.IsSet())
 {
@@ -3925,6 +3925,11 @@ public:
 }
 return false;
 }
+
+bool signal_key(const GdkEventKey* pEvent)
+{
+return do_signal_key(pEvent);
+}
 #endif
 
 virtual void grab_add() override
@@ -16855,6 +16860,10 @@ public:
 return signal_im_context_delete_surrounding(rRange);
 }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+virtual bool do_signal_key(const GdkEventKey* pEvent) override;
+#endif
+
 virtual void queue_draw() override
 {
 gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
@@ -17206,8 +17215,24 @@ public:
 pThis->updateIMSpotLocation();
 pThis->EndExtTextInput();
 }
+
+#if !GTK_CHECK_VERSION(4, 0, 0)
+bool im_context_filter_keypress(const GdkEventKey* pEvent)
+{
+return gtk_im_context_filter_keypress(m_pIMContext, 
const_cast(pEvent));
+}
+#endif
 };
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+bool GtkInstanceDrawingArea::do_signal_key(const GdkEventKey* pEvent)
+{
+if (m_xIMHandler && m_xIMHandler->im_context_filter_keypress(pEvent))
+return true;
+return GtkInstanceWidget::do_signal_key(pEvent);
+}
+#endif
+
 void GtkInstanceDrawingArea::set_input_context(const InputContext& 
rInputContext)
 {
 bool bUseIm(rInputContext.GetOptions() & InputContextFlags::Text);


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

2022-01-25 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

New commits:
commit a6827c3787f3056444586979750f97d3e963f6f2
Author: Caolán McNamara 
AuthorDate: Mon Jan 24 20:09:49 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 25 11:45:36 2022 +0100

tdf#146971 changing a11y desc to replace %PRODUCTNAME has perf issues

so leave it alone, and do the conversion just for the originally
report situation as a safely backportable change with a follow up
to not allow us to get into this situation in the first place

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 94184ca3db42..aa5b0685aa21 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21349,7 +21349,15 @@ namespace {
 const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
 if (pDesc && pDesc[0])
 {
-gtk_tooltip_set_text(tooltip, pDesc);
+if (ResHookProc pStringReplace = 
Translate::GetReadStringHook())
+{
+// tdf#142704 %PRODUCTNAME shown in extended tips
+OUString aDesc(pDesc, strlen(pDesc), 
RTL_TEXTENCODING_UTF8);
+aDesc = (*pStringReplace)(aDesc);
+gtk_tooltip_set_text(tooltip, OUStringToOString(aDesc, 
RTL_TEXTENCODING_UTF8).getStr());
+}
+else
+gtk_tooltip_set_text(tooltip, pDesc);
 return true;
 }
 #endif
@@ -21670,18 +21678,6 @@ private:
 aTooltip = (*m_pStringReplace)(aTooltip);
 gtk_widget_set_tooltip_text(pWidget, 
OUStringToOString(aTooltip, RTL_TEXTENCODING_UTF8).getStr());
 }
-
-#if !GTK_CHECK_VERSION(4, 0, 0)
-// tdf#142704 %PRODUCTNAME shown in extended tips
-AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
-const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
-if (pDesc && pDesc[0])
-{
-OUString aDesc(pDesc, strlen(pDesc), RTL_TEXTENCODING_UTF8);
-aDesc = (*m_pStringReplace)(aDesc);
-atk_object_set_description(pAtkObject, 
OUStringToOString(aDesc, RTL_TEXTENCODING_UTF8).getStr());
-}
-#endif
 }
 
 // expand placeholder and collect potentially missing mnemonics


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

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

New commits:
commit 5dcfec0a31075723bf6b94c57d65b560da42df3b
Author: Caolán McNamara 
AuthorDate: Fri Jan 7 20:29:59 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jan 9 17:44:14 2022 +0100

tdf#146641 allocations attempted while hidden are discarded by gtk

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

diff --git a/vcl/unx/gtk3/gtkobject.cxx b/vcl/unx/gtk3/gtkobject.cxx
index fbe5a7c39a75..42da4f6f9136 100644
--- a/vcl/unx/gtk3/gtkobject.cxx
+++ b/vcl/unx/gtk3/gtkobject.cxx
@@ -491,7 +491,12 @@ void GtkSalObjectWidgetClip::Show( bool bVisible )
 if (bVisible == bCurrentVis)
 return;
 if( bVisible )
+{
 gtk_widget_show(m_pScrolledWindow);
+// tdf#146641 allocations attempted while hidden are discarded by gtk,
+// so on transition to visible ApplyClipRegion needs to be called
+ApplyClipRegion();
+}
 else
 {
 // on hiding the widget, if a child has focus gtk will want to move 
the focus out of the widget


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

2021-12-15 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtksalmenu.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0e89f357b1b0bcee94568f7b221972ef3a7ba7b3
Author: Caolán McNamara 
AuthorDate: Wed Dec 15 14:58:49 2021 +
Commit: Stephan Bergmann 
CommitDate: Wed Dec 15 17:04:23 2021 +0100

unset mpMenuBarWidget when it was destroyed along with its parent

Resolves: https://github.com/flathub/org.libreoffice.LibreOffice/issues/173
Change-Id: I875cf658fb86adfa389429ead059bfd7c4f08ef4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx
index e9e6508ef407..1ae30b05a5b8 100644
--- a/vcl/unx/gtk3/gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtksalmenu.cxx
@@ -1114,6 +1114,7 @@ void GtkSalMenu::DestroyMenuBarWidget()
 g_clear_pointer(, gtk_widget_unparent);
 #endif
 mpMenuBarContainerWidget = nullptr;
+mpMenuBarWidget = nullptr;
 mpCloseButton = nullptr;
 }
 }


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

2021-11-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   81 +++
 1 file changed, 33 insertions(+), 48 deletions(-)

New commits:
commit 26227a0bf6adc64e1a94fd655782054ac92d0993
Author: Caolán McNamara 
AuthorDate: Thu Nov 25 12:37:40 2021 +
Commit: Michael Stahl 
CommitDate: Fri Nov 26 11:36:10 2021 +0100

Resolves: tdf#145786 get the correct bounds with window scaling enabled

the per-window/app scaling as opposed to the global desktop one which
wasn't affected.

the menubutton thought it saw the mouse release happen outside the
window it popped up when the combobox inside it was clicked, so popped
down the popup from underneath the combobox.

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 4b1cd409fc48..94184ca3db42 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -9414,6 +9414,29 @@ GtkPositionType show_menu(GtkWidget* pMenuButton, 
GtkWindow* pMenu)
 return ePosUsed;
 }
 
+bool button_event_is_outside(GtkWidget* pMenuHack, GdkEventButton* pEvent)
+{
+//we want to pop down if the button was released outside our popup
+gdouble x = pEvent->x_root;
+gdouble y = pEvent->y_root;
+
+gint window_x, window_y;
+GdkSurface* pWindow = widget_get_surface(pMenuHack);
+gdk_window_get_position(pWindow, _x, _y);
+
+GtkAllocation alloc;
+gtk_widget_get_allocation(pMenuHack, );
+gint x1 = window_x;
+gint y1 = window_y;
+gint x2 = x1 + alloc.width;
+gint y2 = y1 + alloc.height;
+
+if (x > x1 && x < x2 && y > y1 && y < y2)
+return false;
+
+return true;
+}
+
 #endif
 
 /* four types of uses of this
@@ -9548,36 +9571,17 @@ private:
 }
 }
 
-static gboolean signalButtonRelease(GtkWidget* pWidget, GdkEventButton* 
pEvent, gpointer widget)
+static gboolean signalButtonRelease(GtkWidget* /*pWidget*/, 
GdkEventButton* pEvent, gpointer widget)
 {
 GtkInstanceMenuButton* pThis = 
static_cast(widget);
-return pThis->button_release(pWidget, pEvent);
+return pThis->button_release(pEvent);
 }
 
-bool button_release(GtkWidget* pWidget, GdkEventButton* pEvent)
+bool button_release(GdkEventButton* pEvent)
 {
 //we want to pop down if the button was released outside our popup
-gdouble x = pEvent->x_root;
-gdouble y = pEvent->y_root;
-gint xoffset, yoffset;
-gdk_window_get_root_origin(widget_get_surface(pWidget), , 
);
-
-GtkAllocation alloc;
-gtk_widget_get_allocation(pWidget, );
-xoffset += alloc.x;
-yoffset += alloc.y;
-
-gtk_widget_get_allocation(GTK_WIDGET(m_pMenuHack), );
-gint x1 = alloc.x + xoffset;
-gint y1 = alloc.y + yoffset;
-gint x2 = x1 + alloc.width;
-gint y2 = y1 + alloc.height;
-
-if (x > x1 && x < x2 && y > y1 && y < y2)
-return false;
-
-set_active(false);
-
+if (button_event_is_outside(GTK_WIDGET(m_pMenuHack), pEvent))
+set_active(false);
 return false;
 }
 
@@ -19749,36 +19753,17 @@ private:
 }
 }
 
-static gboolean signalButtonPress(GtkWidget* pWidget, GdkEventButton* 
pEvent, gpointer widget)
+static gboolean signalButtonPress(GtkWidget* /*pWidget*/, GdkEventButton* 
pEvent, gpointer widget)
 {
 GtkInstanceComboBox* pThis = static_cast(widget);
-return pThis->button_press(pWidget, pEvent);
+return pThis->button_press(pEvent);
 }
 
-bool button_press(GtkWidget* pWidget, GdkEventButton* pEvent)
+bool button_press(GdkEventButton* pEvent)
 {
 //we want to pop down if the button was pressed outside our popup
-gdouble x = pEvent->x_root;
-gdouble y = pEvent->y_root;
-gint xoffset, yoffset;
-gdk_window_get_root_origin(widget_get_surface(pWidget), , 
);
-
-GtkAllocation alloc;
-gtk_widget_get_allocation(pWidget, );
-xoffset += alloc.x;
-yoffset += alloc.y;
-
-gtk_widget_get_allocation(GTK_WIDGET(m_pMenuWindow), );
-gint x1 = alloc.x + xoffset;
-gint y1 = alloc.y + yoffset;
-gint x2 = x1 + alloc.width;
-gint y2 = y1 + alloc.height;
-
-if (x > x1 && x < x2 && y > y1 && y < y2)
-return false;
-
-gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pToggleButton), 
false);
-
+if (button_event_is_outside(GTK_WIDGET(m_pMenuWindow), pEvent))
+gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pToggleButton), 
false);
 return false;
 }
 


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

2021-11-22 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   39 ---
 1 file changed, 36 insertions(+), 3 deletions(-)

New commits:
commit b80b17884962c5e2f50c734f153825c0e37605e2
Author: Caolán McNamara 
AuthorDate: Sun Nov 21 19:53:47 2021 +
Commit: Michael Stahl 
CommitDate: Mon Nov 22 11:51:19 2021 +0100

Related: tdf#145786 cooperate between our own grabs

don't try to workaround a grab if the grab is done by another
of our own popups, and on tearing down one of our popups, restore
the grab of its parent if that parent was one of our own popups.

This typically matters on X where we don't use GtkPopovers (unlike
wayland, where Popovers can escape the parent window). Things to test
are:

writer's watermark dialog: click the color button to get the 1st level
popup, then click the combobox to get the 2nd level one, select an entry
to return to the 1st level.
a) Clicking a valueset element should select that color, not dismiss the
popup without selecting a color.
b) Clicking the combobox to get the popup again should result in a popup
where the focus still follows the mouse (i.e. the 1st level popup
doesn't try and steal away the 2nd level grab)

sidebar: same scenario as above, except a color popover parented to a
sidebar pane and not a dialog.

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 78c3b09789c1..4b1cd409fc48 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -9469,9 +9469,15 @@ private:
 return;
 if (!get_active())
 {
+bool bHadFocus = gtk_window_has_toplevel_focus(m_pMenuHack);
+
 do_ungrab(GTK_WIDGET(m_pMenuHack));
 
 gtk_widget_hide(GTK_WIDGET(m_pMenuHack));
+
+GdkSurface* pSurface = widget_get_surface(GTK_WIDGET(m_pMenuHack));
+g_object_set_data(G_OBJECT(pSurface), "g-lo-InstancePopup", 
GINT_TO_POINTER(false));
+
 //put contents back from where the came from
 GtkWidget* pChild = gtk_bin_get_child(GTK_BIN(m_pMenuHack));
 g_object_ref(pChild);
@@ -9489,6 +9495,15 @@ private:
 GtkSalFrame* pFrame = pParent ? 
GtkSalFrame::getFromWindow(pParent) : nullptr;
 if (pFrame)
 pFrame->UnblockTooltip();
+
+if (bHadFocus)
+{
+GdkSurface* pParentSurface = pParent ? 
widget_get_surface(pParent) : nullptr;
+void* pParentIsPopover = pParentSurface ? 
g_object_get_data(G_OBJECT(pParentSurface), "g-lo-InstancePopup") : nullptr;
+if (pParentIsPopover)
+do_grab(GTK_WIDGET(m_pMenuButton));
+gtk_widget_grab_focus(GTK_WIDGET(m_pMenuButton));
+}
 }
 else
 {
@@ -9503,6 +9518,8 @@ private:
 g_object_unref(pChild);
 
 GtkPositionType ePosUsed = show_menu(m_pMenuHackAlign ? 
m_pMenuHackAlign : GTK_WIDGET(m_pMenuButton), m_pMenuHack);
+GdkSurface* pSurface = widget_get_surface(GTK_WIDGET(m_pMenuHack));
+g_object_set_data(G_OBJECT(pSurface), "g-lo-InstancePopup", 
GINT_TO_POINTER(true));
 // 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);
 }
@@ -9522,7 +9539,7 @@ private:
 {
 set_active(false);
 }
-else
+else if (!g_object_get_data(G_OBJECT(event->grab_window), 
"g-lo-InstancePopup")) // another LibreOffice popover took a grab
 {
 //try and regrab, so when we lose the grab to the menu of the 
color palette
 //combobox we regain it so the color palette doesn't itself 
disappear on next
@@ -17979,7 +17996,7 @@ private:
 {
 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_pToggleButton), 
false);
 }
-else
+else if (!g_object_get_data(G_OBJECT(event->grab_window), 
"g-lo-InstancePopup")) // another LibreOffice popover took a grab
 {
 //try and regrab, so when we lose the grab to the menu of the 
color palette
 //combobox we regain it so the color palette doesn't itself 
disappear on next
@@ -19209,10 +19226,15 @@ private:
 m_bHoverSelection = false;
 }
 
+bool bHadFocus = gtk_window_has_toplevel_focus(m_pMenuWindow);
+
 do_ungrab(GTK_WIDGET(m_pMenuWindow));
 
 gtk_widget_hide(GTK_WIDGET(m_pMenuWindow));
 
+GdkSurface* pSurface = 
widget_get_surface(GTK_WIDGET(m_pMenuWindow));
+g_object_set_data(G_OBJECT(pSurface), "g-lo-InstancePopup", 
GINT_TO_POINTER(false));
+
 

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

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

New commits:
commit ac3c1de61e7cf069d3022907570832130235fa32
Author: Caolán McNamara 
AuthorDate: Sat Nov 6 21:32:21 2021 +
Commit: Xisco Fauli 
CommitDate: Mon Nov 15 12:31:41 2021 +0100

Resolves: tdf#145567 restore focus to the usual frame focus widget

when tearing down the start center. Don't leave the focus in an
arbitrary widget.

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 6b592b341ea0..78c3b09789c1 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21803,6 +21803,14 @@ private:
 // rehook handler and let vcl cycle its own way through this widget's
 // children
 pFrame->AllowCycleFocusOut();
+
+// tdf#145567 if the focus is in this hierarchy then, now that we are 
tearing down,
+// move focus to the usual focus candidate for the frame
+GtkWindow* pFocusWin = get_active_window();
+GtkWidget* pFocus = pFocusWin ? gtk_window_get_focus(pFocusWin) : 
nullptr;
+bool bHasFocus = pFocus && gtk_widget_is_ancestor(pFocus, pTopLevel);
+if (bHasFocus)
+pFrame->GrabFocus();
 }
 
 static void signalUnmap(GtkWidget*, gpointer user_data)


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

2021-11-03 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   39 ---
 1 file changed, 24 insertions(+), 15 deletions(-)

New commits:
commit 13d4a0d2a287074a954bd698e325fc2fe2d76bbb
Author: Caolán McNamara 
AuthorDate: Wed Nov 3 10:59:53 2021 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Nov 4 01:26:13 2021 +0100

Related: tdf#143443 remove PANGO_ATTR_ABSOLUTE_SIZE and PANGO_ATTR_SIZE

when setting a new size because an absolute size set by gtk itself seems
to be not overwritten by pango_attr_size_new so sometimes the size of
the font in the annotation window label is too large

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 6bfef76f9ed9..6b592b341ea0 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8689,6 +8689,7 @@ void update_attr_list(PangoAttrList* pAttrList, const 
vcl::Font& rFont)
 {
 pango_attr_list_change(pAttrList, 
pango_attr_family_new(OUStringToOString(rFont.GetFamilyName(), 
RTL_TEXTENCODING_UTF8).getStr()));
 pango_attr_list_change(pAttrList, 
pango_attr_size_new(rFont.GetFontSize().Height() * PANGO_SCALE));
+
 switch (rFont.GetItalic())
 {
 case ITALIC_NONE:
@@ -8757,10 +8758,33 @@ void update_attr_list(PangoAttrList* pAttrList, const 
vcl::Font& rFont)
 }
 }
 
+gboolean filter_pango_attrs(PangoAttribute *attr, gpointer data)
+{
+PangoAttrType* pFilterAttrs = static_cast(data);
+while (*pFilterAttrs)
+{
+if (attr->klass->type == *pFilterAttrs)
+return true;
+++pFilterAttrs;
+}
+return false;
+}
+
 void set_font(GtkLabel* pLabel, const vcl::Font& rFont)
 {
 PangoAttrList* pOrigList = gtk_label_get_attributes(pLabel);
 PangoAttrList* pAttrList = pOrigList ? pango_attr_list_copy(pOrigList) : 
pango_attr_list_new();
+
+if (pOrigList)
+{
+// tdf#143443 remove both PANGO_ATTR_ABSOLUTE_SIZE and PANGO_ATTR_SIZE
+// because pango_attr_list_change(..., pango_attr_size_new...) isn't
+// sufficient on its own to ensure a new size sticks.
+PangoAttrType aFilterAttrs[] = {PANGO_ATTR_ABSOLUTE_SIZE, 
PANGO_ATTR_SIZE, PANGO_ATTR_INVALID};
+PangoAttrList* pRemovedAttrs = pOrigList ? 
pango_attr_list_filter(pAttrList, filter_pango_attrs, ) : nullptr;
+pango_attr_list_unref(pRemovedAttrs);
+}
+
 update_attr_list(pAttrList, rFont);
 gtk_label_set_attributes(pLabel, pAttrList);
 pango_attr_list_unref(pAttrList);
@@ -11867,21 +11891,6 @@ namespace
 }
 }
 
-namespace
-{
-gboolean filter_pango_attrs(PangoAttribute *attr, gpointer data)
-{
-PangoAttrType* pFilterAttrs = static_cast(data);
-while (*pFilterAttrs)
-{
-if (attr->klass->type == *pFilterAttrs)
-return true;
-++pFilterAttrs;
-}
-return false;
-}
-}
-
 namespace
 {
 


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

2021-10-19 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit be611817ba6a1627b9d1384537aeb471d0372a7c
Author: Caolán McNamara 
AuthorDate: Tue Oct 19 12:29:18 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 19 20:52:52 2021 +0200

Related: tdf#145169 warn on overwrite from gtk "save as" for remote files

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

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index a318a115f575..b9b6b057b8e5 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -46,6 +46,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -967,11 +968,10 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
 Sequence < OUString > aPathSeq = getFiles();
 if( aPathSeq.getLength() == 1 )
 {
-OString sFileName = unicodetouri( aPathSeq[0] );
-gchar *gFileName = g_filename_from_uri ( 
sFileName.getStr(), nullptr, nullptr );
-if( g_file_test( gFileName, G_FILE_TEST_IS_REGULAR ) )
+OUString sFileName = aPathSeq[0];
+if (::utl::UCBContentHelper::Exists(sFileName))
 {
-INetURLObject aFileObj( 
OStringToOUString(sFileName, RTL_TEXTENCODING_UTF8) );
+INetURLObject aFileObj(sFileName);
 
 OString baseName(
   OUStringToOString(
@@ -1049,7 +1049,6 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
 gtk_window_destroy(GTK_WINDOW(dlg));
 #endif
 }
-g_free (gFileName);
 
 if( btn == GTK_RESPONSE_YES )
 retVal = ExecutableDialogResults::OK;


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

2021-10-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |  127 ++-
 1 file changed, 71 insertions(+), 56 deletions(-)

New commits:
commit 261d2ec2ab16a74d39ac1a372311e94869a68ac3
Author: Caolán McNamara 
AuthorDate: Thu Oct 7 11:56:29 2021 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Oct 9 03:07:51 2021 +0200

fix "gtk_bin_remove: assertion 'priv->child == child' failed" warning

on closing a document from tdf#141633 with a combobox in the tableform.

So remove the mouse event widget before we remove the combobox
replacement

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 66cefee6b559..727b6b547c36 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -2712,6 +2712,74 @@ protected:
 #endif
 }
 
+void DisconnectMouseEvents()
+{
+if (m_nButtonPressSignalId)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+g_signal_handler_disconnect(get_click_controller(), 
m_nButtonPressSignalId);
+#else
+g_signal_handler_disconnect(m_pMouseEventBox, 
m_nButtonPressSignalId);
+#endif
+m_nButtonPressSignalId = 0;
+}
+if (m_nMotionSignalId)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+g_signal_handler_disconnect(get_motion_controller(), 
m_nMotionSignalId);
+#else
+g_signal_handler_disconnect(m_pMouseEventBox, m_nMotionSignalId);
+#endif
+m_nMotionSignalId = 0;
+}
+if (m_nLeaveSignalId)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+g_signal_handler_disconnect(get_motion_controller(), 
m_nLeaveSignalId);
+#else
+g_signal_handler_disconnect(m_pMouseEventBox, m_nLeaveSignalId);
+#endif
+m_nLeaveSignalId = 0;
+}
+if (m_nEnterSignalId)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+g_signal_handler_disconnect(get_motion_controller(), 
m_nEnterSignalId);
+#else
+g_signal_handler_disconnect(m_pMouseEventBox, m_nEnterSignalId);
+#endif
+m_nEnterSignalId = 0;
+}
+if (m_nButtonReleaseSignalId)
+{
+#if GTK_CHECK_VERSION(4, 0, 0)
+g_signal_handler_disconnect(get_click_controller(), 
m_nButtonReleaseSignalId);
+#else
+g_signal_handler_disconnect(m_pMouseEventBox, 
m_nButtonReleaseSignalId);
+#endif
+m_nButtonReleaseSignalId = 0;
+}
+
+#if !GTK_CHECK_VERSION(4, 0, 0)
+if (m_pMouseEventBox && m_pMouseEventBox != m_pWidget)
+{
+// put things back they way we found them
+GtkWidget* pParent = gtk_widget_get_parent(m_pMouseEventBox);
+
+g_object_ref(m_pWidget);
+gtk_container_remove(GTK_CONTAINER(m_pMouseEventBox), m_pWidget);
+
+gtk_widget_destroy(m_pMouseEventBox);
+
+gtk_container_add(GTK_CONTAINER(pParent), m_pWidget);
+// coverity[freed_arg : FALSE] - this does not free m_pWidget, it 
is reffed by pParent
+g_object_unref(m_pWidget);
+
+m_pMouseEventBox = m_pWidget;
+}
+#endif
+}
+
 private:
 bool m_bTakeOwnership;
 #if !GTK_CHECK_VERSION(4, 0, 0)
@@ -4016,46 +4084,6 @@ public:
 g_signal_handler_disconnect(m_pWidget, m_nKeyPressSignalId);
 if (m_nKeyReleaseSignalId)
 g_signal_handler_disconnect(m_pWidget, m_nKeyReleaseSignalId);
-if (m_nButtonPressSignalId)
-{
-#if GTK_CHECK_VERSION(4, 0, 0)
-g_signal_handler_disconnect(get_click_controller(), 
m_nButtonPressSignalId);
-#else
-g_signal_handler_disconnect(m_pMouseEventBox, 
m_nButtonPressSignalId);
-#endif
-}
-if (m_nMotionSignalId)
-{
-#if GTK_CHECK_VERSION(4, 0, 0)
-g_signal_handler_disconnect(get_motion_controller(), 
m_nMotionSignalId);
-#else
-g_signal_handler_disconnect(m_pMouseEventBox, m_nMotionSignalId);
-#endif
-}
-if (m_nLeaveSignalId)
-{
-#if GTK_CHECK_VERSION(4, 0, 0)
-g_signal_handler_disconnect(get_motion_controller(), 
m_nLeaveSignalId);
-#else
-g_signal_handler_disconnect(m_pMouseEventBox, m_nLeaveSignalId);
-#endif
-}
-if (m_nEnterSignalId)
-{
-#if GTK_CHECK_VERSION(4, 0, 0)
-g_signal_handler_disconnect(get_motion_controller(), 
m_nEnterSignalId);
-#else
-g_signal_handler_disconnect(m_pMouseEventBox, m_nEnterSignalId);
-#endif
-}
-if (m_nButtonReleaseSignalId)
-{
-#if GTK_CHECK_VERSION(4, 0, 0)
-g_signal_handler_disconnect(get_click_controller(), 
m_nButtonReleaseSignalId);
-#else
-g_signal_handler_disconnect(m_pMouseEventBox, 
m_nButtonReleaseSignalId);
-#endif
-}
 
 if (m_nFocusInSignalId)
 {
@@ 

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

2021-10-07 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |  131 ++-
 1 file changed, 73 insertions(+), 58 deletions(-)

New commits:
commit bb70cd3d4badb615528ff18b46ff233d8be6e2ff
Author: Caolán McNamara 
AuthorDate: Wed Oct 6 12:49:05 2021 +0100
Commit: Michael Stahl 
CommitDate: Thu Oct 7 13:24:18 2021 +0200

tdf#141633 use css instead of pango attribs for font size

in GtkEntry. Rendering was using the font set via pango attribs, but
when measuring the mininum size gtk will use the min size of the widget
font so that has to change to allow the GtkEntry to fit the size of the
desired font

bundle together the setting-font-via-css as "WidgetFont"

Change-Id: Ic00d8b84decf528016fe47fc3b142daf3439340d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123138
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit a693009c28059435ea5bae6d89a76e2243fe7793)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123146
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index f535c06871fc..b033be801ff3 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8813,6 +8813,55 @@ public:
 }
 };
 
+class WidgetFont
+{
+private:
+GtkWidget* m_pWidget;
+GtkCssProvider* m_pFontCssProvider;
+std::unique_ptr m_xFont;
+public:
+WidgetFont(GtkWidget* pWidget)
+: m_pWidget(pWidget)
+, m_pFontCssProvider(nullptr)
+{
+}
+
+void use_custom_font(const vcl::Font* pFont, std::u16string_view 
rCSSSelector)
+{
+GtkStyleContext *pWidgetContext = 
gtk_widget_get_style_context(m_pWidget);
+if (m_pFontCssProvider)
+{
+gtk_style_context_remove_provider(pWidgetContext, 
GTK_STYLE_PROVIDER(m_pFontCssProvider));
+m_pFontCssProvider = nullptr;
+}
+
+m_xFont.reset();
+
+if (!pFont)
+return;
+
+m_xFont.reset(new vcl::Font(*pFont));
+m_pFontCssProvider = gtk_css_provider_new();
+OUString aBuffer = rCSSSelector + OUString::Concat(" { ") + 
vcl_font_to_css(*pFont) + OUString::Concat(" }");
+OString aResult = OUStringToOString(aBuffer, RTL_TEXTENCODING_UTF8);
+css_provider_load_from_data(m_pFontCssProvider, aResult.getStr(), 
aResult.getLength());
+gtk_style_context_add_provider(pWidgetContext, 
GTK_STYLE_PROVIDER(m_pFontCssProvider),
+   
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
+const vcl::Font* get_custom_font() const
+{
+return m_xFont.get();
+}
+
+~WidgetFont()
+{
+if (m_pFontCssProvider)
+use_custom_font(nullptr, u"");
+assert(!m_pFontCssProvider);
+}
+};
+
 class GtkInstanceButton : public GtkInstanceWidget, public virtual weld::Button
 {
 private:
@@ -11829,7 +11878,7 @@ protected:
 GtkEditable* m_pEditable;
 GtkWidget* m_pDelegate;
 private:
-std::unique_ptr m_xFont;
+WidgetFont m_aCustomFont;
 gulong m_nChangedSignalId;
 gulong m_nInsertTextSignalId;
 gulong m_nCursorPosSignalId;
@@ -11925,6 +11974,7 @@ public:
 #else
 , m_pDelegate(pWidget)
 #endif
+, m_aCustomFont(m_pWidget)
 , m_nChangedSignalId(g_signal_connect(m_pEditable, "changed", 
G_CALLBACK(signalChanged), this))
 , m_nInsertTextSignalId(g_signal_connect(m_pEditable, "insert-text", 
G_CALLBACK(signalInsertText), this))
 , m_nCursorPosSignalId(g_signal_connect(m_pEditable, 
"notify::cursor-position", G_CALLBACK(signalCursorPosition), this))
@@ -12085,18 +12135,13 @@ public:
 
 virtual void set_font(const vcl::Font& rFont) override
 {
-m_xFont.reset(new vcl::Font(rFont));
-PangoAttrList* pOrigList = get_attributes();
-PangoAttrList* pAttrList = pOrigList ? pango_attr_list_copy(pOrigList) 
: pango_attr_list_new();
-update_attr_list(pAttrList, rFont);
-set_attributes(pAttrList);
-pango_attr_list_unref(pAttrList);
+m_aCustomFont.use_custom_font(, u"entry");
 }
 
 virtual vcl::Font get_font() override
 {
-if (m_xFont)
-return *m_xFont;
+if (const vcl::Font* pFont = m_aCustomFont.get_custom_font())
+return *pFont;
 return GtkInstanceWidget::get_font();
 }
 
@@ -16140,8 +16185,7 @@ private:
 GtkTextBuffer* m_pTextBuffer;
 GtkAdjustment* m_pVAdjustment;
 GtkCssProvider* m_pFgCssProvider;
-GtkCssProvider* m_pFontCssProvider;
-std::optional m_xFont;
+WidgetFont m_aCustomFont;
 int m_nMaxTextLength;
 gulong m_nChangedSignalId; // we don't disable/enable this one, it's to 
implement max-length
 gulong m_nInsertTextSignalId;
@@ -16233,7 +16277,7 @@ public:
 , m_pTextBuffer(gtk_text_view_get_buffer(pTextView))
 , 
m_pVAdjustment(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(pTextView)))
 , 

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

2021-10-07 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkdata.cxx |   49 ---
 vcl/unx/gtk3/gtkinst.cxx |   14 +++--
 2 files changed, 38 insertions(+), 25 deletions(-)

New commits:
commit 4c8916fce009a1aee0e644fa62150a9279202a53
Author: Caolán McNamara 
AuthorDate: Wed Jun 16 15:20:58 2021 +0100
Commit: Michael Stahl 
CommitDate: Thu Oct 7 13:23:37 2021 +0200

Related: tdf#141633 allow "small-button" elements to shrink further

so they can go smaller to fit small zoom sizes for the table control

Change-Id: I6df47ed57a511e3b00d10075dedfdd9f1edcc477
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123136
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 10ec02f6fe4cd2c29021b967c255ace3f71424b5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123145
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx
index 63ed47d6c8c3..86ea3a430875 100644
--- a/vcl/unx/gtk3/gtkdata.cxx
+++ b/vcl/unx/gtk3/gtkdata.cxx
@@ -417,30 +417,41 @@ bool GtkSalData::Yield( bool bWait, bool 
bHandleAllCurrentEvents )
 return bWasEvent;
 }
 
-static GtkStyleProvider* CreateSmallButtonProvider()
+static GtkStyleProvider* CreateStyleProvider()
 {
 /*
-   set a provider to allow certain widgets to have no padding
+   set a provider to:
 
-   a) little close button in menubar to close back to start-center
-   b) and small buttons in view->data sources (button.small-button)
-   c) small toolbar button in infobars (toolbar.small-button button)
-   d) comboboxes in the data browser for tdf#137695 (box#combobox 
button.small-button,
+   1) allow certain widgets to have no padding
+
+   1.a) little close button in menubar to close back to start-center
+   1.b) and small buttons in view->data sources (button.small-button)
+   1.c.1) gtk3 small toolbar button in infobars (toolbar.small-button 
button)
+   1.c.2) gtk4 small toolbar button in infobars (box.small-button button)
+   1.d) comboboxes in the data browser for tdf#137695 (box#combobox 
button.small-button,
   which would instead be combobox button.small-button if we didn't 
replace GtkComboBox,
   see GtkInstanceComboBox for an explanation for why we do that)
-   e) entry in the data browser for tdf#137695 (entry.small-button)
+   1.e) entry in the data browser for tdf#137695 (entry.small-button)
+
+   2) hide the unwanted active tab in an 'overflow' notebook of 
double-decker notebooks.
+  (tdf#122623) it's nigh impossible to have a GtkNotebook without an 
active (checked) tab,
+  so theme the unwanted tab into invisibility
 */
-GtkCssProvider* pSmallButtonProvider = gtk_css_provider_new();
+GtkCssProvider* pStyleProvider = gtk_css_provider_new();
 static const gchar data[] =
-  "button.small-button, toolbar.small-button button, combobox.small-button 
*.combo, box#combobox.small-button *.combo, entry.small-button { "
-  "padding: 0;"
-  "margin-left: 0px;"
-  "margin-right: 0px;"
-  "min-height: 18px;"
-  "min-width: 18px;"
-  "}";
-css_provider_load_from_data(pSmallButtonProvider, data, -1);
-return GTK_STYLE_PROVIDER(pSmallButtonProvider);
+  "button.small-button, toolbar.small-button button, box.small-button 
button, "
+  "combobox.small-button *.combo, box#combobox.small-button *.combo, 
entry.small-button { "
+  "padding: 0; margin-left: 0; margin-right: 0; margin-top: 0; 
margin-bottom: 0;"
+  "border-width: 0; min-height: 0; min-width: 0; }"
+  "notebook.overflow > header.top > tabs > tab:checked { "
+  "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; }";
+css_provider_load_from_data(pStyleProvider, data, -1);
+return GTK_STYLE_PROVIDER(pStyleProvider);
 }
 
 void GtkSalData::Init()
@@ -543,7 +554,7 @@ void GtkSalData::Init()
 GListModel *pMonitors = gdk_display_get_monitors(pGdkDisp);
 g_signal_connect(pMonitors, "items-changed", 
G_CALLBACK(signalMonitorsChanged), pDisplay);
 
-gtk_style_context_add_provider_for_display(pGdkDisp, 
CreateSmallButtonProvider(),
+gtk_style_context_add_provider_for_display(pGdkDisp, CreateStyleProvider(),
 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 #else
 int nScreens = gdk_display_get_n_screens( pGdkDisp );
@@ -561,7 +572,7 @@ void GtkSalData::Init()
 g_signal_connect( G_OBJECT(pScreen), "monitors-changed",
   G_CALLBACK(signalMonitorsChanged), pDisplay );
 
-gtk_style_context_add_provider_for_screen(pScreen, 
CreateSmallButtonProvider(),
+

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

2021-09-24 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   28 
 1 file changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 7f1ded9d814f6558ae9b2e6e85063c355950200e
Author: Caolán McNamara 
AuthorDate: Thu Sep 23 09:32:03 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Sep 24 11:33:04 2021 +0200

Related: tdf#142704 ReadStringHook may not be set in testing configurations

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 53ab57ae32dd..38205154be22 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21396,14 +21396,17 @@ private:
 }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
-// tdf#142704 %PRODUCTNAME shown in extended tips
-AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
-const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
-if (pDesc && pDesc[0])
+if (m_pStringReplace)
 {
-OUString aDesc(pDesc, strlen(pDesc), RTL_TEXTENCODING_UTF8);
-aDesc = (*m_pStringReplace)(aDesc);
-atk_object_set_description(pAtkObject, OUStringToOString(aDesc, 
RTL_TEXTENCODING_UTF8).getStr());
+// tdf#142704 %PRODUCTNAME shown in extended tips
+AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
+const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
+if (pDesc && pDesc[0])
+{
+OUString aDesc(pDesc, strlen(pDesc), RTL_TEXTENCODING_UTF8);
+aDesc = (*m_pStringReplace)(aDesc);
+atk_object_set_description(pAtkObject, 
OUStringToOString(aDesc, RTL_TEXTENCODING_UTF8).getStr());
+}
 }
 #endif
 
@@ -21411,7 +21414,7 @@ private:
 if (GTK_IS_BUTTON(pWidget))
 {
 GtkButton* pButton = GTK_BUTTON(pWidget);
-if (m_pStringReplace != nullptr)
+if (m_pStringReplace)
 {
 OUString aLabel(get_label(pButton));
 if (!aLabel.isEmpty())
@@ -21424,7 +21427,7 @@ private:
 else if (GTK_IS_CHECK_BUTTON(pWidget))
 {
 GtkCheckButton* pButton = GTK_CHECK_BUTTON(pWidget);
-if (m_pStringReplace != nullptr)
+if (m_pStringReplace)
 {
 OUString aLabel(get_label(pButton));
 if (!aLabel.isEmpty())
@@ -21437,7 +21440,7 @@ private:
 else if (GTK_IS_LABEL(pWidget))
 {
 GtkLabel* pLabel = GTK_LABEL(pWidget);
-if (m_pStringReplace != nullptr)
+if (m_pStringReplace)
 {
 OUString aLabel(get_label(pLabel));
 if (!aLabel.isEmpty())
@@ -21449,7 +21452,7 @@ private:
 else if (GTK_IS_TEXT_VIEW(pWidget))
 {
 GtkTextView* pTextView = GTK_TEXT_VIEW(pWidget);
-if (m_pStringReplace != nullptr)
+if (m_pStringReplace)
 {
 GtkTextBuffer* pBuffer = gtk_text_view_get_buffer(pTextView);
 GtkTextIter start, end;
@@ -21467,7 +21470,8 @@ private:
 }
 else if (GTK_IS_WINDOW(pWidget))
 {
-if (m_pStringReplace != nullptr) {
+if (m_pStringReplace)
+{
 GtkWindow* pWindow = GTK_WINDOW(pWidget);
 set_title(pWindow, (*m_pStringReplace)(get_title(pWindow)));
 if (GTK_IS_MESSAGE_DIALOG(pWindow))


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

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

New commits:
commit e163000fdb525b93d639aa9886365745439b2132
Author: Caolán McNamara 
AuthorDate: Wed Sep 22 16:26:00 2021 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Sep 23 05:26:03 2021 +0200

Resolves: tdf#142704 %PRODUCTNAME shown in gtk3 extended tips

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 7034386c35f3..53ab57ae32dd 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21395,6 +21395,18 @@ private:
 gtk_widget_hide(pWidget);
 }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+// tdf#142704 %PRODUCTNAME shown in extended tips
+AtkObject* pAtkObject = gtk_widget_get_accessible(pWidget);
+const char* pDesc = pAtkObject ? 
atk_object_get_description(pAtkObject) : nullptr;
+if (pDesc && pDesc[0])
+{
+OUString aDesc(pDesc, strlen(pDesc), RTL_TEXTENCODING_UTF8);
+aDesc = (*m_pStringReplace)(aDesc);
+atk_object_set_description(pAtkObject, OUStringToOString(aDesc, 
RTL_TEXTENCODING_UTF8).getStr());
+}
+#endif
+
 // expand placeholder and collect potentially missing mnemonics
 if (GTK_IS_BUTTON(pWidget))
 {


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

2021-09-02 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 132603eb108a4e028ec0f41ada6defe777079ded
Author: Caolán McNamara 
AuthorDate: Wed Sep 1 10:33:09 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Sep 2 16:45:37 2021 +0200

tdf#138519 use gtk_adjustment_set_value instead of gtk_spin_button_set_value

for FormattedSpinButton because the latter doesn't change the value if
the new value is less than an EPSILON diff of 1e-10 from the old value

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 4a6001146f8b..c4a516ca5d41 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -15828,7 +15828,10 @@ public:
 return;
 m_bSyncingValue = true;
 disable_notify_events();
-gtk_spin_button_set_value(m_pButton, m_pFormatter->GetValue());
+// tdf#138519 use gtk_adjustment_set_value instead of 
gtk_spin_button_set_value because the
+// latter doesn't change the value if the new value is less than an 
EPSILON diff of 1e-10
+// from the old value
+gtk_adjustment_set_value(gtk_spin_button_get_adjustment(m_pButton), 
m_pFormatter->GetValue());
 enable_notify_events();
 m_bSyncingValue = false;
 }


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

2021-08-26 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |   23 +--
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx |2 ++
 2 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit f07d6e060df1c52e6a9a6c89c028a842d5c97be1
Author: Caolán McNamara 
AuthorDate: Thu Aug 26 10:03:09 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 26 14:48:07 2021 +0200

Resolves: tdf#144084 if not initialized default to FILEOPEN_SIMPLE

which is a problem since...

commit 43335776cfc18cdc7addf33250cffc886d384186
Author: Caolán McNamara 
Date:   Tue May 11 17:21:47 2021 +0100

gtk[3|4] don't create File Dialog with buttons that need to be removed

just create it without the offending buttons in the first place

where we create without buttons because its hard, especially since gtk4,
to remove unwanted buttons.

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

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 2b5081463403..a318a115f575 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -89,6 +89,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< 
uno::XComponentContext
 mnHID_SelectionChange( 0 ),
 bVersionWidthUnset( false ),
 mbPreviewState( false ),
+mbInitialized(false),
 mHID_Preview( 0 ),
 m_pPreview( nullptr ),
 m_pPseudoFilter( nullptr )
@@ -899,6 +900,13 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
 {
 SolarMutexGuard g;
 
+if (!mbInitialized)
+{
+// tdf#144084 if not initialized default to FILEOPEN_SIMPLE
+impl_initialize(nullptr, FILEOPEN_SIMPLE);
+assert(mbInitialized);
+}
+
 OSL_ASSERT( m_pDialog != nullptr );
 
 sal_Int16 retVal = 0;
@@ -1610,6 +1618,8 @@ void SAL_CALL SalGtkFilePicker::initialize( const 
uno::Sequence& aArgu
 sal_Int16 templateId = -1;
 aAny >>= templateId;
 
+GtkWidget* pParentWidget = nullptr;
+
 css::uno::Reference xParentWindow;
 if (aArguments.getLength() > 1)
 {
@@ -1619,7 +1629,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const 
uno::Sequence& aArgu
 if (xParentWindow.is())
 {
 if (SalGtkXWindow* pGtkXWindow = 
dynamic_cast(xParentWindow.get()))
-m_pParentWidget = pGtkXWindow->getGtkWidget();
+pParentWidget = pGtkXWindow->getGtkWidget();
 else
 {
 css::uno::Reference 
xSysDepWin(xParentWindow, css::uno::UNO_QUERY);
@@ -1630,11 +1640,18 @@ void SAL_CALL SalGtkFilePicker::initialize( const 
uno::Sequence& aArgu
 aAny = xSysDepWin->getWindowHandle(aProcessIdent, 
css::lang::SystemDependent::SYSTEM_XWINDOW);
 css::awt::SystemDependentXWindow tmp;
 aAny >>= tmp;
-m_pParentWidget = 
GetGtkSalData()->GetGtkDisplay()->findGtkWidgetForNativeHandle(tmp.WindowHandle);
+pParentWidget = 
GetGtkSalData()->GetGtkDisplay()->findGtkWidgetForNativeHandle(tmp.WindowHandle);
 }
 }
 }
 
+impl_initialize(pParentWidget, templateId);
+}
+
+void SalGtkFilePicker::impl_initialize(GtkWidget* pParentWidget, sal_Int16 
templateId)
+{
+m_pParentWidget = pParentWidget;
+
 GtkFileChooserAction eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
 OString sOpen = getOpenText();
 OString sSave = getSaveText();
@@ -1781,6 +1798,8 @@ void SAL_CALL SalGtkFilePicker::initialize( const 
uno::Sequence& aArgu
 gtk_widget_show( m_pHBoxs[ nTVIndex ] );
 }
 }
+
+mbInitialized = true;
 }
 
 void SalGtkFilePicker::preview_toggled_cb( GObject *cb, SalGtkFilePicker* 
pobjFP )
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
index 5797a7a04e19..1c072c83c1a9 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.hxx
@@ -142,6 +142,7 @@ class SalGtkFilePicker : public SalGtkPicker, public 
SalGtkFilePicker_Base
 void impl_fileSelectionChanged( const 
css::ui::dialogs::FilePickerEvent& aEvent );
 void impl_directoryChanged( const css::ui::dialogs::FilePickerEvent& 
aEvent );
 void impl_controlStateChanged( const 
css::ui::dialogs::FilePickerEvent& aEvent );
+void impl_initialize(GtkWidget* pParentWidget, sal_Int16 templateId);
 
 private:
 css::uno::Reference< css::ui::dialogs::XFilePickerListener >
@@ -196,6 +197,7 @@ class SalGtkFilePicker : public SalGtkPicker, public 
SalGtkFilePicker_Base
 
 bool bVersionWidthUnset;
 bool mbPreviewState;
+bool mbInitialized;
 gulong mHID_Preview;
 GtkWidget* m_pPreview;
 GtkFileFilter* m_pPseudoFilter;


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

2021-06-30 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

New commits:
commit a75915366490a562afeacb7fc1475d9fe874ee86
Author: Caolán McNamara 
AuthorDate: Tue Jun 29 17:14:13 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 30 10:10:15 2021 +0200

gtk[3|4] AnyInput wasn't doing anything useful under wayland

which is going to be the case for all backends under gtk4

at least detect if there is evidence that the VCL_INPUT_ANY
condition is true to curtail the idle spellchecking (etc)
writer loop in favor of user interaction

Change-Id: Id1cefd720a921e3a0d1d403769c544c15c6360e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118126
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 0f340ed4e814b445dbdd37b154015585769df589)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118102

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 65427f880bed..4a6001146f8b 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -438,17 +438,37 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 
 static constexpr VclInputFlags ANY_INPUT_EXCLUDING_TIMER = VCL_INPUT_ANY & 
~VclInputFlags::TIMER;
 
+const bool bCheckForAnyInput = nType == ANY_INPUT_EXCLUDING_TIMER;
+
+bool bRet = false;
+
+#if defined(GDK_WINDOWING_WAYLAND)
+if (bCheckForAnyInput)
+{
+GdkDisplay* pDisplay = gdk_display_get_default();
+if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay))
+{
+wl_display* pWLDisplay = 
gdk_wayland_display_get_wl_display(pDisplay);
+static auto wayland_display_get_fd = reinterpret_cast(dlsym(nullptr, "wl_display_get_fd"));
+if (wayland_display_get_fd)
+{
+GPollFD aPollFD;
+aPollFD.fd = wayland_display_get_fd(pWLDisplay);
+aPollFD.events = G_IO_IN | G_IO_ERR | G_IO_HUP;
+bRet = g_poll(, 1, 0) > 0;
+}
+}
+}
+#endif
+
 #if !GTK_CHECK_VERSION(4, 0, 0)
 GdkDisplay* pDisplay = gdk_display_get_default();
 if (!gdk_display_has_pending(pDisplay))
-return false;
-#endif
+return bRet;
 
-if (nType == ANY_INPUT_EXCLUDING_TIMER)
+if (bCheckForAnyInput)
 return true;
 
-bool bRet = false;
-#if !GTK_CHECK_VERSION(4, 0, 0)
 std::deque aEvents;
 GdkEvent *pEvent = nullptr;
 while ((pEvent = gdk_display_get_event(pDisplay)))
@@ -469,6 +489,7 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 aEvents.pop_front();
 }
 #endif
+
 return bRet;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-29 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 8bb24cf81ba59537e58ebb1c6049ba2fa54be7b2
Author: Caolán McNamara 
AuthorDate: Tue Jun 29 16:41:38 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 29 21:33:45 2021 +0200

gtk3: match VCL_INPUT_ANY with or without TIMER if there's pending gdk 
events

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index a58fd1a295a4..65427f880bed 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -433,13 +433,18 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 if( (nType & VclInputFlags::TIMER) && IsTimerExpired() )
 return true;
 
+// strip timer bits now
+nType = nType & ~VclInputFlags::TIMER;
+
+static constexpr VclInputFlags ANY_INPUT_EXCLUDING_TIMER = VCL_INPUT_ANY & 
~VclInputFlags::TIMER;
+
 #if !GTK_CHECK_VERSION(4, 0, 0)
 GdkDisplay* pDisplay = gdk_display_get_default();
 if (!gdk_display_has_pending(pDisplay))
 return false;
 #endif
 
-if (nType == VCL_INPUT_ANY)
+if (nType == ANY_INPUT_EXCLUDING_TIMER)
 return true;
 
 bool bRet = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

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

New commits:
commit 5f9997202c5fc8db3912ccdf852c77a7f27f5a8b
Author: Caolán McNamara 
AuthorDate: Mon Jun 28 15:15:05 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 29 20:20:27 2021 +0200

gdk_events_pending->gdk_display_has_pending

the latter at least still exists, if mostly private, in GTK4

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 9c3b67f79bdb..a58fd1a295a4 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -432,8 +432,10 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 EnsureInit();
 if( (nType & VclInputFlags::TIMER) && IsTimerExpired() )
 return true;
+
 #if !GTK_CHECK_VERSION(4, 0, 0)
-if (!gdk_events_pending())
+GdkDisplay* pDisplay = gdk_display_get_default();
+if (!gdk_display_has_pending(pDisplay))
 return false;
 #endif
 
@@ -444,7 +446,7 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 #if !GTK_CHECK_VERSION(4, 0, 0)
 std::deque aEvents;
 GdkEvent *pEvent = nullptr;
-while ((pEvent = gdk_event_get()))
+while ((pEvent = gdk_display_get_event(pDisplay)))
 {
 aEvents.push_back(pEvent);
 VclInputFlags nEventType = categorizeEvent(pEvent);
@@ -457,7 +459,7 @@ bool GtkInstance::AnyInput( VclInputFlags nType )
 while (!aEvents.empty())
 {
 pEvent = aEvents.front();
-gdk_event_put(pEvent);
+gdk_display_put_event(pDisplay, pEvent);
 gdk_event_free(pEvent);
 aEvents.pop_front();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-29 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 1d032975519e1008ea3ab1687b431e255c71d948
Author: Caolán McNamara 
AuthorDate: Tue Jun 29 12:13:19 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 29 15:28:52 2021 +0200

Related: tdf#143088 listen to DefaultWindow for Settings changed

having multiple Application::EventListener are expensive while a
Window::EventListener is cheap and in this document there are thousands
of comments so having thousands of EventListeners is problematic.

under gtk with start center open use gnome-tweaks to toggle in/out of a
dark theme and the branding logo should continue to switch dark/light
variants

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 3c4e3136a0f9..9c3b67f79bdb 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -16475,7 +16475,7 @@ private:
 }
 #endif
 
-DECL_LINK(SettingsChangedHdl, VclSimpleEvent&, void);
+DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void);
 public:
 GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* 
pBuilder, const a11yref& rA11y, bool bTakeOwnership)
 : GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership)
@@ -16501,7 +16501,7 @@ public:
 g_object_set_data(G_OBJECT(m_pDrawingArea), 
"g-lo-GtkInstanceDrawingArea", this);
 m_xDevice->EnableRTL(get_direction());
 
-Application::AddEventListener(LINK(this, GtkInstanceDrawingArea, 
SettingsChangedHdl));
+ImplGetDefaultWindow()->AddEventListener(LINK(this, 
GtkInstanceDrawingArea, SettingsChangedHdl));
 }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
@@ -16680,7 +16680,7 @@ public:
 
 virtual ~GtkInstanceDrawingArea() override
 {
-Application::RemoveEventListener(LINK(this, GtkInstanceDrawingArea, 
SettingsChangedHdl));
+ImplGetDefaultWindow()->RemoveEventListener(LINK(this, 
GtkInstanceDrawingArea, SettingsChangedHdl));
 
 g_object_steal_data(G_OBJECT(m_pDrawingArea), 
"g-lo-GtkInstanceDrawingArea");
 #if !GTK_CHECK_VERSION(4, 0, 0)
@@ -16722,12 +16722,12 @@ public:
 }
 };
 
-IMPL_LINK(GtkInstanceDrawingArea, SettingsChangedHdl, VclSimpleEvent&, rEvent, 
void)
+IMPL_LINK(GtkInstanceDrawingArea, SettingsChangedHdl, VclWindowEvent&, rEvent, 
void)
 {
-if (rEvent.GetId() != VclEventId::ApplicationDataChanged)
+if (rEvent.GetId() != VclEventId::WindowDataChanged)
 return;
 
-DataChangedEvent* pData = 
static_cast(static_cast(rEvent).GetData());
+DataChangedEvent* pData = static_cast(rEvent.GetData());
 if (pData->GetType() == DataChangedEventType::SETTINGS)
 signal_style_updated();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-18 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 4895e825b9fb40c2df272f910a9fe14e545a7c99
Author: Caolán McNamara 
AuthorDate: Fri Jun 18 10:58:13 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 18 15:06:25 2021 +0200

tdf#142924 "toggled" is too late to use to populate changes to the menu

so use "state-flag-changed" on GTK_STATE_FLAG_CHECKED instead which
happens before "toggled"

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index f50d98a5fb05..3c4e3136a0f9 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8912,7 +8912,6 @@ class GtkInstanceToggleButton : public GtkInstanceButton, 
public virtual weld::T
 {
 protected:
 GtkToggleButton* m_pToggleButton;
-private:
 gulong m_nToggledSignalId;
 
 static void signalToggled(GtkToggleButton*, gpointer widget)
@@ -9472,6 +9471,17 @@ private:
 }
 #endif
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+static void signalFlagsChanged(GtkToggleButton* pToggleButton, 
GtkStateFlags flags, gpointer widget)
+{
+bool bOldChecked = flags & GTK_STATE_FLAG_CHECKED;
+bool bNewChecked = 
gtk_widget_get_state_flags(GTK_WIDGET(pToggleButton)) & GTK_STATE_FLAG_CHECKED;
+if (bOldChecked == bNewChecked)
+return;
+signalToggled(pToggleButton, widget);
+}
+#endif
+
 public:
 #if !GTK_CHECK_VERSION(4, 0, 0)
 GtkInstanceMenuButton(GtkMenuButton* pMenuButton, GtkWidget* pMenuAlign, 
GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
@@ -9493,6 +9503,14 @@ public:
 , m_aCustomBackground(GTK_WIDGET(pMenuButton))
 #endif
 {
+#if !GTK_CHECK_VERSION(4, 0, 0)
+// tdf#142924 "toggled" is to late to use to populate changes to the 
menu,
+// so use "state-flag-changed" on GTK_STATE_FLAG_CHECKED instead which
+// happens before "toggled"
+g_signal_handler_disconnect(m_pToggleButton, m_nToggledSignalId);
+m_nToggledSignalId = g_signal_connect(m_pToggleButton, 
"state-flags-changed", G_CALLBACK(signalFlagsChanged), this);
+#endif
+
 #if !GTK_CHECK_VERSION(4, 0, 0)
 m_pLabel = gtk_bin_get_child(GTK_BIN(m_pMenuButton));
 find_image(GTK_WIDGET(m_pMenuButton), _pImage);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

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

New commits:
commit 53f3db2829472d735fa3975c40e105a6ca38c674
Author: Caolán McNamara 
AuthorDate: Fri Jun 18 10:46:22 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 18 14:44:13 2021 +0200

rename signalToggled to signalMenuButtonToggled

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index d1121f048b21..f50d98a5fb05 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -9220,7 +9220,7 @@ private:
 WidgetBackground m_aCustomBackground;
 #endif
 
-static void signalToggled(GtkWidget*, gpointer widget)
+static void signalMenuButtonToggled(GtkWidget*, gpointer widget)
 {
 GtkInstanceMenuButton* pThis = 
static_cast(widget);
 SolarMutexGuard aGuard;
@@ -9852,7 +9852,7 @@ public:
 gtk_window_set_type_hint(m_pMenuHack, 
GDK_WINDOW_TYPE_HINT_COMBO);
 gtk_window_set_modal(m_pMenuHack, true);
 gtk_window_set_resizable(m_pMenuHack, false);
-m_nSignalId = 
g_signal_connect(GTK_TOGGLE_BUTTON(m_pMenuButton), "toggled", 
G_CALLBACK(signalToggled), this);
+m_nSignalId = 
g_signal_connect(GTK_TOGGLE_BUTTON(m_pMenuButton), "toggled", 
G_CALLBACK(signalMenuButtonToggled), this);
 g_signal_connect(m_pMenuHack, "grab-broken-event", 
G_CALLBACK(signalGrabBroken), this);
 g_signal_connect(m_pMenuHack, "button-release-event", 
G_CALLBACK(signalButtonRelease), this);
 g_signal_connect(m_pMenuHack, "key-press-event", 
G_CALLBACK(keyPress), this);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-18 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit c0c5c5c660d3be6ea423b08837a847447e7f78eb
Author: Caolán McNamara 
AuthorDate: Fri Jun 18 10:28:12 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 18 14:43:55 2021 +0200

rename m_nSignalId to m_nToggledSignalId

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 98eea7cadcbe..d1121f048b21 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8913,7 +8913,7 @@ class GtkInstanceToggleButton : public GtkInstanceButton, 
public virtual weld::T
 protected:
 GtkToggleButton* m_pToggleButton;
 private:
-gulong m_nSignalId;
+gulong m_nToggledSignalId;
 
 static void signalToggled(GtkToggleButton*, gpointer widget)
 {
@@ -8925,7 +8925,7 @@ public:
 GtkInstanceToggleButton(GtkToggleButton* pButton, GtkInstanceBuilder* 
pBuilder, bool bTakeOwnership)
 : GtkInstanceButton(GTK_BUTTON(pButton), pBuilder, bTakeOwnership)
 , m_pToggleButton(pButton)
-, m_nSignalId(g_signal_connect(m_pToggleButton, "toggled", 
G_CALLBACK(signalToggled), this))
+, m_nToggledSignalId(g_signal_connect(m_pToggleButton, "toggled", 
G_CALLBACK(signalToggled), this))
 {
 }
 
@@ -8965,19 +8965,19 @@ public:
 
 virtual void disable_notify_events() override
 {
-g_signal_handler_block(m_pToggleButton, m_nSignalId);
+g_signal_handler_block(m_pToggleButton, m_nToggledSignalId);
 GtkInstanceButton::disable_notify_events();
 }
 
 virtual void enable_notify_events() override
 {
 GtkInstanceButton::enable_notify_events();
-g_signal_handler_unblock(m_pToggleButton, m_nSignalId);
+g_signal_handler_unblock(m_pToggleButton, m_nToggledSignalId);
 }
 
 virtual ~GtkInstanceToggleButton() override
 {
-g_signal_handler_disconnect(m_pToggleButton, m_nSignalId);
+g_signal_handler_disconnect(m_pToggleButton, m_nToggledSignalId);
 }
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-17 Thread Gabor Kelemen (via logerrit)
 vcl/unx/generic/app/keysymnames.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 80e813fc9c2134fffbaec37246bff506d14d9cc8
Author: Gabor Kelemen 
AuthorDate: Sat Jun 5 11:32:40 2021 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 17 12:52:48 2021 +0200

tdf#103388 Show the backtick used in shortcut in Calc View menu

as Ctrl+` instead of "Ctrl+grave" (see at View->Show Formula).

This affected only gen backend on Linux (SAL_USE_VCLPLUGIN=gen),
gtk3 and qt5 are handling this correctly.

Change-Id: I2bebcf68118642e6c12cf2c5d4392f2ca423665b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116742
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 3f9fcf0e7f154e49bbffeaea925edb6055add494)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117299
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/vcl/unx/generic/app/keysymnames.cxx 
b/vcl/unx/generic/app/keysymnames.cxx
index c4211be02b16..387792d95984 100644
--- a/vcl/unx/generic/app/keysymnames.cxx
+++ b/vcl/unx/generic/app/keysymnames.cxx
@@ -67,7 +67,8 @@ namespace vcl_sal {
 { XK_Escape, "Esc" },
 { XK_space, "Space" },
 { XK_Page_Up, "PgUp"},
-{ XK_Page_Down, "PgDn"}
+{ XK_Page_Down, "PgDn"},
+{ XK_grave, "`"}
 };
 
 const struct KeysymNameReplacement aImplReplacements_Turkish[] =
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits