Back to index

im-sdk  12.3.91
Classes | Typedefs | Functions
guiIMPre.h File Reference
#include "guiIM.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PreeditCharsRec
struct  _PreeditLineRec
struct  _PreeditAreaRec
struct  _PreeditWinRec
struct  _PreeditAreaRec.win_config

Typedefs

typedef struct _PreeditCharsRec PreeditCharsRec
typedef struct _PreeditCharsRecPreeditChars
typedef struct _PreeditLineRec PreeditLineRec
typedef struct _PreeditLineRecPreeditLine
typedef struct _PreeditAreaRec PreeditAreaRec
typedef struct _PreeditAreaRecPreeditArea
typedef struct _PreeditWinRec PreeditWinRec
typedef void(* PreeditCB )(XicCommon, XPointer)

Functions

Bool FilterConfigureNotify (Display *, Window, XEvent *, XPointer)
void UnmapPreeditWindow (XicCommon, PreeditArea)
Bool SetupPreeditExt (XicCommon)
Bool NewPreeditWindow (XicCommon)
Bool SetupPreeditWindow (XicCommon, Window)
void SetPreeditForeground (XicCommon, XPointer)
void SetPreeditBackground (XicCommon, XPointer)
void SetPreeditFont (XicCommon, XPointer)
void PreeditStart (XicCommon, XPointer)
void PreeditCaret (XicCommon, XPointer)
void PreeditDrawText (XicCommon, XPointer)
void PreeditDone (XicCommon, XPointer)
void DestroyPreedit (XicCommon, XPointer)
void PreeditCaretAdjustLookupPlacement (XicCommon, XPoint *)
void PreeditCaretPlacement (XicCommon, XPoint *)
void PreeditCaretPlacementRelative (XicCommon, XPoint *)

Class Documentation

struct _PreeditCharsRec

Definition at line 47 of file guiIMPre.h.

Collaboration diagram for _PreeditCharsRec:
Class Members
int alloc_len
int caret_pos
XIMFeedback * feedback
IMFeedbackList * feedback_list
wchar_t * wchar
int wchar_len
unsigned short * wchar_width
struct _PreeditLineRec

Definition at line 57 of file guiIMPre.h.

Class Members
int char_len
int char_offset
int x
int y
struct _PreeditAreaRec

Definition at line 64 of file guiIMPre.h.

Collaboration diagram for _PreeditAreaRec:
Class Members
int active_lines
int alloc_lines
int char_len
int char_len_backup
int char_offset
int char_offset_backup
Bool configured
PreeditLine lines
Bool mapped
struct _PreeditAreaRec win_config
Window window
int x
int y
struct _PreeditWinRec

Definition at line 85 of file guiIMPre.h.

Collaboration diagram for _PreeditWinRec:
Class Members
int active_areas
int alloc_areas
int client_window_height
int client_window_width
Bool discard_expose_event
XFontSet fontset
XFontSetExtents * fse
GC gc
Bool need_free_fontset
Window parent
PreeditArea preedit_areas
CacheRec preedit_cache
PreeditCharsRec preedit_chars
PreeditCharsRec preedit_chars_backup
GC rgc
struct _PreeditAreaRec.win_config

Definition at line 77 of file guiIMPre.h.

Class Members
int height
int width
int x
int y

Typedef Documentation

typedef struct _PreeditAreaRec * PreeditArea
typedef void(* PreeditCB)(XicCommon, XPointer)

Definition at line 103 of file guiIMPre.h.

typedef struct _PreeditCharsRec * PreeditChars
typedef struct _PreeditLineRec * PreeditLine
typedef struct _PreeditWinRec PreeditWinRec

Function Documentation

void DestroyPreedit ( XicCommon  ,
XPointer   
)

Definition at line 1454 of file guiIMPre.c.

                                                 {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  int i;
  PreeditArea preedit_area;

  if (!preedit) return;

  if (preedit->fontset && preedit->need_free_fontset) {
    XFactoryFreeDefaultFontSet (ic->core.im->core.display);
    preedit->need_free_fontset = False;
  }
#if 0
  PreeditDone(ic, NULL);
#else
  _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window,
                   FilterConfigureNotify, (XPointer)ic);
#endif

  preedit_area = (PreeditArea)(preedit->preedit_areas);
  for (i = 0; i < preedit->alloc_areas; i++) {
    _XUnregisterFilter(ic->core.im->core.display, 
                     preedit_area[i].window,
                     RepaintPreedit, (XPointer)ic);
    _XUnregisterFilter(ic->core.im->core.display, 
                     preedit_area[i].window,
                     FilterKeyPress, (XPointer)ic);
  }

  if (preedit->gc) XFreeGC(ic->core.im->core.display, preedit->gc);
  if (preedit->rgc) XFreeGC(ic->core.im->core.display, preedit->rgc);

  for (i = 0; i < preedit->alloc_areas; i++) {
    if (ic->core.input_style & XIMPreeditNothing) {
      /* check the window is valid before XDestroyWindow() */
      if(IMCheckIMWindow(ic, preedit_area[i].window)) {
        XDestroyWindow(ic->core.im->core.display, preedit_area[i].window);
      }
    }
  }
  if (preedit->preedit_areas) Xfree(preedit->preedit_areas);
  Xfree(preedit);
  ic->gui_icpart->preedit = (PreeditWin)NULL;
  return;
}

Here is the call graph for this function:

Bool FilterConfigureNotify ( Display *  ,
Window  ,
XEvent *  ,
XPointer   
)

Definition at line 119 of file guiIMPre.c.

                                                                              {
  XicCommon ic = (XicCommon)client_data;

  if (!ic->gui_icpart || NULL == XIC_GUI(ic, preedit)) {
    /* perhaps the ic has been destroyed already */
    return False;
  }
  if (NULL != ev) {
    if (ConfigureNotify == ev->type) {
      if (((XConfigureEvent *)ev)->window == ic->core.focus_window) {
       XIC_GUI(ic, preedit)->client_window_width =
              ((XConfigureEvent *)ev)->width;
       XIC_GUI(ic, preedit)->client_window_height =
              ((XConfigureEvent *)ev)->height;
       XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_WIN, NULL);
       UpdatePreedit(ic, 0, 0);
      }
    }
  } else {
    if (w == ic->core.focus_window) {
      XWindowAttributes attr;
      if (XGetWindowAttributes(d, w, &attr)) {
       XIC_GUI(ic, preedit)->client_window_width = attr.width;
       XIC_GUI(ic, preedit)->client_window_height = attr.height;
      }
    }
  }

  return False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 454 of file guiIMPre.c.

                               {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  Window win;
  int x, y;
  unsigned int width, height;
  unsigned long fg, bg;
  Display *display = ic->core.im->core.display;
  PreeditArea preedit_area = (PreeditArea)NULL;
  int n;
  int nn;
  int mask;
  XIMFilterRec filters[2];
  XClassHint class_hint;

  if (!preedit) return False;

  if (XIMP_CHK_PREAREAMASK(ic)) {
    x = ic->core.preedit_attr.area.x;
    y = ic->core.preedit_attr.area.y;
    width   = ic->core.preedit_attr.area.width;
    height  = ic->core.preedit_attr.area.height;
  } else if (XIMP_CHK_PRESPOTLMASK(ic)) {
    x = ic->core.preedit_attr.spot_location.x;
    y = ic->core.preedit_attr.spot_location.y;
    width = height = 1;
  } else {
    x  = y = 0;
    width = height = 1;
  }

  if (preedit->alloc_areas == 0 || !preedit->preedit_areas) {
    preedit->alloc_areas = 1;
    preedit->active_areas = 1;
    preedit->preedit_areas = (PreeditArea)Xmalloc(sizeof(PreeditAreaRec));
    if (!preedit->preedit_areas) {
      return False;
    }
    memset((char *)preedit->preedit_areas, 0, sizeof(PreeditAreaRec));
  } else {
    preedit->alloc_areas++;
    preedit->active_areas++;
    preedit->preedit_areas = (PreeditArea)
      Xrealloc(preedit->preedit_areas, sizeof(PreeditAreaRec) *
              preedit->alloc_areas);
    if (!preedit->preedit_areas) {
      return False;
    }
  }
  preedit_area = preedit->preedit_areas;
  n = preedit->alloc_areas;

  preedit_window_fg_and_bg(ic, &fg, &bg);

  mask = None;
  nn = 0;
  filters[nn].type = KeyPress;
  filters[nn].filter = FilterKeyPress;
  filters[nn].client_data = (XPointer)ic;
  mask |= KeyPressMask;
  nn++;
  filters[nn].type = Expose;
  filters[nn].filter = RepaintPreedit;
  filters[nn].client_data = (XPointer)ic;
  nn++;
  mask |= ExposureMask;

  width = height = 1;
  win = XFactoryCreateIMWindow(display, preedit->parent,
                            ic->core.client_window,
                            x, y, width, height, bg,
                            mask, filters, nn);
  if (!win) return False;

  if (ic->core.input_style & XIMPreeditArea ||
      ic->core.input_style & XIMPreeditPosition) {
    /* set override-redirect to true */
    XSetWindowAttributes attributes;
    int cmask = 0;
    cmask |= CWOverrideRedirect;
    attributes.override_redirect = True;
    XChangeWindowAttributes(ic->core.im->core.display, win,
                         cmask, &attributes);
  }

  XStoreName(display, win, "iiimx IM Preedit");

  class_hint.res_name = "iiimx-im-preedit";
  class_hint.res_class = "IiimxImPreedit";
  XSetClassHint(display, win, &class_hint);

  if (!(ic->core.input_style & XIMPreeditNothing)) {
    /* bug fix:
          4295973: preedit text is invisible in XIMPreeditNothing
       We don't know why backing store with XIMPreeditNothing causes
       4295973, but having the codes commented out will fix it.
    */
    XSetWindowAttributes attributes;
    mask = 0;
    attributes.bit_gravity = NorthWestGravity;
    mask |= CWBitGravity;
    attributes.backing_store = WhenMapped;
    mask |= CWBackingStore;
    XChangeWindowAttributes(display, win, mask, &attributes);
  }
#if 0
  if (XIMP_CHK_PREFGMASK(ic) && XIMP_CHK_PREBGMASK(ic)) {
    create_preedit_gc(display, win, preedit,
                    ic->core.preedit_attr.foreground,
                    ic->core.preedit_attr.background);
  }
#endif

  preedit_area[n-1].window = win;
  preedit_area[n-1].char_offset = 0;
  preedit_area[n-1].char_len = 0;
  preedit_area[n-1].char_offset_backup = 0;
  preedit_area[n-1].char_len_backup = 0;
  preedit_area[n-1].active_lines = 0;
  preedit_area[n-1].alloc_lines = 0;
  preedit_area[n-1].mapped = False;
  preedit_area[n-1].win_config.x = x;
  preedit_area[n-1].win_config.y = y;
  preedit_area[n-1].win_config.width = width;
  preedit_area[n-1].win_config.height = height;


  return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PreeditCaret ( XicCommon  ,
XPointer   
)

Definition at line 1414 of file guiIMPre.c.

                                               {
  /* do nothing */
  return;
}
void PreeditCaretAdjustLookupPlacement ( XicCommon  ,
XPoint *   
)

Definition at line 1500 of file guiIMPre.c.

                                                                {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  PreeditArea preedit_area;
  PreeditChars preedit_chars;
  int  escapement = 0; 
  int vertical = 0;
  int i;

  if (NULL == preedit) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
    preedit = (PreeditWin)(ic->gui_icpart->preedit);
  }
  if (NULL != preedit) {
    preedit_area = (PreeditArea)(preedit->preedit_areas);
    preedit_chars = (PreeditChars)&(preedit->preedit_chars);
    for (i = 0; i < preedit->alloc_areas; i++) {
      if (preedit_area[i].active_lines == 0) {
       int char_offset = preedit_area[i].char_offset;
       int char_len = preedit_area[i].char_len;
       if ((char_offset <= preedit_chars->caret_pos) &&
           (preedit_chars->caret_pos <= (char_offset + char_len))) {
         if (char_offset != preedit_chars->caret_pos) {
           escapement = XwcTextEscapement(preedit->fontset,
                                      preedit_chars->wchar + 
                                      preedit_chars->caret_pos,
                                      preedit_chars->caret_pos -
                                      char_offset);
         }
         vertical = (ic->core.preedit_attr.area.height * i);
         point->x += escapement;
         point->y += vertical;
         TRACE_MESSAGE('p', ("caret_pos=%d escapement=%d vertical=%d\n",
                           preedit_chars->caret_pos, escapement, vertical));
         return;
       }
      }
    }
    if ((preedit_chars->caret_pos <= 0) ||
       (preedit_chars->wchar_len <= preedit_chars->caret_pos)) {
      return;
    }
    if (0 < preedit_chars->caret_pos) {
      escapement = XwcTextEscapement(preedit->fontset,
                                 preedit_chars->wchar,
                                 preedit_chars->caret_pos);
    }
    TRACE_MESSAGE('p', ("caret_pos=%d escapement=%d len=%d caret=%d\n",
                     preedit_chars->caret_pos, escapement,
                     preedit_chars->wchar_len, preedit_chars->caret_pos));
  }
  return;
}
void PreeditCaretPlacement ( XicCommon  ,
XPoint *   
)

Definition at line 1554 of file guiIMPre.c.

{
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  PreeditArea preedit_area;
  PreeditChars preedit_chars;
  int  x = 0; 
  int y = 0;
  int i;

  if (NULL == preedit) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
    preedit = (PreeditWin)(ic->gui_icpart->preedit);
  }
  if (NULL != preedit) {
    preedit_area = (PreeditArea)(preedit->preedit_areas);
    preedit_chars = (PreeditChars)&(preedit->preedit_chars);

    if (preedit_area == 0 || preedit_chars == 0 ||
       preedit_chars->wchar == 0) {
      return;
    }
    for (i = 0; i < preedit->alloc_areas; i++) {
      int char_offset = preedit_area[i].char_offset;
      int char_len = preedit_area[i].char_len;

      if (preedit_area[i].active_lines == 0) {
       if ((char_offset <= preedit_chars->caret_pos) &&
           (preedit_chars->caret_pos <= (char_offset + char_len))) {

         XFontSetExtents *fse = 0;
         if (!preedit->fontset) {
           SetPreeditFont(ic, NULL);
         }
         fse = XExtentsOfFontSet(preedit->fontset);

         if (char_offset != preedit_chars->caret_pos) {
           x = XwcTextEscapement(preedit->fontset,
                              preedit_chars->wchar + 
                              char_offset,
                              preedit_chars->caret_pos -
                              char_offset);
         } else {
           x = 0;
         }
         y = (-fse->max_ink_extent.y);
         XFactoryGetLocationOnScreen(ic->core.im->core.display,
                                  preedit_area[i].window,
                                  x, y, point);
         TRACE_MESSAGE('p', ("caret_pos=%d escapement=%d vertical=%d\n",
                           preedit_chars->caret_pos, x, y));
         return;

       }
      } else {
       PreeditLine line = (PreeditLine)preedit_area[i].lines;
       int j;

       for (j = 0; j < preedit_area[i].active_lines; j++) {
         if ((line[j].char_offset <= preedit_chars->caret_pos) &&
             (preedit_chars->caret_pos < (line[j].char_offset + line[j].char_len))) {
           XFontSetExtents *fse = 0;
           if (!preedit->fontset) {
             SetPreeditFont(ic, NULL);
           }
           fse = XExtentsOfFontSet(preedit->fontset);
           if (line[j].char_offset != preedit_chars->caret_pos) {
             x = XwcTextEscapement(preedit->fontset,
                                preedit_chars->wchar + 
                                line[j].char_offset,
                                preedit_chars->caret_pos -
                                line[j].char_offset);
           } else {
             x = 0;
           }
           y = ((fse->max_logical_extent.height * j) +
               (-fse->max_ink_extent.y));
           XFactoryGetLocationOnScreen(ic->core.im->core.display,
                                   preedit_area[i].window,
                                   x, y, point);
           TRACE_MESSAGE('p', ("caret_pos=%d escapement=%d vertical=%d\n",
                            preedit_chars->caret_pos, x, y));
           return;
         }
       }
      }
    }
  }
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PreeditCaretPlacementRelative ( XicCommon  ,
XPoint *   
)

Definition at line 1645 of file guiIMPre.c.

{
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  PreeditArea preedit_area;
  PreeditChars preedit_chars;
  int  x = 0; 
  int y = 0;
  int i;
  int new_x;
  int new_y;
  Window child;


  if (NULL == preedit) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
    preedit = (PreeditWin)(ic->gui_icpart->preedit);
  }
  if (NULL != preedit) {
    preedit_area = (PreeditArea)(preedit->preedit_areas);
    preedit_chars = (PreeditChars)&(preedit->preedit_chars);

    for (i = 0; i < preedit->alloc_areas; i++) {
      int char_offset = preedit_area[i].char_offset;
      int char_len = preedit_area[i].char_len;

      if (preedit_area[i].active_lines == 0) {
       if ((char_offset <= preedit_chars->caret_pos) &&
           (preedit_chars->caret_pos <= (char_offset + char_len))) {
         XFontSetExtents *fse = 0;
         if (0 == preedit_chars->wchar_len) {
           if (XIMP_CHK_PREAREAMASK(ic)) {
             x = ic->core.preedit_attr.area.x;
             y = ic->core.preedit_attr.area.y;
           } else if (XIMP_CHK_PRESPOTLMASK(ic)) {
             x = ic->core.preedit_attr.spot_location.x;
             y = ic->core.preedit_attr.spot_location.y;
           } else {
             x  = y = 0;
           }
           return;
         }
         if (!preedit->fontset) {
           SetPreeditFont(ic, NULL);
         }
         fse = XExtentsOfFontSet(preedit->fontset);

         if (char_offset != preedit_chars->caret_pos) {
           x = XwcTextEscapement(preedit->fontset,
                              preedit_chars->wchar + 
                              char_offset,
                              preedit_chars->caret_pos -
                              char_offset);
         } else {
           x = 0;
         }
         y = fse->max_logical_extent.height;
         y += (fse->max_ink_extent.height + fse->max_ink_extent.y);

         XTranslateCoordinates(ic->core.im->core.display,
                            preedit_area[i].window,
                            ic->core.focus_window,
                            x, y, &new_x, &new_y, &child);
         point->x = new_x;
         point->y = new_y;

         TRACE_MESSAGE('p', ("caret_pos=%d escapement=%d vertical=%d\n",
                           preedit_chars->caret_pos, x, y));
         return;

       }
      } else {
       PreeditLine line = (PreeditLine)preedit_area[i].lines;
       int j;

       for (j = 0; j < preedit_area[i].active_lines; j++) {
         if ((line[j].char_offset <= preedit_chars->caret_pos) &&
             (preedit_chars->caret_pos < (line[j].char_offset + line[j].char_len))) {
           XFontSetExtents *fse = 0;
           if (0 == preedit_chars->wchar_len) {
             if (XIMP_CHK_PREAREAMASK(ic)) {
              x = ic->core.preedit_attr.area.x;
              y = ic->core.preedit_attr.area.y;
             } else if (XIMP_CHK_PRESPOTLMASK(ic)) {
              x = ic->core.preedit_attr.spot_location.x;
              y = ic->core.preedit_attr.spot_location.y;
             } else {
              x  = y = 0;
             }
             return;
           }
           if (!preedit->fontset) {
             SetPreeditFont(ic, NULL);
           }
           fse = XExtentsOfFontSet(preedit->fontset);
           if (line[j].char_offset != preedit_chars->caret_pos) {
             x = XwcTextEscapement(preedit->fontset,
                                preedit_chars->wchar + 
                                line[j].char_offset,
                                preedit_chars->caret_pos -
                                line[j].char_offset);
           } else {
             x = 0;
           }
           y = (fse->max_logical_extent.height * (j + 1));
           y += (fse->max_ink_extent.height + fse->max_ink_extent.y);

           XTranslateCoordinates(ic->core.im->core.display,
                              preedit_area[i].window,
                              ic->core.focus_window,
                              x, y, &new_x, &new_y, &child);
           point->x = new_x;
           point->y = new_y;

           TRACE_MESSAGE('p', ("caret_pos=%d escapement=%d vertical=%d\n",
                            preedit_chars->caret_pos, x, y));
           return;
         }
       }
      }
    }
  }
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PreeditDone ( XicCommon  ,
XPointer   
)

Definition at line 1420 of file guiIMPre.c.

                                              {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  PreeditArea preedit_area;
  PreeditChars preedit_chars;
  int i;

  if (!preedit) return;

  _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window,
                   FilterConfigureNotify, (XPointer)ic);

  preedit_area = (PreeditArea)(preedit->preedit_areas);
  preedit_chars = (PreeditChars)&(preedit->preedit_chars);

  if (preedit_chars->feedback) Xfree((char*)preedit_chars->feedback);
  if (preedit_chars->wchar) Xfree((char*)preedit_chars->wchar);
  if (preedit_chars->wchar_width)
    Xfree((char*)preedit_chars->wchar_width);
  FreeFeedbackList(preedit_chars->feedback_list, 
                 preedit_chars->alloc_len);
  preedit_chars->feedback_list = NULL;
  preedit_chars->feedback = NULL;
  preedit_chars->wchar = NULL;
  preedit_chars->wchar_width = NULL;
  preedit_chars->wchar_len = 0;
  preedit_chars->alloc_len = 0;

  for (i = 0; i < preedit->alloc_areas; i++) {
    UnmapPreeditWindow(ic, preedit_area + i);
  }
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PreeditDrawText ( XicCommon  ,
XPointer   
)

Definition at line 1340 of file guiIMPre.c.

                                          {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  PreeditChars preedit_chars;
  int chg_first;
  int chg_length;
  XIMDrawTextStruct *preedit_draw = (XIMDrawTextStruct*)p;
  XIMPreeditDrawCallbackStruct *call_data =
    (XIMPreeditDrawCallbackStruct*)preedit_draw->call_data;
  XIMText *text = (XIMText*)call_data->text;
  IMFeedbackList *feedback_list = preedit_draw->feedback_list;

  if (!preedit) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
    preedit = (PreeditWin)(ic->gui_icpart->preedit);
    if (!preedit) return;
  }

  preedit_chars = (PreeditChars)&(preedit->preedit_chars);
  if (preedit_chars->alloc_len == 0) {
    if (text) {
      /* Start drawing preedit without calling preedit_start */
      PreeditStart(ic, NULL);
    } else {
      return;               /* nothing to do */
    }
  }

#if 0
  if (call_data->chg_first == preedit_chars->wchar_len) {
    /* append from right most position */
    if (text && text->length > 0) change_len = text->length;
  }else if ((call_data->chg_first + call_data->chg_length
            == preedit_chars->wchar_len) && !text) {
    /* delete from right most position */
    change_len = call_data->chg_length;
  } else {
    /* other operations */
    change_len = preedit_chars->wchar_len - call_data->chg_first;
    change_len -= call_data->chg_length;
    if (text && text->length > 0) change_len += text->length;
  }
#endif /* 0 */

  chg_first = call_data->chg_first;
  chg_length = call_data->chg_length;

  TRACE_MESSAGE('p', ("PreeditDrawText: chg_first = %d chg_length = %d, %d %d, caret = %d\n",
                    call_data->chg_first, call_data->chg_length,
                    chg_first, chg_length, call_data->caret));

#if 1
  PreeditReplaceString(ic, preedit,
                     &chg_first, &chg_length, text, feedback_list);

#else /* 0 */
  if (call_data->chg_length) {
    PreeditDelete(preedit_chars,
                call_data->chg_first, call_data->chg_length);
  }
  PreeditInsert(ic, preedit_chars, call_data->chg_first,
              text, feedback_list);
#endif /* 0 */
  PreeditCursor(preedit_chars, call_data->caret);
  XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_WIN, NULL);
#if 1
  UpdatePreedit(ic, chg_first, chg_length);
#else /* 0 */
  UpdatePreedit(ic, call_data->chg_first, change_len);
#endif /* 0 */

  return;
}

Here is the call graph for this function:

void PreeditStart ( XicCommon  ,
XPointer   
)

Definition at line 1299 of file guiIMPre.c.

                                               {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  PreeditChars preedit_chars;

  if (!preedit) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
    preedit = (PreeditWin)(ic->gui_icpart->preedit);
    if (!preedit) return;
  }
  preedit_chars = (PreeditChars)&(preedit->preedit_chars);
  preedit_chars->caret_pos = 0;
  preedit_chars->wchar_len = 0;
  preedit_chars->alloc_len = 16;
  preedit_chars->wchar = Xmalloc(sizeof(wchar_t) *
                             preedit_chars->alloc_len);
  preedit_chars->wchar_width = Xmalloc(sizeof(unsigned short) *
                                   preedit_chars->alloc_len);
  preedit_chars->feedback = Xmalloc(sizeof(XIMFeedback) *
                                preedit_chars->alloc_len);
  preedit_chars->feedback_list = Xmalloc(sizeof(IMFeedbackList) *
                                    preedit_chars->alloc_len);
  memset(preedit_chars->wchar, 0,
        sizeof(wchar_t) * preedit_chars->alloc_len);
  memset(preedit_chars->wchar_width, 0,
        sizeof(unsigned short) * preedit_chars->alloc_len);
  memset(preedit_chars->feedback, 0,
        sizeof(XIMFeedback) * preedit_chars->alloc_len);
  memset(preedit_chars->feedback_list, 0,
        sizeof(IMFeedbackList) * preedit_chars->alloc_len);

  FilterConfigureNotify(ic->core.im->core.display,
                     ic->core.focus_window,
                     NULL, (XPointer)ic);
  _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window,
                      ConfigureNotify, ConfigureNotify,
                      FilterConfigureNotify, (XPointer)ic);

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 683 of file guiIMPre.c.

                                                       {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  CacheRec *preedit_cache;
  int i;

  if (!preedit) return;  /* Let's do it later */

  preedit_cache = (CacheRec*)&(preedit->preedit_cache);

  TRACE_MESSAGE('p', ("SetPreeditBackground: %d %d\n",
                    preedit_cache->background,
                    ic->core.preedit_attr.background));

  if (preedit_cache->background == ic->core.preedit_attr.background) {
    return;
  }

  for (i = 0; i < preedit->alloc_areas; i++) {
    if (preedit->preedit_areas[i].window) {
      XSetWindowBackground(ic->core.im->core.display,
                        preedit->preedit_areas[i].window,
                        ic->core.preedit_attr.background);
    }
  }
#if 0
  if (preedit->gc) {
    XGCValues val;
    unsigned long mask;
    val.background = ic->core.preedit_attr.background;
    mask = GCBackground;
    XChangeGC(ic->core.im->core.display,
             preedit->gc,
             mask,
             &val);
  }
  if (preedit->rgc) {
    XGCValues val;
    unsigned long mask;
    val.foreground = ic->core.preedit_attr.background;
    mask = GCForeground;
    XChangeGC(ic->core.im->core.display,
             preedit->rgc,
             mask,
             &val);
  }
#endif
  preedit_cache->background = ic->core.preedit_attr.background;
  return;
}
void SetPreeditFont ( XicCommon  ,
XPointer   
)

Definition at line 752 of file guiIMPre.c.

                                                 {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);

  if (!preedit) {
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_CREATE, NULL);
    preedit = (PreeditWin)ic->gui_icpart->preedit;
    if (!preedit) return;
  }
  if (ic->core.preedit_attr.fontset) {
    if (preedit->fontset && preedit->need_free_fontset) {
      XFactoryFreeDefaultFontSet (ic->core.im->core.display);
      preedit->need_free_fontset = False;
    }
    preedit->fontset = ic->core.preedit_attr.fontset;
  } else if (preedit->fontset == NULL) {
    preedit->fontset = XFactoryCreateDefaultFontSet(ic->core.im->core.display,
                                              XIM_IIIMP(ic->core.im, default_font_name));
    preedit->need_free_fontset = True;
  }
  preedit->fse = XExtentsOfFontSet(preedit->fontset);

  XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_WIN, NULL);
  UpdatePreeditWidth(ic);
  XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_MOVE, NULL);
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 644 of file guiIMPre.c.

                                                       {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  CacheRec *preedit_cache;

  if (!preedit) return;  /* Let's do it later */

  preedit_cache = (CacheRec*)&(preedit->preedit_cache);

  if (preedit_cache->foreground == ic->core.preedit_attr.foreground) {
    return;
  }
#if 0
  if (preedit->gc) {
    XGCValues val;
    unsigned long mask;
    val.foreground = ic->core.preedit_attr.foreground;
    mask = GCForeground;
    XChangeGC(ic->core.im->core.display,
             preedit->gc,
             mask,
             &val);
  }

  if (preedit->rgc) {
    XGCValues val;
    unsigned long mask;
    val.background = ic->core.preedit_attr.foreground;
    mask = GCBackground;
    XChangeGC(ic->core.im->core.display,
             preedit->rgc,
             mask,
             &val);
  }
#endif
  preedit_cache->foreground = ic->core.preedit_attr.foreground;
  return;
}

Definition at line 439 of file guiIMPre.c.

                              {
  PreeditWin preedit = (PreeditWin)Xmalloc(sizeof(PreeditWinRec));

  if (!preedit) return False;
  memset((char *)preedit, 0, sizeof(PreeditWinRec));

  preedit->alloc_areas = 0;
  preedit->active_areas = 0;
  preedit->need_free_fontset = False;

  ic->gui_icpart->preedit = (void *)preedit;
  return True;
}

Here is the caller graph for this function:

Bool SetupPreeditWindow ( XicCommon  ,
Window   
)

Definition at line 584 of file guiIMPre.c.

                                                {
  PreeditWin preedit = (PreeditWin)(ic->gui_icpart->preedit);
  int x, y;
  Display *display = ic->core.im->core.display;
  PreeditArea preedit_area = (PreeditArea)NULL;
  XWindowAttributes cwin_att;
  int i;

  if (!preedit) return False;

  /* A new parent window is the same as the previous, nothing to do. */
  if (preedit->preedit_areas) {
    if (parent == 0 || preedit->parent == parent)
      return False;

    /* on Linux, sometimes parent window is invalid */
    if (preedit->parent && !IMCheckIMWindow(ic, preedit->parent)) {
      preedit->alloc_areas=0;
    }
  }

  preedit->parent = parent;

  if (XIMP_CHK_PREAREAMASK(ic)) {
    x = ic->core.preedit_attr.area.x;
    y = ic->core.preedit_attr.area.y;
  } else if (XIMP_CHK_PRESPOTLMASK(ic)) {
    x = ic->core.preedit_attr.spot_location.x;
    y = ic->core.preedit_attr.spot_location.y;
  } else {
    x  = y = 0;
  }

  if (preedit->alloc_areas > 0) {
    preedit_area = preedit->preedit_areas;
    for (i = 0; i < preedit->alloc_areas; i++) {
      if (preedit_area[i].window) {
       /* Make sure the window gets unmapped */
        preedit_area[i].mapped = True;
       UnmapPreeditWindow(ic, preedit_area + i);
       XReparentWindow(display, preedit_area[i].window,
                     preedit->parent,
                     x, y);
      }
    }
    XIC_GUI(ic, change_preedit)((XIC)ic, PREEDIT_MOVE, NULL);
    /* redraw if any text in preedit windows */
    UpdatePreedit(ic, 0, 0);
    return True;
  } else {
    if (XGetWindowAttributes(ic->core.im->core.display, 
              ic->core.client_window, &cwin_att) && 
              (cwin_att.map_state == IsViewable))
      return NewPreeditWindow(ic);
    else 
      return False;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 267 of file guiIMPre.c.

                                                           {
  if (False == preedit_area->mapped) {
    return;
  }

  XUnmapWindow(ic->core.im->core.display, preedit_area->window);
  preedit_area->mapped = False;
  preedit_area->win_config.x = -1;
  preedit_area->win_config.y = -1;
  preedit_area->win_config.height = -1;
  preedit_area->win_config.width = -1;

  return;
}

Here is the caller graph for this function: