]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/mi/miclipn.c
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / programs / Xserver / mi / miclipn.c
1 /* $XConsortium: miclipn.c,v 5.1 94/04/17 20:27:26 rws Exp $ */
2 /*
3
4 Copyright (c) 1990  X Consortium
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice shall be included
15 in all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 OTHER DEALINGS IN THE SOFTWARE.
24
25 Except as contained in this notice, the name of the X Consortium shall
26 not be used in advertising or otherwise to promote the sale, use or
27 other dealings in this Software without prior written authorization
28 from the X Consortium.
29
30 */
31
32 #include "X.h"
33 #include "windowstr.h"
34 #include "scrnintstr.h"
35
36 static void     (*clipNotify)() = 0;
37 static void     (*ClipNotifies[MAXSCREENS])();
38
39 static void
40 miClipNotifyWrapper(pWin, dx, dy)
41     WindowPtr pWin;
42     int dx, dy;
43 {
44     if (clipNotify)
45         (*clipNotify)(pWin, dx, dy);
46     if (ClipNotifies[pWin->drawable.pScreen->myNum])
47         (*ClipNotifies[pWin->drawable.pScreen->myNum])(pWin, dx, dy);
48 }
49
50 /*
51  * miClipNotify --
52  *      Hook to let DDX request notification when the clipList of
53  *      a window is recomputed on any screen.  For R4 compatibility;
54  *      better if you wrap the ClipNotify screen proc yourself.
55  */
56
57 static unsigned long clipGeneration = 0;
58
59 void
60 miClipNotify (func)
61     void (*func)();
62 {
63     int i;
64
65     clipNotify = func;
66     if (clipGeneration != serverGeneration)
67     {
68         clipGeneration = serverGeneration;
69         for (i = 0; i < screenInfo.numScreens; i++)
70         {
71             ClipNotifies[i] = screenInfo.screens[i]->ClipNotify;
72             screenInfo.screens[i]->ClipNotify = miClipNotifyWrapper;
73         }
74     }
75 }