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

  1.  
  2.  
  3.  
  4. #ifndef lint
  5. static char *rcsid_Refresh_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Refresh.c,v 1.2 89/02/07 21:23:32 jkh Exp $";
  6. #endif    lint
  7.  
  8. #include "X11/copyright.h"
  9. /*
  10.  *
  11.  * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  12.  *
  13.  * Copyright 1987 by Jordan Hubbard.
  14.  *
  15.  *
  16.  *                         All Rights Reserved
  17.  *
  18.  * Permission to use, copy, modify, and distribute this software and its
  19.  * documentation for any purpose and without fee is hereby granted,
  20.  * provided that the above copyright notice appear in all copies and that
  21.  * both that copyright notice and this permission notice appear in
  22.  * supporting documentation, and that the name of Ardent Computer
  23.  * Corporation or Jordan Hubbard not be used in advertising or publicity
  24.  * pertaining to distribution of the software without specific, written
  25.  * prior permission.
  26.  *
  27.  */
  28.  
  29. /*
  30.  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  31.  *
  32.  *                         All Rights Reserved
  33.  *
  34.  * Permission to use, copy, modify, and distribute this software and its
  35.  * documentation for any purpose and without fee is hereby granted,
  36.  * provided that the above copyright notice appear in all copies and that
  37.  * both that copyright notice and this permission notice appear in
  38.  * supporting documentation, and that the name of Digital Equipment
  39.  * Corporation not be used in advertising or publicity pertaining to
  40.  * distribution of the software without specific, written prior permission.
  41.  *
  42.  *
  43.  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  44.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  45.  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  46.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  47.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  48.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  49.  * SOFTWARE.
  50.  */
  51.  
  52.  
  53.  
  54. /*
  55.  * MODIFICATION HISTORY
  56.  *
  57.  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  58.  * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  59.  *  Western Software Lab. Convert to X11.
  60.  * 002 -- Jordan Hubbard, Ardent Computer
  61.  *  Changes for awm.
  62.  */
  63.  
  64. #include "awm.h"
  65.  
  66. /*ARGSUSED*/
  67. Boolean Refresh(window, mask, button, x, y)
  68. Window window;                          /* Event window. */
  69. int mask;                               /* Button/key mask. */
  70. int button;                           /* Button event detail. */
  71. int x, y;                               /* Event mouse position. */
  72. {
  73.     Entry("Refresh")
  74.  
  75. #ifdef titan
  76.     XTitanReset(dpy);
  77. #endif /* titan */
  78.     Leave( Redraw(RootWindow(dpy,scr), mask, button, x, y) )
  79. }
  80.  
  81.  
  82.  
  83. /*ARGSUSED*/
  84. Boolean Redraw(window, mask, button, x, y)
  85. Window window;                          /* Event window. */
  86. int mask;                               /* Button/key mask. */
  87. int button;                             /* Button event detail. */
  88. int x, y;                               /* Event mouse position. */
  89. {
  90.     XWindowAttributes winfo;        /* window info. */
  91.     XSetWindowAttributes swa;        /* New window info */
  92.     Window w;                /* Refresh window. */
  93.  
  94.     Entry("Redraw")
  95.  
  96.     /*
  97.      * Get info on the target window.
  98.      */
  99.     status = XGetWindowAttributes(dpy, window, &winfo);
  100.     if (status == FAILURE)
  101.      Error("Refresh -> Can't query target window.");
  102.     /*
  103.      * Create and map a window which covers the target window, then destroy it.
  104.      */
  105.     swa.override_redirect = TRUE;
  106.     swa.background_pixel = 0;
  107.  
  108.     /*
  109.      * What we have here is a failure to communicate. This window should
  110.      * more properly be created as a subwindow of "window", but
  111.      * when we do that, all events (Create, Map, Destroy) get reported
  112.      * as coming from "window", not the newly created one. This is
  113.      * very nasty when the DestroyNotify is received. For now, we'll
  114.      * create it on the RootWindow and take the chance of generating an
  115.      * expose on an overlapping window.
  116.      */
  117.     if ((w = XCreateWindow(dpy, RootWindow(dpy, scr), winfo.x, winfo.y, 
  118.                (unsigned int) winfo.width, 
  119.                (unsigned int) winfo.height, (unsigned int) 0,
  120.                DefaultDepth(dpy, scr),
  121.                CopyFromParent,
  122.                DefaultVisual(dpy, scr),
  123.                (CWOverrideRedirect | CWBackPixel),
  124.                &swa)) == NULL)
  125.      Error("Refresh -> Can't create refresh window.");
  126.     XMapWindow(dpy, w);
  127.     XDestroyWindow(dpy, w);
  128.     XFlush(dpy);
  129.     Leave(FALSE)
  130. }
  131.