You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
5.1 KiB
125 lines
5.1 KiB
6 years ago
|
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
|
||
|
|