![]() |
![]() |
![]() |
GtkUnique Reference Manual | ![]() |
---|
The real communication between processes is initiated by the
process calling gtk_unique_app_send_message()
(from now on, the
sender process). The sender process must find the window of the
running instance (or receiver process) following the steps in
the "discovery" phase; once the right window has been found, it
must set the following properties on that window:
_GTK_UNIQUE_STARTUP_ID (type: XA_STRING, format: 8), containing the startup-id of the startup notification specification; this property is optional;
_GTK_UNIQUE_WORKSPACE (type: XA_CARDINAL, format: 32), containing the number of the workspace where the sender process has been started; this property is required;
_GTK_UNIQUE_COMMAND_DATA (type: XA_STRING, format: 8), containing a string to be passed to the receiver process as part of the command; this property is optional;
After setting these properties, the _GTK_UNIQUE_COMMAND (type: XA_STRING, format: 8) property must be set using one of these command strings:
new - for creating a new top-level window
open-uri - for opening a new document
activate - for bringing the current window upfront
custom - for custom messages
Once the sender process has set the _GTK_UNIQUE_COMMAND property it should block until a PropertyNotify event has been sent on the _GTK_UNIQUE_RESPONSE property.
Meanwhile, the receiver process should have received the PropertyNotify event on the _GTK_UNIQUE_COMMAND property. The sender process should retrieve the values of the other properties set by the sender process and execute the command. Once the command has been completed, the sender process should set the _GTK_UNIQUE_RESPONSE (type: XA_STRING, format: 8) property with a response code between the following:
ok - for a successful completion of the command
cancel - for a user-cancelled completion of the command
abort - for a system-cancelled completion of the command
The 'fail' and 'invalid' response codes are reserved for error conditions inside the GtkUnique library.
The sender process should then receive a PropertyNotify event on the _GTK_UNIQUE_RESPONSE property, retrieve the value of the property and return the code to the user before terminating.