2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
5 #include "ecore_xcb_private.h"
9 * @defgroup Ecore_X_Damage_Group X Damage Extension Functions
11 * Functions related to the X Damage extension.
15 #ifdef ECORE_XCB_DAMAGE
16 static uint8_t _damage_available = 0;
17 static xcb_damage_query_version_cookie_t _ecore_xcb_damage_init_cookie;
18 #endif /* ECORE_XCB_DAMAGE */
21 /* To avoid round trips, the initialization is separated in 2
22 functions: _ecore_xcb_damage_init and
23 _ecore_xcb_damage_init_finalize. The first one gets the cookies and
24 the second one gets the replies. */
27 _ecore_x_damage_init(const xcb_query_extension_reply_t *reply)
29 #ifdef ECORE_XCB_DAMAGE
30 if (reply && (reply->present))
31 _ecore_xcb_damage_init_cookie = xcb_damage_query_version_unchecked(_ecore_xcb_conn, 1, 1);
32 #endif /* ECORE_XCB_DAMAGE */
36 _ecore_x_damage_init_finalize(void)
38 #ifdef ECORE_XCB_DAMAGE
39 xcb_damage_query_version_reply_t *reply;
41 reply = xcb_damage_query_version_reply(_ecore_xcb_conn,
42 _ecore_xcb_damage_init_cookie,
46 if (reply->major_version >= 1)
47 _damage_available = 1;
50 #endif /* ECORE_XCB_DAMAGE */
55 * Return whether the Damage Extension is available.
56 * @return 1 if the Damage Extension is available, 0 if not.
58 * Return 1 if the X server supports the Damage Extension version 1.0,
60 * @ingroup Ecore_X_Damage_Group
63 ecore_x_damage_query(void)
65 #ifdef ECORE_XCB_DAMAGE
66 return _damage_available;
69 #endif /* ECORE_XCB_DAMAGE */
74 * Creates a damage object.
75 * @param drawable The drawable to monotor.
76 * @param level The level of the damage report.
77 * @return The damage object.
79 * Creates a damage object to monitor changes to @p drawable, with the
81 * @ingroup Ecore_X_Damage_Group
84 ecore_x_damage_new(Ecore_X_Drawable drawable,
85 Ecore_X_Damage_Report_Level level)
87 Ecore_X_Damage damage = 0;
89 #ifdef ECORE_XCB_DAMAGE
90 damage = xcb_generate_id(_ecore_xcb_conn);
91 xcb_damage_create(_ecore_xcb_conn, damage, drawable, level);
92 #endif /* ECORE_XCB_DAMAGE */
99 * Destroys a damage object.
100 * @param damage The damage object to destroy.
102 * Destroys the damage object @p damage.
103 * @ingroup Ecore_X_Damage_Group
106 ecore_x_damage_del(Ecore_X_Damage damage)
108 #ifdef ECORE_XCB_DAMAGE
109 xcb_damage_destroy(_ecore_xcb_conn, damage);
110 #endif /* ECORE_XCB_DAMAGE */
115 * Synchronously modifies the region.
116 * @param damage The damage object to destroy.
117 * @param repair The repair region.
118 * @param parts The parts region.
120 * Synchronously modifies the regions in the following manner:
121 * If @p repair is @c XCB_NONE:
123 * 2) damage = <empty>
125 * 1) parts = damage INTERSECT repair
126 * 2) damage = damage - parts
127 * 3) Generate DamageNotify for remaining damage areas
128 * @ingroup Ecore_X_Damage_Group
131 ecore_x_damage_subtract(Ecore_X_Damage damage,
132 Ecore_X_Region repair,
133 Ecore_X_Region parts)
135 #ifdef ECORE_XCB_DAMAGE
136 xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
137 #endif /* ECORE_XCB_DAMAGE */