2 * Copyright © 2013 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 #ifdef HAVE_XORG_CONFIG_H
24 #include <xorg-config.h>
27 #include "present_priv.h"
30 * Mark all pending notifies for 'window' as invalid when
31 * the window is destroyed
35 present_clear_window_notifies(WindowPtr window
)
37 present_notify_ptr notify
;
38 present_window_priv_ptr window_priv
= present_window_priv(window
);
43 xorg_list_for_each_entry(notify
, &window_priv
->notifies
, window_list
) {
44 notify
->window
= NULL
;
49 * 'notify' is being freed; remove it from the window's notify list
53 present_free_window_notify(present_notify_ptr notify
)
55 xorg_list_del(¬ify
->window_list
);
59 * 'notify' is new; add it to the specified window
63 present_add_window_notify(present_notify_ptr notify
)
65 WindowPtr window
= notify
->window
;
66 present_window_priv_ptr window_priv
= present_get_window_priv(window
, TRUE
);
71 xorg_list_add(¬ify
->window_list
, &window_priv
->notifies
);
76 present_create_notifies(ClientPtr client
, int num_notifies
, xPresentNotify
*x_notifies
, present_notify_ptr
*p_notifies
)
78 present_notify_ptr notifies
;
83 notifies
= calloc (num_notifies
, sizeof (present_notify_rec
));
87 for (i
= 0; i
< num_notifies
; i
++) {
88 status
= dixLookupWindow(¬ifies
[i
].window
, x_notifies
[i
].window
, client
, DixGetAttrAccess
);
89 if (status
!= Success
)
92 notifies
[i
].serial
= x_notifies
[i
].serial
;
93 status
= present_add_window_notify(¬ifies
[i
]);
94 if (status
!= Success
)
102 present_destroy_notifies(notifies
, added
);
107 present_destroy_notifies(present_notify_ptr notifies
, int num_notifies
)
110 for (i
= 0; i
< num_notifies
; i
++)
111 present_free_window_notify(¬ifies
[i
]);