/* * This sets up the DAMAGE extentsion to receive damage events on all * child windows * */ static void set_up_damage_notifications(xcb_connection_t *conn, xcb_screen_t *scr) { xcb_damage_query_version_unchecked(conn, XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION); dam_ext_data = xcb_get_extension_data(conn, &xcb_damage_id); xcb_query_tree_reply_t *reply = xcb_query_tree_reply(conn, xcb_query_tree(conn, scr->root), NULL); xcb_window_t *children = xcb_query_tree_children(reply); xcb_get_window_attributes_cookie_t *attribs = (xcb_get_window_attributes_cookie_t *)malloc( sizeof(xcb_get_window_attributes_cookie_t) * reply->children_len); if (!attribs) { errx(EXIT_FAILURE, "Failed to allocate memory"); } for (int i = 0; i < reply->children_len; ++i) { attribs[i] = xcb_get_window_attributes_unchecked(conn, children[i]); } for (int i = 0; i < reply->children_len; ++i) { /* Get attributes to check if input-only window */ xcb_get_window_attributes_reply_t *attrib = xcb_get_window_attributes_reply(conn, attribs[i], NULL); create_damage(conn, children[i], attrib); } free(attribs); free(reply); }
static void window_decorated_notify (MetaWindow *window, GParamSpec *pspec, gpointer user_data) { MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (user_data); detach_pixmap (self); free_damage (self); create_damage (self); }
static void handle_map_notify(xcb_map_notify_event_t *event) { if (fuzzy) { /* Create damage objects for new windows */ xcb_get_window_attributes_reply_t *attribs = xcb_get_window_attributes_reply(conn, xcb_get_window_attributes(conn, event->window), NULL); create_damage(conn, event->window, attribs); } if (!dont_fork) { /* After the first MapNotify, we never fork again. */ dont_fork = true; /* In the parent process, we exit */ if (fork() != 0) exit(0); ev_loop_fork(EV_DEFAULT); } }
MetaSurfaceActor * meta_surface_actor_x11_new (MetaWindow *window) { MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL); MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self); MetaDisplay *display = meta_window_get_display (window); g_assert (!meta_is_wayland_compositor ()); priv->window = window; priv->display = display; create_damage (self); g_signal_connect_object (priv->window, "notify::decorated", G_CALLBACK (window_decorated_notify), self, 0); priv->unredirected = FALSE; sync_unredirected (self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); return META_SURFACE_ACTOR (self); }