Miscelanewous notes about possible solutions to the different difficult parts
of xepdmgr.


COMMUNICATION
- Information about X Atoms and Properties (used here for communication
  between the app and xepdmrg, as in xpdf remote):

http://en.wikipedia.org/wiki/X_Window_System_core_protocol#Atoms

- Comm. sample from
  xpdf-3.02.tar.gz:xpdf-3.02/xpdf/XPDFApp.cc (remoteAtom)
  INIT:
  XSetSelectionOwner(dpy, atom, {rem_win | None //for quit//}, CurrentTime);
  XtAddEventHandler(rem_win, PropertyChangeMask, False,&rem_win_callbk, user_ptr);
  atom=XInternAtom(dpy, shared_atom_name_for_comm, False);
  rem_win = XGetSelectionOwner(dpy, atom);
  SEND_STRING:
  XChangeProperty(dpy, rem_win, atom, atom, 8,PropModeReplace, str, strlen(str)+1);
  XFlush(dpy);
  RECV STRING (rem_win_callbk):
  void rem_win_callbk(Widget widget, XtPointer ptr,
                     XEvent *event, Boolean *cont) {
     char *cmd;Atom type;int format; unsigned long size, remain;
     if(event->xproperty.atom!=atom) { *cont=True; return; } else { *cont=False; }
     if(XGetWindowProperty(dpy, XtWindow(rem_win),atom,0,MAXCMDSIZE,True,atom,
                           &type,&format,&size,&remain,&resptr)!=Success || cmd==NULL) { return; }
     // parse cmd, do action, etc
     // ...
     XFree((XPointer)cmd);
  }
  - Differences with the usage in XPDF:
    1. We only have one instance of communication per x server, so
       rem_win=RootWindow(dpy,DefaultScreen(dpy));
    2. We only have one comm. channel, so
       #define shared_atom_for_comm "XEPDMGR_CMD"
  - Things to share: make every command '\n' terminated, so it's possble to send
    multiple commands in one SEND_STRING:

  - There is an alternative example that doesn't require Intrinsics (Xt) in:
     http://www.motifdeveloper.com/tips/tip6.html

XFIXES
- It seems to be undocumented. To see the sources (Region.c):
  http://www.koders.com/c/fidCAD6267901B273ADCA68A6218455382F38145649.aspx

XDAMAGE
- Documented in damageproto.txt. Sources (XDamage.c XDamage.h damagewire.h):
  http://www.koders.com/c/fid051D49E14F94620A748C6752FA1A600AC02587CB.aspx
  http://www.koders.com/c/fid2954C99225C0F18BFCF40D99C08452003DE2D392.aspx
  http://www.koders.com/c/fidA94851BC8CFDFD4CDE1FBE543E6337A033D6282B.aspx

TIMEOUTS using plain Xlib.h (warning: old X11R5 sources)
- How Xt does it:
  http://www.google.es/codesearch?hl=es&q=XtAddInput+show:IhoO08R6w54:hTH3-kOiC1s:ZH2MjqUOP8s&source=universal&cs_p=http://web.rge.com/pub/X/X11R5/distrib/mit-1.tar.gz&cs_f=mit/lib/Xt/NextEvent.c#l468
- If timeouts are implemented using signals (note that now there is a function to notify a signal and get am Event):
  NOTE: The following document has at the end an example of using select with x,
  which is exactly what we need (using select means that we don't need SIGALRM
  to implement the timeouts).
  http://www-h.eng.cam.ac.uk/help/tpl/graphics/X/signals.html

