GXimServerTemplate

GXimServerTemplate — Base class for XIM server

Synopsis

                    GXimServerTemplate;
struct              GXimServerTemplateClass;
enum                GXimServerTemplateError;
#define             G_XIM_SRV_TMPL_ERROR
void                g_xim_srv_tmpl_add_connection       (GXimServerTemplate *srvtmpl,
                                                         GXimConnection *conn,
                                                         GdkNativeWindow window);
GQuark              g_xim_srv_tmpl_get_error_quark      (void);
gboolean            g_xim_srv_tmpl_is_running           (GXimServerTemplate *srvtmpl,
                                                         GError **error);
GXimConnection *    g_xim_srv_tmpl_lookup_connection    (GXimServerTemplate *srvtmpl,
                                                         GdkWindow *window);
GXimConnection *    g_xim_srv_tmpl_lookup_connection_with_native_window
                                                        (GXimServerTemplate *srvtmpl,
                                                         GdkNativeWindow window);
void                g_xim_srv_tmpl_remove_connection    (GXimServerTemplate *srvtmpl,
                                                         GdkNativeWindow window);
gboolean            g_xim_srv_tmpl_send_selection_notify
                                                        (GXimServerTemplate *srvtmpl,
                                                         GdkEventSelection *event,
                                                         const gchar *data,
                                                         gsize length,
                                                         GError **error);
gboolean            g_xim_srv_tmpl_take_ownership       (GXimServerTemplate *srvtmpl,
                                                         gboolean force,
                                                         GError **error);

Object Hierarchy

  GObject
   +----GXimCore
         +----GXimServerTemplate

Properties

  "server-name"              gchar*                : Read / Write / Construct Only

Signals

  "destroy"                                        : Run First
  "get-supported-locales"                          : Run Last
  "get-supported-transport"                        : Run Last
  "xconnect"                                       : Run Last

Description

GXimServerTemplate provides a common facility to deal with XIM protocol events, particularly to be working on XIM server.

Details

GXimServerTemplate

typedef struct _GXimServerTemplate GXimServerTemplate;

An abstract implementation of XIM server class


struct GXimServerTemplateClass

struct GXimServerTemplateClass {
	GXimCoreClass parent_class;
};


enum GXimServerTemplateError

typedef enum {
	G_XIM_SRV_TMPL_ERROR_BEGIN = 128,
	G_XIM_SRV_TMPL_ERROR_SAME_SERVER_IS_RUNNING,
	G_XIM_SRV_TMPL_ERROR_ANOTHER_SERVER_IS_RUNNING,
	G_XIM_SRV_TMPL_ERROR_UNABLE_TO_ACQUIRE_SERVER_OWNER,
	G_XIM_SRV_TMPL_ERROR_UNABLE_TO_ADD_SERVER,
	G_XIM_SRV_TMPL_ERROR_UNABLE_TO_SEND_PROPERTY_NOTIFY,
} GXimServerTemplateError;

Error codes returned by GXimServerTemplate functions.

G_XIM_SRV_TMPL_ERROR_BEGIN

Unused.

G_XIM_SRV_TMPL_ERROR_SAME_SERVER_IS_RUNNING

Server is already running in the instance.

G_XIM_SRV_TMPL_ERROR_ANOTHER_SERVER_IS_RUNNING

Server in another process is already running with the same name.

G_XIM_SRV_TMPL_ERROR_UNABLE_TO_ACQUIRE_SERVER_OWNER

Unable to acquire the owner of the name.

G_XIM_SRV_TMPL_ERROR_UNABLE_TO_ADD_SERVER

Unable to add the server to XIM_SERVERS.

G_XIM_SRV_TMPL_ERROR_UNABLE_TO_SEND_PROPERTY_NOTIFY

Failed to send PropertyNotify.

G_XIM_SRV_TMPL_ERROR

#define G_XIM_SRV_TMPL_ERROR		(g_xim_srv_tmpl_get_error_quark())

Error domain for GXimServerTemplate. Errors in this domain will be from the GXimServerTemplateError or GXimStandardError enumeration. See GError for more information on error domains.


g_xim_srv_tmpl_add_connection ()

void                g_xim_srv_tmpl_add_connection       (GXimServerTemplate *srvtmpl,
                                                         GXimConnection *conn,
                                                         GdkNativeWindow window);

Puts conn to get it managed under srvtmpl. window will be referred to deliver events to the right place. i.e. conn to deal with events for window.

srvtmpl :

a GXimServerTemplate.

conn :

the GXimConnection to get it managed under srvtmpl.

window :

the GdkNativeWindow to make reference.

g_xim_srv_tmpl_get_error_quark ()

GQuark              g_xim_srv_tmpl_get_error_quark      (void);


g_xim_srv_tmpl_is_running ()

gboolean            g_xim_srv_tmpl_is_running           (GXimServerTemplate *srvtmpl,
                                                         GError **error);

Checks if XIM server process is already running at srvtmpl.

srvtmpl :

a GXimServerTemplate.

error :

a location to store error, or NULL.

Returns :

TRUE when XIM server process is already running at srvtmpl. Otherwise FALSE.

g_xim_srv_tmpl_lookup_connection ()

GXimConnection *    g_xim_srv_tmpl_lookup_connection    (GXimServerTemplate *srvtmpl,
                                                         GdkWindow *window);

Looks up the connection which is reference with window. this is a convenience function to look up with GdkWindow. use g_xim_srv_tmpl_lookup_connection_with_native_window() for GdkNativeWindow if you like.

srvtmpl :

a GXimServerTemplate.

window :

the GdkWindow to look up the connection.

Returns :

a GXimConnection, or NULL if the key is not found.

g_xim_srv_tmpl_lookup_connection_with_native_window ()

GXimConnection *    g_xim_srv_tmpl_lookup_connection_with_native_window
                                                        (GXimServerTemplate *srvtmpl,
                                                         GdkNativeWindow window);

Looks up the connection which is reference with window.

srvtmpl :

a GXimServerTemplate.

window :

the GdkNativeWindow to look up the connection.

Returns :

a GXimConnection, or NULL if the key is not found.

g_xim_srv_tmpl_remove_connection ()

void                g_xim_srv_tmpl_remove_connection    (GXimServerTemplate *srvtmpl,
                                                         GdkNativeWindow window);

Gets rid of the connection, which managed under srvtmpl. window will be used as the key to remove it.

srvtmpl :

a GXimServerTemplate.

window :

the GdkNativeWindow to get rid of the connection. which should be added with g_xim_srv_tmpl_add_connection().

g_xim_srv_tmpl_send_selection_notify ()

gboolean            g_xim_srv_tmpl_send_selection_notify
                                                        (GXimServerTemplate *srvtmpl,
                                                         GdkEventSelection *event,
                                                         const gchar *data,
                                                         gsize length,
                                                         GError **error);

Sends data with SelectionNotify. which mainly be used to deliver the result of LOCALES and TRANSPORT request.

srvtmpl :

a GXimServerTemplate.

event :

the GdkEventSelection to send.

data :

the chunks of data to send with SelectionNotify.

length :

the number of bytes of data to send.

error :

a location to store error, or NULL.

Returns :

TRUE if data is successfully sent.

g_xim_srv_tmpl_take_ownership ()

gboolean            g_xim_srv_tmpl_take_ownership       (GXimServerTemplate *srvtmpl,
                                                         gboolean force,
                                                         GError **error);

Starts XIM server if able to take an ownership for "server_name" in X property.

srvtmpl :

a GXimServerTemplate.

force :

TRUE to take an ownership forcibly. FALSE to fail if the XIM server is already running.

error :

a location to store error, or NULL.

Returns :

TRUE when XIM serrver could be started.

Property Details

The "server-name" property

  "server-name"              gchar*                : Read / Write / Construct Only

XIM server name that is used to identify the XIM server through X property, such as XIM_SERVERS. also it's used to identify for client applications with XMODIFIERS.

Default value: NULL

Signal Details

The "destroy" signal

void                user_function                      (GXimServerTemplate *srvtmpl,
                                                        gpointer            user_data)      : Run First

The ::destroy signal will be emitted when the instance is going to be destroyed. you can do something with it if you want.

srvtmpl :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "get-supported-locales" signal

gchar*              user_function                      (GXimServerTemplate *srvtmpl,
                                                        gpointer            user_data)      : Run Last

The ::get-supported-locales signal will be emitted when the client application is connecting and requesting which locales XIM server would supports.

This is a convenience signal to deal with "selection-request-event" for LOCALES request.

srvtmpl :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

Returns :

a locales string that XIM server would supports. multiple locales would be separated with comma.

The "get-supported-transport" signal

gchar*              user_function                      (GXimServerTemplate *srvtmpl,
                                                        gpointer            user_data)      : Run Last

The ::get-supported-transport signal will be emitted when the client application is connecting and requesting which transport-specific names XIM server would supports.

This is a convenience signal to deal with "selection-request-event" for TRANSPORT request.

srvtmpl :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

Returns :

a transport-specific names that XIM server would supports. In general, you may just need to support "X/" for X Window System. Multiple transport-specific names would be separated with comma. and evaluated in order of the list.

The "xconnect" signal

GXimConnection*     user_function                      (GXimServerTemplate *srvtmpl,
                                                        GdkEvent           *event,
                                                        gpointer            user_data)      : Run Last

The ::xconnect signal will be emitted when XIM_XCONNECT event is dispatched from the client applications in order to establish a connection between XIM server and a client. During processing this signal, it would be supposed to prepare a GXimConnection instance and sends back XIM_XCONNECT reply to the client. See The Input Method Protocol, XIM specification document for more details about XIM_XCONNECT.

srvtmpl :

the object which received the signal.

event :

the GdkEventClient which triggered this signal.

user_data :

user data set when the signal handler was connected.

Returns :

a GXimConnection for this session.

See Also

GXimCore