libgxim Reference Manual | ||||
---|---|---|---|---|
Top | Description |
GXimProtocolClosure; gboolean (*GXimProtocolClosureFunc) (GXimProtocolClosure *closure
,GXimProtocol *proto
,GDataInputStream *stream
,GError **error
,gpointer user_data
); enum GXimProtocolError; struct GXimProtocolIface; struct GXimProtocolQueueNode; #define G_XIM_OPCODE_KEY (_m_, _n_) #define G_XIM_PROTOCOL_ERROR gpointer g_xim_attr_get_attribute_from_stream (GXimProtocol *proto
,GXimAttr *attr
,GDataInputStream *stream
,GCancellable *cancellable
,GError **error
); gsize g_xim_attr_put_attribute_to_stream (GXimProtocol *proto
,GXimAttr *attr
,guint attribute_id
,GCancellable *cancellable
,GError **error
); void g_xim_protocol_add_protocol (GXimProtocol *proto
,GXimProtocolClosure *closure
); void g_xim_protocol_cancel_queue (GXimProtocol *proto
); void g_xim_protocol_closure_add_signal (GXimProtocolClosure *closure
,GClosureMarshal marshaller
,guint n_params
,...
); gulong g_xim_protocol_closure_connect (GXimProtocolClosure *closure
,GCallback func
,gpointer data
); void g_xim_protocol_closure_disconnect (GXimProtocolClosure *closure
,gulong id
); gboolean g_xim_protocol_closure_emit_signal (GXimProtocolClosure *closure
,GXimProtocol *proto
,...
); void g_xim_protocol_closure_free (gpointer data
,GClosure *closure
); gboolean g_xim_protocol_closure_is_an_extension (GXimProtocolClosure *closure
); GXimProtocolClosure * g_xim_protocol_closure_new (guint8 major_opcode
,guint8 minor_opcode
,const gchar *name
,gboolean is_an_extension
); void g_xim_protocol_closure_set_marshal (GXimProtocolClosure *closure
,GXimProtocolClosureFunc func
,gpointer data
); gulong g_xim_protocol_connect_closure_by_id (GXimProtocol *proto
,guint8 major_opcode
,guint8 minor_opcode
,GCallback func
,gpointer data
); gulong g_xim_protocol_connect_closure_by_name (GXimProtocol *proto
,const gchar *signal_name
,GCallback func
,gpointer data
); void g_xim_protocol_dispose (GObject *object
); GXimProtocolQueueNode * g_xim_protocol_end_queue (GXimProtocol *proto
); void g_xim_protocol_finalize (GObject *object
); GQuark g_xim_protocol_get_error_quark (void
); GSList * g_xim_protocol_get_extensions (GXimProtocol *proto
); GXimProtocolPrivate * g_xim_protocol_get_private (GXimProtocol *proto
); guint g_xim_protocol_get_queue_length (GXimProtocol *proto
); void g_xim_protocol_init (GXimProtocol *proto
); gboolean g_xim_protocol_is_queued (GXimProtocol *proto
); GXimProtocolClosure * g_xim_protocol_lookup_protocol_by_id (GXimProtocol *proto
,guint8 major_opcode
,guint8 minor_opcode
); GXimProtocolClosure * g_xim_protocol_lookup_protocol_by_name (GXimProtocol *proto
,const gchar *name
); #define g_xim_protocol_n_pad4 (_n_) gboolean g_xim_protocol_process_event (GXimProtocol *proto
,GdkEventClient *event
,GError **error
); gboolean g_xim_protocol_raise_parser_error (GXimProtocol *proto
,guint major_opcode
,guint minor_opcode
,guint imid
,guint icid
); gboolean g_xim_protocol_read_format (GXimProtocol *proto
,GDataInputStream *stream
,GCancellable *cancellable
,GError **error
,guint n_params
,...
); gboolean g_xim_protocol_read_vformat (GXimProtocol *proto
,GDataInputStream *stream
,GCancellable *cancellable
,GError **error
,guint n_params
,va_list args
); void g_xim_protocol_remove_protocol (GXimProtocol *proto
,GXimProtocolClosure *closure
); void g_xim_protocol_remove_protocol_by_id (GXimProtocol *proto
,guint8 major_opcode
,guint8 minor_opcode
); gboolean g_xim_protocol_send (GXimProtocol *proto
,GXimOpcode major_opcode
,guint8 minor_opcode
,guint n_params
,...
); gsize g_xim_protocol_send_format (GXimProtocol *proto
,GCancellable *cancellable
,GError **error
,guint n_params
,...
); gboolean g_xim_protocol_send_packets (GXimProtocol *proto
,const gchar *data
,gsize length
); gsize g_xim_protocol_send_vformat (GXimProtocol *proto
,GCancellable *cancellable
,GError **error
,guint n_params
,va_list args
); gboolean g_xim_protocol_send_with_list (GXimProtocol *proto
,GXimOpcode major_opcode
,guint8 minor_opcode
,GSList *types
,GSList *values
); gboolean g_xim_protocol_start_queue (GXimProtocol *proto
); gboolean g_xim_protocol_translate (GXimProtocol *proto
,gpointer data
,gssize length
,GError **error
); gboolean g_xim_protocol_wait_for_reply (GXimProtocol *proto
,GXimOpcode major_opcode
,guint8 minor_opcode
,GError **error
);
typedef struct { GCClosure closure; GClosureMarshal signal_marshaller; guint n_params; GType *param_types; GSList *signal_handlers; gchar *name; union { GXimOpcode v1; guint8 v2; } major_opcode; guint8 minor_opcode; gboolean is_an_extension; } GXimProtocolClosure;
gboolean (*GXimProtocolClosureFunc) (GXimProtocolClosure *closure
,GXimProtocol *proto
,GDataInputStream *stream
,GError **error
,gpointer user_data
);
typedef enum { G_XIM_PROTOCOL_ERROR_BEGIN = 128, G_XIM_PROTOCOL_ERROR_UNKNOWN_ENDIAN, G_XIM_PROTOCOL_ERROR_INVALID_PACKETS_RECEIVED, G_XIM_PROTOCOL_ERROR_DELIVERY_FAILURE, G_XIM_PROTOCOL_ERROR_NO_PARSER, G_XIM_PROTOCOL_ERROR_NO_DATA, } GXimProtocolError;
Error codes returned by GXimProtocol functions.
Unused. | |
Packets is sent with the unknown endian. | |
Not parserable packets received. | |
Unable to deliver the signal properly. | |
No handlers available to parse packets. | |
No data received in a request. |
struct GXimProtocolIface { GTypeInterface parent_iface; GXimMessages *message; GdkAtom atom_xim_protocol; GdkAtom atom_xim_moredata; };
An interface of XIM protocol.
a parent. | |
GXimMessages * |
a GXimMessages. |
GdkAtom |
a GdkAtom for _XIM_PROTOCOL . |
GdkAtom |
a GdkAtom for _XIM_MOREDATA . |
struct GXimProtocolQueueNode { gchar *data; gsize length; guint16 major_opcode; guint16 minor_opcode; guint16 imid; guint16 icid; gboolean is_sent; };
#define G_XIM_OPCODE_KEY(_m_,_n_) GUINT_TO_POINTER ((_m_) << 8 | ((_n_) & 0xff))
Generates a key from opcodes.
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
#define G_XIM_PROTOCOL_ERROR (g_xim_protocol_get_error_quark())
Error domain for GXimProtocol. Errors in this domain will be from the GXimProtocolError or GXimStandardError enumeration. See GError for more information on error domains.
gpointer g_xim_attr_get_attribute_from_stream (GXimProtocol *proto
,GXimAttr *attr
,GDataInputStream *stream
,GCancellable *cancellable
,GError **error
);
gsize g_xim_attr_put_attribute_to_stream (GXimProtocol *proto
,GXimAttr *attr
,guint attribute_id
,GCancellable *cancellable
,GError **error
);
void g_xim_protocol_add_protocol (GXimProtocol *proto
,GXimProtocolClosure *closure
);
Registers a closure
to add the XIM protocol handler.
|
a GXimProtocol. |
|
a structure of closure. |
void g_xim_protocol_cancel_queue (GXimProtocol *proto
);
Cancels queueing. Note that you have to invoke this function if you can't proceed queueing process with any errors say. otherwise invalid node is kept in the queue and you may get a trouble with it eveutnally.
|
a GXimProtocol. |
void g_xim_protocol_closure_add_signal (GXimProtocolClosure *closure
,GClosureMarshal marshaller
,guint n_params
,...
);
Adds a marshaller for signal.
|
a GXimProtocolClosure. |
|
the GClosureMarshal to deal with the signal. |
|
the number of parameters for the signal. |
|
a list of types, one for each parameter. |
gulong g_xim_protocol_closure_connect (GXimProtocolClosure *closure
,GCallback func
,gpointer data
);
Connects a closure to a signal.
|
a GXimProtocolClosure. |
|
the GCallback to connect. |
|
data to pass to func . |
Returns : |
the handler id. |
void g_xim_protocol_closure_disconnect (GXimProtocolClosure *closure
,gulong id
);
Disconnects a handler from an instance so it will not be called during
any future or currently ongoing emissions of the signal if has been
connected to. The id
becomes invalid and may be reused.
The id
has to be a valid signal handler id, connected to a
signal of closure
.
|
a GXimProtocolClosure. |
|
Handler id of the handler to be disconnected. |
gboolean g_xim_protocol_closure_emit_signal (GXimProtocolClosure *closure
,GXimProtocol *proto
,...
);
Emits a signal.
|
a GXimProtocolClosure. |
|
the instance which wants to raise a signal with closure . |
|
parameters to be passed to the signal. |
Returns : |
TRUE to be proceeded a signal in the handlers. FALSE to be failed
in any handlers or no handlers for this signal. |
gboolean g_xim_protocol_closure_is_an_extension
(GXimProtocolClosure *closure
);
Checks if the closure
was created as an extension protocol in XIM.
|
a GXimProtocolClosure. |
Returns : |
TRUE to be an extension. |
GXimProtocolClosure * g_xim_protocol_closure_new (guint8 major_opcode
,guint8 minor_opcode
,const gchar *name
,gboolean is_an_extension
);
Creates an instance of the GXimProtocolClosure.
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
|
the XIM protocol name. |
|
TRUE to define an extension in XIM protocol, otherwise FALSE . |
Returns : |
the GXimProtocolClosure. |
void g_xim_protocol_closure_set_marshal (GXimProtocolClosure *closure
,GXimProtocolClosureFunc func
,gpointer data
);
Sets the marshaller of closure
which scans the XIM protocol packets and emit
the proper signal as needed. Note that g_xim_protocol_closure_emit_signal()
has to be invoked in func
otherwise any signals added by
g_xim_protocol_closure_add_signal()
won't do anything at all.
|
a GXimProtocolClosure. |
|
the GXimProtocolClosureFunc function to scan the XIM protocol packet and emits the proper signal. |
|
the data to store in the data field of the GClosure. |
gulong g_xim_protocol_connect_closure_by_id (GXimProtocol *proto
,guint8 major_opcode
,guint8 minor_opcode
,GCallback func
,gpointer data
);
Connects a GCallback function to a signal for XIM protocol events.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
|
the GCallback to connect. |
|
data to pass to func . |
Returns : |
the handler id. |
gulong g_xim_protocol_connect_closure_by_name (GXimProtocol *proto
,const gchar *signal_name
,GCallback func
,gpointer data
);
Connects a GCallback function to a signal for XIM protocol events.
|
a GXimProtocol. |
|
a XIM protocol event name. |
|
the GCallback to connect. |
|
data to pass to func . |
Returns : |
the handler id. |
void g_xim_protocol_dispose (GObject *object
);
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from "dispose" which has the GXimProtocol interface.
|
a GObject. |
GXimProtocolQueueNode * g_xim_protocol_end_queue (GXimProtocol *proto
);
Terminates the queue.
|
a GXimProtocol. |
Returns : |
the GXimProtocolQueueNode which queued the request this time. |
void g_xim_protocol_finalize (GObject *object
);
Finalizes the instance.
This function should only be called from "finalize" which has the GXimProtocol interface.
|
a GObject. |
GSList * g_xim_protocol_get_extensions (GXimProtocol *proto
);
Obtains a set of GXimProtocolClosure registered as an extension. this is
helpful to deal with G_XIM_QUERY_EXTENSION
and so on.
|
a GXimProtocol. |
Returns : |
the GSList which contains GXimProtocolClosure. |
GXimProtocolPrivate * g_xim_protocol_get_private (GXimProtocol *proto
);
Obtains the GXimProtocolPrivate which is referenced proto
.
|
a GXimProtocol. |
guint g_xim_protocol_get_queue_length (GXimProtocol *proto
);
Obtains how many requests are stored in the queue now.
|
a GXimProtocol. |
Returns : |
the number of requests in the queue. |
void g_xim_protocol_init (GXimProtocol *proto
);
Initializes proto
. this isn't being invoked from the class automatically
which has a GXimProtocol interface. you need to call this function manually
before doing something with proto
.
|
a GXimProtocol. |
gboolean g_xim_protocol_is_queued (GXimProtocol *proto
);
Checks if proto
is in queueing process.
|
a GXimProtocol. |
Returns : |
TRUE to be in the queueing process. otherwise FALSE . |
GXimProtocolClosure * g_xim_protocol_lookup_protocol_by_id (GXimProtocol *proto
,guint8 major_opcode
,guint8 minor_opcode
);
Looks up the XIM protocol closure with major_opcode
and minor_opcode
which
proto
is dealing with.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
Returns : |
a GXimProtocolClosure corresponding to major_opcode and minor_opcode . |
GXimProtocolClosure * g_xim_protocol_lookup_protocol_by_name (GXimProtocol *proto
,const gchar *name
);
Looks up the XIM protocol closure with name
which proto
is dealing with.
|
a GXimProtocol. |
|
the name of XIM protocol event. |
Returns : |
a GXimProtocolClosure corresponding to name . |
#define g_xim_protocol_n_pad4(_n_)
Generates a number aligned to 4 bytes as needed.
|
a number |
gboolean g_xim_protocol_process_event (GXimProtocol *proto
,GdkEventClient *event
,GError **error
);
Picks up XIM protocol packets from event
and deal with it as needed.
|
a GXimProtocol. |
|
the GdkEventClient which wants to process this time. |
|
a location to store error, or NULL . |
Returns : |
TRUE to be processed successfully. |
gboolean g_xim_protocol_raise_parser_error (GXimProtocol *proto
,guint major_opcode
,guint minor_opcode
,guint imid
,guint icid
);
Raises an appropriate error to the opposite direction on the connection
according to major_opcode
and minor_opcode
.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
|
input-method ID. |
|
input-context ID. |
Returns : |
TRUE to be sent an error successfully. |
gboolean g_xim_protocol_read_format (GXimProtocol *proto
,GDataInputStream *stream
,GCancellable *cancellable
,GError **error
,guint n_params
,...
);
Scans XIM protocol packets according to the set of parameters. if any, objects generated against it is stored in the locations pointed to by the pointer arguments. Each pointer argument must be of a type that is appropriate for the value returned by the corresponding value type. See GXimValueType documentation which objects the value type is supposed to be.
|
a GXimProtocol. |
|
a GDataInputStream which contains XIM protocol packets. |
|
optional GCancellable object, NULL to ignore. |
|
a location to store error, or NULL . |
|
the number of a set of parameters. |
Returns : |
TRUE to be read successfully. |
gboolean g_xim_protocol_read_vformat (GXimProtocol *proto
,GDataInputStream *stream
,GCancellable *cancellable
,GError **error
,guint n_params
,va_list args
);
Scans XIM protocol packets according to the set of parameters. if any, objects generated against it is stored in the locations pointed to by the pointer arguments. Each pointer argument must be of a type that is appropriate for the value returned by the corresponding value type. See GXimValueType documentation which objects the value type is supposed to be.
|
a GXimProtocol. |
|
a GDataInputStream which contains XIM protocol packets. |
|
optional GCancellable object, NULL to ignore. |
|
a location to store error, or NULL . |
|
the number of a set of parameters. |
|
a va_list. |
Returns : |
TRUE to be read successfully. |
void g_xim_protocol_remove_protocol (GXimProtocol *proto
,GXimProtocolClosure *closure
);
Gets rid of closure
to stop XIM protocol handling in proto
.
|
a GXimProtocol. |
|
a structure of closure. |
void g_xim_protocol_remove_protocol_by_id (GXimProtocol *proto
,guint8 major_opcode
,guint8 minor_opcode
);
Gets rid of XIM protocol handling to stop dealing with major_opcode
and
minor_opcode
in proto
.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
gboolean g_xim_protocol_send (GXimProtocol *proto
,GXimOpcode major_opcode
,guint8 minor_opcode
,guint n_params
,...
);
Sends XIM protocol according to the set of parameters. one is a parameter type defined in GXimValueType, and one is an object related to that. See GXimValueType documentation which objects are supposed to be specified with them.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
|
the number of a set of parameters. |
Returns : |
TRUE to be sent successfully. |
gsize g_xim_protocol_send_format (GXimProtocol *proto
,GCancellable *cancellable
,GError **error
,guint n_params
,...
);
Converts the objects to the XIM protocol packets according to the format
and store it into the send buffer. you shouldn't use this function directly.
use g_xim_protocol_send()
instead.
|
a GXimProtocol. |
|
optional GCancellable object, NULL to ignore. |
|
a location to store error, or NULL . |
|
the number of a set of parameters. |
Returns : |
the number of data stored. |
gboolean g_xim_protocol_send_packets (GXimProtocol *proto
,const gchar *data
,gsize length
);
Sends data
to the opposite direction on the connection.
|
a GXimProtocol. |
|
a chunk of XIM protocol packets. |
|
the number of data . |
Returns : |
TRUE to be sent successfully. |
gsize g_xim_protocol_send_vformat (GXimProtocol *proto
,GCancellable *cancellable
,GError **error
,guint n_params
,va_list args
);
Converts the objects to the XIM protocol packets according to format
and store it into the send buffer. you shouldn't use this function directly.
use g_xim_protocol_send()
instead.
|
a GXimProtocol. |
|
optional GCancellable object, NULL to ignore. |
|
a location to store error, or NULL . |
|
the number of a set of parameters. |
|
a va_list. |
Returns : |
the number of data stored. |
gboolean g_xim_protocol_send_with_list (GXimProtocol *proto
,GXimOpcode major_opcode
,guint8 minor_opcode
,GSList *types
,GSList *values
);
Sends XIM protocol according to types
and values
.
See GXimValueType documentation which objects are supposed to be specified
with them.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
|
a list of GXimValueType. |
|
a list of objects fitting to each value types in types . |
Returns : |
TRUE to be sent successfully. |
gboolean g_xim_protocol_start_queue (GXimProtocol *proto
);
Prepares the queue to not send a request immediately. this function is useful if you need to wait for any requests but want to send it after the pending requests is done.
|
a GXimProtocol. |
Returns : |
TRUE to be ready to queue. |
gboolean g_xim_protocol_translate (GXimProtocol *proto
,gpointer data
,gssize length
,GError **error
);
Translate the packets and deliver it to the appropriate places.
|
a GXimProtocol. |
|
a chunk of XIM protocol packets |
|
the number of data . |
|
a location to store error, or NULL . |
Returns : |
TRUE to be processed successfully. |
gboolean g_xim_protocol_wait_for_reply (GXimProtocol *proto
,GXimOpcode major_opcode
,guint8 minor_opcode
,GError **error
);
Waits for a response of major_opcode
and minor_opcode
or G_XIM_ERROR
.
this can be used if you need to send a request synchronously. Note that
using this function in the server instance won't works due to how GObject
delivers signals and iterates it.
|
a GXimProtocol. |
|
a major opcode in XIM protocol. |
|
a minor opcode in XIM protocol. |
|
a location to store error, or NULL . |
Returns : |
TRUE the request was successfully done. |