#include <umservice.hpp>
Inheritance diagram for ubit::UMService:
Public Member Functions | |
UMService (const UStr &host, int port=0) | |
opens a connection with a remote UMS server (Ubit Mouse/Message Server). | |
bool | browseUMServers (UCall &callback) |
browse available UMSservers on a local net by using ZeroConf/Rendezvous. | |
bool | resolveUMServer (const UStr &name, UCall &callback) |
resolves a UMS server name into a IP address by using ZeroConf/Rendezvous. | |
bool | browseUMSNeighbors (UCall &callback) |
browse the neigbors of this UMS. | |
bool | pressMouse (int event_flow, int button_id) |
bool | releaseMouse (int event_flow, int button_id) |
bool | moveMouse (int event_flow, int x, int y, bool absolute_coords) |
control the pointer(s) of the display managed by this UMS server. | |
bool | pressKey (int event_flow, unsigned long keysym) |
bool | releaseKey (int event_flow, unsigned long keysym) |
sends key events on the display managed by this UMS server. | |
bool | sendMouseClick (const char *target, int x, int y, int button_id, int modifiers) |
bool | sendMousePress (const char *target, int x, int y, int button_id, int modifiers) |
bool | sendMouseRelease (const char *target, int x, int y, int button_id, int modifiers) |
sends an event to a window located on the display managed by this UMS server. | |
bool | sendMessage (const char *target, const UStr &message) |
bool | sendMessage (const char *target, const char *message) |
sends a message to a target window located on the display managed by this UMS server. | |
bool | sendRequest (int ums_request, const UStr &data) |
bool | sendRequest (int ums_request, const char *data=null) |
sends a request to the UMS server (see UMSrequest). | |
UMService (const UStr &host, int port, const char *client_name) | |
[impl]. | |
virtual void | inputCallback () |
[impl]. | |
Protected Attributes | |
uptr< UCall > | browse_call |
uptr< UCall > | neighbor_call |
Classes | |
struct | BrowseReply |
see browseUMServers(). More... | |
struct | ResolveReply |
see resolveUMServer(). More... |
ubit::UMService::UMService | ( | const UStr & | host, | |
int | port = 0 | |||
) |
opens a connection with a remote UMS server (Ubit Mouse/Message Server).
This makes it possible to control the pointer(s) of a remote X display, to send text or events to the windows that are located on this display, and many other things (see umsproto.hpp and directory ubit/ums)
Args:
Note: the UMS server (ie. the 'umsd' program) must already be running on the (local or remote) host. umsd can be found in directory ubit/ums
bool ubit::UMService::browseUMServers | ( | UCall & | callback | ) |
browse available UMSservers on a local net by using ZeroConf/Rendezvous.
Exemple:
o is an instance of Obj, a an instance of Arg (callback methods,
such as foo(), can have 0 to 2 args)
ums->browseUMServers( ucall(o, a, &Obj::foo) );
....
void Obj::foo(UEvent& e, Arg a) {
UMService::BrowseReply r(e);
cerr << "browse: " << r.serviceName << endl;
if (r.isAdded())
....; // this UMS server has been added
else ...;
}
bool ubit::UMService::browseUMSNeighbors | ( | UCall & | callback | ) |
browse the neigbors of this UMS.
use UMService::ResolveReply in the callback function. flags indicates the position and is one of 't', 'b', 'l', 'r'.
bool ubit::UMService::moveMouse | ( | int | event_flow, | |
int | x, | |||
int | y, | |||
bool | absolute_coords | |||
) |
control the pointer(s) of the display managed by this UMS server.
args:
bool ubit::UMService::releaseKey | ( | int | event_flow, | |
unsigned long | keysym | |||
) |
sends key events on the display managed by this UMS server.
see: pressMouse().
resolves a UMS server name into a IP address by using ZeroConf/Rendezvous.
Args:
Exemple:
o is an instance of Obj, a an instance of Arg (callback methods,
such as foo(), can have 0 to 2 args)
ums->resolveUMServer(name, ucall(o, a, &Obj::foo));
....
void Obj::foo(UEvent& e, Arg a) {
UMService::ResolveReply r(e);
r.hosttarget = IP address / r.port = the port (9666 by default)
cerr << "resolve: " << r.hosttarget << " " << r.port << endl;
}
bool ubit::UMService::sendMessage | ( | const char * | target, | |
const char * | message | |||
) |
sends a message to a target window located on the display managed by this UMS server.
window = name or X ID of the window, can be one of:
bool ubit::UMService::sendMouseRelease | ( | const char * | target, | |
int | x, | |||
int | y, | |||
int | button_id, | |||
int | modifiers | |||
) |
sends an event to a window located on the display managed by this UMS server.
in contrast with pressMouse() etc. these functions do not control the pointers, they just send events to a given window.
Args: