[ex11] use of Display

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Sat Jan 24 20:19:45 CET 2004


From: "Joe Armstrong" <joe@REDACTED>
> > If I run something like
> > Display=sw:start("3.1"),
> > Win  = swTopLevel:make(Display, 160, 50, 16#ffffcc),
> > Win2 = swTopLevel:make(Display, 260, 50, 16#ffffcc),
> > then closing any of the windows will close both of them.
>
> This is how X works I was rather surprised by this.
>
> The X server seems to assume that one window = one socket connection. Kill
the
> window by clicking on the window destoy button
> then all top level windows die. That's why you'll only ever see one top
> level window created in my code.

Then maybe the ex11_connection could be hidden behind the
swTopLevel:make(...) call? At least for the most common case. If the
connections aren't shared, then they don't fill any function in the
interface, just add entropy.

The Display can be saved in the top-level's state, and if needed retrieved
from there.

What do you think?
regards,
Vlad



More information about the erlang-questions mailing list