home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / mi / miclipn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-23  |  1.7 KB  |  63 lines

  1. /*
  2.  
  3. Copyright 1990 by the Massachusetts Institute of Technology
  4.  
  5. Permission to use, copy, modify, distribute, and sell this software and its
  6. documentation for any purpose is hereby granted without fee, provided that
  7. the above copyright notice appear in all copies and that both that
  8. copyright notice and this permission notice appear in supporting
  9. documentation, and that the name of M.I.T. not be used in advertising or
  10. publicity pertaining to distribution of the software without specific,
  11. written prior permission.  M.I.T. makes no representations about the
  12. suitability of this software for any purpose.  It is provided "as is"
  13. without express or implied warranty.
  14.  
  15. */
  16.  
  17. /* $XConsortium: miclipn.c,v 5.0 90/09/24 09:41:16 rws Exp $ */
  18.  
  19. #include "X.h"
  20. #include "windowstr.h"
  21. #include "scrnintstr.h"
  22.  
  23. static void    (*clipNotify)() = 0;
  24. static void    (*ClipNotifies[MAXSCREENS])();
  25.  
  26. static void
  27. miClipNotifyWrapper(pWin, dx, dy)
  28.     WindowPtr pWin;
  29.     int dx, dy;
  30. {
  31.     if (clipNotify)
  32.     (*clipNotify)(pWin, dx, dy);
  33.     if (ClipNotifies[pWin->drawable.pScreen->myNum])
  34.     (*ClipNotifies[pWin->drawable.pScreen->myNum])(pWin, dx, dy);
  35. }
  36.  
  37. /*
  38.  * miClipNotify --
  39.  *    Hook to let DDX request notification when the clipList of
  40.  *    a window is recomputed on any screen.  For R4 compatibility;
  41.  *    better if you wrap the ClipNotify screen proc yourself.
  42.  */
  43.  
  44. static unsigned long clipGeneration = 0;
  45.  
  46. void
  47. miClipNotify (func)
  48.     void (*func)();
  49. {
  50.     int i;
  51.  
  52.     clipNotify = func;
  53.     if (clipGeneration != serverGeneration)
  54.     {
  55.     clipGeneration = serverGeneration;
  56.     for (i = 0; i < screenInfo.numScreens; i++)
  57.     {
  58.         ClipNotifies[i] = screenInfo.screens[i]->ClipNotify;
  59.         screenInfo.screens[i]->ClipNotify = miClipNotifyWrapper;
  60.     }
  61.     }
  62. }
  63.