From 978fc59abadba1b9d305572554e6638198753a00 Mon Sep 17 00:00:00 2001 From: Johns Date: Wed, 8 Jan 2014 16:57:08 +0100 Subject: [PATCH] Add support for umlauts in input fields. --- ChangeLog | 1 + softhddev.h | 5 +++-- softhddevice.cpp | 15 ++++++++++++--- softhddevice.h | 2 +- video.c | 14 ++++++++------ 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc1f5cb..d595744 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ User johns Date: + Add support for umlauts in input fields. Fix compile error with VDR 2.1.3. Fix bug: memory leak. PIP close clears the last used PIP channel. diff --git a/softhddev.h b/softhddev.h index 6e446dc..da16ece 100644 --- a/softhddev.h +++ b/softhddev.h @@ -1,7 +1,7 @@ /// /// @file softhddev.h @brief software HD device plugin header file. /// -/// Copyright (c) 2011 - 2013 by Johns. All Rights Reserved. +/// Copyright (c) 2011 - 2014 by Johns. All Rights Reserved. /// /// Contributor(s): /// @@ -25,7 +25,8 @@ extern "C" { #endif /// C callback feed key press - extern void FeedKeyPress(const char *, const char *, int, int); + extern void FeedKeyPress(const char *, const char *, int, int, + const char *); /// C plugin get osd size and ascpect extern void GetOsdSize(int *, int *, double *); diff --git a/softhddevice.cpp b/softhddevice.cpp index 0d75cc9..d5b8f0d 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -212,9 +212,10 @@ class cSoftRemote:public cRemote ** @param key pressed/released key name ** @param repeat repeated key flag ** @param release released key flag +** @param letter x11 character string (system setting locale) */ extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, - int release) + int release, const char *letter) { cRemote *remote; cSoftRemote *csoft; @@ -237,9 +238,17 @@ extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, csoft = new cSoftRemote(keymap); } - //dsyslog("[softhddev]%s %s, %s\n", __FUNCTION__, keymap, key); + //dsyslog("[softhddev]%s %s, %s, %s\n", __FUNCTION__, keymap, key, letter); if (key[1]) { // no single character - csoft->Put(key, repeat, release); + if (!csoft->Put(key, repeat, release) && letter) { + cCharSetConv conv; + unsigned code; + + code = Utf8CharGet(conv.Convert(letter)); + if (code <= 0xFF) { + cRemote::Put(KBDKEY(code)); // feed it for edit mode + } + } } else if (!csoft->Put(key, repeat, release)) { cRemote::Put(KBDKEY(key[0])); // feed it for edit mode } diff --git a/softhddevice.h b/softhddevice.h index 1729441..3bc4480 100644 --- a/softhddevice.h +++ b/softhddevice.h @@ -1,7 +1,7 @@ /// /// @file softhddevice.h @brief software HD device plugin header file. /// -/// Copyright (c) 2011 by Johns. All Rights Reserved. +/// Copyright (c) 2011, 2014 by Johns. All Rights Reserved. /// /// Contributor(s): /// diff --git a/video.c b/video.c index 1aa52a1..ef6facd 100644 --- a/video.c +++ b/video.c @@ -1,7 +1,7 @@ /// /// @file video.c @brief Video module /// -/// Copyright (c) 2009 - 2013 by Johns. All Rights Reserved. +/// Copyright (c) 2009 - 2014 by Johns. All Rights Reserved. /// /// Contributor(s): /// @@ -9526,7 +9526,7 @@ void VideoOsdExit(void) //---------------------------------------------------------------------------- /// C callback feed key press -extern void FeedKeyPress(const char *, const char *, int, int); +extern void FeedKeyPress(const char *, const char *, int, int, const char *); /// /// Handle XLib I/O Errors. @@ -9570,6 +9570,7 @@ static void VideoEvent(void) KeySym keysym; const char *keynam; char buf[64]; + char letter[64]; uint32_t values[1]; VideoThreadLock(); @@ -9580,7 +9581,7 @@ static void VideoEvent(void) Debug(3, "video/event: ClientMessage\n"); if (event.xclient.data.l[0] == (long)WmDeleteWindowAtom) { Debug(3, "video/event: wm-delete-message\n"); - FeedKeyPress("XKeySym", "Close", 0, 0); + FeedKeyPress("XKeySym", "Close", 0, 0, NULL); } break; @@ -9609,7 +9610,7 @@ static void VideoEvent(void) break; case KeyPress: VideoThreadLock(); - XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL); + XLookupString(&event.xkey, letter, sizeof(letter), &keysym, NULL); VideoThreadUnlock(); if (keysym == NoSymbol) { Warning(_("video/event: No symbol for %d\n"), @@ -9632,7 +9633,7 @@ static void VideoEvent(void) strncat(buf, keynam, sizeof(buf) - 10); keynam = buf; } - FeedKeyPress("XKeySym", keynam, 0, 0); + FeedKeyPress("XKeySym", keynam, 0, 0, letter); break; case KeyRelease: break; @@ -11289,7 +11290,8 @@ void FeedKeyPress( __attribute__ ((unused)) const char *x, __attribute__ ((unused)) const char *y, __attribute__ ((unused)) int a, __attribute__ ((unused)) - int b) + int b, __attribute__ ((unused)) + const char *s) { }