Resolves: tdf#122623 theme unwanted tab into invisibilty

f41
Caolán McNamara 6 years ago
parent 374f904470
commit 2d01c68dcc

@ -0,0 +1,54 @@
From 2e0f991f2eb57c0c25f32f759853195f9764a529 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Wed, 16 Jan 2019 12:36:25 +0000
Subject: [PATCH] Resolves: tdf#122623 theme unwanted tab into invisibility
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
its nigh impossible to have a GtkNotebook without an active tab, so
try and theme it into invisibility with no width
Change-Id: I312b81ae51abe9fdd222fb5d5c45cb41603b80cb
Reviewed-on: https://gerrit.libreoffice.org/66471
Tested-by: Jenkins
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
---
vcl/unx/gtk3/gtk3gtkinst.cxx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 4ea6de898734..83794ade2efd 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3153,7 +3153,7 @@ private:
{
disable_notify_events();
- GtkWidget *pTabWidget = gtk_image_new_from_icon_name("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
+ GtkWidget *pTabWidget = gtk_fixed_new();
gtk_buildable_set_name(GTK_BUILDABLE(pTabWidget), "useless");
GtkWidget *pChild = gtk_grid_new();
@@ -3383,6 +3383,16 @@ public:
else
m_nSizeAllocateSignalId = 0;
gtk_notebook_set_show_border(m_pOverFlowNotebook, false);
+
+ // tdf#122623 it's nigh impossible to have a GtkNotebook without an active (checked) tab, so try and theme
+ // the unwanted tab into invisibility
+ GtkStyleContext *pNotebookContext = gtk_widget_get_style_context(GTK_WIDGET(m_pOverFlowNotebook));
+ GtkCssProvider *pProvider = gtk_css_provider_new();
+ static const gchar data[] = "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; }";
+ static const gchar olddata[] = "tab.top:active { 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; }";
+ gtk_css_provider_load_from_data(pProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+ gtk_style_context_add_provider(pNotebookContext, GTK_STYLE_PROVIDER(pProvider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
virtual int get_current_page() const override
--
2.21.0.rc1

@ -0,0 +1,124 @@
From f929a7e9e854ede215a72d3d84ca74cae156e1aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 17 Jan 2019 12:28:55 +0000
Subject: [PATCH] tdf#122393 move to overflow row on using left/right at end of
other row
and on ctrl+page_up/ctrl+page_down
Change-Id: I3320abfb91655b7b4278886cc6fc4dceb637e4b1
Reviewed-on: https://gerrit.libreoffice.org/66527
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
---
vcl/unx/gtk3/gtk3gtkinst.cxx | 59 ++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fe74ae76bdb3..08fc49de25e5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3002,6 +3002,8 @@ private:
gulong m_nSwitchPageSignalId;
gulong m_nOverFlowSwitchPageSignalId;
gulong m_nSizeAllocateSignalId;
+ gulong m_nFocusSignalId;
+ gulong m_nChangeCurrentPageId;
guint m_nLaunchSplitTimeoutId;
bool m_bOverFlowBoxActive;
bool m_bOverFlowBoxIsStart;
@@ -3365,6 +3367,55 @@ private:
pThis->signal_notebook_size_allocate();
}
+ bool signal_focus(GtkDirectionType direction)
+ {
+ if (!m_bOverFlowBoxActive)
+ return false;
+
+ int nPage = gtk_notebook_get_current_page(m_pNotebook);
+ if (direction == GTK_DIR_LEFT && nPage == 0)
+ {
+ auto nOverFlowLen = gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1;
+ gtk_notebook_set_current_page(m_pOverFlowNotebook, nOverFlowLen - 1);
+ return true;
+ }
+ else if (direction == GTK_DIR_RIGHT && nPage == gtk_notebook_get_n_pages(m_pNotebook) - 1)
+ {
+ gtk_notebook_set_current_page(m_pOverFlowNotebook, 0);
+ return true;
+ }
+
+ return false;
+ }
+
+ static gboolean signalFocus(GtkNotebook* notebook, GtkDirectionType direction, gpointer widget)
+ {
+ // if the notebook widget itself has focus
+ if (gtk_widget_is_focus(GTK_WIDGET(notebook)))
+ {
+ GtkInstanceNotebook* pThis = static_cast<GtkInstanceNotebook*>(widget);
+ return pThis->signal_focus(direction);
+ }
+ return false;
+ }
+
+ // ctrl + page_up/ page_down
+ bool signal_change_current_page(gint arg1)
+ {
+ bool bHandled = signal_focus(arg1 < 0 ? GTK_DIR_LEFT : GTK_DIR_RIGHT);
+ if (bHandled)
+ g_signal_stop_emission_by_name(m_pNotebook, "change-current-page");
+ return false;
+ }
+
+ static gboolean signalChangeCurrentPage(GtkNotebook*, gint arg1, gpointer widget)
+ {
+ if (arg1 == 0)
+ return true;
+ GtkInstanceNotebook* pThis = static_cast<GtkInstanceNotebook*>(widget);
+ return pThis->signal_change_current_page(arg1);
+ }
+
public:
GtkInstanceNotebook(GtkNotebook* pNotebook, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pNotebook), bTakeOwnership)
@@ -3373,6 +3424,8 @@ public:
, m_pOverFlowNotebook(GTK_NOTEBOOK(gtk_notebook_new()))
, m_nSwitchPageSignalId(g_signal_connect(pNotebook, "switch-page", G_CALLBACK(signalSwitchPage), this))
, m_nOverFlowSwitchPageSignalId(g_signal_connect(m_pOverFlowNotebook, "switch-page", G_CALLBACK(signalOverFlowSwitchPage), this))
+ , m_nFocusSignalId(g_signal_connect(pNotebook, "focus", G_CALLBACK(signalFocus), this))
+ , m_nChangeCurrentPageId(g_signal_connect(pNotebook, "change-current-page", G_CALLBACK(signalChangeCurrentPage), this))
, m_nLaunchSplitTimeoutId(0)
, m_bOverFlowBoxActive(false)
, m_bOverFlowBoxIsStart(false)
@@ -3508,6 +3561,8 @@ public:
virtual void disable_notify_events() override
{
g_signal_handler_block(m_pNotebook, m_nSwitchPageSignalId);
+ g_signal_handler_block(m_pNotebook, m_nFocusSignalId);
+ g_signal_handler_block(m_pNotebook, m_nChangeCurrentPageId);
g_signal_handler_block(m_pOverFlowNotebook, m_nOverFlowSwitchPageSignalId);
gtk_widget_freeze_child_notify(GTK_WIDGET(m_pOverFlowNotebook));
GtkInstanceContainer::disable_notify_events();
@@ -3519,6 +3574,8 @@ public:
gtk_widget_thaw_child_notify(GTK_WIDGET(m_pOverFlowNotebook));
g_signal_handler_unblock(m_pOverFlowNotebook, m_nOverFlowSwitchPageSignalId);
g_signal_handler_unblock(m_pNotebook, m_nSwitchPageSignalId);
+ g_signal_handler_unblock(m_pNotebook, m_nFocusSignalId);
+ g_signal_handler_unblock(m_pNotebook, m_nChangeCurrentPageId);
}
void reset_split_data()
@@ -3560,6 +3617,8 @@ public:
if (m_nSizeAllocateSignalId)
g_signal_handler_disconnect(m_pNotebook, m_nSizeAllocateSignalId);
g_signal_handler_disconnect(m_pNotebook, m_nSwitchPageSignalId);
+ g_signal_handler_disconnect(m_pNotebook, m_nFocusSignalId);
+ g_signal_handler_disconnect(m_pNotebook, m_nChangeCurrentPageId);
g_signal_handler_disconnect(m_pOverFlowNotebook, m_nOverFlowSwitchPageSignalId);
gtk_widget_destroy(GTK_WIDGET(m_pOverFlowNotebook));
if (m_pOverFlowBox)
--
2.21.0.rc1

@ -54,7 +54,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.3
Release: 1%{?libo_prerelease}%{?dist}
Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
URL: http://www.libreoffice.org/
@ -239,6 +239,8 @@ Patch0: 0001-don-t-suppress-crashes.patch
Patch1: 0001-Resolves-rhbz-1432468-disable-opencl-by-default.patch
# not upstreamed
Patch2: 0001-Upgrade-external-boost-to-Boost-1.69.0.patch
Patch3: 0001-Resolves-tdf-122623-theme-unwanted-tab-into-invisibi.patch
Patch4: 0001-tdf-122393-move-to-overflow-row-on-using-left-right-.patch
%if 0%{?rhel}
# not upstreamed
@ -2119,6 +2121,9 @@ done
%{_includedir}/LibreOfficeKit
%changelog
* Thu Feb 21 2019 Caolán McNamara <caolanm@redhat.com> - 1:6.2.0.3-2
- Resolves: tdf#122623 theme unwanted tab into invisibilty
* Thu Feb 07 2019 Caolán McNamara <caolanm@redhat.com> - 1:6.2.0.3-1
- latest version

Loading…
Cancel
Save