View Single Post
Old 12-23-2010, 04:41 AM   #5
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
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:
Originally Posted by heyneman View Post
Quick question for folks:

I've got a DR800, but I'm running DR800+ to get the tab functionality, etc, from the DR1000. How does a program get put in a new tab, vs running in the main (explorer) tab?

I ask because, for example, rxvt shows up in the explorer tab. If I don't explicitly exit the terminal, it is still running in the background when I try to switch back to the home screen (I know because the on-screen keyboard doesn't disappear, and when I start rxvt up again I see all my previous commands). I've looked a bit into the source for rxvt and the xournal port (which does end up in its own tab), and the only thing I've noticed so far is that the xournal port uses the IPC stuff. Is that the key?

Thanks,

-heyneman
You could also take a look at how we do it in FBReader: https://bitbucket.org/inigoserna/fbr...t/8c0f3a67c11a

1. while initating FBreader we store application GTK+ window as a global variable for later use.

ipc_sys_set_window(GTK_WIDGET(myMainWindow)) in zlibrary/ui/src/gtk/application-desktop/ZLGtkApplicationWindow.cpp:70

This function is in ipc.c file (renamed to dr-ipc.cpp in a later release).


2. after all the initization is done we call ipc_sys_startup_complete(), located at the end of ipc.c file.
This function gets Xwindow ID from the GTK+ window stored before and calls the DR machinery to associate xwindow ID and application process ID and set as a tab if firmware supports tabs, that is, in DR1000 and DR800+.

Code:
void ipc_sys_startup_complete ( void )
{
    eripc_error_t   result;
    // parameters for ipc message
    const int       my_pid = getpid();
    const int       my_xid = GDK_WINDOW_XID(g_window->window);
    const gboolean  is_multidoc = FALSE;        // TODO: set TRUE/FALSE depending on your application
    const gboolean  show_taskbar = TRUE;

    // broadcast signal over session bus
    result = eripc_send_signal_varargs( eripcContext,
                                        ERIPC_BUS_SESSION,
                                        DBUS_PATH,
                                        DBUS_SERVICE_SYSTEM_CONTROL,
                                        "startupComplete",
                                        ERIPC_TYPE_STRING, DBUS_APPL_NAME,
                                        ERIPC_TYPE_INT,    my_pid,
                                        ERIPC_TYPE_BOOL,   is_multidoc,
                                        ERIPC_TYPE_STRING, DBUS_SERVICE,
                                        ERIPC_TYPE_INT,    my_xid,
                                        ERIPC_TYPE_BOOL,   show_taskbar,
                                        ERIPC_TYPE_INVALID );

    if (result != ERIPC_ERROR_SUCCESS) {
        printf("eripc_send_varargs returns [%d]", result);
    } 
}
See the "show_taskbar" argument passed to the eripc_...?

Note this is not the last version, as code evolved to gain DR-like menus, but it's simpler to show and comment.

Hope it helps,
Iņigo

Last edited by Iņigo; 12-23-2010 at 04:45 AM.
Iņigo is offline   Reply With Quote