gtktiledviewer: use setView() before postKeyEvent()
Also in SfxLokHelper::setView() set the current view shell directly, GetFocus() in VCL may be a NOP for hidden windows. With this, the Writer layout dump shows that two Gtk windows can have different cursor positions correctly. Change-Id: I81890c1d8ad7972f1194db3d5f2e9d8a39fc2f87
This commit is contained in:
@@ -106,6 +106,9 @@ struct _LOKDocViewPrivate
|
|||||||
/// If we are in the middle of a drag of a graphic selection handle.
|
/// If we are in the middle of a drag of a graphic selection handle.
|
||||||
gboolean m_bInDragGraphicHandles[8];
|
gboolean m_bInDragGraphicHandles[8];
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
/// View ID, returned by createView() or 0 by default.
|
||||||
|
int m_nViewId;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -240,6 +243,7 @@ postKeyEventInThread(gpointer data)
|
|||||||
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
|
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
|
||||||
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
|
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
|
||||||
|
|
||||||
|
priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
|
||||||
priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument,
|
priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument,
|
||||||
pLOEvent->m_nKeyEvent,
|
pLOEvent->m_nKeyEvent,
|
||||||
pLOEvent->m_nCharCode,
|
pLOEvent->m_nCharCode,
|
||||||
@@ -1847,18 +1851,19 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
|
|||||||
return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL));
|
return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView)
|
SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView)
|
||||||
{
|
{
|
||||||
LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pLOKDocView));
|
LOKDocViewPrivate* pOldPriv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pOldLOKDocView));
|
||||||
GtkWidget* pDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
|
GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
|
||||||
"lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL));
|
"lopath", pOldPriv->m_aLOPath, "lopointer", pOldPriv->m_pOffice, "docpointer", pOldPriv->m_pDocument, NULL));
|
||||||
|
|
||||||
// No documentLoad(), just a createView().
|
// No documentLoad(), just a createView().
|
||||||
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView));
|
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView));
|
||||||
pDocument->pClass->createView(pDocument);
|
LOKDocViewPrivate* pNewPriv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(LOK_DOC_VIEW(pNewDocView)));
|
||||||
|
pNewPriv->m_nViewId = pDocument->pClass->createView(pDocument);
|
||||||
|
|
||||||
postDocumentLoad(pDocView);
|
postDocumentLoad(pNewDocView);
|
||||||
return pDocView;
|
return pNewDocView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -46,7 +46,7 @@ void SfxLokHelper::setView(size_t nId)
|
|||||||
|
|
||||||
SfxViewShell* pViewShell = rViewArr[nId];
|
SfxViewShell* pViewShell = rViewArr[nId];
|
||||||
if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame())
|
if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame())
|
||||||
pViewFrame->GetWindow().GrabFocus();
|
pViewFrame->MakeActive_Impl(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SfxLokHelper::getView()
|
size_t SfxLokHelper::getView()
|
||||||
|
Reference in New Issue
Block a user