erkeyb-client.h File Reference

#include <gdk/gdk.h>
Include dependency graph for erkeyb-client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

G_BEGIN_DECLS int erkeyb_client_init (void)
void erkeyb_client_show (void)
void erkeyb_client_hide (void)
void erkeyb_client_term (void)

Function Documentation

void erkeyb_client_hide ( void   ) 

Definition at line 161 of file erkeyb-client.c.

References _keyb_client::chan, DBG_ENTRY, DBG_EXIT, erkeyb_client_init(), and _keyb_client::is_closed.

Referenced by cb_sys_set_keyboard(), ergtk_im_context_erkeyb_focus_out(), ergtk_im_context_erkeyb_set_client_window(), go_back_cb(), go_emall_cb(), go_forward_cb(), load_started_cb(), and on_process_exit().

00162 {
00163     DBG_ENTRY;
00164 
00165     if ( g_keyb_client.is_closed == TRUE )
00166     {
00167         erkeyb_client_init();
00168     }
00169 
00170     g_io_channel_write_chars(g_keyb_client.chan, "keyboard-hide\n", -1, NULL, NULL );
00171     g_io_channel_flush(g_keyb_client.chan, NULL );
00172 
00173     DBG_EXIT;
00174 }

Here is the call graph for this function:

Here is the caller graph for this function:

G_BEGIN_DECLS int erkeyb_client_init ( void   ) 

Copyright (C) 2009 iRex Technologies B.V. All rights reserved.

Definition at line 87 of file erkeyb-client.c.

References _keyb_client::chan, DBG_ASSERT, DBG_ENTRY, DBG_EXIT, ERR, _keyb_client::hints, HOST, _keyb_client::is_closed, PORT, and _keyb_client::sfd.

Referenced by ergtk_im_context_erkeyb_init(), erkeyb_client_hide(), erkeyb_client_show(), and ipc_set_services().

00088 {
00089     DBG_ENTRY;
00090     struct addrinfo *result, *rp;
00091     int s;
00092 
00093     /* Obtain address(es) matching host/port */
00094 
00095     memset(&g_keyb_client, 0x0, sizeof(keyb_client));
00096     memset(&g_keyb_client.hints, 0x0, sizeof(struct addrinfo));
00097 
00098     g_keyb_client.hints.ai_family = AF_INET;    /* Allow IPv4 */
00099     g_keyb_client.hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
00100     g_keyb_client.hints.ai_flags = 0;
00101     g_keyb_client.hints.ai_protocol = 0;          /* Any protocol */
00102 
00103     s = getaddrinfo(HOST, PORT, &g_keyb_client.hints, &result);
00104 
00105     if (s != 0) {
00106         ERR("getaddrinfo: %s\n", gai_strerror(s));
00107         return 1;
00108     }
00109 
00110     for (rp = result; rp != NULL; rp = rp->ai_next) {
00111         g_keyb_client.sfd = socket(rp->ai_family, rp->ai_socktype,
00112                 rp->ai_protocol);
00113         if (g_keyb_client.sfd == -1)
00114             continue;
00115 
00116         if (connect(g_keyb_client.sfd, rp->ai_addr, rp->ai_addrlen) != -1)
00117             break;                  /* Success */
00118 
00119         close(g_keyb_client.sfd);
00120     }
00121 
00122     if (rp == NULL) {               /* No address succeeded */
00123         ERR("Could not connect\n");
00124         freeaddrinfo(result);           /* No longer needed */
00125         return 1;
00126     }
00127 
00128     freeaddrinfo(result);           /* No longer needed */
00129 
00130 
00131     /* we have a connection */
00132     /* so we can setup a GIOChannel */
00133 
00134     g_keyb_client.chan = NULL ;
00135     g_keyb_client.chan = g_io_channel_unix_new( g_keyb_client.sfd);
00136     DBG_ASSERT( g_keyb_client.chan != NULL  ) ;
00137 
00138     g_io_channel_set_encoding(g_keyb_client.chan, NULL, NULL  );
00139 
00140     g_keyb_client.is_closed = FALSE;
00141 
00142     DBG_EXIT;
00143     return 0;
00144 }

Here is the caller graph for this function:

void erkeyb_client_show ( void   ) 

Definition at line 146 of file erkeyb-client.c.

References _keyb_client::chan, DBG_ENTRY, DBG_EXIT, erkeyb_client_init(), and _keyb_client::is_closed.

Referenced by cb_sys_set_keyboard(), and ergtk_im_context_erkeyb_focus_in().

00147 {
00148     DBG_ENTRY;
00149     
00150     if ( g_keyb_client.is_closed == TRUE )
00151     {
00152         erkeyb_client_init();
00153     }
00154 
00155     g_io_channel_write_chars(g_keyb_client.chan, "keyboard-show\n", -1, NULL, NULL );
00156     g_io_channel_flush(g_keyb_client.chan, NULL );
00157 
00158     DBG_EXIT;
00159 }

Here is the call graph for this function:

Here is the caller graph for this function:

void erkeyb_client_term ( void   ) 

Definition at line 176 of file erkeyb-client.c.

References _keyb_client::chan, DBG_ENTRY, DBG_EXIT, _keyb_client::is_closed, and _keyb_client::sfd.

Referenced by destroy_cb(), ergtk_im_context_erkeyb_finalize(), and ipc_unset_services().

00177 {
00178     DBG_ENTRY;
00179 
00180     if ( g_keyb_client.is_closed == FALSE )
00181     {
00182         g_io_channel_write_chars(g_keyb_client.chan, "keyboard-hide\n", -1, NULL, NULL );
00183         g_io_channel_flush(g_keyb_client.chan, NULL );
00184 
00185         g_io_channel_shutdown(g_keyb_client.chan, FALSE, NULL);
00186         g_io_channel_unref(g_keyb_client.chan);
00187         g_keyb_client.chan = NULL ;
00188         close(g_keyb_client.sfd);
00189         g_keyb_client.sfd = -1;
00190         g_keyb_client.is_closed = TRUE;
00191     }
00192 
00193     DBG_EXIT;
00194 }

Here is the caller graph for this function:

Generated by  doxygen 1.6.2-20100208