xcb illustrate pseudo transparency (copy of root window pixmap to a children window background)

StackOverflow https://stackoverflow.com/questions/10040246

  •  29-05-2021
  •  | 
  •  

Вопрос

I want to illustrate the pseudo transparency of windows with xcb (copy part of root windows pixmap on a window background)

For that, I use:

the root pixmap is set with feh then I launch my programm which do (just part of code):

->initialize connection :

xcb_connect()

->create the window:

xcb_create_window()
xcb_create_pixmap( connection,screen->root_depth, pixmap, screen->root, width, height)
xcb_create_gc( connection, graphic_context, pixmap, XCB_GC_FOREGROUND | XCB_GC_BACKGROUND, gc_values_mask)
xcb_map_window

->grab xcb event:

xcb_wait_for_event

->answer to map_request_event ( when it's the request of our window) or property_notify (when changed property is the root pixmap via feh):

get the root pixmap:

xcb_get_property / xcb_get_property_reply / xcb_get_property_value     
==> this works

copy part of the root pixmap to window pixmap:

xcb_copy_area_checked(backbone.connection,
              rootpix,
              pixmap,
              graphic_context,
              x, y,
              0, 0,
              width, height)

I use xcb_request_check but it seems that I have no error with this last request.

Then I draw elements in my window with cairo.

The problem is that I just see a white window with the element draw by cairo. Even without the cairo elements, I can't display the copied pixmap of my window.

Have you got any idea to help me? Thanks

Это было полезно?

Решение

As nobody helps me, I find the solution alone:

I just have to copy part of the root pixmap in my window:

xcb_copy_area_checked(backbone.connection,
          rootpix,
          my_window,
          graphic_context,
          x, y,
          0, 0,
          width, height)

It works even if I am not sure it's the best way to do it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top