[Xcb] Opening/closing (and resizing) many windows

Edder edder at tkwsping.nl
Wed Aug 3 02:43:47 PDT 2011


On 2 August 2011 19:49, Jamey Sharp <jamey at minilop.net> wrote:
> Hello Edwin!

Hi Jamey and Josh,

> snip...

Thank you very much for the detailed analysis. This makes a lot of
sense and explains the weird behaviour. I ran your rewritten test
program under xmonad and see the same behaviour, where the number of
open windows in the end is basically equal to the number of unique
wids/xids.

I there anyway I could control the xids/wids xcb uses?

>
> Finally, and most importantly, you can almost certainly avoid the
> problem by not rapidly closing and opening connections like your test
> program does. :)  You should maintain a single connection and use that
> for any X operations you want to do.
>

I did at some point think that this might be the correct way of doing
things, but I couldn't find any examples of this/I read the
documentation as implying that you need one connection per window.
Also it will need a big refactoring of the code, since it will
suddenly need one main class in control of the connection, instead of
having each plot object in full control of its own window/connection
:(

I have experimented a little bit with this and have two questions.
1) Is there an easy way to see which event belongs to which
xcb_drawable_t, or will I need to keep track of which window is in
focus. Related to that: will an expose/resize event by the window
manager always be send to the drawable in focus or can it be send to
the one in the background?
2) I noticed that if I closed one window, both windows will close. Is
there a way to not do this?

>
> Jamey Sharp and Josh Triplett


Cheers, Edwin


More information about the Xcb mailing list