[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - libreofficekit/Executable_gtktiledviewer.mk libreofficekit/qa

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 12 07:51:24 PST 2015


 libreofficekit/Executable_gtktiledviewer.mk         |    2 +
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   23 ++++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit bbd49041a3bd4cfae6e367d395205fc9200d25c6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 12 16:24:37 2015 +0100

    gtktiledviewer: handle more key values
    
    Change-Id: I8af971f659d483c16507c906fa65346a5e0292f1

diff --git a/libreofficekit/Executable_gtktiledviewer.mk b/libreofficekit/Executable_gtktiledviewer.mk
index 153d7a0..882309a 100644
--- a/libreofficekit/Executable_gtktiledviewer.mk
+++ b/libreofficekit/Executable_gtktiledviewer.mk
@@ -14,6 +14,8 @@ $(eval $(call gb_Executable_set_include,gtktiledviewer,\
     -I$(SRCDIR)/desktop/inc \
 ))
 
+$(eval $(call gb_Executable_use_sdk_api,gtktiledviewer))
+
 $(eval $(call gb_Executable_use_externals,gtktiledviewer,\
     gtk \
 ))
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 73be3b9..e1e9e4f 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -12,12 +12,15 @@
 #include <string.h>
 
 #include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
 #include <LibreOfficeKit/LibreOfficeKitGtk.h>
 #include <LibreOfficeKit/LibreOfficeKitInit.h>
 #include "../lokdocview_quad/lokdocview_quad.h"
 
+#include <com/sun/star/awt/Key.hpp>
+
 static int help()
 {
     fprintf( stderr, "Usage: gtktiledviewer <absolute-path-to-libreoffice-install> <path-to-document>\n" );
@@ -129,10 +132,26 @@ static void signalKey(GtkWidget* /*pWidget*/, GdkEventKey* pEvent, gpointer /*pD
 {
     LOKDocView* pLOKDocView = LOK_DOCVIEW(pDocView);
 
+    int nCode = 0;
+    switch (pEvent->keyval)
+    {
+    case GDK_BackSpace:
+        nCode = com::sun::star::awt::Key::BACKSPACE;
+        break;
+    case GDK_Return:
+        nCode = com::sun::star::awt::Key::RETURN;
+        break;
+    default:
+        if (pEvent->keyval >= GDK_F1 && pEvent->keyval <= GDK_F26)
+            nCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_F1);
+        else
+            nCode = gdk_keyval_to_unicode(pEvent->keyval);
+    }
+
     if (pEvent->type == GDK_KEY_RELEASE)
-        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYUP, gdk_keyval_to_unicode(pEvent->keyval));
+        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYUP, nCode);
     else
-        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYINPUT, gdk_keyval_to_unicode(pEvent->keyval));
+        pLOKDocView->pOffice->pClass->postKeyEvent(pLOKDocView->pOffice, LOK_KEYEVENT_KEYINPUT, nCode);
 }
 
 // GtkComboBox requires gtk 2.24 or later


More information about the Libreoffice-commits mailing list