indeed, ipc is required.
The main call is
Code:
// iRex DR: report "application started"
const int xid = GDK_WINDOW_XID(window->window); // window->window seems to be a good candidate
eripc_sysd_startup_complete(eripcClient, getpid(), FALSE, xid); // TRUE only when the app handles openFile and closeFile
Below is the complete sequence of all calls around this one (taken from the port of StarDict). Note, that GDK/GTK is used here, and I'm not sure you can do this in rxvt. I had the same kind of problems of how to make a tab when
porting xMahjongg (= non GTK app). Still do not know the solution, so if/when you have one please share
Code:
#include <liberipc/eripc.h>
#include <liberipc/eripc_support.h>
// IPC application
// TODO: set DBUS_APPL_NAME to your application name, use lower-case and digits only
// or set to PACKAGENAME when this is lower-case and digits only
#define DBUS_APPL_NAME "stardict" // lower-case and digits only
#define DBUS_SERVICE "com.irexnet." DBUS_APPL_NAME
#define DBUS_PATH "/com/irexnet/" DBUS_APPL_NAME
#define DBUS_INTERFACE "com.irexnet." DBUS_APPL_NAME
// IPC system control
#define DBUS_SERVICE_SYSTEM_CONTROL "com.irexnet.sysd"
// IPC popup menu
#define DBUS_SERVICE_POPUP_MENU "com.irexnet.popupmenu"
#define DBUS_SERVICE_CTB "com.irexnet.ctb"
#define DBUS_SERVICE_MENU "com.irexnet.popupmenu"
#define DBUS_SERVICE_CONN_WIFI "com.irexnet.connwifi"
#define DBUS_SERVICE_CONN_BLUE "com.irexnet.connblue"
#define DBUS_SERVICE_CONN_3G "com.irexnet.conn3g"
//----------------------------------------------------------------------------
// Static Variables
//----------------------------------------------------------------------------
static eripc_client_context_t *eripcClient = NULL;
// Exported DBUS API list
static eripc_callback_function_t service_functions[] = { {NULL} };
........
///////////////////
AppCore::AppCore()
{
......
// iRex DR, init ipc
eripcClient = eripc_client_context_new(
DBUS_APPL_NAME,
"1.0",
DBUS_SERVICE,
DBUS_PATH,
DBUS_INTERFACE,
service_functions);
}
AppCore::~AppCore()
{
......
// iRex DR, un-init
eripc_client_context_free(eripcClient, service_functions);
}
void someMethodWhenIKnowAppIsReady()
{
// iRex DR: report "application started"
const int xid = GDK_WINDOW_XID(window->window); // window->window seems to be a good candidate
eripc_sysd_startup_complete(eripcClient, getpid(), FALSE, xid); // TRUE only when the app handles openFile and closeFile
// rename
eripc_send_varargs(eripcClient->context,
NULL,
NULL,
ERIPC_BUS_SESSION,
DBUS_SERVICE_MENU,
"renameTask",
ERIPC_TYPE_INT, xid,
ERIPC_TYPE_STRING, _("NameToBeSeenInTab"),
ERIPC_TYPE_INVALID);
}