Back to index

im-sdk  12.3.91
Classes | Enumerations | Functions | Variables
guiIM.c File Reference
#include "guiIM.h"
#include "XimpIm.h"
#include "iiimpDL.h"
#include <X11/Xatom.h>

Go to the source code of this file.

Classes

struct  IMSettings

Enumerations

enum  IMStatusPlacement { ON_DESKTOP_PANEL, ATTACH_TO_APP_FRAME, ON_DESKTOP_PANEL, ATTACH_TO_APP_FRAME }
enum  IMEnabled {
  IM_OFF = 0, IM_ON, IM_OFF = 0, IM_ON,
  IM_OFF = 0, IM_ON, IM_OFF = 0, IM_ON
}

Functions

static Bool GetIMSettingsPropertyFilter (Display *display, Window window, XEvent *event, XPointer client_data)
static void ChangeStatus (XIC, StatusAttr, XPointer)
static void ChangePreedit (XIC, PreeditAttr, XPointer)
static Bool SetInputStyle (XicCommon ic, XIMArg *values)
XICGUI CreateGUI (XicCommon ic, XIMArg *arg)
void DestroyGUI (XicCommon ic)
void SetScreenNumber (XicCommon ic)
Bool GetIMSettings (XicCommon ic)
Bool IsIMEnabled ()
Bool IsIMStatusEnabled ()
Bool IsIMStatusAttached ()
Bool IsIMLookupEnabled ()

Variables

static IMSettings current_setting
static Bool current_setting_enabled
static Atom im_settings_atom = None
static const char * _IM_SETTINGS = "_IM_SETTINGS"

Class Documentation

struct IMSettings

Definition at line 47 of file im_settings_daemon.c.

Class Members
IMEnabled im_enabled
IMEnabled lookup_enabled
IMEnabled status_enabled
IMStatusPlacement status_placement

Enumeration Type Documentation

enum IMEnabled
Enumerator:
IM_OFF 
IM_ON 
IM_OFF 
IM_ON 
IM_OFF 
IM_ON 
IM_OFF 
IM_ON 

Definition at line 53 of file guiIM.c.

             {
  IM_OFF = 0,
  IM_ON
} IMEnabled;
Enumerator:
ON_DESKTOP_PANEL 
ATTACH_TO_APP_FRAME 
ON_DESKTOP_PANEL 
ATTACH_TO_APP_FRAME 

Definition at line 48 of file guiIM.c.


Function Documentation

static void ChangePreedit ( XIC  xic,
PreeditAttr  reason,
XPointer  call_data 
) [static]

Definition at line 174 of file guiIM.c.

                                                               {
  /* do nothing  */
  return;
}

Here is the caller graph for this function:

static void ChangeStatus ( XIC  xic,
StatusAttr  reason,
XPointer  call_data 
) [static]

Definition at line 168 of file guiIM.c.

                                                             {
  /* do nothing  */
  return;
}

Here is the caller graph for this function:

XICGUI CreateGUI ( XicCommon  ic,
XIMArg arg 
)

Definition at line 129 of file guiIM.c.

                                     {
  XICGUIRec* gui_icpart = 0;
  XimCommon im = (XimCommon)ic->core.im;
  Display *display = im->core.display;

  gui_icpart = (XICGUIRec*)Xmalloc(sizeof(XICGUIRec));
  if (!gui_icpart) return 0;

  memset(gui_icpart, 0, sizeof(XICGUIRec));
  ic->gui_icpart = gui_icpart;

  XIC_GUI(ic, change_status) = ChangeStatus; /* default */
  XIC_GUI(ic, change_preedit) = ChangePreedit; /* default */

  SetScreenNumber(ic);

  if (im_settings_atom == None)
    im_settings_atom = XInternAtom (display, _IM_SETTINGS, False);

  _XRegisterFilterByType (display,
                       RootWindow(display, XIC_GUI(ic, screen_number)),
                       PropertyNotify, PropertyNotify,
                       GetIMSettingsPropertyFilter, (XPointer)ic);

  /* register a handler for dl_impart to return key events */
  if (im->dl_impart &&
      im->dl_impart->register_forwardevent)
    im->dl_impart->register_forwardevent((XIC)ic, IMForwardEvent);

  /* Need to set inputstyle to the ic first */
  if (!SetInputStyle(ic, arg)) {
    Xfree(gui_icpart);
    return 0;
  }
  ic->gui_icpart = gui_icpart;
  return gui_icpart;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DestroyGUI ( XicCommon  ic)

Definition at line 180 of file guiIM.c.

                         {
  if (ic->gui_icpart) Xfree(ic->gui_icpart);
  ic->gui_icpart = 0;
}

Here is the caller graph for this function:

Definition at line 201 of file guiIM.c.

{
  Atom type;
  unsigned char *data = NULL;
  int format;
  unsigned long length = 0, bytes_after;
  Display *display = ic->core.im->core.display;

  if (XGetWindowProperty (display,
                       RootWindow(display, XIC_GUI(ic, screen_number)),
                       im_settings_atom, 0L, 1000000L,
                       False, AnyPropertyType, &type, &format, &length,
                       &bytes_after, (unsigned char **)&data ) == Success &&
      data != NULL)
    {
      memmove (&current_setting, data, sizeof (IMSettings));
      Xfree (data);
      current_setting_enabled = True;
      return True;
    }
  else
    current_setting_enabled = False;
  return False;
}

Here is the caller graph for this function:

static Bool GetIMSettingsPropertyFilter ( Display *  display,
Window  window,
XEvent *  event,
XPointer  client_data 
) [static]

Definition at line 227 of file guiIM.c.

{
  if (event->xproperty.atom != im_settings_atom)
    return False;

  return GetIMSettings ((XicCommon)client_data);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 238 of file guiIM.c.

Here is the caller graph for this function:

Definition at line 261 of file guiIM.c.

Here is the caller graph for this function:

Definition at line 253 of file guiIM.c.

Here is the caller graph for this function:

static Bool SetInputStyle ( XicCommon  ic,
XIMArg values 
) [static]

Definition at line 79 of file guiIM.c.

                                            {
  XIMArg *p;
  XimCommon im = (XimCommon)ic->core.im;
  Bool status = False;

  for (p = values; p->name != NULL; p++) {
    if (strcmp(p->name, XNInputStyle) == 0) {
      ic->core.input_style = (XIMStyle)p->value;
      ic->ximp_icpart->value_mask |= XIMP_INPUT_STYLE;

      if (ic->core.input_style & XIMStatusArea)
       XIC_GUI(ic, change_status) = ChangeStatusArea;
      else if (ic->core.input_style & XIMStatusNothing)
       XIC_GUI(ic, change_status) = ChangeStatusNothing;

      if (ic->core.input_style & XIMPreeditArea)
       XIC_GUI(ic, change_preedit) = ChangePreeditArea;
      else if (ic->core.input_style & XIMPreeditPosition)
       XIC_GUI(ic, change_preedit) = ChangePreeditPosition;
      else if (ic->core.input_style & XIMPreeditNothing)
       XIC_GUI(ic, change_preedit) = ChangePreeditNothing;
      status = True;
      break;
    }
  }
  /* Set fallback lookup method */
  XIC_GUI(ic, change_lookup) = ChangeLookup;

  if (im->dl_impart) {
    XIMStyles *styles = im->dl_impart->styles;
    int i;
    if (styles && styles->count_styles != 0) {
      for (i = 0; i < styles->count_styles; i++) {
       if (ic->core.input_style == styles->supported_styles[i]) {
         if (im->dl_impart->change_status)
           XIC_GUI(ic, change_status) = im->dl_impart->change_status;
         if (im->dl_impart->change_preedit)
           XIC_GUI(ic, change_preedit) = im->dl_impart->change_preedit;
         if (im->dl_impart->change_lookup)
           XIC_GUI(ic, change_lookup) = im->dl_impart->change_lookup;
         break;
       }
      }
    }
  }

  return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetScreenNumber ( XicCommon  ic)

Definition at line 186 of file guiIM.c.

                              {
  XWindowAttributes attr;
  if (None != ic->core.focus_window) {
    if (XGetWindowAttributes(ic->core.im->core.display,
                          ic->core.focus_window, &attr)) {
      XIC_GUI(ic, screen_number) = XScreenNumberOfScreen(attr.screen);
    } else {
      XIC_GUI(ic, screen_number) = DefaultScreen(ic->core.im->core.display);
    }
  } else {
    XIC_GUI(ic, screen_number) = DefaultScreen(ic->core.im->core.display);
  }
}

Here is the caller graph for this function:


Variable Documentation

const char* _IM_SETTINGS = "_IM_SETTINGS" [static]

Definition at line 68 of file guiIM.c.

Definition at line 65 of file guiIM.c.

Definition at line 66 of file guiIM.c.

Atom im_settings_atom = None [static]

Definition at line 67 of file guiIM.c.