Hello Max,
Quote:
Originally Posted by Max
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);
when you set a icon the last parameter is a code send to de ipcCbk when you click on the icon. then you can set a icon like:
Code:
tbAppendPlatformIcon( ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_pan, ccVwrToolbar);
and in the ipcCbk do:
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:
In when ccVwrToolbar is recibed ipdf check the icon name to decide the action to take.
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.
|
scotty1024 mrxvt code [1] proposed the same code, a program can use:
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);
to show the keyboard, but studying those functions, we can see that tbSetStatePlatformIcon calls erIpcStartClient function (in eripc.c), which opens a socket to send the message/action.
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);
which sends an IPC command through a socket. The daemon listening this socket and who in fact turn off the led is erbusyd, using an ioctl call (look at erbusyd.c).
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