11-25-2009, 07:39 PM | #1 |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Some doubts: showing keyboard and ContentLister
Hi,
some questions for the ones who have dived into iLiad sources: - how to make keyboard show/hide from a program? Found [1], but I can't see anything useful from there, only: Code:
toolbar_setIconState(iconID_keyboard, iconState_selected); [1] http://iliad.hpelbers.org/irexdox/co...2bc0cd0ff67e31 - executing ipdf from ContentLister vs. from CLI If I run ipdf file.pdf from a ssh shell, up button don't quit the program. Same happens for FBReader. Could you point me to the part of the sources where ContentLister changes this behaviour? It looks like pm_TerminateUserApp() in programManager.c kills the viewer [1] UPDATE: ContentLister gets the "quit" key and then kills the app with kill(pid). To emulate what ContentLister does when running a new program [2] we should execute pm_RunViewer or store uaID (viewer id) by ourselves (g_uaOnTop and g_lastStartedUa stacks). pm_SendKey function is quite interesting too [3]. [1] http://iliad.hpelbers.org/irexdox/co...17410649ff165a [2] http://iliad.hpelbers.org/irexdox/co...04c2f19d198317 [3] http://iliad.hpelbers.org/irexdox/co...2bc0cd0ff67e31 Thanks in advance, Iņigo |
11-26-2009, 08:15 PM | #2 |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Attached you can find a simple lua demo of a matchbox-keyboard embeded into a gtk program, and whose keystrokes are forwarded to a gtk.TextView widget.
It's a mere translation of the C example included with matchbox-keyboard v0.1 sources. It works on my desktop, but sadly enough, the matchbox-keyboard included in my Iliad doesn't accept the "-xid" argument, and looking at the sources it has no support to be embedded. So I'm coming back to the first question, how does Iliad manage to open the keyboard and handle the keystrokes? |
11-27-2009, 04:28 AM | #3 |
Connoisseur
Posts: 95
Karma: 186186
Join Date: May 2009
Location: Canberra, Australia
Device: Irex Iliad (Dead), EcoReader (Smashed screen), Kobo Touch
|
from what I recall, you need to include the iliad eripc headers, create the ipc channel, then use that channel to show/hide the keyboard. This is C code, could probably work similarly in C++
Code:
// include eripc #include <liberipc/eripc.h> #include <liberipc/eripcviewer.h> #include <liberipc/eripctoolbar.h> // ipc channel variable erClientChannel_t ertoolbarChannel; // ipc channel creation erIpcStartClient(ER_TOOLBAR_CHANNEL, &ertoolbarChannel); // get the toolbar channel set up as for the PDF viewer application tbSelectIconSet(ertoolbarChannel, ER_PDF_VIEWER_UA_ID); tbClearIconSet(ertoolbarChannel, ER_PDF_VIEWER_UA_ID); // enable on screen keyboard tbAppendPlatformIcon(ertoolbarChannel,ER_PDF_VIEWER_UA_ID,iconID_keyboard,-1); // turn off trashcan as an extra. tbAppendPlatformIcon(ertoolbarChannel,ER_PDF_VIEWER_UA_ID,iconID_trashcan,-1); tbSetStatePlatformIcon(ertoolbarChannel,ER_PDF_VIEWER_UA_ID,iconID_trashcan, iconState_grey); |
11-27-2009, 05:21 AM | #4 | |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Quote:
first thanks for your comments. I understand that this is the way to send the action "show the keyboard" but I guess it should be the other side of the channel, the code which performs the launch of the keyboard. I'm interested in that other end of the channel. Who is listening on that other side? which daemon or process? Or am I missing anything? |
|
11-27-2009, 06:09 AM | #5 |
Connoisseur
Posts: 95
Karma: 186186
Join Date: May 2009
Location: Canberra, Australia
Device: Irex Iliad (Dead), EcoReader (Smashed screen), Kobo Touch
|
Oh, I see, you're after the process that's listening for those IPC calls, and then launches the matchbox keyboard software? I'm clueless about that end of things
|
11-28-2009, 12:09 PM | #6 | |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Quote:
Look at "registry.xml", you will find that FBReader is using channel 14 (for shell script) and ipdf is using channel 2. When you execute ipdf from shell, ipdf will use channel 2 but CLI will wait on channel 14 (maybe vice versa). That's why UP button won't be functional in this case. |
|
11-29-2009, 06:24 PM | #7 | ||
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Quote:
Quote:
Neither ipdf or FBreader listen to UP key when running from the CLI, so it must depends on how the apps are started. Anyway, first question remains... who is listening on the other side of the IPC mechanism? how keyboard is shown? |
||
11-30-2009, 03:50 AM | #8 |
Connoisseur
Posts: 79
Karma: 380
Join Date: Mar 2008
Location: Girona, Spain
Device: iLiad, DR1000s
|
In the ipdf app. the events in the toolbar buttons are send to the ipcCbk function. You set the call back function with:
Code:
erIpcChannel = channel; int fd = erIpcGetServerFd(channel); gdk_input_add (fd, GDK_INPUT_READ, (GdkInputFunction) ipcCbk, (gpointer) this); Code:
tbAppendPlatformIcon( ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_pan, ccVwrToolbar); Code:
void IliadToolbar::ipcCbk(gpointer client_data, gint *fd, GdkInputCondition id) { IliadToolbar *toolBar = (IliadToolbar *) client_data; char szBuffer[IPC_BUF_MAX]; int nBuf = IPC_BUF_MAX; erIpcCmd_t command; erServerChannel_t channel = toolBar->erIpcChannel; erIpcGetMessage(channel, szBuffer, &nBuf); if (vwrParseCommand(szBuffer, &command) >= 0) { switch (command.cc) { case ccVwrToolbar: As how you show/hide the keyboar you can see the settings app code in: http://iliad.hpelbers.org/irexdox/se...735f93a6ced14a the method show_keyboard. |
11-30-2009, 02:28 PM | #9 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
IIRC, the UP key is defined as GDK_F5. That mean, CLI will send a GDK_F5 button event to some applicatoin when the key is pushed. To make FBReader react to the key, you have to modify "keymap.xml". I assign GDK_F5 to "QUIT", so that FBReader will quit when I push the UP key. This step is to be done manually by each user. Normally, ipdf should react to the UP key when starting from CLI. Your description is quite strange. I suppose the UP key is on the top-left corner of iLiad, not the up-arrow key.
Last edited by ericshliao; 11-30-2009 at 02:32 PM. |
12-01-2009, 07:07 PM | #10 | |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Solved keyboard question
Hello Max,
Quote:
Code:
// Enable then pop up keyboard tbAppendPlatformIcon( ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_keyboard, -1); tbSetStatePlatformIcon(ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_keyboard, iconState_selected); Who is listening on the other part of the socket? For instance, we can turn off the led from a program with (also from [1]): Code:
// Turn off busy LED if we were invoked via [SHELL] erIpcStartClient(ER_BUSYD_CHANNEL, &erbusyChannel); busySetBusy(erbusyChannel, ccBusyState_Off); UPDATE: ok, mistery solved: looks like it must be mb-applet-icon-container.c (lines 303 and 1479). Matchbox handles it. It's very easy to make this work, to show the keyboard from inside an application and make the keystrokes to be redirected to our widgets. You can see a proof of concept attached. To run it: $ lua test_kbd.lua | /path/to/xx -p Thanks for all the ideas and enjoy the simplicity ;-) Iņigo PS: btw Hansel, I think you could substitute your custom keyboard in Minipad with something like this. [1] https://www.mobileread.com/forums/sho...63&postcount=4 |
|
12-01-2009, 07:09 PM | #11 | |
Guru
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
|
Quote:
(and yes, I referred to top-left corner UP/quit button). Thanks, Iņigo |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A couple of doubts. | johnpdoe | Amazon Kindle | 15 | 07-25-2010 07:32 AM |
PRS-600 Some doubts with the battery of 600 | shineofleo | Sony Reader | 16 | 10-17-2009 12:52 PM |
Two doubts from a potential 505 buyer | ccpraveen | Sony Reader | 7 | 07-26-2009 09:31 AM |
Doubts about usability | satanicoPlan | iRex | 1 | 12-05-2007 08:42 AM |
FBReader Newbie doubts. | Gubbi | Reading and Management | 6 | 02-22-2006 06:33 AM |