[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - desktop/source include/LibreOfficeKit libreofficekit/qa

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 12 04:19:49 PST 2015


 desktop/source/lib/init.cxx                         |    9 +++++++--
 include/LibreOfficeKit/LibreOfficeKit.h             |    9 +++++++++
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |    4 ++--
 3 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit f20003a7eff5c66d88d546588364bf4c83338bb4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 12 13:18:47 2015 +0100

    LOK: add LibreOfficeKitKeyEventType enumeration
    
    Change-Id: I3d422670323cd982251569c4226dc46803d4f6a1

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c3eedf5..14c1860 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -657,10 +657,15 @@ static void lo_postKeyEvent(LibreOfficeKit* /*pThis*/, int nType, int nCode)
     if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame())
     {
         KeyEvent aEvent(nCode, nCode, 0);
-        if (nType == 0)
+        switch (nType)
+        {
+        case LOK_KEYEVENT_KEYINPUT:
             Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
-        else
+            break;
+        case LOK_KEYEVENT_KEYUP:
             Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
+            break;
+        }
     }
 #endif
 }
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index d4c1f99..c5909ef 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -64,6 +64,15 @@ typedef enum
 }
 LibreOfficeKitCallbackType;
 
+typedef enum
+{
+    /// A key on the keyboard is pressed.
+    LOK_KEYEVENT_KEYINPUT,
+    /// A key on the keyboard is released.
+    LOK_KEYEVENT_KEYUP
+}
+LibreOfficeKitKeyEventType;
+
 typedef void (*LibreOfficeKitCallback)(int nType, const char* pPayload, void* pData);
 #endif // LOK_USE_UNSTABLE_API
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c4725f2..73be3b9 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -130,9 +130,9 @@ static void signalKey(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer /*pD
     LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView);
 
     if (pEvent->type == GDK_KEY_RELEASE)
-        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, 1, gdk_keyval_to_unicode(pEvent->keyval));
+        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYUP, gdk_keyval_to_unicode(pEvent->keyval));
     else
-        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, 0, gdk_keyval_to_unicode(pEvent->keyval));
+        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYINPUT, gdk_keyval_to_unicode(pEvent->keyval));
 }
 
 // GtkComboBox requires gtk 2.24 or later


More information about the Libreoffice-commits mailing list