Back to index

im-sdk  12.3.91
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | Friends
XIMPublic Class Reference

#include <XIMPublic.hh>

Inheritance diagram for XIMPublic:
Inheritance graph
[legend]
Collaboration diagram for XIMPublic:
Collaboration graph
[legend]

List of all members.

Public Types

enum  CONTEXT_ID_SPECIAL { INVALID_CONTEXT_ID = 0xFFFF }
enum  CONCURRENCY_FLAGS { SYNC, ASYNC }
enum  IM_Attribute {
  ServerName = 1, TransportAddress = 2, VendorName = 3, PrimaryInputLocale = 4,
  LanguageList = 5, ConversionOnKeys = 6, ConversionOffKeys = 7, ProtocolHandler = 8,
  ObjectDescriptors = 9, IMEDescriptors = 10, DisplayConnection = 11, IFName = 12,
  AppName = 13, DisableStatusArea = 14, DefaultFontName = 15
}

Public Member Functions

 XIMPublic (IMArg *, int)
 ~XIMPublic ()
int set_values (IMArg *, int)
void select_destroy_emask (Window)
void select_keypress_emask (Window)
void select_keyrelease_emask (Window)
void unselect_destroy_emask (Window)
void unselect_keypress_emask (Window)
void unselect_keyrelease_emask (Window)
XIM getXIM ()
const CompoundStringgetIfName () const
void OpenIM ()
void CloseIM ()
Bool isConversionKey (unsigned int kcode, unsigned int kstate, int convOn)
Display * getDisplay () const
bool dispatch (CARD16BIT im_id, CARD16BIT ic_id, void *message)
virtual bool receive_and_dispatch (IMState *pims, int flags=SYNC)=0
virtual IMStateaccept (int flags=SYNC)=0
int get_values (IMArg *, int)
virtual int run ()=0
int countOnKeys () const
int countOffKeys () const
IMTriggerKeygetOnKey (unsigned int index) const
IMTriggerKeygetOffKey (unsigned int index) const
int countLanguages () const
CompoundStringgetLang (unsigned int index) const
int countObjectDescriptors () const
IMObjectDescriptorStructgetObjectDescriptor (unsigned int index) const
IMObjectDescriptorStructgetFirstObjectDescriptor ()
IMObjectDescriptorStructgetNextObjectDescriptor ()
int countIME () const
IMEditorStructgetIME (unsigned int index) const
IMEditorStructgetFirstIME ()
IMEditorStructgetNextIME ()
const CompoundStringgetPrimaryLocale () const
IMTransAcceptgetIMTransAccept (IMTransListen *trans_listen) const

Public Attributes

IMProtoHandlerproto_handler

Protected Types

enum  XIC_RESET_FLAG { RESET_NOTHING = 0, RESET_BY_CMSG, RESET_BY_PROP }
enum  MODE { OPEN, SET, GET }
typedef map< CARD16BIT, IMState * > IMStateMap

Protected Member Functions

int setSelectionOwner (Window, char *, Atom *)
void add_imstate (IMState *pims)
void remove_imstate (IMState *pims)
IMStateget_imstate (CARD16BIT im_id)
ICStateget_icstate (CARD16BIT im_id, CARD16BIT ic_id)

Protected Attributes

IMList< InputContextinput_context_list
Display * display
XIMTriggerKeys start_keys
XIMTriggerKeys stop_keys
Bool disable_status_area
IMAcceptpimaccept
IMStateMap immap
CompoundString protocol_name
CompoundString im_name
CompoundString im_address
CompoundString input_locale
CompoundString vendor_name
IMLanguageList lang_list
IMTriggerKeyList on_keys
IMTriggerKeyList off_keys
IMObjectDescriptorList od_list
IMEditorDescriptorList ime_list

Private Attributes

XIM xim
XIC root_xic
CompoundString ifname
CompoundString application_name
CompoundString default_font_name

Friends

class IMState

Detailed Description

Definition at line 52 of file XIMPublic.hh.


Member Typedef Documentation

typedef map<CARD16BIT, IMState*> IMProtocol::IMStateMap [protected, inherited]

Definition at line 17 of file IMProtocol.hh.


Member Enumeration Documentation

Enumerator:
SYNC 
ASYNC 

Definition at line 50 of file IMProtocol.hh.

                           {
           SYNC,
           ASYNC
    };
Enumerator:
INVALID_CONTEXT_ID 

Definition at line 40 of file IMProtocol.hh.

                            {
           INVALID_CONTEXT_ID = 0xFFFF
    };
enum IMProtocol::IM_Attribute [inherited]
Enumerator:
ServerName 
TransportAddress 
VendorName 
PrimaryInputLocale 
LanguageList 
ConversionOnKeys 
ConversionOffKeys 
ProtocolHandler 
ObjectDescriptors 
IMEDescriptors 
DisplayConnection 
IFName 
AppName 
DisableStatusArea 
DefaultFontName 

Definition at line 56 of file IMProtocol.hh.

                    {
    ServerName = 1,         // "iiimd"
    TransportAddress = 2,   // "tcp/<hostname>:9010" for iiim,
                            // not used for ximp40
    VendorName = 3,         // "SunMicroSystems", optional
    PrimaryInputLocale = 4,
    LanguageList = 5,
    ConversionOnKeys = 6,
    ConversionOffKeys = 7,
    ProtocolHandler = 8,
    ObjectDescriptors = 9,
    IMEDescriptors = 10,
    DisplayConnection = 11,
    IFName = 12,
    AppName = 13,
    DisableStatusArea = 14,
    DefaultFontName = 15
  };
enum IMProtocol::MODE [protected, inherited]
Enumerator:
OPEN 
SET 
GET 

Definition at line 122 of file IMProtocol.hh.

            {
    OPEN, SET, GET
  };
enum XIMPublic::XIC_RESET_FLAG [protected]
Enumerator:
RESET_NOTHING 
RESET_BY_CMSG 
RESET_BY_PROP 

Definition at line 87 of file XIMPublic.hh.


Constructor & Destructor Documentation

XIMPublic::XIMPublic ( IMArg args,
int  n 
)

Definition at line 157 of file XIMPublic.cpp.

Here is the call graph for this function:

Definition at line 166 of file XIMPublic.cpp.

             {
  delete start_keys.keylist;
  delete stop_keys.keylist;

  return;
}

Member Function Documentation

virtual IMState* IMProtocol::accept ( int  flags = SYNC) [pure virtual, inherited]

Implemented in IIIMProtocol.

Here is the caller graph for this function:

void IMProtocol::add_imstate ( IMState pims) [protected, inherited]

Definition at line 8 of file IMProtocol.cpp.

{
    immap[pims->get_im_id()] = pims;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 144 of file XIMPublic.cpp.

                   {
  if (root_xic) XDestroyIC(root_xic);
  if (xim) XCloseIM(xim);

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IMProtocol::countIME ( ) const [inherited]

Definition at line 97 of file IMProtocol.cpp.

                           {
  return ime_list.count();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IMProtocol::countLanguages ( ) const [inherited]

Definition at line 67 of file IMProtocol.cpp.

                                 {
  return lang_list.count();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IMProtocol::countObjectDescriptors ( ) const [inherited]

Definition at line 77 of file IMProtocol.cpp.

                                         {
  return od_list.count();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IMProtocol::countOffKeys ( ) const [inherited]

Definition at line 52 of file IMProtocol.cpp.

                               {
  return off_keys.count();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int IMProtocol::countOnKeys ( ) const [inherited]

Definition at line 47 of file IMProtocol.cpp.

                              {
  return on_keys.count();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool IMProtocol::dispatch ( CARD16BIT  im_id,
CARD16BIT  ic_id,
void *  message 
) [inherited]

Definition at line 25 of file IMProtocol.cpp.

{
    if (ic_id == INVALID_CONTEXT_ID) {
       IMState *pims = get_imstate(im_id);
       return pims->deliver(message);
    }
    ICState *pics = get_icstate(im_id, ic_id);

    if (!pics) {
       LOG_ERROR("Invalid im_id and ic_id (%d, %d)",
                (int) im_id, (int) ic_id);
       return false;
    }

    return pics->deliver(message);
}

Here is the call graph for this function:

ICState* IMProtocol::get_icstate ( CARD16BIT  im_id,
CARD16BIT  ic_id 
) [inline, protected, inherited]

Definition at line 31 of file IMProtocol.hh.

    {
       IMState *pims;
       pims = get_imstate(im_id);
       if (!pims) return NULL;
       return pims->get_icstate(ic_id);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

IMState* IMProtocol::get_imstate ( CARD16BIT  im_id) [inline, protected, inherited]

Definition at line 24 of file IMProtocol.hh.

    {
       IMStateMap::iterator it;
       it = immap.find(im_id);
       if (it == immap.end()) return NULL;
       return it->second;
    }

Here is the caller graph for this function:

int IMProtocol::get_values ( IMArg args,
int  n 
) [inherited]

Reimplemented in IIIMProtocol.

Definition at line 196 of file IMProtocol.cpp.

                                         {
  return parseArgs(IMProtocol::GET, args, n);
}

Here is the call graph for this function:

Display* XIMPublic::getDisplay ( ) const [inline]

Definition at line 75 of file XIMPublic.hh.

{return display;}

Here is the caller graph for this function:

Definition at line 107 of file IMProtocol.cpp.

                        {
  return ime_list.getFirstIME();
}

Here is the call graph for this function:

Definition at line 87 of file IMProtocol.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 152 of file XIMPublic.cpp.

                           {
  return ifname;
}

Here is the caller graph for this function:

IMEditorStruct & IMProtocol::getIME ( unsigned int  index) const [inherited]

Definition at line 102 of file IMProtocol.cpp.

                                           {
  return ime_list.getIME(index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

IMTransAccept * IMProtocol::getIMTransAccept ( IMTransListen trans_listen) const [inherited]

Definition at line 201 of file IMProtocol.cpp.

{
  return proto_handler->getIMTransAccept(trans_listen);
}

Here is the call graph for this function:

Here is the caller graph for this function:

CompoundString & IMProtocol::getLang ( unsigned int  index) const [inherited]

Definition at line 72 of file IMProtocol.cpp.

                                            {
  return lang_list.getLang(index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 112 of file IMProtocol.cpp.

                       {
  return ime_list.getNextIME();
}

Here is the call graph for this function:

Definition at line 92 of file IMProtocol.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

IMObjectDescriptorStruct & IMProtocol::getObjectDescriptor ( unsigned int  index) const [inherited]

Definition at line 82 of file IMProtocol.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

IMTriggerKey & IMProtocol::getOffKey ( unsigned int  index) const [inherited]

Definition at line 62 of file IMProtocol.cpp.

                                              {
  return off_keys.getKey(index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

IMTriggerKey & IMProtocol::getOnKey ( unsigned int  index) const [inherited]

Definition at line 57 of file IMProtocol.cpp.

                                             {
  return on_keys.getKey(index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const CompoundString & IMProtocol::getPrimaryLocale ( ) const [inherited]

Definition at line 117 of file IMProtocol.cpp.

                                   {
  return input_locale;
}

Here is the caller graph for this function:

Definition at line 138 of file XIMPublic.cpp.

                  {
  if (!xim) OpenIM();
  return xim;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool XIMPublic::isConversionKey ( unsigned int  kcode,
unsigned int  kstate,
int  convOn 
)

Definition at line 219 of file XIMPublic.cpp.

                                      {
  int i;
  KeySym ksym = XKeycodeToKeysym(display, kcode, 0);
  XIMTriggerKey *ximp_keyp;

  if (convOn)
    ximp_keyp = stop_keys.keylist;
  else
    ximp_keyp = start_keys.keylist;

  for (i = 0; i < start_keys.count_keys; i++, ximp_keyp++) {
    if ((ximp_keyp->keysym == ksym) &&
       ((kstate & ximp_keyp->modifier_mask) == ximp_keyp->modifier)) {
      return True;
    }
  }
  return False;
}

Here is the caller graph for this function:

Definition at line 77 of file XIMPublic.cpp.

                  {
  char *tmpmodifiers = NULL;

  if (!dl_module) {
    dl_module = dlopen(XIIIMP_PATH, RTLD_LAZY);
    if (!dl_module) return; // fatal error
    im_openIM =
      (XIM(*)(XLCd, Display*, XrmDatabase, char*, char*))dlsym(dl_module,
                                                        "_IIIMP_OpenIM");
    if (!im_openIM) return; // fatal error
  }
  /* 
     Untidy hack.  When users set XMODIFIERS environment variable beforehand,
     XLC regard it as the modifier specification.   Therefore, if it specifies
     XIM-based IM, _IIIMP_OpenIM would fail to open IM because it could deal with
     only IIIMP-based IM.
  */

  tmpmodifiers = getenv("XMODIFIERS");
  if (tmpmodifiers) {
    unsetenv("XMODIFIERS");
    XSetLocaleModifiers("");
  }
  XLCd lcd = _XlcCurrentLC();
  if (tmpmodifiers) {
    setenv("XMODIFIERS", tmpmodifiers, 1);
    XSetLocaleModifiers("");
  }

  xim = (*im_openIM)(lcd, display, (XrmDatabase) NULL,
                   (char*)0, (char *)0);

  if (xim) {
    char *ret;

    if (ifname.length())
      ret = XSetIMValues(xim,
                      "engineInterfaceName", (char*)ifname,
                      "applicationType", (char*)application_name,
                      0);
    else
      ret = XSetIMValues(xim,
                      "applicationType", (char*)application_name,
                      0);
    if (default_font_name.length())
      ret = XSetIMValues(xim,
                      "defaultFontName", (char*)default_font_name,
                      0);

    // create a root IC for X-AUX initialization
    root_xic =
      XCreateIC(xim,
              XNInputStyle, XIMPreeditCallbacks|XIMStatusCallbacks,
              0);
    if (root_xic)
      XSetICFocus(root_xic);
  }
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool IMProtocol::receive_and_dispatch ( IMState pims,
int  flags = SYNC 
) [pure virtual, inherited]

Implemented in IIIMProtocol.

Here is the caller graph for this function:

void IMProtocol::remove_imstate ( IMState pims) [protected, inherited]

Definition at line 16 of file IMProtocol.cpp.

{
    immap.erase(pims->get_im_id());
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int IMProtocol::run ( ) [pure virtual, inherited]

Implemented in XIMProtocol, IIIMProtocol, and R6IMProtocol.

Here is the caller graph for this function:

void XIMPublic::select_destroy_emask ( Window  win)

Definition at line 240 of file XIMPublic.cpp.

                                          {
  XWindowAttributes win_attr;
  XGetWindowAttributes(display, win, &win_attr);
  XSelectInput(display, win,
              (win_attr.your_event_mask | StructureNotifyMask));
  return;
}

Here is the caller graph for this function:

void XIMPublic::select_keypress_emask ( Window  win)

Definition at line 248 of file XIMPublic.cpp.

                                           {
  XWindowAttributes win_attr;
  XGetWindowAttributes(display, win, &win_attr);
  XSelectInput(display, win, (win_attr.your_event_mask | KeyPressMask));
  return;
}

Here is the caller graph for this function:

void XIMPublic::select_keyrelease_emask ( Window  win)

Definition at line 255 of file XIMPublic.cpp.

                                             {
  XWindowAttributes win_attr;
  XGetWindowAttributes(display, win, &win_attr);
  XSelectInput(display, win, (win_attr.your_event_mask | KeyReleaseMask));
  return;
}

Here is the caller graph for this function:

int XIMPublic::set_values ( IMArg args,
int  n 
) [virtual]

Reimplemented from IMProtocol.

Definition at line 191 of file XIMPublic.cpp.

                                        {
  if (n == 0) return 0;
  for (IMArg *argp = args; argp < &args[n]; argp++) {
    switch (argp->id) {
    case DisplayConnection:
      display = (Display*)argp->value; // extension 
      break;
    case IFName:
      ifname = (char*)argp->value; // extension 
      break;
    case AppName:
      application_name = (char*)argp->value; // extension 
      break;
    case DisableStatusArea:
      disable_status_area = (Bool)(long)argp->value; // extension
      break;
    case DefaultFontName:
      default_font_name = (char*)argp->value; // extension
      break;
    default:
      (void)IMProtocol::set_values(argp, 1);
      break;
    }
  }
  return 0;
}

Here is the call graph for this function:

int XIMPublic::setSelectionOwner ( Window  im_window,
char *  name,
Atom *  selection 
) [protected]

Definition at line 174 of file XIMPublic.cpp.

                                                       {
  Window owner;
  *selection = XInternAtom(display, name, False);

  if ((owner = XGetSelectionOwner(display, *selection)) != im_window) {
    if (owner == None) {
      XSetSelectionOwner(display, *selection, im_window, CurrentTime);
      return True;
    } else {
      return False;
    }
  }
  return True;
}

Here is the caller graph for this function:

void XIMPublic::unselect_destroy_emask ( Window  win)

Definition at line 262 of file XIMPublic.cpp.

                                            {
  XWindowAttributes win_attr;
  XGetWindowAttributes(display, win, &win_attr);
  XSelectInput(display, win,
              (win_attr.your_event_mask & ~StructureNotifyMask));
  return;
}

Here is the caller graph for this function:

void XIMPublic::unselect_keypress_emask ( Window  win)

Definition at line 270 of file XIMPublic.cpp.

                                             {
  XWindowAttributes win_attr;
  XGetWindowAttributes(display, win, &win_attr);
  XSelectInput(display, win,
              (win_attr.your_event_mask & ~KeyPressMask));
  return;
}

Here is the caller graph for this function:

Definition at line 278 of file XIMPublic.cpp.

                                               {
  XWindowAttributes win_attr;
  XGetWindowAttributes(display, win, &win_attr);
  XSelectInput(display, win,
              (win_attr.your_event_mask & ~KeyReleaseMask));
  return;
}

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class IMState [friend, inherited]

Definition at line 60 of file IMProtocol.hh.


Member Data Documentation

Definition at line 99 of file XIMPublic.hh.

Definition at line 100 of file XIMPublic.hh.

Definition at line 93 of file XIMPublic.hh.

Display* XIMPublic::display [protected]

Definition at line 80 of file XIMPublic.hh.

Definition at line 98 of file XIMPublic.hh.

CompoundString IMProtocol::im_address [protected, inherited]

Definition at line 111 of file IMProtocol.hh.

CompoundString IMProtocol::im_name [protected, inherited]

Definition at line 110 of file IMProtocol.hh.

Definition at line 120 of file IMProtocol.hh.

IMStateMap IMProtocol::immap [protected, inherited]

Definition at line 18 of file IMProtocol.hh.

Definition at line 78 of file XIMPublic.hh.

CompoundString IMProtocol::input_locale [protected, inherited]

Definition at line 112 of file IMProtocol.hh.

IMLanguageList IMProtocol::lang_list [protected, inherited]

Definition at line 114 of file IMProtocol.hh.

Definition at line 118 of file IMProtocol.hh.

IMTriggerKeyList IMProtocol::off_keys [protected, inherited]

Definition at line 116 of file IMProtocol.hh.

IMTriggerKeyList IMProtocol::on_keys [protected, inherited]

Definition at line 115 of file IMProtocol.hh.

IMAccept* IMProtocol::pimaccept [protected, inherited]

Definition at line 15 of file IMProtocol.hh.

Definition at line 103 of file IMProtocol.hh.

CompoundString IMProtocol::protocol_name [protected, inherited]

Definition at line 109 of file IMProtocol.hh.

XIC XIMPublic::root_xic [private]

Definition at line 96 of file XIMPublic.hh.

Definition at line 82 of file XIMPublic.hh.

Definition at line 83 of file XIMPublic.hh.

CompoundString IMProtocol::vendor_name [protected, inherited]

Definition at line 113 of file IMProtocol.hh.

XIM XIMPublic::xim [private]

Definition at line 95 of file XIMPublic.hh.


The documentation for this class was generated from the following files: