/*
 * -- $Header: /cec/src/nestor/servers/R3/shXlib/XGetIFocus.c,v 1.1.1.1
 * 90/04/23 09:58:55 spanachi Exp $
 */
#include "copyright.h"

/* $XConsortium: XGetIFocus.c,v 11.9 88/09/06 16:08:01 jim Exp $ */
/* Copyright    Massachusetts Institute of Technology    1986	 */

/* -- MULTIPLEX Extension -- */

#define NEED_REPLIES
#include "Xlibint.h"

/* -- additional includes -- */
#include "utils.h"
#include "map.h"

XGetInputFocus (dpy, focus, revert_to)
  register Display *dpy;
  Window *focus;
  int *revert_to;
{
  xGetInputFocusReply rep;
  register xReq *req;

  /* -- flush default dpy's queue to keep buffers aligned -- */
  XmuXFlushDefault (dpy);
  /* -- switch to the chalk holder display -- */
  dpy = XmuXChalkDisplay (dpy);

  LockDisplay (dpy);
  GetEmptyReq (GetInputFocus, req);
  (void) _XReply (dpy, (xReply *) & rep, 0, xTrue);
  /* -- must map -- */
  *focus = XmuXMapID (dpy, rep.focus, FromServer);
  *revert_to = rep.revertTo;
  UnlockDisplay (dpy);
  SyncHandle ();
}
