Kaydet (Commit) a84157c3 authored tarafından Miklos Vajna's avatar Miklos Vajna

gtktiledviewer: handle more key values

Change-Id: I8af971f659d483c16507c906fa65346a5e0292f1
üst fca89aea
......@@ -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 \
))
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment