desktop/source/lib/init.cxx              |   21 ++++++++-------------
 libreofficekit/source/gtk/lokdocview.cxx |    2 +-
 2 files changed, 9 insertions(+), 14 deletions(-)

New commits:
commit 6e9598fee2737ca580dbd2b26b99d8ad30cf924a
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jul 23 20:38:39 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jul 25 17:25:06 2025 +0200

    alt key in gtktiledviewer becomes "stuck" on once seen
    
    Do the same as is done for the ctrl key and just pass on the
    current state, otherwise alt-tab between windows makes it
    look like the keys don't get sent to the expected place.
    
    Change-Id: I9d895373ce05fcb144867a1d387f993c269ac204
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188348
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index fdae962f26a6..f9b4d617dc99 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -730,7 +730,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
     if (pEvent->state & GDK_CONTROL_MASK)
         nKeyCode |= KEY_MOD1;
 
-    if (priv->m_nKeyModifier & KEY_MOD2)
+    if (pEvent->state & GDK_MOD1_MASK)
         nKeyCode |= KEY_MOD2;
 
     if (nKeyCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)) {
commit cee725cee3a8128ab91d1b27555924dd72769c8f
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jul 23 20:35:45 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jul 25 17:24:56 2025 +0200

    use SfxLokHelper::getViewId to get current view of this document
    
    which avoid two sets of callbacks intended for two different documents
    getting registered on the same view and trampling on eachother.
    
    invalidation events now go to the correct place and typing updates
    as expected.
    
    Change-Id: I36a630997b917efcd9f436522013f22d6a957023
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188347
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9b58c752bbfb..3b160fae098d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4671,10 +4671,11 @@ static void 
doc_registerCallback(LibreOfficeKitDocument* pThis,
     SetLastExceptionMsg();
 
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-
-    const int nView = SfxLokHelper::getCurrentView();
-    if (nView < 0)
+    const int nView = SfxLokHelper::getViewId(pDocument->mnDocumentId);
+    SfxViewShell* pViewShell = SfxLokHelper::getViewOfId(nView);
+    if (!pViewShell)
         return;
+    assert(nView == pViewShell->GetViewShellId().get() && "otherwise we 
couldn't have found it");
 
     const size_t nId = nView;
     if (pCallback != nullptr)
@@ -4711,11 +4712,8 @@ static void doc_registerCallback(LibreOfficeKitDocument* 
pThis,
             
pDocument->mpCallbackFlushHandlers[nView]->addViewStates(pair.first);
         }
 
-        if (SfxViewShell* pViewShell = SfxViewShell::Current())
-        {
-            
pDocument->mpCallbackFlushHandlers[nView]->setViewId(pViewShell->GetViewShellId().get());
-            
pViewShell->setLibreOfficeKitViewCallback(pDocument->mpCallbackFlushHandlers[nView].get());
-        }
+        pDocument->mpCallbackFlushHandlers[nView]->setViewId(nView);
+        
pViewShell->setLibreOfficeKitViewCallback(pDocument->mpCallbackFlushHandlers[nView].get());
 
         if (!pDocument->maFontsMissing.empty())
         {
@@ -4748,11 +4746,8 @@ static void doc_registerCallback(LibreOfficeKitDocument* 
pThis,
     }
     else
     {
-        if (SfxViewShell* pViewShell = SfxViewShell::Current())
-        {
-            pViewShell->setLibreOfficeKitViewCallback(nullptr);
-            pDocument->mpCallbackFlushHandlers[nView]->setViewId(-1);
-        }
+        pViewShell->setLibreOfficeKitViewCallback(nullptr);
+        pDocument->mpCallbackFlushHandlers[nView]->setViewId(-1);
     }
 }
 

Reply via email to