Back to index

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

Go to the source code of this file.

Classes

struct  xaux_atommng_data_struct
struct  xaux_propq_prop_struct
struct  xaux_propq_struct

Defines

#define XAUX_ATOMMNG_SX_SUFFIX   "_sx"
#define XAUX_ATOMMNG_XS_SUFFIX   "_xs"
#define XAUX_ATOMMNG_HASHSIZE   XAUX_MAXNPROPS_INIT

Typedefs

typedef struct
xaux_atommng_data_struct 
xaux_atommng_data_t
typedef struct
xaux_propq_prop_struct 
xaux_propq_prop_t
typedef struct xaux_propq_struct xaux_propq_t

Functions

xaux_atommng_data_txaux_atommng_alloc_data (const char *, Bool, Display *)
Atom xaux_atommng_get_atom (xaux_atommng_data_t *, Window)
Bool xaux_atommng_check_atom (xaux_atommng_data_t *, Bool, Atom)
Bool xaux_atommng_release_atom (xaux_atommng_data_t *)
void xaux_atommng_free_data (xaux_atommng_data_t *)
Bool xaux_atommng_process_delete (xaux_atommng_data_t *, XPropertyEvent *)
Bool xaux_atommng_process_selclr (xaux_atommng_data_t *, XSelectionClearEvent *)
Atom xaux_atommng_know_atom (xaux_atommng_data_t *, Bool)
xaux_propq_txaux_propq_alloc (size_t)
int xaux_propq_add (xaux_propq_t *, unsigned char *, int)
int xaux_propq_check (xaux_propq_t *)
int xaux_propq_get (xaux_propq_t *, unsigned char **, int *)
void xaux_propq_clean (xaux_propq_t *)
void xaux_propq_free (xaux_propq_t *)

Class Documentation

struct xaux_atommng_data_struct

Definition at line 51 of file xaux_atommng.h.

Class Members
Atom atom_sx
Bool atom_sx_inuse
Atom atom_xs
Bool atom_xs_inuse
const char * classname
Display * display
int idx
Bool is_xs
Window win
struct xaux_propq_prop_struct

Definition at line 74 of file xaux_atommng.h.

Collaboration diagram for xaux_propq_prop_struct:
Class Members
unsigned char * buf
int len
struct xaux_propq_prop_struct * next
struct xaux_propq_prop_struct * prev
struct xaux_propq_struct

Definition at line 81 of file xaux_atommng.h.

Collaboration diagram for xaux_propq_struct:
Class Members
int count
xaux_propq_prop_t * list
size_t maxtotalsz
size_t totalsz

Define Documentation

Definition at line 63 of file xaux_atommng.h.

#define XAUX_ATOMMNG_SX_SUFFIX   "_sx"

Definition at line 48 of file xaux_atommng.h.

#define XAUX_ATOMMNG_XS_SUFFIX   "_xs"

Definition at line 49 of file xaux_atommng.h.


Typedef Documentation


Function Documentation

xaux_atommng_data_t* xaux_atommng_alloc_data ( const char *  ,
Bool  ,
Display *   
)

Definition at line 54 of file xaux_atommng.c.

{
       xaux_atommng_data_t  *data;
       int                  i;
       char                 buf[PATH_MAX];

       data = (xaux_atommng_data_t *)malloc(sizeof (xaux_atommng_data_t));

       if (data == NULL) {
              return (NULL);
       }

       data->classname = classname;
       data->display = display;

       snprintf(buf, PATH_MAX, "%s%s", data->classname,
              XAUX_ATOMMNG_SX_SUFFIX);
       data->atom_sx = XInternAtom(data->display, buf, False);
       data->atom_sx_inuse = False;

       snprintf(buf, PATH_MAX, "%s%s", data->classname,
              XAUX_ATOMMNG_XS_SUFFIX);
       data->atom_xs = XInternAtom(data->display, buf, False);
       data->atom_xs_inuse = False;

       data->idx = -1;
       data->is_xs = is_xs;

       return (data);
}

Here is the caller graph for this function:

Definition at line 90 of file xaux_atommng.c.

{
       if (((is_xs == True) && (atom == data->atom_xs))
                     || ((is_xs == False) && (atom == data->atom_sx))) {
              return (True);
       }

       return (False);
}

Here is the caller graph for this function:

Definition at line 140 of file xaux_atommng.c.

{
       if (data == NULL) {
              return;
       }

       free(data);

       return;
}

Here is the caller graph for this function:

Atom xaux_atommng_get_atom ( xaux_atommng_data_t ,
Window   
)

Definition at line 105 of file xaux_atommng.c.

{
       if (data->is_xs == True) {
              if (data->atom_xs_inuse == True) {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_xs=%d is busy\n", data->atom_xs);
#endif /* defined(DEBUG_XAUX) */
                     return ((Atom)None);
              } else {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_xs=%d is available\n", data->atom_xs);
#endif /* defined(DEBUG_XAUX) */
                     data->atom_xs_inuse = True;
                     return (data->atom_xs);
              }
       } else {
              if (data->atom_sx_inuse == True) {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_sx=%d is busy\n", data->atom_sx);
#endif /* defined(DEBUG_XAUX) */
                     return ((Atom)None);
              } else {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_sx=%d is available\n", data->atom_sx);
#endif /* defined(DEBUG_XAUX) */
                     data->atom_sx_inuse = True;
                     return (data->atom_sx);
              }
       }
}

Here is the caller graph for this function:

Definition at line 219 of file xaux_atommng.c.

{
       if (is_xs == True) {
              return (data->atom_xs);
       } else {
              return (data->atom_sx);
       }
}

Here is the caller graph for this function:

Bool xaux_atommng_process_delete ( xaux_atommng_data_t ,
XPropertyEvent *   
)

Definition at line 166 of file xaux_atommng.c.

{
              if ((data->is_xs == True) && (pev->atom == data->atom_xs)) {
                     data->atom_xs_inuse = False;
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_xs=%d is released\n", data->atom_xs);
#endif /* defined(DEBUG_XAUX) */
                     return (True);
              } else if ((data->is_xs == False) &&
                            (pev->atom == data->atom_sx)) {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_sx=%d is released\n", data->atom_sx);
#endif /* defined(DEBUG_XAUX) */
                     data->atom_sx_inuse = False;
                     return (True);
              } else {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: unknown PropertyDelete to atom=%d\n", pev->atom);
#endif /* defined(DEBUG_XAUX) */
                     return (False);
              }
}

Here is the caller graph for this function:

Bool xaux_atommng_process_selclr ( xaux_atommng_data_t ,
XSelectionClearEvent *   
)

Definition at line 192 of file xaux_atommng.c.

{
              if ((data->is_xs == True)
                            && (scev->selection == data->atom_xs)) {
                     data->atom_xs_inuse = False;
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_xs=%d is released\n", data->atom_xs);
#endif /* defined(DEBUG_XAUX) */
                     return (True);
              } else if ((data->is_xs == False) &&
                            (scev->selection == data->atom_sx)) {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: atom_sx=%d is released\n", data->atom_sx);
#endif /* defined(DEBUG_XAUX) */
                     data->atom_sx_inuse = False;
                     return (True);
              } else {
#if defined(DEBUG_XAUX)
fprintf(stderr, "atommng: unknown SelectionClear to atom=%d\n", scev->selection);
#endif /* defined(DEBUG_XAUX) */
                     return (False);
              }
}

Here is the caller graph for this function:

Definition at line 154 of file xaux_atommng.c.

{
       if (data->is_xs == True) {
              data->atom_xs_inuse = False;
       } else {
              data->atom_sx_inuse = False;
       }
       return (True);
}

Here is the caller graph for this function:

int xaux_propq_add ( xaux_propq_t ,
unsigned char *  ,
int   
)

Definition at line 248 of file xaux_atommng.c.

{
       xaux_propq_prop_t    *add;
       xaux_propq_prop_t    *last;

       if ((data->maxtotalsz > 0) &&
                     ((data->totalsz + len) > data->maxtotalsz)) {
#if defined(DEBUG_XAUX)
fprintf(stderr, "propq: add() failed because of size limit\n");
#endif /* defined(DEBUG_XAUX) */
              return (-2);
       }

       if ((add = (xaux_propq_prop_t *)malloc(sizeof (xaux_propq_prop_t)))
                     == NULL) {
              return (-1);
       }

       add->buf = buf;
       add->len = len;

       if (data->list == NULL) {
              add->prev = NULL;
              add->next = NULL;
              data->list = add;
       } else {
              for (last = data->list; ; last = last->next) {
                     if (last->next == NULL) {
                            break;
                     }
              }
              add->prev = last;
              add->next = NULL;
              last->next = add;
       }

       data->count++;
       data->totalsz += len;

#if defined(DEBUG_XAUX)
fprintf(stderr, "propq: add(%d:0x%x)\n", data->count, data->totalsz);
#endif /* defined(DEBUG_XAUX) */
       return (data->count);
}

Here is the caller graph for this function:

Definition at line 231 of file xaux_atommng.c.

{
       xaux_propq_t  *p;

       if ((p = (xaux_propq_t *)malloc(sizeof (xaux_propq_t)))
                     == NULL) {
              return (NULL);
       }
       p->count = 0;
       p->totalsz = 0U;
       p->maxtotalsz = maxtotalsz;
       p->list = NULL;

       return (p);
}

Here is the caller graph for this function:

Definition at line 297 of file xaux_atommng.c.

{
#if defined(DEBUG_XAUX_DETAIL)
fprintf(stderr, "propq: check(%d)\n", data->count);
#endif /* defined(DEBUG_XAUX_DETAIL) */
       return (data->count);
}

Here is the caller graph for this function:

Definition at line 338 of file xaux_atommng.c.

{
       xaux_propq_prop_t    *cur = data->list;
       xaux_propq_prop_t    *prev;

       while (cur != NULL) {
              prev = cur;
              cur = cur->next;
              free(prev->buf);
              free(prev);
       }

       data->count = 0;
       data->totalsz = 0U;
       data->list = NULL;

       return;
}

Here is the caller graph for this function:

Definition at line 359 of file xaux_atommng.c.

{
       xaux_propq_prop_t    *cur = data->list;
       xaux_propq_prop_t    *prev;

       xaux_propq_clean(data);

       free(data);

       return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int xaux_propq_get ( xaux_propq_t ,
unsigned char **  ,
int *   
)

Definition at line 307 of file xaux_atommng.c.

{
       xaux_propq_prop_t    *prev;

       if (data->list == NULL) {
              return (-1);
       }

       (*pbuf) = data->list->buf;
       (*plen) = data->list->len;

       prev = data->list;
       data->list = data->list->next;
       if (data->list != NULL) {
              data->list->prev = NULL;
       }
       free(prev);

       data->count--;
       data->totalsz -= *plen;

#if defined(DEBUG_XAUX)
fprintf(stderr, "propq: get(%d:0x%x)\n", data->count, data->totalsz);
#endif /* defined(DEBUG_XAUX) */
       return (data->count);
}

Here is the caller graph for this function: