home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / awm2 / part10 / Focus.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-21  |  3.2 KB  |  111 lines

  1.  
  2.  
  3.  
  4. #ifndef lint
  5. static char *rcsid_Focus_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Focus.c,v 1.2 89/02/07 20:04:46 jkh Exp $";
  6. #endif    lint
  7.  
  8.  
  9. #include "X11/copyright.h"
  10. /*
  11.  *
  12.  * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  13.  *
  14.  * Copyright 1987 by Jordan Hubbard.
  15.  *
  16.  *
  17.  *                         All Rights Reserved
  18.  *
  19.  * Permission to use, copy, modify, and distribute this software and its
  20.  * documentation for any purpose and without fee is hereby granted,
  21.  * provided that the above copyright notice appear in all copies and that
  22.  * both that copyright notice and this permission notice appear in
  23.  * supporting documentation, and that the name of Ardent Computer
  24.  * Corporation or Jordan Hubbard not be used in advertising or publicity
  25.  * pertaining to distribution of the software without specific, written
  26.  * prior permission.
  27.  *
  28.  */
  29.  
  30. /*
  31.  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  32.  *
  33.  *                         All Rights Reserved
  34.  *
  35.  * Permission to use, copy, modify, and distribute this software and its
  36.  * documentation for any purpose and without fee is hereby granted,
  37.  * provided that the above copyright notice appear in all copies and that
  38.  * both that copyright notice and this permission notice appear in
  39.  * supporting documentation, and that the name of Digital Equipment
  40.  * Corporation not be used in advertising or publicity pertaining to
  41.  * distribution of the software without specific, written prior permission.
  42.  *
  43.  *
  44.  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  45.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  46.  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  47.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  48.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  49.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  50.  * SOFTWARE.
  51.  */
  52.  
  53.  
  54.  
  55. /*
  56.  * MODIFICATION HISTORY
  57.  *
  58.  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  59.  * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  60.     Western Software Lab. Converted to X11.
  61.  */
  62.  
  63. #ifndef lint
  64. static char *sccsid = "@(#)Focus.c    3.8    1/24/86";
  65. #endif
  66.  
  67. #include "awm.h"
  68.  
  69. extern Window FocusWindow;
  70.  
  71. /*ARGSUSED*/
  72. Boolean Focus(window, mask, button, x, y)
  73. Window window;                /* Event window. */
  74. int mask;                /* Button/key mask. */
  75. int button;                /* Button event detail. */
  76. int x, y;                /* Event mouse position. */
  77. {
  78.      AwmInfoPtr awi;
  79.  
  80.      Entry("Focus");
  81.  
  82.      awi = GetAwmInfo(window);
  83.      if (awi)
  84.       window = awi->client;
  85.      XSetInputFocus(dpy, window, RevertToPointerRoot, CurrentTime);
  86.      if (window != RootWindow(dpy, scr))
  87.       FocusSetByUser = TRUE;
  88.      else
  89.       FocusSetByUser = FALSE;
  90.      FocusSetByWM = FALSE;
  91.      FocusWindow = window;
  92.      Leave(FALSE)
  93. }
  94.  
  95. /*ARGSUSED*/
  96. Boolean UnFocus(window, mask, button, x, y)
  97. Window window;                /* Event window. */
  98. int mask;                /* Button/key mask. */
  99. int button;                /* Button event detail. */
  100. int x, y;                /* Event mouse position. */
  101. {
  102.      Entry("UnFocus");
  103.  
  104.      XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
  105.      FocusSetByUser = FALSE;
  106.      FocusSetByWM = FALSE;
  107.      FocusWindow = RootWindow(dpy, scr);
  108.      Leave(FALSE)
  109. }
  110.  
  111.