libreofficekit/source/gtk/lokdocview.cxx | 48 +++++++++++++++++++++++++++++-- sfx2/source/menu/mnumgr.cxx | 6 +-- 2 files changed, 48 insertions(+), 6 deletions(-)
New commits: commit 7e4711e642f6b085698a0d2912b0381cb7a2c9c3 Author: Pranav Kant <pran...@collabora.com> Date: Tue May 24 16:52:27 2016 +0530 lok context menu: Remove disabled items (set enabled to false) Change-Id: I18a95cc53f9e79eab257baa4d7b23853cb05e039 diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 715f9a6..bc6e473 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -478,6 +478,8 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram pSVMenu = static_cast<PopupMenu*>( pMenu ); } + SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() ); + aPop.RemoveDisabledEntries(); if (comphelper::LibreOfficeKit::isActive()) { boost::property_tree::ptree aMenu = fillPopupMenu(pSVMenu); @@ -490,11 +492,7 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram objSh->libreOfficeKitCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str()); } else - { - SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() ); - aPop.RemoveDisabledEntries(); aPop.Execute( rPoint, pWindow ); - } // #i112646 avoid crash when context menu is closed. // the (manually inserted) sub-menu needs to be destroyed before commit 532ce3bc3cdbb4d6b656c684497e1f23a275514c Author: Pranav Kant <pran...@collabora.com> Date: Tue May 24 14:04:54 2016 +0530 lok context menu: Expose context menu (cherry-picked from 610db8d5d0500aed2ca6d4da822cf70746b44d49) Earlier cherry-pick (6be044e919d28b93332f04bdc18f6def2925b098) left out some code important to the working of lokdocview. Change-Id: I6422c28e880f9e04f4fad88e5202e46c4de2650d diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 242bfa7..ea94237 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -966,6 +966,8 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType) return "LOK_CALLBACK_SET_PART"; case LOK_CALLBACK_ERROR: return "LOK_CALLBACK_ERROR"; + case LOK_CALLBACK_CONTEXT_MENU: + return "LOK_CALLBACK_CONTEXT_MENU"; } return 0; } @@ -1087,6 +1089,11 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) reportError(pCallback->m_aPayload); } break; + case LOK_CALLBACK_CONTEXT_MENU: + { + // TODO: Implement me + } + break; default: g_assert(false); break; commit 1cc66ffa57dc3b65c7a1a43e99a0cad7007b0474 Author: Mihai Varga <mihai.va...@collabora.com> Date: Tue May 24 13:57:26 2016 +0530 LOK: added the button type and key modifier to postMouseEvent() To get a better functionality we need to know the button type (left, right, middle). We also need the key modifier (ctrl, alt, shift) for actions such as ctrl+click (to open a link) or shift+click to select (cherry picked from commit c90c08a65c480a1012182979d5e9218f17a2ba2e) Button type was not cherry-picked earlier in 527a83d77c139427028ad08bef3a6349135716f7 Change-Id: If05326b1d7c82f14808bd2c15f552508b97bc7c1 diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index cdc7e801..242bfa7 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -460,19 +460,45 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent) case GDK_BUTTON_PRESS: { int nCount = 1; + int nButtons = MOUSE_LEFT; + switch(pEvent->button) { + case 1: + nButtons = MOUSE_LEFT; + break; + case 2: + nButtons = MOUSE_MIDDLE; + break; + case 3: + nButtons = MOUSE_RIGHT; + break; + } + if ((pEvent->time - m_nLastButtonPressTime) < 250) nCount++; m_nLastButtonPressTime = pEvent->time; - m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, MOUSE_LEFT, 0); + m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, nButtons, 0); break; } case GDK_BUTTON_RELEASE: { int nCount = 1; + int nButtons = MOUSE_LEFT; + switch(pEvent->button) { + case 1: + nButtons = MOUSE_LEFT; + break; + case 2: + nButtons = MOUSE_MIDDLE; + break; + case 3: + nButtons = MOUSE_RIGHT; + break; + } + if ((pEvent->time - m_nLastButtonReleaseTime) < 250) nCount++; m_nLastButtonReleaseTime = pEvent->time; - m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, MOUSE_LEFT, 0); + m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, nButtons, 0); break; } default: commit 1151ec8b519be960ca6975accac9be1f6e7959dc Author: Andrzej Hunt <andr...@ahunt.org> Date: Tue Nov 10 11:40:41 2015 +0100 lokdocview: support LOK_CALLBACK_MOUSE_POINTER Change-Id: I2052e39fa2e25988a40f293389d5a183a625acd4 Reviewed-on: https://gerrit.libreoffice.org/19903 Reviewed-by: Andrzej Hunt <andr...@ahunt.org> Tested-by: Andrzej Hunt <andr...@ahunt.org> diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index b5017b0..cdc7e801 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -920,6 +920,8 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType) return "LOK_CALLBACK_CURSOR_VISIBLE"; case LOK_CALLBACK_GRAPHIC_SELECTION: return "LOK_CALLBACK_GRAPHIC_SELECTION"; + case LOK_CALLBACK_MOUSE_POINTER: + return "LOK_CALLBACK_MOUSE_POINTER"; case LOK_CALLBACK_HYPERLINK_CLICKED: return "LOK_CALLBACK_HYPERLINK_CLICKED"; case LOK_CALLBACK_STATE_CHANGED: @@ -1008,6 +1010,15 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback) m_bCursorVisible = pCallback->m_aPayload == "true"; } break; + case LOK_CALLBACK_MOUSE_POINTER: + { + // The gtk docs claim that most css cursors should be supported, however + // on my system at least this is not true and many cursors are unsupported. + // In this case pCursor = null, which results in the default cursor being set. + GdkCursor* pCursor = gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pCallback->m_pDocView)), pCallback->m_aPayload.c_str()); + gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pCallback->m_pDocView)), pCursor); + } + break; case LOK_CALLBACK_GRAPHIC_SELECTION: { if (pCallback->m_aPayload != "EMPTY") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits